wenay-react2 1.0.20 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +383 -382
- package/lib/common/api.d.ts +28 -0
- package/lib/common/api.js +41 -16
- package/lib/common/src/components/Buttons/MiniButton.d.ts +1 -0
- package/lib/common/src/components/Buttons/MiniButton.js +2 -2
- package/lib/common/src/components/Dnd/DraggableOutlineDiv.d.ts +1 -0
- package/lib/common/src/components/Dnd/DraggableOutlineDiv.js +7 -6
- package/lib/common/src/components/Dnd/RNDFunc.js +28 -17
- package/lib/common/src/components/Dnd/RNDFunc3.d.ts +27 -17
- package/lib/common/src/components/Dnd/RNDFunc3.js +107 -105
- package/lib/common/src/components/Dnd/Resizable.js +3 -3
- package/lib/common/src/components/Menu/RightMenu.js +11 -17
- package/lib/common/src/components/Menu/StickerMenu.js +42 -28
- package/lib/common/src/components/Menu/index.d.ts +1 -1
- package/lib/common/src/components/Menu/index.js +1 -1
- package/lib/common/src/components/Modal/LeftModal.d.ts +14 -12
- package/lib/common/src/components/Modal/LeftModal.js +30 -16
- package/lib/common/src/components/Modal/Modal.d.ts +26 -12
- package/lib/common/src/components/Modal/Modal.js +66 -89
- package/lib/common/src/components/Modal/ModalContextProvider.d.ts +20 -3
- package/lib/common/src/components/Modal/ModalContextProvider.js +35 -8
- package/lib/common/src/components/MyResizeObserver.js +15 -18
- package/lib/common/src/components/Other.js +3 -2
- package/lib/common/src/components/Parameters.js +7 -6
- package/lib/common/src/components/ParametersEngine.js +25 -54
- package/lib/common/src/grid/agGrid4/agGrid4.d.ts +53 -0
- package/lib/common/src/grid/agGrid4/agGrid4.js +132 -0
- package/lib/common/src/grid/agGrid4/core.d.ts +56 -0
- package/lib/common/src/grid/agGrid4/core.js +127 -0
- package/lib/common/src/grid/agGrid4/index.d.ts +6 -0
- package/lib/common/src/grid/agGrid4/index.js +3 -0
- package/lib/common/src/grid/agGrid4/theme.d.ts +7 -0
- package/lib/common/src/grid/agGrid4/theme.js +18 -0
- package/lib/common/src/hooks/useAddDownAnyKey.d.ts +21 -2
- package/lib/common/src/hooks/useAddDownAnyKey.js +46 -8
- package/lib/common/src/hooks/useDraggable.d.ts +20 -2
- package/lib/common/src/hooks/useDraggable.js +146 -115
- package/lib/common/src/hooks/useOutside.d.ts +24 -4
- package/lib/common/src/hooks/useOutside.js +76 -27
- package/lib/common/src/logs/logs.d.ts +5 -2
- package/lib/common/src/logs/logs.js +15 -31
- package/lib/common/src/logs/logs3.d.ts +9 -9
- package/lib/common/src/logs/logs3.js +47 -38
- package/lib/common/src/logs/miniLogs.d.ts +3 -3
- package/lib/common/src/logs/miniLogs.js +28 -36
- package/lib/common/src/menu/menu.d.ts +18 -18
- package/lib/common/src/menu/menu.js +48 -24
- package/lib/common/src/menu/menuMouse.js +4 -1
- package/lib/common/src/menu/menuR.d.ts +2 -2
- package/lib/common/src/menu/menuR.js +34 -34
- package/lib/common/src/myChart/1/myChart.d.ts +5 -5
- package/lib/common/src/myChart/1/myChart.js +58 -47
- package/lib/common/src/myChart/1/myChartTest.js +8 -4
- package/lib/common/src/myChart/chartEngine/chartEngineReact.d.ts +24 -27
- package/lib/common/src/myChart/chartEngine/chartEngineReact.js +166 -117
- package/lib/common/src/styles/styleGrid.d.ts +2 -1
- package/lib/common/src/styles/styleGrid.js +10 -12
- package/lib/common/src/styles/tokens.d.ts +39 -0
- package/lib/common/src/styles/tokens.js +40 -0
- package/lib/common/src/utils/applyTransactionAsyncUpdate.d.ts +7 -0
- package/lib/common/src/utils/applyTransactionAsyncUpdate.js +19 -12
- package/lib/common/src/utils/arrayPromise.d.ts +6 -0
- package/lib/common/src/utils/arrayPromise.js +7 -1
- package/lib/common/src/utils/cache.js +24 -21
- package/lib/common/src/utils/inputAutoStep.d.ts +1 -1
- package/lib/common/src/utils/inputAutoStep.js +30 -19
- package/lib/common/src/utils/mapMemory.js +9 -10
- package/lib/common/updateBy.d.ts +21 -2
- package/lib/common/updateBy.js +66 -31
- package/lib/index.js +0 -2
- package/lib/style/menuRight.css +13 -26
- package/lib/style/style.css +51 -39
- package/lib/style/tokens.css +34 -0
- package/package.json +2 -2
package/lib/common/api.d.ts
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import "../style/menuRight.css";
|
|
2
2
|
import "../style/style.css";
|
|
3
|
+
import * as hooksV2 from "./src/hooks";
|
|
4
|
+
import * as dndV2 from "./src/components/Dnd";
|
|
5
|
+
import * as utilsV2 from "./src/utils";
|
|
6
|
+
import * as gridV2 from "./src/grid/agGrid4";
|
|
7
|
+
import * as modalV2 from "./src/components/Modal";
|
|
8
|
+
import * as menuV2 from "./src/menu/menu";
|
|
9
|
+
import * as menuMouseV2 from "./src/menu/menuMouse";
|
|
10
|
+
import * as menuRV2 from "./src/menu/menuR";
|
|
11
|
+
import * as logsV2 from "./src/logs/logs";
|
|
12
|
+
import * as updateByV2 from "./updateBy";
|
|
3
13
|
export * from "./src/styles/styleGrid";
|
|
14
|
+
export * from "./src/styles/tokens";
|
|
4
15
|
export * from "./updateBy";
|
|
5
16
|
export * from "./src/hooks";
|
|
6
17
|
export * from "./src/components/Dnd";
|
|
7
18
|
export * from "./src/utils";
|
|
19
|
+
export * from "./src/grid/agGrid4";
|
|
8
20
|
export * from "./src/components/Buttons";
|
|
9
21
|
export * from "./src/components/MyResizeObserver";
|
|
10
22
|
export * from "./src/components/Other";
|
|
@@ -23,3 +35,19 @@ export * from "./src/myChart/1/myChart";
|
|
|
23
35
|
export * from "./src/myChart/1/myChartTest";
|
|
24
36
|
export * from "./src/myChart/chartEngine/chartEngineReact";
|
|
25
37
|
export declare function test(): number;
|
|
38
|
+
export declare const v2: {
|
|
39
|
+
readonly hooks: typeof hooksV2;
|
|
40
|
+
readonly dnd: typeof dndV2;
|
|
41
|
+
readonly utils: typeof utilsV2;
|
|
42
|
+
readonly grid: typeof gridV2;
|
|
43
|
+
readonly modal: typeof modalV2;
|
|
44
|
+
readonly menu: {
|
|
45
|
+
readonly mouse: typeof menuMouseV2;
|
|
46
|
+
readonly rightClick: typeof menuRV2;
|
|
47
|
+
readonly MenuBase: typeof menuV2.MenuBase;
|
|
48
|
+
readonly TimeNum: typeof menuV2.TimeNum;
|
|
49
|
+
readonly MenuElement: typeof menuV2.MenuElement;
|
|
50
|
+
};
|
|
51
|
+
readonly logs: typeof logsV2;
|
|
52
|
+
readonly updateBy: typeof updateByV2;
|
|
53
|
+
};
|
package/lib/common/api.js
CHANGED
|
@@ -1,43 +1,68 @@
|
|
|
1
|
-
// ... existing code ...
|
|
2
1
|
import "../style/menuRight.css";
|
|
3
2
|
import "../style/style.css";
|
|
4
|
-
|
|
3
|
+
import * as hooksV2 from "./src/hooks";
|
|
4
|
+
import * as dndV2 from "./src/components/Dnd";
|
|
5
|
+
import * as utilsV2 from "./src/utils";
|
|
6
|
+
import * as gridV2 from "./src/grid/agGrid4";
|
|
7
|
+
import * as modalV2 from "./src/components/Modal";
|
|
8
|
+
import * as menuV2 from "./src/menu/menu";
|
|
9
|
+
import * as menuMouseV2 from "./src/menu/menuMouse";
|
|
10
|
+
import * as menuRV2 from "./src/menu/menuR";
|
|
11
|
+
import * as logsV2 from "./src/logs/logs";
|
|
12
|
+
import * as updateByV2 from "./updateBy";
|
|
13
|
+
// 0. STYLES - independent
|
|
5
14
|
export * from "./src/styles/styleGrid";
|
|
6
|
-
|
|
15
|
+
export * from "./src/styles/tokens";
|
|
16
|
+
// 1. BASE LAYER - no internal project dependencies
|
|
7
17
|
export * from "./updateBy";
|
|
8
|
-
// 2.
|
|
18
|
+
// 2. HOOKS - depend only on updateBy
|
|
9
19
|
export * from "./src/hooks";
|
|
10
|
-
// 4. DND
|
|
20
|
+
// 4. DND components - depend on updateBy
|
|
11
21
|
export * from "./src/components/Dnd";
|
|
12
|
-
// 5. UTILS -
|
|
22
|
+
// 5. UTILS - now depend on Dnd (mapMemory imports ExRNDMap3, mapResiReact)
|
|
13
23
|
export * from "./src/utils";
|
|
14
|
-
//
|
|
24
|
+
// 5b. GRID (agGrid4): core buffer + headless hook + AgGridMy. New path instead of applyTransactionAsyncUpdate
|
|
25
|
+
export * from "./src/grid/agGrid4";
|
|
26
|
+
// 6. BASE COMPONENTS - depend on hooks
|
|
15
27
|
export * from "./src/components/Buttons";
|
|
16
28
|
export * from "./src/components/MyResizeObserver";
|
|
17
29
|
export * from "./src/components/Other";
|
|
18
|
-
// 7. Parameters -
|
|
30
|
+
// 7. Parameters - depends on utils
|
|
19
31
|
export * from "./src/components/Parameters";
|
|
20
|
-
// 8. ParametersEngine -
|
|
32
|
+
// 8. ParametersEngine - depends on Parameters and utils
|
|
21
33
|
export * from "./src/components/ParametersEngine";
|
|
22
|
-
// 9. Input -
|
|
34
|
+
// 9. Input - depends on hooks and Dnd
|
|
23
35
|
export * from "./src/components/Input";
|
|
24
|
-
// 10. Modal -
|
|
36
|
+
// 10. Modal - depends on Input and updateBy
|
|
25
37
|
export * from "./src/components/Modal";
|
|
26
|
-
// 11. Menu -
|
|
38
|
+
// 11. Menu - depends on hooks, Dnd, and Modal
|
|
27
39
|
export * from "./src/components/Menu";
|
|
28
|
-
// 12.
|
|
40
|
+
// 12. MENU - depends on components
|
|
29
41
|
export * from "./src/menu/menu";
|
|
30
42
|
export * from "./src/menu/menuMouse";
|
|
31
43
|
export * from "./src/menu/menuR";
|
|
32
|
-
// 13.
|
|
44
|
+
// 13. LOGS - depend on utils/mapMemory, menu, and components/ParametersEngine
|
|
33
45
|
export * from "./src/logs/logs";
|
|
34
46
|
export * from "./src/logs/logs3";
|
|
35
47
|
export * from "./src/logs/miniLogs";
|
|
36
|
-
// 14.
|
|
48
|
+
// 14. CHARTS - highest level
|
|
37
49
|
export * from "./src/myChart/1/myChart";
|
|
38
50
|
export * from "./src/myChart/1/myChartTest";
|
|
39
51
|
export * from "./src/myChart/chartEngine/chartEngineReact";
|
|
40
52
|
export function test() {
|
|
41
53
|
return 5;
|
|
42
54
|
}
|
|
43
|
-
|
|
55
|
+
export const v2 = {
|
|
56
|
+
hooks: hooksV2,
|
|
57
|
+
dnd: dndV2,
|
|
58
|
+
utils: utilsV2,
|
|
59
|
+
grid: gridV2,
|
|
60
|
+
modal: modalV2,
|
|
61
|
+
menu: {
|
|
62
|
+
...menuV2,
|
|
63
|
+
mouse: menuMouseV2,
|
|
64
|
+
rightClick: menuRV2,
|
|
65
|
+
},
|
|
66
|
+
logs: logsV2,
|
|
67
|
+
updateBy: updateByV2,
|
|
68
|
+
};
|
|
@@ -14,4 +14,5 @@ export declare function MiniButton2({ name, children, statusDef, className }: {
|
|
|
14
14
|
children: React.ReactElement | (() => React.ReactElement);
|
|
15
15
|
className?: string;
|
|
16
16
|
}): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
/** @deprecated Use MiniButton2 instead */
|
|
17
18
|
export declare const MiniButton3: typeof MiniButton2;
|
|
@@ -8,11 +8,11 @@ export function MiniButton({ name, arr, get, onClick, style }) {
|
|
|
8
8
|
const t = data;
|
|
9
9
|
t[k] = !(t[k] ?? false);
|
|
10
10
|
onClick(i);
|
|
11
|
-
}, children: k },
|
|
11
|
+
}, children: k }, k)) }) }) });
|
|
12
12
|
}
|
|
13
13
|
export function MiniButton2({ name, children, statusDef, className = "newButtonSimple" }) {
|
|
14
14
|
const content = typeof children === 'function' ? children() : children;
|
|
15
15
|
return _jsx(Button, { className: className, statusDef: statusDef, button: (e) => _jsx("div", { className: e ? "msTradeAlt msTradeActive" : "msTradeAlt", children: name }), children: content });
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
/** @deprecated Use MiniButton2 instead */
|
|
18
18
|
export const MiniButton3 = MiniButton2;
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
|
-
const ANIMATION_DURATION = 500; //
|
|
3
|
+
const ANIMATION_DURATION = 500; // animation duration in ms
|
|
4
|
+
/** @deprecated Demo component with hardcoded content; used only by the test SubMenu. Will be removed in a major version. */
|
|
4
5
|
export function DraggableOutlineDiv() {
|
|
5
6
|
const [isDragging, setIsDragging] = useState(false);
|
|
6
7
|
const [animationFinished, setAnimationFinished] = useState(false);
|
|
7
8
|
const timerRef = useRef(null);
|
|
8
9
|
const handleMouseDown = (e) => {
|
|
9
|
-
//
|
|
10
|
+
// Check that the left mouse button was pressed
|
|
10
11
|
if (e.button !== 0)
|
|
11
12
|
return;
|
|
12
13
|
setIsDragging(true);
|
|
13
14
|
setAnimationFinished(false);
|
|
14
|
-
//
|
|
15
|
+
// Start the animation - after the timeout, animationFinished becomes true
|
|
15
16
|
timerRef.current = window.setTimeout(() => {
|
|
16
|
-
setAnimationFinished(true); //
|
|
17
|
+
setAnimationFinished(true); // Animation is complete - the outline remains
|
|
17
18
|
timerRef.current = null;
|
|
18
19
|
}, ANIMATION_DURATION);
|
|
19
20
|
};
|
|
20
21
|
const handleMouseUp = () => {
|
|
21
22
|
setIsDragging(false);
|
|
22
23
|
setAnimationFinished(false);
|
|
23
|
-
//
|
|
24
|
+
// If the animation has not finished yet, cancel the timer and remove the outline
|
|
24
25
|
if (timerRef.current) {
|
|
25
26
|
window.clearTimeout(timerRef.current);
|
|
26
27
|
timerRef.current = null;
|
|
@@ -28,6 +29,6 @@ export function DraggableOutlineDiv() {
|
|
|
28
29
|
};
|
|
29
30
|
useEffect(() => () => { if (timerRef.current)
|
|
30
31
|
window.clearTimeout(timerRef.current); }, []);
|
|
31
|
-
return (_jsx("div", { className: `draggable-div ${isDragging ? 'outline-animation' : ''} ${animationFinished ? 'outline-complete' : ''}`, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, onMouseLeave: handleMouseUp, children: "
|
|
32
|
+
return (_jsx("div", { className: `draggable-div ${isDragging ? 'outline-animation' : ''} ${animationFinished ? 'outline-complete' : ''}`, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, onMouseLeave: handleMouseUp, children: "Div content" }));
|
|
32
33
|
}
|
|
33
34
|
;
|
|
@@ -6,29 +6,40 @@ export function Drag2({ children, onY, onX, x = 0, y = 0, last, onStart, onStop,
|
|
|
6
6
|
const lastT = useRef(null);
|
|
7
7
|
const [a, setA] = useState(false);
|
|
8
8
|
const [b, setB] = useState(false);
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
// Default was {y: x, x: y} - coordinates were swapped; fixed (K3, see CHANGELOG/plan)
|
|
10
|
+
const lastD = useRef(last?.current ?? { x, y });
|
|
11
|
+
const wasDragging = useRef(false);
|
|
12
|
+
// callbacks via ref: with them in the effect deps an inline callback from the consumer
|
|
13
|
+
// resubscribed document listeners and re-fired onStart on every drag tick
|
|
14
|
+
const callbacksRef = useRef({ onX, onY, onStart, onStop });
|
|
15
|
+
callbacksRef.current = { onX, onY, onStart, onStop };
|
|
16
|
+
// Update `lastD` values when `x` or `y` changes
|
|
11
17
|
useLayoutEffect(() => {
|
|
12
18
|
lastD.current.x = x;
|
|
13
19
|
lastD.current.y = y;
|
|
14
20
|
}, [x, y]);
|
|
15
|
-
//
|
|
21
|
+
// Main movement event handling logic
|
|
16
22
|
useEffect(() => {
|
|
17
23
|
if (!(a || b)) {
|
|
18
|
-
onStop
|
|
24
|
+
// onStop only after a real drag - previously it also fired on initial mount
|
|
25
|
+
if (wasDragging.current) {
|
|
26
|
+
wasDragging.current = false;
|
|
27
|
+
callbacksRef.current.onStop?.();
|
|
28
|
+
}
|
|
19
29
|
return;
|
|
20
30
|
}
|
|
31
|
+
wasDragging.current = true;
|
|
21
32
|
if (a) {
|
|
22
33
|
const handleMouseMove = (e) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
// mousedown always sets lastC before this subscription exists
|
|
35
|
+
if (!lastC.current)
|
|
36
|
+
return;
|
|
26
37
|
const data = lastC.current;
|
|
27
|
-
//
|
|
38
|
+
// Calculate and update coordinates
|
|
28
39
|
lastD.current.x = e.clientX + data.x;
|
|
29
40
|
lastD.current.y = e.clientY + data.y;
|
|
30
|
-
onX?.(lastD.current.x);
|
|
31
|
-
onY?.(lastD.current.y);
|
|
41
|
+
callbacksRef.current.onX?.(lastD.current.x);
|
|
42
|
+
callbacksRef.current.onY?.(lastD.current.y);
|
|
32
43
|
e.stopPropagation();
|
|
33
44
|
};
|
|
34
45
|
const handleMouseUp = () => {
|
|
@@ -39,7 +50,7 @@ export function Drag2({ children, onY, onX, x = 0, y = 0, last, onStart, onStop,
|
|
|
39
50
|
};
|
|
40
51
|
document.body.addEventListener("mousemove", handleMouseMove);
|
|
41
52
|
document.body.addEventListener("mouseup", handleMouseUp);
|
|
42
|
-
onStart?.();
|
|
53
|
+
callbacksRef.current.onStart?.();
|
|
43
54
|
return () => {
|
|
44
55
|
document.body.removeEventListener("mousemove", handleMouseMove);
|
|
45
56
|
document.body.removeEventListener("mouseup", handleMouseUp);
|
|
@@ -53,11 +64,11 @@ export function Drag2({ children, onY, onX, x = 0, y = 0, last, onStart, onStop,
|
|
|
53
64
|
const touch = Array.from(e.changedTouches).find((t) => t.identifier === data.id);
|
|
54
65
|
if (!touch)
|
|
55
66
|
return;
|
|
56
|
-
//
|
|
67
|
+
// Calculate and update coordinates
|
|
57
68
|
lastD.current.x = touch.clientX + data.x;
|
|
58
69
|
lastD.current.y = touch.clientY + data.y;
|
|
59
|
-
onX?.(lastD.current.x);
|
|
60
|
-
onY?.(lastD.current.y);
|
|
70
|
+
callbacksRef.current.onX?.(lastD.current.x);
|
|
71
|
+
callbacksRef.current.onY?.(lastD.current.y);
|
|
61
72
|
e.stopPropagation();
|
|
62
73
|
};
|
|
63
74
|
const handleTouchEnd = (e) => {
|
|
@@ -76,14 +87,14 @@ export function Drag2({ children, onY, onX, x = 0, y = 0, last, onStart, onStop,
|
|
|
76
87
|
};
|
|
77
88
|
document.body.addEventListener("touchmove", handleTouchMove);
|
|
78
89
|
document.body.addEventListener("touchend", handleTouchEnd);
|
|
79
|
-
onStart?.();
|
|
90
|
+
callbacksRef.current.onStart?.();
|
|
80
91
|
return () => {
|
|
81
92
|
document.body.removeEventListener("touchmove", handleTouchMove);
|
|
82
93
|
document.body.removeEventListener("touchend", handleTouchEnd);
|
|
83
94
|
};
|
|
84
95
|
}
|
|
85
|
-
}, [a, b
|
|
86
|
-
//
|
|
96
|
+
}, [a, b]);
|
|
97
|
+
// Create an element for dragging
|
|
87
98
|
return useMemo(() => (_jsx("div", { style: {
|
|
88
99
|
width: "auto",
|
|
89
100
|
height: "auto",
|
|
@@ -11,11 +11,21 @@ type tRND = {
|
|
|
11
11
|
position: tPosition;
|
|
12
12
|
size: tSize;
|
|
13
13
|
};
|
|
14
|
+
export type tRndUpdate = {
|
|
15
|
+
e: MouseEvent | TouchEvent;
|
|
16
|
+
dir: string;
|
|
17
|
+
elementRef: HTMLElement;
|
|
18
|
+
delta: {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
};
|
|
22
|
+
position: tPosition;
|
|
23
|
+
};
|
|
14
24
|
type tDivRndBase = {
|
|
15
25
|
zIndex?: number;
|
|
16
26
|
disableDragging?: () => boolean;
|
|
17
27
|
keyForSave?: string;
|
|
18
|
-
onUpdate?: (data:
|
|
28
|
+
onUpdate?: (data: tRndUpdate) => void;
|
|
19
29
|
position?: tPosition;
|
|
20
30
|
size?: tSize;
|
|
21
31
|
moveOnlyHeader?: boolean;
|
|
@@ -39,43 +49,43 @@ type tDivRndBase = {
|
|
|
39
49
|
export declare const ExRNDMap3: Map<string, tRND>;
|
|
40
50
|
export declare const DivRnd3: typeof DivRndBase3;
|
|
41
51
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
52
|
+
* Wrapper component around react-rnd.
|
|
53
|
+
* Provides dragging and resizing, an optional header, and a close button.
|
|
44
54
|
*/
|
|
45
55
|
export declare function DivRndBase3({ children, keyForSave: ks, position, size, overflow, zIndex, onUpdate, disableDragging, className, header, moveOnlyHeader, limit, onCLickClose, sizeByWindow }: tDivRndBase): import("react/jsx-runtime").JSX.Element;
|
|
46
56
|
export type Drag2Props = {
|
|
47
|
-
/**
|
|
57
|
+
/** Child element that should be draggable */
|
|
48
58
|
children: ReactNode;
|
|
49
|
-
/**
|
|
59
|
+
/** Callback when the X coordinate changes */
|
|
50
60
|
onX?: (val: number) => void;
|
|
51
|
-
/**
|
|
61
|
+
/** Callback when the Y coordinate changes */
|
|
52
62
|
onY?: (val: number) => void;
|
|
53
|
-
/**
|
|
63
|
+
/** Initial (or controlled) X value */
|
|
54
64
|
x?: number;
|
|
55
|
-
/**
|
|
65
|
+
/** Initial (or controlled) Y value */
|
|
56
66
|
y?: number;
|
|
57
|
-
/**
|
|
67
|
+
/** Count from the right edge */
|
|
58
68
|
right?: boolean;
|
|
59
69
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
70
|
+
* External ref for storing coordinates.
|
|
71
|
+
* If provided, the component updates the ref on each movement.
|
|
62
72
|
*/
|
|
63
73
|
last?: React.RefObject<{
|
|
64
74
|
x: number;
|
|
65
75
|
y: number;
|
|
66
76
|
}>;
|
|
67
|
-
/**
|
|
77
|
+
/** Called when dragging starts (mouse or touch) */
|
|
68
78
|
onStart?: () => void;
|
|
69
|
-
/**
|
|
79
|
+
/** Called when dragging ends (mouse and touch) */
|
|
70
80
|
onStop?: () => void;
|
|
71
81
|
dragging?: boolean;
|
|
72
82
|
};
|
|
73
83
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
84
|
+
* Wrapper component that lets a nested element be dragged
|
|
85
|
+
* with both mouse and touch input.
|
|
76
86
|
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
87
|
+
* Function only as a hook for parameter changes during movement, although it has its own component (for offset counting).
|
|
88
|
+
* Returns the distance traveled when moving the child element.
|
|
79
89
|
*/
|
|
80
90
|
export declare function Drag22({ children, onX, onY, x, y, right, last, dragging, onStart, onStop }: Drag2Props): import("react/jsx-runtime").JSX.Element;
|
|
81
91
|
export {};
|