@wandelbots/wandelbots-js-react-components 2.40.0 → 2.41.0-pr.feature-seperate-timer.383.cd7e408
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/components/CycleTimer/DefaultVariant.d.ts.map +1 -1
- package/dist/components/CycleTimer/SmallVariant.d.ts.map +1 -1
- package/dist/components/CycleTimer/index.d.ts +4 -5
- package/dist/components/CycleTimer/index.d.ts.map +1 -1
- package/dist/components/CycleTimer/types.d.ts +2 -3
- package/dist/components/CycleTimer/types.d.ts.map +1 -1
- package/dist/components/CycleTimer/useTimerLogic.d.ts +1 -2
- package/dist/components/CycleTimer/useTimerLogic.d.ts.map +1 -1
- package/dist/components/TabBar.d.ts +2 -0
- package/dist/components/TabBar.d.ts.map +1 -1
- package/dist/components/Timer/Timer.d.ts +3 -0
- package/dist/components/Timer/Timer.d.ts.map +1 -0
- package/dist/components/Timer/TimerDefaultVariant.d.ts +10 -0
- package/dist/components/Timer/TimerDefaultVariant.d.ts.map +1 -0
- package/dist/components/Timer/TimerSmallVariant.d.ts +11 -0
- package/dist/components/Timer/TimerSmallVariant.d.ts.map +1 -0
- package/dist/components/Timer/index.d.ts +19 -0
- package/dist/components/Timer/index.d.ts.map +1 -0
- package/dist/components/Timer/types.d.ts +36 -0
- package/dist/components/Timer/types.d.ts.map +1 -0
- package/dist/components/Timer/useTimerAnimations.d.ts +11 -0
- package/dist/components/Timer/useTimerAnimations.d.ts.map +1 -0
- package/dist/components/Timer/useTimerLogic.d.ts +20 -0
- package/dist/components/Timer/useTimerLogic.d.ts.map +1 -0
- package/dist/components/Timer/utils.d.ts +9 -0
- package/dist/components/Timer/utils.d.ts.map +1 -0
- package/dist/components/jogging/PoseCartesianValues.d.ts.map +1 -1
- package/dist/components/jogging/PoseJointValues.d.ts.map +1 -1
- package/dist/index.cjs +47 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5346 -4911
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CycleTimer/DefaultVariant.tsx +0 -2
- package/src/components/CycleTimer/SmallVariant.tsx +2 -5
- package/src/components/CycleTimer/index.tsx +4 -5
- package/src/components/CycleTimer/types.ts +1 -3
- package/src/components/CycleTimer/useTimerLogic.ts +40 -96
- package/src/components/CycleTimer/utils.ts +3 -3
- package/src/components/TabBar.tsx +35 -8
- package/src/components/Timer/Timer.ts +2 -0
- package/src/components/Timer/TimerDefaultVariant.tsx +140 -0
- package/src/components/Timer/TimerSmallVariant.tsx +140 -0
- package/src/components/Timer/index.tsx +101 -0
- package/src/components/Timer/types.ts +38 -0
- package/src/components/Timer/useTimerAnimations.ts +94 -0
- package/src/components/Timer/useTimerLogic.ts +214 -0
- package/src/components/Timer/utils.ts +15 -0
- package/src/components/jogging/PoseCartesianValues.tsx +69 -66
- package/src/components/jogging/PoseJointValues.tsx +69 -66
- package/src/i18n/locales/de/translations.json +1 -0
- package/src/i18n/locales/en/translations.json +1 -0
- package/src/index.ts +1 -0
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
} from "@wandelbots/nova-js/v1"
|
|
7
7
|
import { observer } from "mobx-react-lite"
|
|
8
8
|
import { useRef, useState } from "react"
|
|
9
|
+
import { externalizeComponent } from "../../externalizeComponent"
|
|
9
10
|
import { CopyableText } from "../CopyableText"
|
|
10
11
|
import { useAnimationFrame } from "../utils/hooks"
|
|
11
12
|
|
|
@@ -38,81 +39,83 @@ export type PoseJointValuesProps = {
|
|
|
38
39
|
showCopyButton?: boolean
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
export const PoseJointValues =
|
|
42
|
-
(
|
|
43
|
-
|
|
44
|
-
connectedMotionGroup,
|
|
45
|
-
showCopyButton = false,
|
|
46
|
-
}: PoseJointValuesProps) => {
|
|
47
|
-
const poseHolderRef = useRef<HTMLDivElement>(null)
|
|
48
|
-
const [copyMessage, setCopyMessage] = useState("")
|
|
49
|
-
|
|
50
|
-
const activeMotionStream = createMotionStateProvider(
|
|
42
|
+
export const PoseJointValues = externalizeComponent(
|
|
43
|
+
observer(
|
|
44
|
+
({
|
|
51
45
|
motionStream,
|
|
52
46
|
connectedMotionGroup,
|
|
53
|
-
|
|
47
|
+
showCopyButton = false,
|
|
48
|
+
}: PoseJointValuesProps) => {
|
|
49
|
+
const poseHolderRef = useRef<HTMLDivElement>(null)
|
|
50
|
+
const [copyMessage, setCopyMessage] = useState("")
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
const activeMotionStream = createMotionStateProvider(
|
|
53
|
+
motionStream,
|
|
54
|
+
connectedMotionGroup,
|
|
58
55
|
)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function getCurrentPoseString() {
|
|
62
|
-
if (!activeMotionStream) return ""
|
|
63
|
-
const { joints } =
|
|
64
|
-
activeMotionStream.rapidlyChangingMotionState.state.joint_position
|
|
65
|
-
return `[${joints.map((j: number) => parseFloat(j.toFixed(4))).join(", ")}]`
|
|
66
|
-
}
|
|
67
56
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
setTimeout(() => setCopyMessage(""), 2000)
|
|
73
|
-
} catch {
|
|
74
|
-
setCopyMessage("Copy failed")
|
|
75
|
-
setTimeout(() => setCopyMessage(""), 2000)
|
|
57
|
+
if (!activeMotionStream) {
|
|
58
|
+
throw new Error(
|
|
59
|
+
"PoseJointValues requires either motionStream or connectedMotionGroup prop",
|
|
60
|
+
)
|
|
76
61
|
}
|
|
77
|
-
}
|
|
78
62
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
63
|
+
function getCurrentPoseString() {
|
|
64
|
+
if (!activeMotionStream) return ""
|
|
65
|
+
const { joints } =
|
|
66
|
+
activeMotionStream.rapidlyChangingMotionState.state.joint_position
|
|
67
|
+
return `[${joints.map((j: number) => parseFloat(j.toFixed(4))).join(", ")}]`
|
|
82
68
|
}
|
|
83
69
|
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
70
|
+
const handleCopy = async () => {
|
|
71
|
+
try {
|
|
72
|
+
await navigator.clipboard.writeText(getCurrentPoseString())
|
|
73
|
+
setCopyMessage("Copied!")
|
|
74
|
+
setTimeout(() => setCopyMessage(""), 2000)
|
|
75
|
+
} catch {
|
|
76
|
+
setCopyMessage("Copy failed")
|
|
77
|
+
setTimeout(() => setCopyMessage(""), 2000)
|
|
78
|
+
}
|
|
87
79
|
}
|
|
88
|
-
poseHolderRef.current.textContent = newPoseContent
|
|
89
|
-
})
|
|
90
80
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
81
|
+
useAnimationFrame(() => {
|
|
82
|
+
if (!poseHolderRef.current) {
|
|
83
|
+
return
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const newPoseContent = getCurrentPoseString()
|
|
87
|
+
if (poseHolderRef.current.textContent === newPoseContent) {
|
|
88
|
+
return
|
|
89
|
+
}
|
|
90
|
+
poseHolderRef.current.textContent = newPoseContent
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<Stack
|
|
95
|
+
direction="row"
|
|
96
|
+
alignItems="center"
|
|
97
|
+
spacing={1}
|
|
98
|
+
sx={{ flexGrow: 1, minWidth: 0, overflow: "hidden" }}
|
|
99
|
+
>
|
|
100
|
+
<CopyableText value={getCurrentPoseString()} ref={poseHolderRef} />
|
|
101
|
+
{showCopyButton && (
|
|
102
|
+
<Button
|
|
103
|
+
variant="contained"
|
|
104
|
+
color="secondary"
|
|
105
|
+
size="small"
|
|
106
|
+
onClick={handleCopy}
|
|
107
|
+
sx={{ flexShrink: 0 }}
|
|
108
|
+
>
|
|
109
|
+
Copy
|
|
110
|
+
</Button>
|
|
111
|
+
)}
|
|
112
|
+
{copyMessage && (
|
|
113
|
+
<Typography variant="caption" color="success.main">
|
|
114
|
+
{copyMessage}
|
|
115
|
+
</Typography>
|
|
116
|
+
)}
|
|
117
|
+
</Stack>
|
|
118
|
+
)
|
|
119
|
+
},
|
|
120
|
+
),
|
|
118
121
|
)
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"CycleTimer.CycleTime.lb": "Zykluszeit",
|
|
53
53
|
"CycleTimer.Measuring.lb": "wird gemessen...",
|
|
54
54
|
"CycleTimer.Determined.lb": "bestimmt",
|
|
55
|
+
"Timer.error": "Fehler",
|
|
55
56
|
"ProgramControl.Start.bt": "Start",
|
|
56
57
|
"ProgramControl.Resume.bt": "Weiter",
|
|
57
58
|
"ProgramControl.Retry.bt": "Wiederholen",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"CycleTimer.CycleTime.lb": "Cycle Time",
|
|
54
54
|
"CycleTimer.Measuring.lb": "measuring...",
|
|
55
55
|
"CycleTimer.Determined.lb": "determined",
|
|
56
|
+
"Timer.error": "Error",
|
|
56
57
|
"ProgramControl.Start.bt": "Start",
|
|
57
58
|
"ProgramControl.Resume.bt": "Resume",
|
|
58
59
|
"ProgramControl.Retry.bt": "Retry",
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./components/3d-viewport/SafetyZonesRenderer"
|
|
|
4
4
|
export * from "./components/3d-viewport/TrajectoryRenderer"
|
|
5
5
|
export * from "./components/AppHeader"
|
|
6
6
|
export * from "./components/CycleTimer"
|
|
7
|
+
export * from "./components/Timer"
|
|
7
8
|
export * from "./components/DataGrid"
|
|
8
9
|
export * from "./components/jogging/JoggingCartesianAxisControl"
|
|
9
10
|
export * from "./components/jogging/JoggingJointRotationControl"
|