@tiny-codes/react-easy 1.7.5 → 1.7.7
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/CHANGELOG.md +30 -0
- package/es/components/Animation/Pulse/index.d.ts +18 -2
- package/es/components/Animation/Pulse/index.js +1 -1
- package/es/components/Animation/Pulse/index.js.map +1 -1
- package/es/components/BreakLines/index.d.ts +7 -7
- package/es/components/BreakLines/index.js.map +1 -1
- package/es/components/ColumnSetting/index.d.ts +7 -2
- package/es/components/ColumnSetting/index.js +29 -17
- package/es/components/ColumnSetting/index.js.map +1 -1
- package/es/components/ConfigProvider/context.d.ts +38 -0
- package/es/components/ConfigProvider/context.js +2 -1
- package/es/components/ConfigProvider/context.js.map +1 -1
- package/es/components/ConfigProvider/index.d.ts +22 -4
- package/es/components/ConfigProvider/index.js +22 -10
- package/es/components/ConfigProvider/index.js.map +1 -1
- package/es/components/ConfigProvider/style/index.js +1 -1
- package/es/components/ConfigProvider/style/index.js.map +1 -1
- package/es/components/ContextMenu/index.d.ts +16 -0
- package/es/components/ContextMenu/index.js +3 -2
- package/es/components/ContextMenu/index.js.map +1 -1
- package/es/components/ContextMenu/style/index.js.map +1 -1
- package/es/components/DeleteConfirmAction/withDeleteConfirmAction.d.ts +3 -3
- package/es/components/EditableText/form.d.ts +4 -0
- package/es/components/EditableText/form.js.map +1 -1
- package/es/components/EditableText/index.d.ts +6 -2
- package/es/components/EditableText/index.js +3 -2
- package/es/components/EditableText/index.js.map +1 -1
- package/es/components/FloatDrawer/index.d.ts +10 -0
- package/es/components/FloatDrawer/index.js +3 -2
- package/es/components/FloatDrawer/index.js.map +1 -1
- package/es/components/FloatDrawer/style/index.js +1 -1
- package/es/components/FloatDrawer/style/index.js.map +1 -1
- package/es/components/Iconfont/createIconfont.d.ts +28 -0
- package/es/components/Iconfont/createIconfont.js +57 -0
- package/es/components/Iconfont/createIconfont.js.map +1 -0
- package/es/components/Iconfont/index.d.ts +1 -0
- package/es/components/Iconfont/index.js +2 -0
- package/es/components/Iconfont/index.js.map +1 -0
- package/es/components/Loading/index.js +3 -2
- package/es/components/Loading/index.js.map +1 -1
- package/es/components/Loading/style/index.js +1 -1
- package/es/components/Loading/style/index.js.map +1 -1
- package/es/components/OverflowTags/index.d.ts +2 -0
- package/es/components/OverflowTags/index.js +3 -2
- package/es/components/OverflowTags/index.js.map +1 -1
- package/es/components/OverflowTags/style/index.js +1 -1
- package/es/components/OverflowTags/style/index.js.map +1 -1
- package/es/components/index.d.ts +1 -0
- package/es/components/index.js +1 -0
- package/es/components/index.js.map +1 -1
- package/es/hooks/index.d.ts +2 -0
- package/es/hooks/index.js +2 -0
- package/es/hooks/index.js.map +1 -1
- package/es/hooks/style/useSplitter.d.ts +3 -0
- package/es/hooks/style/useSplitter.js +40 -0
- package/es/hooks/style/useSplitter.js.map +1 -0
- package/es/hooks/useLocalStorage.d.ts +16 -0
- package/es/hooks/useLocalStorage.js +115 -0
- package/es/hooks/useLocalStorage.js.map +1 -0
- package/es/hooks/useMovable.js +2 -2
- package/es/hooks/useMovable.js.map +1 -1
- package/es/hooks/useSplitter.d.ts +52 -9
- package/es/hooks/useSplitter.js +69 -39
- package/es/hooks/useSplitter.js.map +1 -1
- package/es/locales/index.js +1 -1
- package/es/locales/index.js.map +1 -1
- package/es/utils/math.d.ts +11 -3
- package/es/utils/math.js +62 -9
- package/es/utils/math.js.map +1 -1
- package/lib/components/Animation/Pulse/index.d.ts +18 -2
- package/lib/components/Animation/Pulse/index.js +0 -5
- package/lib/components/Animation/Pulse/index.js.map +2 -2
- package/lib/components/BreakLines/index.d.ts +7 -7
- package/lib/components/BreakLines/index.js.map +1 -1
- package/lib/components/ColumnSetting/index.d.ts +7 -2
- package/lib/components/ColumnSetting/index.js +20 -15
- package/lib/components/ColumnSetting/index.js.map +3 -3
- package/lib/components/ConfigProvider/context.d.ts +38 -0
- package/lib/components/ConfigProvider/context.js +2 -1
- package/lib/components/ConfigProvider/context.js.map +2 -2
- package/lib/components/ConfigProvider/index.d.ts +22 -4
- package/lib/components/ConfigProvider/index.js +17 -6
- package/lib/components/ConfigProvider/index.js.map +2 -2
- package/lib/components/ConfigProvider/style/index.js +1 -1
- package/lib/components/ConfigProvider/style/index.js.map +2 -2
- package/lib/components/ContextMenu/index.d.ts +16 -0
- package/lib/components/ContextMenu/index.js +2 -1
- package/lib/components/ContextMenu/index.js.map +3 -3
- package/lib/components/ContextMenu/style/index.js.map +2 -2
- package/lib/components/DeleteConfirmAction/withDeleteConfirmAction.d.ts +3 -3
- package/lib/components/EditableText/form.d.ts +4 -0
- package/lib/components/EditableText/form.js.map +2 -2
- package/lib/components/EditableText/index.d.ts +6 -2
- package/lib/components/EditableText/index.js +3 -2
- package/lib/components/EditableText/index.js.map +3 -3
- package/lib/components/FloatDrawer/index.d.ts +10 -0
- package/lib/components/FloatDrawer/index.js +3 -2
- package/lib/components/FloatDrawer/index.js.map +3 -3
- package/lib/components/FloatDrawer/style/index.js +1 -1
- package/lib/components/FloatDrawer/style/index.js.map +2 -2
- package/lib/components/Iconfont/createIconfont.d.ts +28 -0
- package/lib/components/Iconfont/createIconfont.js +65 -0
- package/lib/components/Iconfont/createIconfont.js.map +7 -0
- package/lib/components/Iconfont/index.d.ts +1 -0
- package/lib/components/Iconfont/index.js +24 -0
- package/lib/components/Iconfont/index.js.map +7 -0
- package/lib/components/Loading/index.js +3 -2
- package/lib/components/Loading/index.js.map +3 -3
- package/lib/components/Loading/style/index.js +1 -1
- package/lib/components/Loading/style/index.js.map +2 -2
- package/lib/components/OverflowTags/index.d.ts +2 -0
- package/lib/components/OverflowTags/index.js +3 -2
- package/lib/components/OverflowTags/index.js.map +3 -3
- package/lib/components/OverflowTags/style/index.js +1 -1
- package/lib/components/OverflowTags/style/index.js.map +2 -2
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +3 -1
- package/lib/components/index.js.map +2 -2
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.js +5 -0
- package/lib/hooks/index.js.map +2 -2
- package/lib/hooks/style/useSplitter.d.ts +3 -0
- package/lib/hooks/style/useSplitter.js +72 -0
- package/lib/hooks/style/useSplitter.js.map +7 -0
- package/lib/hooks/useLocalStorage.d.ts +16 -0
- package/lib/hooks/useLocalStorage.js +120 -0
- package/lib/hooks/useLocalStorage.js.map +7 -0
- package/lib/hooks/useMovable.js +2 -2
- package/lib/hooks/useMovable.js.map +3 -3
- package/lib/hooks/useSplitter.d.ts +52 -9
- package/lib/hooks/useSplitter.js +56 -26
- package/lib/hooks/useSplitter.js.map +3 -3
- package/lib/locales/index.js +1 -1
- package/lib/locales/index.js.map +1 -1
- package/lib/utils/math.d.ts +11 -3
- package/lib/utils/math.js +43 -8
- package/lib/utils/math.js.map +3 -3
- package/package.json +14 -7
|
@@ -2,40 +2,41 @@ import { type CSSProperties } from 'react';
|
|
|
2
2
|
export interface UseSplitterProps {
|
|
3
3
|
/**
|
|
4
4
|
* - **EN:** Split direction. vertical = left/right; horizontal = top/bottom.
|
|
5
|
-
* - **
|
|
5
|
+
* - **CN:** 分割方向。vertical 表示左右分割;horizontal 表示上下分割。
|
|
6
6
|
*
|
|
7
7
|
* @default 'vertical'
|
|
8
8
|
*/
|
|
9
9
|
direction?: 'vertical' | 'horizontal';
|
|
10
10
|
/**
|
|
11
|
-
* - **EN:**
|
|
12
|
-
*
|
|
11
|
+
* - **EN:** Parent container element. If not specified, the parent container of the `dom` element
|
|
12
|
+
* will be used automatically.
|
|
13
|
+
* - **CN:** 父容器元素,如果不指定,则自动使用 `dom` 元素的父容器
|
|
13
14
|
*/
|
|
14
|
-
container
|
|
15
|
+
container?: HTMLDivElement | null | undefined;
|
|
15
16
|
/**
|
|
16
17
|
* - **EN:** Default ratio of the left/top pane (0~1).
|
|
17
|
-
* - **
|
|
18
|
+
* - **CN:** 左侧/顶部面板的默认比例 (0~1)。
|
|
18
19
|
*
|
|
19
20
|
* @default 0.32
|
|
20
21
|
*/
|
|
21
22
|
defaultRatio?: number;
|
|
22
23
|
/**
|
|
23
24
|
* - **EN:** Minimum ratio of the left/top pane (0~1).
|
|
24
|
-
* - **
|
|
25
|
+
* - **CN:** 左侧/顶部面板的最小比例 (0~1)。
|
|
25
26
|
*
|
|
26
27
|
* @default 0.15
|
|
27
28
|
*/
|
|
28
29
|
minRatio?: number;
|
|
29
30
|
/**
|
|
30
31
|
* - **EN:** Maximum ratio of the left/top pane (0~1).
|
|
31
|
-
* - **
|
|
32
|
+
* - **CN:** 左侧/顶部面板的最大比例 (0~1)。
|
|
32
33
|
*
|
|
33
34
|
* @default 0.85
|
|
34
35
|
*/
|
|
35
36
|
maxRatio?: number;
|
|
36
37
|
/**
|
|
37
38
|
* - **EN:** Width of the splitter in pixels.
|
|
38
|
-
* - **
|
|
39
|
+
* - **CN:** 分割条的宽度,单位为像素。
|
|
39
40
|
*
|
|
40
41
|
* @default 2
|
|
41
42
|
*/
|
|
@@ -44,9 +45,51 @@ export interface UseSplitterProps {
|
|
|
44
45
|
className?: string;
|
|
45
46
|
/** Additional style for the splitter element */
|
|
46
47
|
style?: CSSProperties;
|
|
48
|
+
/**
|
|
49
|
+
* - **EN:** Custom prefix for the component's CSS class.
|
|
50
|
+
* - **CN:** 组件的自定义 CSS 类前缀。
|
|
51
|
+
*/
|
|
52
|
+
prefixCls?: string;
|
|
53
|
+
/**
|
|
54
|
+
* - **EN:** Semantic class names
|
|
55
|
+
* - **CN:** 语义化类名
|
|
56
|
+
*/
|
|
57
|
+
classNames?: {
|
|
58
|
+
/**
|
|
59
|
+
* - **EN:** Class name applied when the splitter is hovered.
|
|
60
|
+
* - **CN:** 分割条悬停时应用的类名。
|
|
61
|
+
*/
|
|
62
|
+
hover?: string;
|
|
63
|
+
/**
|
|
64
|
+
* - **EN:** Class name applied when the splitter is being dragged.
|
|
65
|
+
* - **CN:** 分割条拖动时应用的类名。
|
|
66
|
+
*/
|
|
67
|
+
dragging?: string;
|
|
68
|
+
/**
|
|
69
|
+
* - **EN:** Class name applied to the splitter handle.
|
|
70
|
+
* - **CN:** 分割条手柄的类名。
|
|
71
|
+
*/
|
|
72
|
+
handle?: string;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* - **EN:** Semantic styles
|
|
76
|
+
* - **CN:** 语义化样式
|
|
77
|
+
*/
|
|
78
|
+
styles?: {
|
|
79
|
+
/**
|
|
80
|
+
* - **EN:** Custom styles for the splitter handle.
|
|
81
|
+
* - **CN:** 分割条手柄的自定义样式。
|
|
82
|
+
*/
|
|
83
|
+
handle?: CSSProperties;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* - **EN:** Callback function when the splitter ratio changes.
|
|
87
|
+
* - **CN:** 分割比例变化时的回调函数。
|
|
88
|
+
*/
|
|
89
|
+
onChange?: (ratio?: number) => void;
|
|
47
90
|
}
|
|
48
91
|
declare const useSplitter: (props: UseSplitterProps) => {
|
|
49
|
-
dom: import("react
|
|
92
|
+
dom: import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
50
93
|
percent: number | undefined;
|
|
51
94
|
width: number | undefined;
|
|
52
95
|
dragging: boolean;
|
package/es/hooks/useSplitter.js
CHANGED
|
@@ -10,13 +10,15 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
11
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import { useEffect, useState } from 'react';
|
|
14
|
-
import
|
|
13
|
+
import { useContext, useEffect, useState } from 'react';
|
|
14
|
+
import names from 'classnames';
|
|
15
|
+
import { ConfigProvider } from "../components";
|
|
16
|
+
import useStyle from "./style/useSplitter";
|
|
15
17
|
import useRefValue from "./useRefValue";
|
|
16
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
19
|
var useSplitter = function useSplitter(props) {
|
|
18
20
|
var _ref = props || {},
|
|
19
|
-
|
|
21
|
+
containerFromProps = _ref.container,
|
|
20
22
|
defaultRatio = _ref.defaultRatio,
|
|
21
23
|
_ref$minRatio = _ref.minRatio,
|
|
22
24
|
minRatio = _ref$minRatio === void 0 ? 0.15 : _ref$minRatio,
|
|
@@ -25,31 +27,50 @@ var useSplitter = function useSplitter(props) {
|
|
|
25
27
|
_ref$direction = _ref.direction,
|
|
26
28
|
direction = _ref$direction === void 0 ? 'vertical' : _ref$direction,
|
|
27
29
|
_ref$splitterWidth = _ref.splitterWidth,
|
|
28
|
-
splitterWidth = _ref$splitterWidth === void 0 ?
|
|
30
|
+
splitterWidth = _ref$splitterWidth === void 0 ? 1 : _ref$splitterWidth,
|
|
29
31
|
className = _ref.className,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
classNames = _ref.classNames,
|
|
33
|
+
styles = _ref.styles,
|
|
34
|
+
prefixClsInProps = _ref.prefixCls,
|
|
35
|
+
style = _ref.style,
|
|
36
|
+
onChange = _ref.onChange;
|
|
37
|
+
var _useContext = useContext(ConfigProvider.ConfigContext),
|
|
38
|
+
getPrefixCls = _useContext.getPrefixCls;
|
|
39
|
+
var prefixCls = getPrefixCls('splitter', prefixClsInProps);
|
|
40
|
+
var _useStyle = useStyle(prefixCls),
|
|
41
|
+
_useStyle2 = _slicedToArray(_useStyle, 3),
|
|
42
|
+
wrapCSSVar = _useStyle2[0],
|
|
43
|
+
hashId = _useStyle2[1],
|
|
44
|
+
cssVarCls = _useStyle2[2];
|
|
33
45
|
var directionRef = useRefValue(direction);
|
|
34
|
-
var _useState = useState(
|
|
46
|
+
var _useState = useState(null),
|
|
35
47
|
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var
|
|
39
|
-
var _useState3 = useState(container && defaultRatio ? ((container === null || container === void 0 ? void 0 : container.clientWidth) || 0) * defaultRatio : undefined),
|
|
48
|
+
splitterRef = _useState2[0],
|
|
49
|
+
setSplitterRef = _useState2[1];
|
|
50
|
+
var _useState3 = useState(containerFromProps),
|
|
40
51
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var _useState5 = useState(
|
|
52
|
+
container = _useState4[0],
|
|
53
|
+
setContainer = _useState4[1];
|
|
54
|
+
var _useState5 = useState(defaultRatio),
|
|
44
55
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
45
|
-
|
|
46
|
-
|
|
56
|
+
percent = _useState6[0],
|
|
57
|
+
setPercent = _useState6[1];
|
|
58
|
+
var percentRef = useRefValue(percent);
|
|
59
|
+
var onChangeRef = useRefValue(onChange);
|
|
60
|
+
var _useState7 = useState(container && defaultRatio ? ((container === null || container === void 0 ? void 0 : container.clientWidth) || 0) * defaultRatio : undefined),
|
|
61
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
62
|
+
width = _useState8[0],
|
|
63
|
+
setWidth = _useState8[1];
|
|
64
|
+
var _useState9 = useState(false),
|
|
65
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
66
|
+
dragging = _useState10[0],
|
|
67
|
+
setDragging = _useState10[1];
|
|
47
68
|
var minRatioRef = useRefValue(minRatio);
|
|
48
69
|
var maxRatioRef = useRefValue(maxRatio);
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
isOver =
|
|
52
|
-
setIsOver =
|
|
70
|
+
var _useState11 = useState(false),
|
|
71
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
72
|
+
isOver = _useState12[0],
|
|
73
|
+
setIsOver = _useState12[1];
|
|
53
74
|
useEffect(function () {
|
|
54
75
|
if (!dragging) return;
|
|
55
76
|
var onMove = function onMove(e) {
|
|
@@ -57,15 +78,19 @@ var useSplitter = function useSplitter(props) {
|
|
|
57
78
|
if (!el) return;
|
|
58
79
|
var rect = el.getBoundingClientRect();
|
|
59
80
|
if (direction === 'vertical') {
|
|
81
|
+
var _onChangeRef$current;
|
|
60
82
|
var x = e.clientX - rect.left;
|
|
61
|
-
var
|
|
62
|
-
setPercent(
|
|
83
|
+
var _ratio = Math.max(minRatioRef.current, Math.min(maxRatioRef.current, x / rect.width));
|
|
84
|
+
setPercent(_ratio);
|
|
63
85
|
setWidth(x);
|
|
86
|
+
(_onChangeRef$current = onChangeRef.current) === null || _onChangeRef$current === void 0 || _onChangeRef$current.call(onChangeRef, _ratio);
|
|
64
87
|
} else {
|
|
88
|
+
var _onChangeRef$current2;
|
|
65
89
|
var y = e.clientY - rect.top;
|
|
66
|
-
var
|
|
67
|
-
setPercent(
|
|
90
|
+
var _ratio2 = Math.max(minRatioRef.current, Math.min(maxRatioRef.current, y / rect.height));
|
|
91
|
+
setPercent(_ratio2);
|
|
68
92
|
setWidth(y);
|
|
93
|
+
(_onChangeRef$current2 = onChangeRef.current) === null || _onChangeRef$current2 === void 0 || _onChangeRef$current2.call(onChangeRef, _ratio2);
|
|
69
94
|
}
|
|
70
95
|
// prevent text selection while dragging
|
|
71
96
|
e.preventDefault();
|
|
@@ -82,6 +107,11 @@ var useSplitter = function useSplitter(props) {
|
|
|
82
107
|
window.removeEventListener('mouseup', onUp);
|
|
83
108
|
};
|
|
84
109
|
}, [container, dragging, direction, minRatioRef, maxRatioRef]);
|
|
110
|
+
useEffect(function () {
|
|
111
|
+
var _ref2;
|
|
112
|
+
var containerDom = (_ref2 = containerFromProps !== null && containerFromProps !== void 0 ? containerFromProps : splitterRef === null || splitterRef === void 0 ? void 0 : splitterRef.parentElement) !== null && _ref2 !== void 0 ? _ref2 : undefined;
|
|
113
|
+
setContainer(containerDom);
|
|
114
|
+
}, [containerFromProps, splitterRef]);
|
|
85
115
|
|
|
86
116
|
// Initialize percent and width on mount
|
|
87
117
|
useEffect(function () {
|
|
@@ -89,25 +119,21 @@ var useSplitter = function useSplitter(props) {
|
|
|
89
119
|
var rect = container.getBoundingClientRect();
|
|
90
120
|
setPercent(defaultRatio);
|
|
91
121
|
if (directionRef.current === 'vertical') {
|
|
122
|
+
var _onChangeRef$current3;
|
|
92
123
|
setWidth(rect.width * defaultRatio);
|
|
124
|
+
(_onChangeRef$current3 = onChangeRef.current) === null || _onChangeRef$current3 === void 0 || _onChangeRef$current3.call(onChangeRef, defaultRatio);
|
|
93
125
|
} else {
|
|
126
|
+
var _onChangeRef$current4;
|
|
94
127
|
setWidth(rect.height * defaultRatio);
|
|
128
|
+
(_onChangeRef$current4 = onChangeRef.current) === null || _onChangeRef$current4 === void 0 || _onChangeRef$current4.call(onChangeRef, defaultRatio);
|
|
95
129
|
}
|
|
96
130
|
}
|
|
97
131
|
}, [defaultRatio, container]);
|
|
98
132
|
var vertical = direction === 'vertical';
|
|
99
|
-
var dom = /*#__PURE__*/_jsx("div", {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
width: vertical ? splitterWidth : '100%',
|
|
104
|
-
height: vertical ? 'auto' : splitterWidth,
|
|
105
|
-
cursor: vertical ? 'col-resize' : 'row-resize',
|
|
106
|
-
background: dragging ? token.colorPrimaryHover : isOver ? token.colorPrimaryActive : token.colorBorder,
|
|
107
|
-
margin: vertical ? '0 4px' : '4px 0',
|
|
108
|
-
borderRadius: 4,
|
|
109
|
-
userSelect: 'none'
|
|
110
|
-
}, style),
|
|
133
|
+
var dom = wrapCSSVar( /*#__PURE__*/_jsx("div", {
|
|
134
|
+
ref: setSplitterRef,
|
|
135
|
+
className: names(hashId, cssVarCls, prefixCls, className, isOver ? names("".concat(prefixCls, "-hover"), classNames === null || classNames === void 0 ? void 0 : classNames.hover) : undefined, dragging ? names("".concat(prefixCls, "-dragging"), classNames === null || classNames === void 0 ? void 0 : classNames.dragging) : undefined, _defineProperty(_defineProperty({}, "".concat(prefixCls, "-vertical"), vertical), "".concat(prefixCls, "-horizontal"), !vertical)),
|
|
136
|
+
style: _objectSpread(_defineProperty({}, "--splitter-width", splitterWidth ? "".concat(splitterWidth, "px") : undefined), style),
|
|
111
137
|
onMouseDown: function onMouseDown() {
|
|
112
138
|
return setDragging(true);
|
|
113
139
|
},
|
|
@@ -119,8 +145,12 @@ var useSplitter = function useSplitter(props) {
|
|
|
119
145
|
},
|
|
120
146
|
role: "separator",
|
|
121
147
|
"aria-orientation": vertical ? 'vertical' : 'horizontal',
|
|
122
|
-
"aria-label": "Resize"
|
|
123
|
-
|
|
148
|
+
"aria-label": "Resize",
|
|
149
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
150
|
+
className: names("".concat(prefixCls, "-handle"), classNames === null || classNames === void 0 ? void 0 : classNames.handle),
|
|
151
|
+
style: styles === null || styles === void 0 ? void 0 : styles.handle
|
|
152
|
+
})
|
|
153
|
+
}));
|
|
124
154
|
return {
|
|
125
155
|
dom: dom,
|
|
126
156
|
percent: percent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useState","theme","useRefValue","jsx","_jsx","useSplitter","props","_ref","container","defaultRatio","_ref$minRatio","minRatio","_ref$maxRatio","maxRatio","_ref$direction","direction","_ref$splitterWidth","splitterWidth","className","style","_theme$useToken","useToken","token","directionRef","_useState","_useState2","_slicedToArray","percent","setPercent","percentRef","_useState3","clientWidth","undefined","_useState4","width","setWidth","_useState5","_useState6","dragging","setDragging","minRatioRef","maxRatioRef","_useState7","_useState8","isOver","setIsOver","onMove","e","el","rect","getBoundingClientRect","x","clientX","left","ratio","Math","max","current","min","y","clientY","top","height","preventDefault","onUp","window","addEventListener","once","removeEventListener","vertical","dom","_objectSpread","flex","cursor","background","colorPrimaryHover","colorPrimaryActive","colorBorder","margin","borderRadius","userSelect","onMouseDown","onMouseEnter","onMouseLeave","role"],"sources":["../../src/hooks/useSplitter.tsx"],"sourcesContent":["import { type CSSProperties, useEffect, useState } from 'react';\nimport { theme } from 'antd';\nimport useRefValue from './useRefValue';\n\nexport interface UseSplitterProps {\n /**\n * - **EN:** Split direction. vertical = left/right; horizontal = top/bottom.\n * - **ZH:** 分割方向。vertical 表示左右分割;horizontal 表示上下分割。\n *\n * @default 'vertical'\n */\n direction?: 'vertical' | 'horizontal';\n /**\n * - **EN:** The container element reference.\n * - **ZH:** 容器元素的引用。\n */\n container: HTMLDivElement | null | undefined;\n /**\n * - **EN:** Default ratio of the left/top pane (0~1).\n * - **ZH:** 左侧/顶部面板的默认比例 (0~1)。\n *\n * @default 0.32\n */\n defaultRatio?: number;\n /**\n * - **EN:** Minimum ratio of the left/top pane (0~1).\n * - **ZH:** 左侧/顶部面板的最小比例 (0~1)。\n *\n * @default 0.15\n */\n minRatio?: number;\n /**\n * - **EN:** Maximum ratio of the left/top pane (0~1).\n * - **ZH:** 左侧/顶部面板的最大比例 (0~1)。\n *\n * @default 0.85\n */\n maxRatio?: number;\n /**\n * - **EN:** Width of the splitter in pixels.\n * - **ZH:** 分割条的宽度,单位为像素。\n *\n * @default 2\n */\n splitterWidth?: number;\n /** Additional class name for the splitter element */\n className?: string;\n /** Additional style for the splitter element */\n style?: CSSProperties;\n}\n\nconst useSplitter = (props: UseSplitterProps) => {\n const {\n container,\n defaultRatio,\n minRatio = 0.15,\n maxRatio = 1 - minRatio,\n direction = 'vertical',\n splitterWidth = 2,\n className,\n style,\n } = props || {};\n const { token } = theme.useToken();\n const directionRef = useRefValue(direction);\n const [percent, setPercent] = useState(defaultRatio);\n const percentRef = useRefValue(percent);\n const [width, setWidth] = useState(\n container && defaultRatio ? (container?.clientWidth || 0) * defaultRatio : undefined\n );\n const [dragging, setDragging] = useState(false);\n const minRatioRef = useRefValue(minRatio);\n const maxRatioRef = useRefValue(maxRatio);\n const [isOver, setIsOver] = useState(false);\n\n useEffect(() => {\n if (!dragging) return;\n const onMove = (e: MouseEvent) => {\n const el = container;\n if (!el) return;\n const rect = el.getBoundingClientRect();\n if (direction === 'vertical') {\n const x = e.clientX - rect.left;\n const ratio = Math.max(minRatioRef.current, Math.min(maxRatioRef.current, x / rect.width));\n setPercent(ratio);\n setWidth(x);\n } else {\n const y = e.clientY - rect.top;\n const ratio = Math.max(minRatioRef.current, Math.min(maxRatioRef.current, y / rect.height));\n setPercent(ratio);\n setWidth(y);\n }\n // prevent text selection while dragging\n e.preventDefault();\n };\n const onUp = () => setDragging(false);\n window.addEventListener('mousemove', onMove);\n window.addEventListener('mouseup', onUp, { once: true });\n\n return () => {\n window.removeEventListener('mousemove', onMove);\n window.removeEventListener('mouseup', onUp);\n };\n }, [container, dragging, direction, minRatioRef, maxRatioRef]);\n\n // Initialize percent and width on mount\n useEffect(() => {\n if (defaultRatio && container && percentRef.current == null) {\n const rect = container.getBoundingClientRect();\n setPercent(defaultRatio);\n if (directionRef.current === 'vertical') {\n setWidth(rect.width * defaultRatio);\n } else {\n setWidth(rect.height * defaultRatio);\n }\n }\n }, [defaultRatio, container]);\n\n const vertical = direction === 'vertical';\n const dom = (\n <div\n className={className}\n style={{\n flex: 'none',\n width: vertical ? splitterWidth : '100%',\n height: vertical ? 'auto' : splitterWidth,\n cursor: vertical ? 'col-resize' : 'row-resize',\n background: dragging ? token.colorPrimaryHover : isOver ? token.colorPrimaryActive : token.colorBorder,\n margin: vertical ? '0 4px' : '4px 0',\n borderRadius: 4,\n userSelect: 'none',\n ...style,\n }}\n onMouseDown={() => setDragging(true)}\n onMouseEnter={() => setIsOver(true)}\n onMouseLeave={() => setIsOver(false)}\n role=\"separator\"\n aria-orientation={vertical ? 'vertical' : 'horizontal'}\n aria-label=\"Resize\"\n />\n );\n\n return {\n dom,\n percent,\n width,\n dragging,\n direction,\n };\n};\n\nexport default useSplitter;\n"],"mappings":";;;;;;;;;;;;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le","useRefValue","jsx","_jsx","useSplitter","props","_ref","containerFromProps","container","defaultRatio","_ref$minRatio","minRatio","_ref$maxRatio","maxRatio","_ref$direction","direction","_ref$splitterWidth","splitterWidth","className","classNames","styles","prefixClsInProps","prefixCls","style","onChange","_useContext","ConfigContext","getPrefixCls","_useStyle","_useStyle2","_slicedToArray","wrapCSSVar","hashId","cssVarCls","directionRef","_useState","_useState2","splitterRef","setSplitterRef","_useState3","_useState4","setContainer","_useState5","_useState6","percent","setPercent","percentRef","onChangeRef","_useState7","clientWidth","undefined","_useState8","width","setWidth","_useState9","_useState10","dragging","setDragging","minRatioRef","maxRatioRef","_useState11","_useState12","isOver","setIsOver","onMove","e","el","rect","getBoundingClientRect","_onChangeRef$current","x","clientX","left","ratio","Math","max","current","min","call","_onChangeRef$current2","y","clientY","top","height","preventDefault","onUp","window","addEventListener","once","removeEventListener","_ref2","containerDom","parentElement","_onChangeRef$current3","_onChangeRef$current4","vertical","dom","ref","concat","hover","_defineProperty","_objectSpread","onMouseDown","onMouseEnter","onMouseLeave","role","children","handle"],"sources":["../../src/hooks/useSplitter.tsx"],"sourcesContent":["import { type CSSProperties, useContext, useEffect, useState } from 'react';\nimport names from 'classnames';\nimport { ConfigProvider } from '../components';\nimport useStyle from './style/useSplitter';\nimport useRefValue from './useRefValue';\n\nexport interface UseSplitterProps {\n /**\n * - **EN:** Split direction. vertical = left/right; horizontal = top/bottom.\n * - **CN:** 分割方向。vertical 表示左右分割;horizontal 表示上下分割。\n *\n * @default 'vertical'\n */\n direction?: 'vertical' | 'horizontal';\n /**\n * - **EN:** Parent container element. If not specified, the parent container of the `dom` element\n * will be used automatically.\n * - **CN:** 父容器元素,如果不指定,则自动使用 `dom` 元素的父容器\n */\n container?: HTMLDivElement | null | undefined;\n /**\n * - **EN:** Default ratio of the left/top pane (0~1).\n * - **CN:** 左侧/顶部面板的默认比例 (0~1)。\n *\n * @default 0.32\n */\n defaultRatio?: number;\n /**\n * - **EN:** Minimum ratio of the left/top pane (0~1).\n * - **CN:** 左侧/顶部面板的最小比例 (0~1)。\n *\n * @default 0.15\n */\n minRatio?: number;\n /**\n * - **EN:** Maximum ratio of the left/top pane (0~1).\n * - **CN:** 左侧/顶部面板的最大比例 (0~1)。\n *\n * @default 0.85\n */\n maxRatio?: number;\n /**\n * - **EN:** Width of the splitter in pixels.\n * - **CN:** 分割条的宽度,单位为像素。\n *\n * @default 2\n */\n splitterWidth?: number;\n /** Additional class name for the splitter element */\n className?: string;\n /** Additional style for the splitter element */\n style?: CSSProperties;\n /**\n * - **EN:** Custom prefix for the component's CSS class.\n * - **CN:** 组件的自定义 CSS 类前缀。\n */\n prefixCls?: string;\n /**\n * - **EN:** Semantic class names\n * - **CN:** 语义化类名\n */\n classNames?: {\n /**\n * - **EN:** Class name applied when the splitter is hovered.\n * - **CN:** 分割条悬停时应用的类名。\n */\n hover?: string;\n /**\n * - **EN:** Class name applied when the splitter is being dragged.\n * - **CN:** 分割条拖动时应用的类名。\n */\n dragging?: string;\n /**\n * - **EN:** Class name applied to the splitter handle.\n * - **CN:** 分割条手柄的类名。\n */\n handle?: string;\n };\n /**\n * - **EN:** Semantic styles\n * - **CN:** 语义化样式\n */\n styles?: {\n /**\n * - **EN:** Custom styles for the splitter handle.\n * - **CN:** 分割条手柄的自定义样式。\n */\n handle?: CSSProperties;\n };\n /**\n * - **EN:** Callback function when the splitter ratio changes.\n * - **CN:** 分割比例变化时的回调函数。\n */\n onChange?: (ratio?: number) => void;\n}\n\nconst useSplitter = (props: UseSplitterProps) => {\n const {\n container: containerFromProps,\n defaultRatio,\n minRatio = 0.15,\n maxRatio = 1 - minRatio,\n direction = 'vertical',\n splitterWidth = 1,\n className,\n classNames,\n styles,\n prefixCls: prefixClsInProps,\n style,\n onChange,\n } = props || {};\n const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('splitter', prefixClsInProps);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const directionRef = useRefValue(direction);\n const [splitterRef, setSplitterRef] = useState<HTMLDivElement | null>(null);\n const [container, setContainer] = useState(containerFromProps);\n const [percent, setPercent] = useState(defaultRatio);\n const percentRef = useRefValue(percent);\n const onChangeRef = useRefValue(onChange);\n const [width, setWidth] = useState(\n container && defaultRatio ? (container?.clientWidth || 0) * defaultRatio : undefined\n );\n const [dragging, setDragging] = useState(false);\n const minRatioRef = useRefValue(minRatio);\n const maxRatioRef = useRefValue(maxRatio);\n const [isOver, setIsOver] = useState(false);\n\n useEffect(() => {\n if (!dragging) return;\n const onMove = (e: MouseEvent) => {\n const el = container;\n if (!el) return;\n const rect = el.getBoundingClientRect();\n if (direction === 'vertical') {\n const x = e.clientX - rect.left;\n const ratio = Math.max(minRatioRef.current, Math.min(maxRatioRef.current, x / rect.width));\n setPercent(ratio);\n setWidth(x);\n onChangeRef.current?.(ratio);\n } else {\n const y = e.clientY - rect.top;\n const ratio = Math.max(minRatioRef.current, Math.min(maxRatioRef.current, y / rect.height));\n setPercent(ratio);\n setWidth(y);\n onChangeRef.current?.(ratio);\n }\n // prevent text selection while dragging\n e.preventDefault();\n };\n const onUp = () => setDragging(false);\n window.addEventListener('mousemove', onMove);\n window.addEventListener('mouseup', onUp, { once: true });\n\n return () => {\n window.removeEventListener('mousemove', onMove);\n window.removeEventListener('mouseup', onUp);\n };\n }, [container, dragging, direction, minRatioRef, maxRatioRef]);\n\n useEffect(() => {\n const containerDom = containerFromProps ?? (splitterRef?.parentElement as HTMLDivElement | undefined) ?? undefined;\n setContainer(containerDom);\n }, [containerFromProps, splitterRef]);\n\n // Initialize percent and width on mount\n useEffect(() => {\n if (defaultRatio && container && percentRef.current == null) {\n const rect = container.getBoundingClientRect();\n setPercent(defaultRatio);\n if (directionRef.current === 'vertical') {\n setWidth(rect.width * defaultRatio);\n onChangeRef.current?.(defaultRatio);\n } else {\n setWidth(rect.height * defaultRatio);\n onChangeRef.current?.(defaultRatio);\n }\n }\n }, [defaultRatio, container]);\n\n const vertical = direction === 'vertical';\n const dom = wrapCSSVar(\n <div\n ref={setSplitterRef}\n className={names(\n hashId,\n cssVarCls,\n prefixCls,\n className,\n isOver ? names(`${prefixCls}-hover`, classNames?.hover) : undefined,\n dragging ? names(`${prefixCls}-dragging`, classNames?.dragging) : undefined,\n {\n [`${prefixCls}-vertical`]: vertical,\n [`${prefixCls}-horizontal`]: !vertical,\n }\n )}\n style={{\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [`--splitter-width` as any]: splitterWidth ? `${splitterWidth}px` : undefined,\n ...style,\n }}\n onMouseDown={() => setDragging(true)}\n onMouseEnter={() => setIsOver(true)}\n onMouseLeave={() => setIsOver(false)}\n role=\"separator\"\n aria-orientation={vertical ? 'vertical' : 'horizontal'}\n aria-label=\"Resize\"\n >\n <div className={names(`${prefixCls}-handle`, classNames?.handle)} style={styles?.handle}></div>\n </div>\n );\n\n return {\n dom,\n percent,\n width,\n dragging,\n direction,\n };\n};\n\nexport default useSplitter;\n"],"mappings":";;;;;;;;;;;;AAAA,SAA6BA,UAAU,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3E,OAAOC,KAAK,MAAM,YAAY;AAC9B,SAASC,cAAc;AACvB,OAAOC,QAAQ;AACf,OAAOC,WAAW;AAAsB,SAAAC,GAAA,IAAAC,IAAA;AA4FxC,IAAMC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,KAAuB,EAAK;EAC/C,IAAAC,IAAA,GAaID,KAAK,IAAI,CAAC,CAAC;IAZFE,kBAAkB,GAAAD,IAAA,CAA7BE,SAAS;IACTC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IAAAC,aAAA,GAAAJ,IAAA,CACZK,QAAQ;IAARA,QAAQ,GAAAD,aAAA,cAAG,IAAI,GAAAA,aAAA;IAAAE,aAAA,GAAAN,IAAA,CACfO,QAAQ;IAARA,QAAQ,GAAAD,aAAA,cAAG,CAAC,GAAGD,QAAQ,GAAAC,aAAA;IAAAE,cAAA,GAAAR,IAAA,CACv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KAAK,EAAEH,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEuF;IAAO,CAAM;EAAC,CAC5F,CACP,CAAC;EAED,OAAO;IACLX,GAAG,EAAHA,GAAG;IACHpD,OAAO,EAAPA,OAAO;IACPQ,KAAK,EAALA,KAAK;IACLI,QAAQ,EAARA,QAAQ;IACRzC,SAAS,EAATA;EACF,CAAC;AACH,CAAC;AAED,eAAeX,WAAW"}
|
package/es/locales/index.js
CHANGED
package/es/locales/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createInstance","enUS","zhCN","langs","resources","en","translation","reactEasyI18n","init","lng","t","apply","arguments"],"sources":["../../src/locales/index.ts"],"sourcesContent":["import { createInstance, type i18n } from 'i18next';\nimport enUS from './langs/en-US';\nimport zhCN from './langs/zh-CN';\n\nexport const langs = ['en', 'en-US', 'zh-CN'] as const;\n\nexport type Langs = (typeof langs)[number];\n\nexport const resources = {\n en: { translation: enUS },\n 'en-US': { translation: enUS },\n 'zh-CN': { translation: zhCN },\n} as const;\n\nconst reactEasyI18n: i18n = createInstance({});\n\nreactEasyI18n.init({\n lng: 'en',\n resources,\n});\n\nexport const t: i18n['t'] = ((...args) => {\n return reactEasyI18n.t(...args);\n}) as i18n['t'];\n\nexport default reactEasyI18n;\n"],"mappings":"AAAA,SAASA,cAAc,QAAmB,SAAS;AACnD,OAAOC,IAAI;AACX,OAAOC,IAAI;AAEX,OAAO,IAAMC,KAAK,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAU;AAItD,OAAO,IAAMC,SAAS,GAAG;EACvBC,EAAE,EAAE;IAAEC,WAAW,EAAEL;EAAK,CAAC;EACzB,OAAO,EAAE;IAAEK,WAAW,EAAEL;EAAK,CAAC;EAC9B,OAAO,EAAE;IAAEK,WAAW,EAAEJ;EAAK;AAC/B,CAAU;AAEV,IAAMK,aAAmB,GAAGP,cAAc,CAAC,CAAC,CAAC,CAAC;AAE9CO,aAAa,CAACC,IAAI,CAAC;EACjBC,GAAG,EAAE,
|
|
1
|
+
{"version":3,"names":["createInstance","enUS","zhCN","langs","resources","en","translation","reactEasyI18n","init","lng","t","apply","arguments"],"sources":["../../src/locales/index.ts"],"sourcesContent":["import { createInstance, type i18n } from 'i18next';\nimport enUS from './langs/en-US';\nimport zhCN from './langs/zh-CN';\n\nexport const langs = ['en', 'en-US', 'zh-CN'] as const;\n\nexport type Langs = (typeof langs)[number];\n\nexport const resources = {\n en: { translation: enUS },\n 'en-US': { translation: enUS },\n 'zh-CN': { translation: zhCN },\n} as const;\n\nconst reactEasyI18n: i18n = createInstance({});\n\nreactEasyI18n.init({\n lng: 'en-US',\n resources,\n});\n\nexport const t: i18n['t'] = ((...args) => {\n return reactEasyI18n.t(...args);\n}) as i18n['t'];\n\nexport default reactEasyI18n;\n"],"mappings":"AAAA,SAASA,cAAc,QAAmB,SAAS;AACnD,OAAOC,IAAI;AACX,OAAOC,IAAI;AAEX,OAAO,IAAMC,KAAK,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAU;AAItD,OAAO,IAAMC,SAAS,GAAG;EACvBC,EAAE,EAAE;IAAEC,WAAW,EAAEL;EAAK,CAAC;EACzB,OAAO,EAAE;IAAEK,WAAW,EAAEL;EAAK,CAAC;EAC9B,OAAO,EAAE;IAAEK,WAAW,EAAEJ;EAAK;AAC/B,CAAU;AAEV,IAAMK,aAAmB,GAAGP,cAAc,CAAC,CAAC,CAAC,CAAC;AAE9CO,aAAa,CAACC,IAAI,CAAC;EACjBC,GAAG,EAAE,OAAO;EACZL,SAAS,EAATA;AACF,CAAC,CAAC;AAEF,OAAO,IAAMM,CAAY,GAAI,SAAhBA,CAAYA,CAAA,EAAiB;EACxC,OAAOH,aAAa,CAACG,CAAC,CAAAC,KAAA,CAAfJ,aAAa,EAAAK,SAAU,CAAC;AACjC,CAAe;AAEf,eAAeL,aAAa"}
|
package/es/utils/math.d.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* **EN**: Generate a random number
|
|
2
|
+
* **EN**: Generate a random decimal number between 0 and 1
|
|
3
3
|
*
|
|
4
|
-
* **CN**:
|
|
4
|
+
* **CN**: 生成一个0~1之间的小数
|
|
5
|
+
*
|
|
6
|
+
* @returns The generated random number | 生成的随机数
|
|
7
|
+
*/
|
|
8
|
+
export declare function random(): number;
|
|
9
|
+
/**
|
|
10
|
+
* **EN**: Generate a random integer within a specified range (inclusive on both ends)
|
|
11
|
+
*
|
|
12
|
+
* **CN**: 生成指定范围(两端包含)内的随机整数
|
|
5
13
|
*
|
|
6
14
|
* @param min The minimum value (inclusive) | 最小值(包含)
|
|
7
15
|
* @param max The maximum value (inclusive) | 最大值(包含)
|
|
8
16
|
*
|
|
9
|
-
* @returns The generated random
|
|
17
|
+
* @returns The generated random integer | 生成的随机整数
|
|
10
18
|
*/
|
|
11
19
|
export declare function random(min: number, max: number): number;
|
package/es/utils/math.js
CHANGED
|
@@ -1,21 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* **EN**: Generate a random number
|
|
2
|
+
* **EN**: Generate a random decimal number between 0 and 1
|
|
3
3
|
*
|
|
4
|
-
* **CN**:
|
|
4
|
+
* **CN**: 生成一个0~1之间的小数
|
|
5
|
+
*
|
|
6
|
+
* @returns The generated random number | 生成的随机数
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* **EN**: Generate a random integer within a specified range (inclusive on both ends)
|
|
11
|
+
*
|
|
12
|
+
* **CN**: 生成指定范围(两端包含)内的随机整数
|
|
5
13
|
*
|
|
6
14
|
* @param min The minimum value (inclusive) | 最小值(包含)
|
|
7
15
|
* @param max The maximum value (inclusive) | 最大值(包含)
|
|
8
16
|
*
|
|
9
|
-
* @returns The generated random
|
|
17
|
+
* @returns The generated random integer | 生成的随机整数
|
|
10
18
|
*/
|
|
19
|
+
|
|
11
20
|
export function random(min, max) {
|
|
12
21
|
var _process$versions, _nodeCrypto, _nodeCrypto2;
|
|
22
|
+
if (min == null && max == null) {
|
|
23
|
+
return randomLikeMath();
|
|
24
|
+
}
|
|
25
|
+
if (min == null || max == null) {
|
|
26
|
+
throw new TypeError('Both min and max must be provided');
|
|
27
|
+
}
|
|
13
28
|
if (!Number.isFinite(min) || !Number.isFinite(max)) {
|
|
14
29
|
throw new TypeError('min and max must be finite numbers');
|
|
15
30
|
}
|
|
16
31
|
if (Math.floor(min) !== min || Math.floor(max) !== max) {
|
|
17
32
|
throw new TypeError('min and max must be integers');
|
|
18
33
|
}
|
|
34
|
+
var globalThat = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {};
|
|
19
35
|
if (min > max) {
|
|
20
36
|
var _ref = [max, min];
|
|
21
37
|
min = _ref[0];
|
|
@@ -29,7 +45,7 @@ export function random(min, max) {
|
|
|
29
45
|
try {
|
|
30
46
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
31
47
|
nodeCrypto = require('crypto');
|
|
32
|
-
} catch (
|
|
48
|
+
} catch (error) {
|
|
33
49
|
// ignore
|
|
34
50
|
}
|
|
35
51
|
}
|
|
@@ -41,12 +57,12 @@ export function random(min, max) {
|
|
|
41
57
|
|
|
42
58
|
// 2. Web Crypto (Browsers or Node 19+ webcrypto)
|
|
43
59
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
-
var webCrypto =
|
|
60
|
+
var webCrypto = globalThat.crypto || ((_nodeCrypto2 = nodeCrypto) === null || _nodeCrypto2 === void 0 ? void 0 : _nodeCrypto2.webcrypto);
|
|
45
61
|
if (webCrypto !== null && webCrypto !== void 0 && webCrypto.getRandomValues) {
|
|
46
62
|
var range = max - min + 1;
|
|
47
63
|
if (range <= 0) return min;
|
|
48
64
|
|
|
49
|
-
//
|
|
65
|
+
// Use rejection sampling to avoid the slight bias caused by (2^32 % range).
|
|
50
66
|
var maxUint32 = 0xffffffff;
|
|
51
67
|
var limit = Math.floor((maxUint32 + 1) / range) * range;
|
|
52
68
|
var arr = new Uint32Array(1);
|
|
@@ -58,8 +74,45 @@ export function random(min, max) {
|
|
|
58
74
|
return min + v % range;
|
|
59
75
|
}
|
|
60
76
|
|
|
61
|
-
// 3. Fallback
|
|
62
|
-
|
|
63
|
-
|
|
77
|
+
// 3. Fallback
|
|
78
|
+
return randomLikeMath();
|
|
79
|
+
}
|
|
80
|
+
function randomLikeMath() {
|
|
81
|
+
var _process$versions2;
|
|
82
|
+
var globalThat = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {};
|
|
83
|
+
// Browser / Node(with webcrypto)
|
|
84
|
+
var cryptoObj = globalThat.crypto;
|
|
85
|
+
if (cryptoObj !== null && cryptoObj !== void 0 && cryptoObj.getRandomValues) {
|
|
86
|
+
var buf = new Uint32Array(2);
|
|
87
|
+
cryptoObj.getRandomValues(buf);
|
|
88
|
+
|
|
89
|
+
// 53-bit precision, mapped to [0, 1)
|
|
90
|
+
var high = buf[0] >>> 5; // 27 bits
|
|
91
|
+
var low = buf[1] >>> 6; // 26 bits
|
|
92
|
+
return (high * 67108864 + low) / 9007199254740992; // 2^53
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Old Node fallback (No webcrypto)
|
|
96
|
+
// Use eval('require') to avoid "require is not defined" error during browser bundling
|
|
97
|
+
var req = typeof process !== 'undefined' && (_process$versions2 = process.versions) !== null && _process$versions2 !== void 0 && _process$versions2.node && typeof globalThat.require === 'function' ? globalThat.require : function () {
|
|
98
|
+
try {
|
|
99
|
+
// eslint-disable-next-line no-eval
|
|
100
|
+
return eval('require');
|
|
101
|
+
} catch (error) {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
}();
|
|
105
|
+
if (!req) {
|
|
106
|
+
throw new Error('No secure random source available in this environment');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
110
|
+
var nodeCrypto = req('crypto');
|
|
111
|
+
if (typeof nodeCrypto.randomBytes !== 'function') {
|
|
112
|
+
throw new Error('No secure random source available in this environment');
|
|
113
|
+
}
|
|
114
|
+
var b = nodeCrypto.randomBytes(7); // 56 bits
|
|
115
|
+
var x = (b[0] & 0x1f) * Math.pow(2, 48) + b[1] * Math.pow(2, 40) + b[2] * Math.pow(2, 32) + b[3] * Math.pow(2, 24) + b[4] * Math.pow(2, 16) + b[5] * Math.pow(2, 8) + b[6];
|
|
116
|
+
return x / 9007199254740992; // 2^53 => [0,1)
|
|
64
117
|
}
|
|
65
118
|
//# sourceMappingURL=math.js.map
|
package/es/utils/math.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["random","min","max","_process$versions","_nodeCrypto","_nodeCrypto2","
|
|
1
|
+
{"version":3,"names":["random","min","max","_process$versions","_nodeCrypto","_nodeCrypto2","randomLikeMath","TypeError","Number","isFinite","Math","floor","globalThat","globalThis","window","global","_ref","nodeCrypto","process","versions","node","require","error","randomInt","webCrypto","crypto","webcrypto","getRandomValues","range","maxUint32","limit","arr","Uint32Array","v","_process$versions2","cryptoObj","buf","high","low","req","eval","undefined","Error","randomBytes","b","x","pow"],"sources":["../../src/utils/math.ts"],"sourcesContent":["/**\n * **EN**: Generate a random decimal number between 0 and 1\n *\n * **CN**: 生成一个0~1之间的小数\n *\n * @returns The generated random number | 生成的随机数\n */\nexport function random(): number;\n/**\n * **EN**: Generate a random integer within a specified range (inclusive on both ends)\n *\n * **CN**: 生成指定范围(两端包含)内的随机整数\n *\n * @param min The minimum value (inclusive) | 最小值(包含)\n * @param max The maximum value (inclusive) | 最大值(包含)\n *\n * @returns The generated random integer | 生成的随机整数\n */\nexport function random(min: number, max: number): number;\nexport function random(min?: number, max?: number): number {\n if (min == null && max == null) {\n return randomLikeMath();\n }\n if (min == null || max == null) {\n throw new TypeError('Both min and max must be provided');\n }\n if (!Number.isFinite(min) || !Number.isFinite(max)) {\n throw new TypeError('min and max must be finite numbers');\n }\n if (Math.floor(min) !== min || Math.floor(max) !== max) {\n throw new TypeError('min and max must be integers');\n }\n const globalThat =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : ({} as typeof globalThis);\n if (min > max) {\n [min, max] = [max, min];\n }\n\n // Try to require Node.js crypto\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let nodeCrypto: any;\n if (typeof process !== 'undefined' && process.versions?.node) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n nodeCrypto = require('crypto');\n } catch (error) {\n // ignore\n }\n }\n\n // 1. Node.js crypto.randomInt\n if (nodeCrypto?.randomInt) {\n return nodeCrypto.randomInt(min, max + 1);\n }\n\n // 2. Web Crypto (Browsers or Node 19+ webcrypto)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const webCrypto: Crypto | undefined = globalThat.crypto || nodeCrypto?.webcrypto;\n\n if (webCrypto?.getRandomValues) {\n const range = max - min + 1;\n if (range <= 0) return min;\n\n // Use rejection sampling to avoid the slight bias caused by (2^32 % range).\n const maxUint32 = 0xffffffff;\n const limit = Math.floor((maxUint32 + 1) / range) * range;\n const arr = new Uint32Array(1);\n let v: number;\n do {\n webCrypto.getRandomValues(arr);\n v = arr[0];\n } while (v >= limit);\n return min + (v % range);\n }\n\n // 3. Fallback\n return randomLikeMath();\n}\n\nfunction randomLikeMath(): number {\n const globalThat =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : ({} as typeof globalThis);\n // Browser / Node(with webcrypto)\n const cryptoObj = globalThat.crypto;\n if (cryptoObj?.getRandomValues) {\n const buf = new Uint32Array(2);\n cryptoObj.getRandomValues(buf);\n\n // 53-bit precision, mapped to [0, 1)\n const high = buf[0] >>> 5; // 27 bits\n const low = buf[1] >>> 6; // 26 bits\n return (high * 67108864 + low) / 9007199254740992; // 2^53\n }\n\n // Old Node fallback (No webcrypto)\n // Use eval('require') to avoid \"require is not defined\" error during browser bundling\n const req: NodeRequire | undefined =\n typeof process !== 'undefined' &&\n process.versions?.node &&\n typeof (globalThat as unknown as { require?: unknown }).require === 'function'\n ? (globalThat as unknown as { require: NodeRequire }).require\n : (() => {\n try {\n // eslint-disable-next-line no-eval\n return eval('require') as NodeRequire;\n } catch (error) {\n return undefined;\n }\n })();\n\n if (!req) {\n throw new Error('No secure random source available in this environment');\n }\n\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const nodeCrypto = req('crypto') as { randomBytes?: (size: number) => Uint8Array };\n if (typeof nodeCrypto.randomBytes !== 'function') {\n throw new Error('No secure random source available in this environment');\n }\n\n const b = nodeCrypto.randomBytes(7); // 56 bits\n const x =\n (b[0] & 0x1f) * 2 ** 48 + b[1] * 2 ** 40 + b[2] * 2 ** 32 + b[3] * 2 ** 24 + b[4] * 2 ** 16 + b[5] * 2 ** 8 + b[6];\n\n return x / 9007199254740992; // 2^53 => [0,1)\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,SAASA,MAAMA,CAACC,GAAY,EAAEC,GAAY,EAAU;EAAA,IAAAC,iBAAA,EAAAC,WAAA,EAAAC,YAAA;EACzD,IAAIJ,GAAG,IAAI,IAAI,IAAIC,GAAG,IAAI,IAAI,EAAE;IAC9B,OAAOI,cAAc,CAAC,CAAC;EACzB;EACA,IAAIL,GAAG,IAAI,IAAI,IAAIC,GAAG,IAAI,IAAI,EAAE;IAC9B,MAAM,IAAIK,SAAS,CAAC,mCAAmC,CAAC;EAC1D;EACA,IAAI,CAACC,MAAM,CAACC,QAAQ,CAACR,GAAG,CAAC,IAAI,CAACO,MAAM,CAACC,QAAQ,CAACP,GAAG,CAAC,EAAE;IAClD,MAAM,IAAIK,SAAS,CAAC,oCAAoC,CAAC;EAC3D;EACA,IAAIG,IAAI,CAACC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C;AAC/B"}
|
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
import type { CSSProperties, FC } from 'react';
|
|
2
2
|
export interface PulseAnimationProps {
|
|
3
|
+
/**
|
|
4
|
+
* - **EN:** Custom class name for the root element
|
|
5
|
+
* - **CN:** 根元素的自定义类名
|
|
6
|
+
*/
|
|
3
7
|
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* - **EN:** Custom styles for the root element
|
|
10
|
+
* - **CN:** 根元素的自定义样式
|
|
11
|
+
*/
|
|
4
12
|
style?: CSSProperties;
|
|
13
|
+
/**
|
|
14
|
+
* - **EN:** Custom styles for the pulse bars
|
|
15
|
+
* - **CN:** 心跳条的自定义样式
|
|
16
|
+
*/
|
|
5
17
|
barStyle?: CSSProperties;
|
|
18
|
+
/**
|
|
19
|
+
* - **EN:** Custom prefix for the component's CSS class.
|
|
20
|
+
* - **CN:** 组件的自定义 CSS 类前缀。
|
|
21
|
+
*/
|
|
6
22
|
prefixCls?: string;
|
|
7
23
|
/**
|
|
8
24
|
* - **EN:** Number of bars, default is `24`
|
|
9
|
-
* - **CN:**
|
|
25
|
+
* - **CN:** 心跳条数量,默认`24`
|
|
10
26
|
*/
|
|
11
27
|
bars?: number;
|
|
12
28
|
/**
|
|
@@ -48,5 +64,5 @@ export interface PulseAnimationProps {
|
|
|
48
64
|
*
|
|
49
65
|
* > 使用 `token.AnimationPulse` 来全局配置 `barMinSize` 和 `barMaxSize` 属性
|
|
50
66
|
*/
|
|
51
|
-
|
|
67
|
+
declare const PulseAnimation: FC<PulseAnimationProps>;
|
|
52
68
|
export default PulseAnimation;
|
|
@@ -29,7 +29,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
// src/components/Animation/Pulse/index.tsx
|
|
30
30
|
var Pulse_exports = {};
|
|
31
31
|
__export(Pulse_exports, {
|
|
32
|
-
PulseAnimation: () => PulseAnimation,
|
|
33
32
|
default: () => Pulse_default
|
|
34
33
|
});
|
|
35
34
|
module.exports = __toCommonJS(Pulse_exports);
|
|
@@ -81,8 +80,4 @@ var PulseAnimation = (props) => {
|
|
|
81
80
|
);
|
|
82
81
|
};
|
|
83
82
|
var Pulse_default = PulseAnimation;
|
|
84
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
-
0 && (module.exports = {
|
|
86
|
-
PulseAnimation
|
|
87
|
-
});
|
|
88
83
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/Animation/Pulse/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { CSSProperties, FC } from 'react';\nimport { useContext, useMemo } from 'react';\nimport { ConfigProvider } from 'antd';\nimport classNames from 'classnames';\nimport useStyle from './style';\n\nexport interface PulseAnimationProps {\n className?: string;\n style?: CSSProperties;\n barStyle?: CSSProperties;\n prefixCls?: string;\n /**\n * - **EN:** Number of bars, default is `24`\n * - **CN:**
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import type { CSSProperties, FC } from 'react';\nimport { useContext, useMemo } from 'react';\nimport { ConfigProvider } from 'antd';\nimport classNames from 'classnames';\nimport useStyle from './style';\n\nexport interface PulseAnimationProps {\n /**\n * - **EN:** Custom class name for the root element\n * - **CN:** 根元素的自定义类名\n */\n className?: string;\n /**\n * - **EN:** Custom styles for the root element\n * - **CN:** 根元素的自定义样式\n */\n style?: CSSProperties;\n /**\n * - **EN:** Custom styles for the pulse bars\n * - **CN:** 心跳条的自定义样式\n */\n barStyle?: CSSProperties;\n /**\n * - **EN:** Custom prefix for the component's CSS class.\n * - **CN:** 组件的自定义 CSS 类前缀。\n */\n prefixCls?: string;\n /**\n * - **EN:** Number of bars, default is `24`\n * - **CN:** 心跳条数量,默认`24`\n */\n\n bars?: number;\n /**\n * - **EN:** Gap between bars, default is `4px`\n * - **CN:** 心跳柱子间隙,默认`4px`\n */\n barGap?: CSSProperties['gap'];\n /**\n * - **EN:** Background color of the bars, default is theme's `colorFillSecondary`\n * - **CN:** 心跳柱子背景色,默认主题的 `colorFillSecondary`\n */\n barColor?: CSSProperties['backgroundColor'];\n /**\n * - **EN:** Minimum height of the bar, default is `10%`\n * - **CN:** 心跳柱子最小高度,默认`10%`\n */\n // barMinSize?: CSSProperties['height'];\n /**\n * - **EN:** Maximum height of the bar, default is `90%`\n * - **CN:** 心跳柱子最大高度,默认`90%`\n */\n // barMaxSize?: CSSProperties['height'];\n /**\n * - **EN:** Animation duration in seconds, default is `1.6` seconds\n * - **CN:** 动画持续时间,单位秒,默认`1.6`秒\n */\n duration?: number;\n /**\n * - **EN:** Animation delay rate, the delay between bars is calculated based on `{bars *\n * delayRate}`, default is `0.09`\n * - **CN:** 动画延迟的百分比,根据 `{bars * delayRate}` 计算柱子之间的延迟,默认 `0.09`\n */\n delayRate?: number;\n}\n\n/**\n * - **EN:** Pulse animation component, used to indicate loading or processing state\n *\n * > Use `token.AnimationPulse` to globally configure `barMinSize` and `barMaxSize` properties\n *\n * - **CN:** 脉动动画组件,用于表示加载或处理状态\n *\n * > 使用 `token.AnimationPulse` 来全局配置 `barMinSize` 和 `barMaxSize` 属性\n */\nconst PulseAnimation: FC<PulseAnimationProps> = (props) => {\n const {\n bars = 8,\n barGap,\n barColor,\n duration,\n delayRate = 0.09,\n prefixCls: prefixClsInProps,\n className,\n style,\n barStyle,\n } = props;\n const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('animation-pulse', prefixClsInProps);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const array = useMemo(() => Array.from({ length: bars }), [bars]);\n\n return wrapCSSVar(\n <div\n className={classNames(prefixCls, hashId, cssVarCls, className)}\n style={{\n gridTemplateColumns: `repeat(${array.length}, 1fr)`,\n gap: barGap,\n ...style,\n }}\n >\n {array.map((_, i) => (\n <div\n // eslint-disable-next-line react/no-array-index-key\n key={i}\n className={`${prefixCls}-bar`}\n style={{\n animationDuration: duration != null ? `${duration}s` : undefined,\n animationDelay: `${(i % array.length) * delayRate}s`,\n backgroundColor: barColor != null ? barColor : undefined,\n ...barStyle,\n }}\n />\n ))}\n </div>\n );\n};\n\nexport default PulseAnimation;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAoC;AACpC,kBAA+B;AAC/B,wBAAuB;AACvB,mBAAqB;AAuErB,IAAM,iBAA0C,CAAC,UAAU;AACzD,QAAM;AAAA,IACJ,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,aAAa,QAAI,yBAAW,2BAAe,aAAa;AAChE,QAAM,YAAY,aAAa,mBAAmB,gBAAgB;AAClE,QAAM,CAAC,YAAY,QAAQ,SAAS,QAAI,aAAAA,SAAS,SAAS;AAC1D,QAAM,YAAQ,sBAAQ,MAAM,MAAM,KAAK,EAAE,QAAQ,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;AAEhE,SAAO;AAAA,IACL;AAAA,MAAC;AAAA;AAAA,QACC,eAAW,kBAAAC,SAAW,WAAW,QAAQ,WAAW,SAAS;AAAA,QAC7D,OAAO;AAAA,UACL,qBAAqB,UAAU,MAAM;AAAA,UACrC,KAAK;AAAA,UACL,GAAG;AAAA,QACL;AAAA;AAAA,MAEC,MAAM,IAAI,CAAC,GAAG,MACb;AAAA,QAAC;AAAA;AAAA,UAEC,KAAK;AAAA,UACL,WAAW,GAAG;AAAA,UACd,OAAO;AAAA,YACL,mBAAmB,YAAY,OAAO,GAAG,cAAc;AAAA,YACvD,gBAAgB,GAAI,IAAI,MAAM,SAAU;AAAA,YACxC,iBAAiB,YAAY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