@adcops/autocore-react 3.0.1 → 3.0.3

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.
Files changed (284) hide show
  1. package/dist/assets/BlocklyLogo.d.ts +3 -0
  2. package/dist/assets/BlocklyLogo.js +1 -0
  3. package/dist/assets/Distance.d.ts +3 -0
  4. package/dist/assets/Distance.js +1 -0
  5. package/dist/assets/JogLong.d.ts +3 -0
  6. package/dist/assets/JogLong.js +1 -0
  7. package/dist/assets/JogMedium.d.ts +3 -0
  8. package/dist/assets/JogMedium.js +1 -0
  9. package/dist/assets/JogShort.d.ts +3 -0
  10. package/dist/assets/JogShort.js +1 -0
  11. package/dist/assets/PythonLogo.d.ts +3 -0
  12. package/dist/assets/PythonLogo.js +1 -0
  13. package/dist/assets/Rotation3D.d.ts +3 -0
  14. package/dist/assets/Rotation3D.js +1 -0
  15. package/dist/assets/RotationCcw.d.ts +3 -0
  16. package/dist/assets/RotationCcw.js +1 -0
  17. package/dist/assets/RotationCcwA.d.ts +3 -0
  18. package/dist/assets/RotationCcwA.js +1 -0
  19. package/dist/assets/RotationCcwB.d.ts +3 -0
  20. package/dist/assets/RotationCcwB.js +1 -0
  21. package/dist/assets/RotationCcwC.d.ts +3 -0
  22. package/dist/assets/RotationCcwC.js +1 -0
  23. package/dist/assets/RotationCw.d.ts +3 -0
  24. package/dist/assets/RotationCw.js +1 -0
  25. package/dist/assets/RotationCwA.d.ts +3 -0
  26. package/dist/assets/RotationCwA.js +1 -0
  27. package/dist/assets/RotationCwB.d.ts +3 -0
  28. package/dist/assets/RotationCwB.js +1 -0
  29. package/dist/assets/RotationCwC.d.ts +3 -0
  30. package/dist/assets/RotationCwC.js +1 -0
  31. package/dist/assets/Run.d.ts +3 -0
  32. package/dist/assets/Run.js +1 -0
  33. package/dist/assets/Speed.d.ts +3 -0
  34. package/dist/assets/Speed.js +1 -0
  35. package/dist/assets/SpeedFast.d.ts +3 -0
  36. package/dist/assets/SpeedFast.js +1 -0
  37. package/dist/assets/SpeedMedium.d.ts +3 -0
  38. package/dist/assets/SpeedMedium.js +1 -0
  39. package/dist/assets/SpeedNone.d.ts +3 -0
  40. package/dist/assets/SpeedNone.js +1 -0
  41. package/dist/assets/SpeedSlow.d.ts +3 -0
  42. package/dist/assets/SpeedSlow.js +1 -0
  43. package/dist/assets/Walk.d.ts +3 -0
  44. package/dist/assets/Walk.js +1 -0
  45. package/dist/assets/index.d.ts +22 -0
  46. package/dist/assets/index.js +1 -0
  47. package/dist/assets/svg/blockly_logo.svg +82 -0
  48. package/dist/assets/svg/distance.svg +40 -0
  49. package/dist/assets/svg/jog_long.svg +1 -0
  50. package/dist/assets/svg/jog_medium.svg +1 -0
  51. package/dist/assets/svg/jog_short.svg +1 -0
  52. package/dist/assets/svg/python_logo.svg +246 -0
  53. package/dist/assets/svg/rotation_3d.svg +1 -0
  54. package/dist/assets/svg/rotation_ccw.svg +50 -0
  55. package/dist/assets/svg/rotation_ccw_a.svg +57 -0
  56. package/dist/assets/svg/rotation_ccw_b.svg +57 -0
  57. package/dist/assets/svg/rotation_ccw_c.svg +57 -0
  58. package/dist/assets/svg/rotation_cw.svg +49 -0
  59. package/dist/assets/svg/rotation_cw_a.svg +30 -0
  60. package/dist/assets/svg/rotation_cw_b.svg +30 -0
  61. package/dist/assets/svg/rotation_cw_c.svg +30 -0
  62. package/dist/assets/svg/run.svg +1 -0
  63. package/dist/assets/svg/speed.svg +39 -0
  64. package/dist/assets/svg/speed_fast.svg +1 -0
  65. package/dist/assets/svg/speed_medium.svg +1 -0
  66. package/dist/assets/svg/speed_none.svg +1 -0
  67. package/dist/assets/svg/speed_slow.svg +1 -0
  68. package/dist/assets/svg/walk.svg +1 -0
  69. package/dist/components/BlocklyEditor.css +25 -0
  70. package/dist/components/BlocklyEditor.d.ts +120 -0
  71. package/dist/components/BlocklyEditor.js +1 -0
  72. package/dist/components/CodeEditor.d.ts +76 -0
  73. package/dist/components/CodeEditor.js +1 -0
  74. package/dist/components/Indicator.d.ts +12 -27
  75. package/dist/components/Indicator.js +1 -1
  76. package/dist/components/IndicatorButton.d.ts +56 -37
  77. package/dist/components/IndicatorButton.js +1 -1
  78. package/dist/components/JogPanel.css +41 -0
  79. package/dist/components/JogPanel.d.ts +115 -0
  80. package/dist/components/JogPanel.js +1 -0
  81. package/dist/components/Lamp.d.ts +81 -0
  82. package/dist/components/Lamp.js +1 -0
  83. package/dist/components/ToggleGroup.d.ts +103 -0
  84. package/dist/components/ToggleGroup.js +1 -0
  85. package/dist/core/ActionMode.d.ts +9 -0
  86. package/dist/core/ActionMode.js +1 -0
  87. package/dist/core/IndicatorButtonState.d.ts +21 -0
  88. package/dist/core/IndicatorButtonState.js +1 -0
  89. package/docs/assets/highlight.css +25 -18
  90. package/docs/assets/navigation.js +1 -1
  91. package/docs/assets/search.js +1 -1
  92. package/docs/classes/components_BlocklyEditor.BlocklyEditor.html +124 -0
  93. package/docs/classes/components_CodeEditor.CodeEditor.html +128 -0
  94. package/docs/classes/components_Indicator.Indicator.html +8 -8
  95. package/docs/classes/components_IndicatorButton.IndicatorButton.html +17 -17
  96. package/docs/classes/components_JogPanel.JogPanel.html +138 -0
  97. package/docs/classes/components_Lamp.Lamp.html +105 -0
  98. package/docs/classes/components_OskDialog.OskDialog.html +5 -5
  99. package/docs/classes/components_ToggleGroup.ToggleGroup.html +118 -0
  100. package/docs/classes/components_ValueDisplay.ValueDisplay.html +4 -4
  101. package/docs/classes/core_ValueSimulator.ValueSimulator.html +2 -2
  102. package/docs/classes/hub_HubBase.HubBase.html +4 -4
  103. package/docs/classes/hub_HubSimulate.HubSimulate.html +2 -2
  104. package/docs/classes/hub_HubSocketIo.HubSocketIo.html +5 -5
  105. package/docs/classes/hub_HubTauri.HubTauri.html +5 -5
  106. package/docs/enums/components_JogPanel.JogDistanceAction.html +5 -0
  107. package/docs/enums/components_JogPanel.JogPanelAction.html +18 -0
  108. package/docs/enums/components_JogPanel.JogSpeedAction.html +5 -0
  109. package/docs/enums/core_ActionMode.ActionMode.html +6 -0
  110. package/docs/enums/core_IndicatorColor.IndicatorColor.html +23 -0
  111. package/docs/functions/assets_BlocklyLogo.default.html +1 -0
  112. package/docs/functions/assets_Distance.default.html +1 -0
  113. package/docs/functions/assets_JogLong.default.html +1 -0
  114. package/docs/functions/assets_JogMedium.default.html +1 -0
  115. package/docs/functions/assets_JogShort.default.html +1 -0
  116. package/docs/functions/assets_PythonLogo.default.html +1 -0
  117. package/docs/functions/assets_Rotation3D.default.html +1 -0
  118. package/docs/functions/assets_RotationCcw.default.html +1 -0
  119. package/docs/functions/assets_RotationCcwA.default.html +1 -0
  120. package/docs/functions/assets_RotationCcwB.default.html +1 -0
  121. package/docs/functions/assets_RotationCcwC.default.html +1 -0
  122. package/docs/functions/assets_RotationCw.default.html +1 -0
  123. package/docs/functions/assets_RotationCwA.default.html +1 -0
  124. package/docs/functions/assets_RotationCwB.default.html +1 -0
  125. package/docs/functions/assets_RotationCwC.default.html +1 -0
  126. package/docs/functions/assets_Run.default.html +1 -0
  127. package/docs/functions/assets_Speed.default.html +1 -0
  128. package/docs/functions/assets_SpeedFast.default.html +1 -0
  129. package/docs/functions/assets_SpeedMedium.default.html +1 -0
  130. package/docs/functions/assets_SpeedNone.default.html +1 -0
  131. package/docs/functions/assets_SpeedSlow.default.html +1 -0
  132. package/docs/functions/assets_Walk.default.html +1 -0
  133. package/docs/functions/components_BlocklyEditor.createCustomToolbox.html +6 -0
  134. package/docs/functions/components_Osk.Osk.html +2 -2
  135. package/docs/functions/core_EventEmitterContext.EventEmitterProvider.html +2 -2
  136. package/docs/functions/core_UniqueId.UniqueId.html +2 -2
  137. package/docs/functions/core_hoc.hocAddSubscription.html +2 -2
  138. package/docs/functions/hub.createHub.html +2 -2
  139. package/docs/hierarchy.html +1 -1
  140. package/docs/index.html +18 -2
  141. package/docs/interfaces/components_IndicatorButton.IndicatorButtonProps.html +160 -132
  142. package/docs/interfaces/components_JogPanel.JogPanelButtonDefinition.html +5 -0
  143. package/docs/interfaces/components_ToggleGroup.ToggleGroupProps.html +636 -0
  144. package/docs/interfaces/core_EventEmitterContext.Action.html +2 -2
  145. package/docs/interfaces/core_EventEmitterContext.EventEmitterContextType.html +2 -2
  146. package/docs/interfaces/core_EventEmitterContext.State.html +2 -2
  147. package/docs/interfaces/core_EventEmitterContext.Subscription.html +2 -2
  148. package/docs/interfaces/core_IndicatorButtonState.IndicatorButtonState.html +10 -0
  149. package/docs/interfaces/core_PositionContext.IPositionContext.html +2 -2
  150. package/docs/modules/assets.html +23 -0
  151. package/docs/modules/assets_BlocklyLogo.html +2 -0
  152. package/docs/modules/assets_Distance.html +2 -0
  153. package/docs/modules/assets_JogLong.html +2 -0
  154. package/docs/modules/assets_JogMedium.html +2 -0
  155. package/docs/modules/assets_JogShort.html +2 -0
  156. package/docs/modules/assets_PythonLogo.html +2 -0
  157. package/docs/modules/assets_Rotation3D.html +2 -0
  158. package/docs/modules/assets_RotationCcw.html +2 -0
  159. package/docs/modules/assets_RotationCcwA.html +2 -0
  160. package/docs/modules/assets_RotationCcwB.html +2 -0
  161. package/docs/modules/assets_RotationCcwC.html +2 -0
  162. package/docs/modules/assets_RotationCw.html +2 -0
  163. package/docs/modules/assets_RotationCwA.html +2 -0
  164. package/docs/modules/assets_RotationCwB.html +2 -0
  165. package/docs/modules/assets_RotationCwC.html +2 -0
  166. package/docs/modules/assets_Run.html +2 -0
  167. package/docs/modules/assets_Speed.html +2 -0
  168. package/docs/modules/assets_SpeedFast.html +2 -0
  169. package/docs/modules/assets_SpeedMedium.html +2 -0
  170. package/docs/modules/assets_SpeedNone.html +2 -0
  171. package/docs/modules/assets_SpeedSlow.html +2 -0
  172. package/docs/modules/assets_Walk.html +2 -0
  173. package/docs/modules/components_BlocklyEditor.html +5 -0
  174. package/docs/modules/components_CodeEditor.html +3 -0
  175. package/docs/modules/components_Indicator.html +2 -2
  176. package/docs/modules/components_IndicatorButton.html +4 -4
  177. package/docs/modules/components_JogPanel.html +9 -0
  178. package/docs/modules/components_Lamp.html +4 -0
  179. package/docs/modules/components_Osk.html +2 -2
  180. package/docs/modules/components_OskDialog.html +2 -2
  181. package/docs/modules/components_ToggleGroup.html +5 -0
  182. package/docs/modules/components_ValueDisplay.html +2 -2
  183. package/docs/modules/core_ActionMode.html +2 -0
  184. package/docs/modules/core_EventEmitterContext.html +2 -2
  185. package/docs/modules/{components_IndicatorColor.html → core_IndicatorButtonState.html} +2 -2
  186. package/docs/modules/core_IndicatorColor.html +2 -0
  187. package/docs/modules/core_MaskPatterns.html +2 -2
  188. package/docs/modules/core_NumerableTypes.html +2 -2
  189. package/docs/modules/core_PositionContext.html +2 -2
  190. package/docs/modules/core_UniqueId.html +2 -2
  191. package/docs/modules/core_ValueSimulator.html +2 -2
  192. package/docs/modules/core_hoc.html +2 -2
  193. package/docs/modules/hub.html +2 -2
  194. package/docs/modules/hub_HubBase.html +2 -2
  195. package/docs/modules/hub_HubSimulate.html +2 -2
  196. package/docs/modules/hub_HubSocketIo.html +2 -2
  197. package/docs/modules/hub_HubTauri.html +2 -2
  198. package/docs/types/components_IndicatorButton.IndicatorButtonOptionsType.html +1 -0
  199. package/docs/types/core_EventEmitterContext.EmitterDispatchFunction.html +2 -2
  200. package/docs/types/core_EventEmitterContext.EmitterSubscribeFunction.html +2 -2
  201. package/docs/types/core_EventEmitterContext.EmitterUnsubscribeFunction.html +2 -2
  202. package/docs/types/core_NumerableTypes.NumerableFormatOptions.html +2 -2
  203. package/docs/types/core_hoc.HocAddSubscriptionProps.html +2 -2
  204. package/docs/variables/components_BlocklyEditor.StandardToolbox.html +1 -0
  205. package/docs/variables/components_JogPanel.kDefaultButtonDefinitions.html +2 -0
  206. package/docs/variables/components_JogPanel.kRotationButtonDefinitions.html +1 -0
  207. package/docs/variables/core_EventEmitterContext.EventEmitterContext.html +6 -6
  208. package/docs/variables/core_MaskPatterns.PrimeReactMaskPatterns.html +2 -2
  209. package/docs/variables/core_MaskPatterns.RegExMaskPatterns.html +2 -2
  210. package/docs/variables/core_PositionContext.DimensionsContext.html +2 -2
  211. package/package.json +7 -3
  212. package/readme.md +33 -0
  213. package/src/assets/BlocklyLogo.tsx +27 -0
  214. package/src/assets/Distance.tsx +18 -0
  215. package/src/assets/JogLong.tsx +13 -0
  216. package/src/assets/JogMedium.tsx +13 -0
  217. package/src/assets/JogShort.tsx +13 -0
  218. package/src/assets/PythonLogo.tsx +83 -0
  219. package/src/assets/Rotation3D.tsx +13 -0
  220. package/src/assets/RotationCcw.tsx +33 -0
  221. package/src/assets/RotationCcwA.tsx +45 -0
  222. package/src/assets/RotationCcwB.tsx +45 -0
  223. package/src/assets/RotationCcwC.tsx +45 -0
  224. package/src/assets/RotationCw.tsx +31 -0
  225. package/src/assets/RotationCwA.tsx +42 -0
  226. package/src/assets/RotationCwB.tsx +42 -0
  227. package/src/assets/RotationCwC.tsx +42 -0
  228. package/src/assets/Run.tsx +13 -0
  229. package/src/assets/Speed.tsx +18 -0
  230. package/src/assets/SpeedFast.tsx +13 -0
  231. package/src/assets/SpeedMedium.tsx +13 -0
  232. package/src/assets/SpeedNone.tsx +13 -0
  233. package/src/assets/SpeedSlow.tsx +13 -0
  234. package/src/assets/Walk.tsx +13 -0
  235. package/src/assets/index.ts +22 -0
  236. package/src/assets/svg/blockly_logo.svg +82 -0
  237. package/src/assets/svg/distance.svg +40 -0
  238. package/src/assets/svg/jog_long.svg +1 -0
  239. package/src/assets/svg/jog_medium.svg +1 -0
  240. package/src/assets/svg/jog_short.svg +1 -0
  241. package/src/assets/svg/python_logo.svg +246 -0
  242. package/src/assets/svg/rotation_3d.svg +1 -0
  243. package/src/assets/svg/rotation_ccw.svg +50 -0
  244. package/src/assets/svg/rotation_ccw_a.svg +57 -0
  245. package/src/assets/svg/rotation_ccw_b.svg +57 -0
  246. package/src/assets/svg/rotation_ccw_c.svg +57 -0
  247. package/src/assets/svg/rotation_cw.svg +49 -0
  248. package/src/assets/svg/rotation_cw_a.svg +30 -0
  249. package/src/assets/svg/rotation_cw_b.svg +30 -0
  250. package/src/assets/svg/rotation_cw_c.svg +30 -0
  251. package/src/assets/svg/run.svg +1 -0
  252. package/src/assets/svg/speed.svg +39 -0
  253. package/src/assets/svg/speed_fast.svg +1 -0
  254. package/src/assets/svg/speed_medium.svg +1 -0
  255. package/src/assets/svg/speed_none.svg +1 -0
  256. package/src/assets/svg/speed_slow.svg +1 -0
  257. package/src/assets/svg/walk.svg +1 -0
  258. package/src/components/BlocklyEditor.css +25 -0
  259. package/src/components/BlocklyEditor.tsx +598 -0
  260. package/src/components/CodeEditor.tsx +156 -0
  261. package/src/components/Indicator.tsx +63 -118
  262. package/src/components/IndicatorButton.tsx +104 -50
  263. package/src/components/JogPanel.css +41 -0
  264. package/src/components/JogPanel.tsx +458 -0
  265. package/src/components/Lamp.tsx +243 -0
  266. package/src/components/ToggleGroup.tsx +429 -0
  267. package/src/core/ActionMode.ts +20 -0
  268. package/src/core/IndicatorButtonState.ts +34 -0
  269. package/tools/copy-distribution-files.cjs +3 -2
  270. package/dist/components/DPad.css +0 -522
  271. package/dist/components/DPad.d.ts +0 -34
  272. package/dist/components/DPad.js +0 -1
  273. package/docs/enums/components_DPad.VcJoyPadAction.html +0 -10
  274. package/docs/enums/components_DPad.VcJoyPadButtonId.html +0 -7
  275. package/docs/enums/components_IndicatorButton.ActionMode.html +0 -6
  276. package/docs/enums/components_IndicatorColor.IndicatorColor.html +0 -23
  277. package/docs/functions/components_DPad.VcDPad.html +0 -5
  278. package/docs/interfaces/components_IndicatorButton.IndicatorButtonState.html +0 -10
  279. package/docs/modules/components_DPad.html +0 -5
  280. package/src/components/DPad.css +0 -522
  281. package/src/components/DPad.tsx +0 -94
  282. /package/dist/{components → core}/IndicatorColor.d.ts +0 -0
  283. /package/dist/{components → core}/IndicatorColor.js +0 -0
  284. /package/src/{components → core}/IndicatorColor.ts +0 -0
@@ -0,0 +1,458 @@
1
+ /*
2
+ * Copyright (C) 2024 Automated Design Corp. All Rights Reserved.
3
+ * Created Date: 2024-01-16 13:17:23
4
+ * -----
5
+ * Last Modified: 2024-03-19 21:20:59
6
+ * -----
7
+ *
8
+ */
9
+
10
+ import React from 'react';
11
+ import { Button } from "primereact/button";
12
+ import { SelectButton } from 'primereact/selectbutton';
13
+ import { Tooltip } from 'primereact/tooltip';
14
+
15
+ import './JogPanel.css';
16
+ //import _default from '@monaco-editor/react';
17
+
18
+ import { Distance, JogShort, JogMedium, JogLong } from '../assets';
19
+ import { Speed, SpeedSlow, SpeedMedium, SpeedFast } from '../assets';
20
+ import { RotationCcwA, RotationCcwB, RotationCcwC } from '../assets';
21
+ import { RotationCwA, RotationCwB, RotationCwC } from '../assets';
22
+
23
+ /**
24
+ * Enumerates the source button or action when an event occurs.
25
+ */
26
+ export enum JogPanelAction {
27
+ /** Invalid - Ignore this button */
28
+ Invalid = 0x00,
29
+ // Horizontal Right
30
+ xPositive = 0x01,
31
+ // Vertical left
32
+ xNegative = 0x02,
33
+ // Away, back
34
+ yPositive = 0x03,
35
+ // Towards, forward
36
+ yNegative = 0x04,
37
+ // Vertical UP
38
+ zPositive = 0x05,
39
+ // Vertical down
40
+ zNegative = 0x06,
41
+ // Rotate positive around the X axis
42
+ aPositive = 0x07,
43
+ // Rotate negative around the X axis
44
+ aNegative = 0x08,
45
+ // Rotate positive around the Y axis
46
+ bPositive = 0x09,
47
+ // Rotate negative around the Y axis
48
+ bNegative = 0x10,
49
+ // Rotate positive around the Z axis
50
+ cPositive = 0x11,
51
+ // Rotate negative around the Z axis
52
+ cNegative = 0x12,
53
+
54
+ /** Stop, clear or reset */
55
+ Stop = 0xFF,
56
+ }
57
+
58
+
59
+ /**
60
+ * Enumerates the selected jog distance.
61
+ */
62
+ export enum JogDistanceAction {
63
+ Short = 0x00,
64
+ Medium = 0x10,
65
+ Long = 0x20
66
+ }
67
+
68
+ /**
69
+ * Enumerates the selected jog distance.
70
+ */
71
+ export enum JogSpeedAction {
72
+ Slow = 0x00,
73
+ Medium = 0x10,
74
+ Fast = 0x20
75
+ }
76
+
77
+
78
+ /**
79
+ * Jog button definition type for defining the button in the JogPanel.
80
+ */
81
+ export interface JogPanelButtonDefinition {
82
+ icon: string;
83
+ alt: string;
84
+ action: JogPanelAction
85
+ }
86
+
87
+ /**
88
+ * Interface for the jog distance select button.
89
+ */
90
+ interface JogDistanceItem {
91
+ name: string;
92
+ value: JogDistanceAction;
93
+ }
94
+
95
+ /**
96
+ * Interface for the jog speed select button.
97
+ */
98
+ interface JogSpeedItem {
99
+ name: string;
100
+ value: JogSpeedAction;
101
+ }
102
+
103
+ /**
104
+ * Component properties of the directional pad.
105
+ */
106
+ interface JogPanelProps {
107
+ onClicked?: (action: JogPanelAction) => void;
108
+ onJogDistanceChanged?: (action: JogDistanceAction) => void;
109
+ onJogSpeedChanged?: (action: JogSpeedAction) => void;
110
+ buttonDefinitions: (JogPanelButtonDefinition | undefined)[][] | undefined;
111
+ defaultJogDistance : JogDistanceAction;
112
+ defaultJogSpeed : JogSpeedAction;
113
+ showDistanceControl : boolean;
114
+ showSpeedControl : boolean;
115
+ }
116
+
117
+
118
+ interface JogPanelState {
119
+ jogDistance : JogDistanceAction,
120
+ jogSpeed : JogSpeedAction
121
+ }
122
+
123
+
124
+ /**
125
+ * Default X, Y, Z configuration.
126
+ */
127
+ export const kDefaultButtonDefinitions : (JogPanelButtonDefinition | undefined)[][] = [
128
+ [{ icon: "pi pi-arrow-up-left", action: JogPanelAction.yPositive, alt: "Y Positive" }, { icon: "pi pi-arrow-up", action: JogPanelAction.zPositive, alt: "Z Positive" }, undefined],
129
+ [{ icon: "pi pi-arrow-left", action: JogPanelAction.xNegative, alt: "X Negative" }, undefined, { icon: "pi pi-arrow-right", action: JogPanelAction.xPositive, alt: "X Positive" }],
130
+ [undefined, { icon: "pi pi-arrow-down", action: JogPanelAction.zNegative, alt: "Z Negative" }, { icon: "pi pi-arrow-down-right", action: JogPanelAction.yNegative, alt: "Y Negative" }],
131
+ ];
132
+
133
+ export const kRotationButtonDefinitions : (JogPanelButtonDefinition | undefined)[][] = [
134
+ [{ icon: "pi", action: JogPanelAction.bPositive, alt: "Rot B Positive" }, { icon: "pi", action: JogPanelAction.cPositive, alt: "Rot C Positive" }, undefined],
135
+ [{ icon: "pi", action: JogPanelAction.aNegative, alt: "Rot A Negative" }, undefined, { icon: "pi", action: JogPanelAction.aPositive, alt: "Rot A Positive" }],
136
+ [undefined, { icon: "pi", action: JogPanelAction.cNegative, alt: "Rot C Negative" }, { icon: "pi ", action: JogPanelAction.bNegative, alt: "Rot B Negative" }],
137
+ ];
138
+
139
+ /**
140
+ * Jogging panel that supports 3D motion. In 3D:
141
+ * - Z is Up and Down,
142
+ * - Y is towards and away
143
+ * - X is left and right
144
+ *
145
+ * This Jog Panel is based upon a standard CNC mill and industrial standards.
146
+ *
147
+ * ## Parameters
148
+ * @param onClicked Callback any time a button is clicked. Includes argument for direction.
149
+ * @param buttonDefinitions A 3x3 matrix of (JogPanelButtonDefinition | undefined) that defines the button. If a button is undefined, it is disabled.
150
+ *
151
+ * ## Button definitions
152
+ *
153
+ * Example:
154
+ * ```
155
+ * export const kDefaultButtonDefinitions : (JogPanelButtonDefinition | undefined)[][] = [
156
+ * [{ icon: "pi pi-arrow-up-left", action: JogPanelAction.yPositive, alt: "Y Positive" }, { icon: "pi pi-arrow-up", action: JogPanelAction.zPositive, alt: "Z Positive" }, undefined],
157
+ * [{ icon: "pi pi-arrow-left", action: JogPanelAction.xNegative, alt: "X Negative" }, undefined, { icon: "pi pi-arrow-right", action: JogPanelAction.xPositive, alt: "X Positive" }],
158
+ * [undefined, { icon: "pi pi-arrow-down", action: JogPanelAction.zNegative, alt: "Z Negative" }, { icon: "pi pi-arrow-down-right", action: JogPanelAction.yNegative, alt: "Y Negative" }],
159
+ * ];
160
+ * ```
161
+ *
162
+ */
163
+ export class JogPanel extends React.Component<JogPanelProps, JogPanelState> {
164
+
165
+ static defaultProps : JogPanelProps = {
166
+ onClicked: undefined,
167
+ onJogDistanceChanged: undefined,
168
+ buttonDefinitions: kDefaultButtonDefinitions,
169
+ defaultJogDistance : JogDistanceAction.Short,
170
+ defaultJogSpeed : JogSpeedAction.Medium,
171
+ showDistanceControl : true,
172
+ showSpeedControl : true
173
+ };
174
+
175
+
176
+ private jogDistanceItems: JogDistanceItem[] = [
177
+ {name: 'S', value: JogDistanceAction.Short},
178
+ {name: 'M', value: JogDistanceAction.Medium},
179
+ {name: 'L', value: JogDistanceAction.Long}
180
+ ];
181
+
182
+ private jogSpeedItems: JogSpeedItem[] = [
183
+ {name: 'S', value: JogSpeedAction.Slow},
184
+ {name: 'M', value: JogSpeedAction.Medium},
185
+ {name: 'F', value: JogSpeedAction.Fast}
186
+ ];
187
+
188
+
189
+ constructor(props: JogPanelProps) {
190
+ super(props);
191
+
192
+ this.state = {
193
+ jogDistance : props.defaultJogDistance,
194
+ jogSpeed : props.defaultJogSpeed
195
+ }
196
+ }
197
+
198
+
199
+ /**
200
+ * Handle a user action on the DirectionalPad
201
+ * @param action DirectionalPadAction
202
+ */
203
+ private handleClicked(action: JogPanelAction | undefined) {
204
+
205
+ if (action === undefined || action === null)
206
+ return;
207
+
208
+ if (this.props.onClicked) {
209
+ this.props.onClicked(action);
210
+ }
211
+
212
+ };
213
+
214
+ /**
215
+ * The user has selected a different jog distance.
216
+ * @param {JogDistanceAction} action The newly-selected distance.
217
+ */
218
+ private handleDistanceChanged(action : JogDistanceAction) {
219
+ this.setState({jogDistance: action});
220
+ if (this.props.onJogDistanceChanged) {
221
+ this.props.onJogDistanceChanged(action);
222
+ }
223
+ }
224
+
225
+ private handleSpeedChanged(action : JogSpeedAction) {
226
+ this.setState({jogSpeed: action});
227
+ if (this.props.onJogSpeedChanged) {
228
+ this.props.onJogSpeedChanged(action);
229
+ }
230
+ }
231
+
232
+
233
+ emptyRow() {
234
+ return <div className="grid-row">
235
+ <div className="button-item empty-slot" />
236
+ <div className="button-item empty-slot" />
237
+ <div className="button-item empty-slot" />
238
+ </div>
239
+ }
240
+
241
+ private actionToIcon(action : JogPanelAction | undefined) {
242
+ if (action == JogPanelAction.Invalid) {
243
+ return <i/>
244
+ }
245
+ else if (action == JogPanelAction.Stop) {
246
+ return <i/>
247
+ }
248
+ else if (action == JogPanelAction.xNegative) {
249
+ return <i className="pi pi-arrow-left" />
250
+ }
251
+ else if (action == JogPanelAction.xPositive) {
252
+ return <i className="pi pi-arrow-right" />
253
+ }
254
+ else if (action == JogPanelAction.yNegative) {
255
+ return <i className="pi pi-arrow-up-left" />
256
+ }
257
+ else if (action == JogPanelAction.yPositive) {
258
+ return <i className="pi pi-arrow-down-right" />
259
+ }
260
+ else if (action == JogPanelAction.zNegative) {
261
+ return <i className="pi pi-up" />
262
+ }
263
+ else if (action == JogPanelAction.zPositive) {
264
+ return <i className="pi pi-down" />
265
+ }
266
+ else if (action == JogPanelAction.aNegative) {
267
+ return <RotationCcwA />
268
+ }
269
+ else if (action == JogPanelAction.aPositive) {
270
+ return <RotationCwA />
271
+ }
272
+ else if (action == JogPanelAction.bNegative) {
273
+ return <RotationCcwB />
274
+ }
275
+ else if (action == JogPanelAction.bPositive) {
276
+ return <RotationCwB />
277
+ }
278
+ else if (action == JogPanelAction.cNegative) {
279
+ return <RotationCcwC />
280
+ }
281
+ else if (action == JogPanelAction.cPositive) {
282
+ return <RotationCwC />
283
+ }
284
+ else {
285
+ return <i />
286
+ }
287
+
288
+ }
289
+
290
+ standardButton(row : number, col : number) {
291
+
292
+ if (this.props.buttonDefinitions !== undefined
293
+ && this.props.buttonDefinitions[row] !== undefined
294
+ && this.props.buttonDefinitions[row][col] !== undefined
295
+ && this.props.buttonDefinitions[row][col]?.action !== undefined ) {
296
+
297
+ const action = this.props.buttonDefinitions[row][col]?.action;
298
+
299
+ if (action !== undefined && action < JogPanelAction.aPositive ) {
300
+ return <Button
301
+ key={`${row}-${col}`}
302
+ icon={this.props.buttonDefinitions[row][col]?.icon}
303
+ tooltip={this.props.buttonDefinitions[row][col]?.alt}
304
+ onClick={() => this.handleClicked(action)}
305
+ className="button-item"
306
+ />
307
+ }
308
+ else {
309
+ return <Button
310
+ key={`${row}-${col}`}
311
+ tooltip={this.props.buttonDefinitions[row][col]?.alt}
312
+ onClick={() => this.handleClicked(action)}
313
+ className="button-item"
314
+ icon={() => this.actionToIcon(action)}/>
315
+ }
316
+
317
+ }
318
+ else {
319
+ return <Button icon="pi" key={`${row}-${col}`} disabled={true} className="button-item empty-slot" />
320
+ }
321
+
322
+
323
+ }
324
+
325
+ render() {
326
+
327
+
328
+ const distanceButtonTemplate = (option: JogDistanceItem) => {
329
+ if (option.value == JogDistanceAction.Short) {
330
+ return <JogShort className="distance-selector-button" width={16} height={16}
331
+ data-pr-tooltip="Short Distance"
332
+ data-pr-position="bottom"
333
+ fill="white"
334
+ />
335
+ }
336
+ else if (option.value == JogDistanceAction.Medium) {
337
+ return <JogMedium className="distance-selector-button" width={16} height={16}
338
+ data-pr-tooltip="Medium Distance"
339
+ data-pr-position="bottom"
340
+ fill="white"
341
+ />;
342
+ }
343
+ else {
344
+ return <JogLong className="distance-selector-button" width={16} height={16}
345
+ data-pr-tooltip="Long Distance"
346
+ data-pr-position="bottom"
347
+ fill="white"
348
+ />;
349
+ }
350
+
351
+ }
352
+
353
+
354
+ const speedButtonTemplate = (option: JogSpeedItem) => {
355
+ if (option.value == JogSpeedAction.Slow) {
356
+ return <SpeedSlow className="distance-selector-button" width={16} height={16}
357
+ data-pr-tooltip="Slow Speed"
358
+ data-pr-position="bottom"
359
+ fill="white"
360
+ />
361
+ }
362
+ else if (option.value == JogSpeedAction.Medium) {
363
+ return <SpeedMedium className="distance-selector-button" width={16} height={16}
364
+ data-pr-tooltip="Medium Speed"
365
+ data-pr-position="bottom"
366
+ fill="white"
367
+ />;
368
+ }
369
+ else {
370
+ return <SpeedFast className="distance-selector-button" width={16} height={16}
371
+ data-pr-tooltip="Fast Speed"
372
+ data-pr-position="bottom"
373
+ fill="white"
374
+ />;
375
+ }
376
+
377
+ }
378
+
379
+ // const jogButtonTemplate = (option: JogDistanceItem) => {
380
+ // if (option.value == JogDistanceAction.Short) {
381
+ // return <svg xmlns="http://www.w3.org/2000/svg" height="16" viewBox="0 -960 960 960" width="24" fill="white">
382
+ // <path d="M800-80v-800h80v800h-80ZM560-280v-400h120v400H560Zm-240 0"/>
383
+ // </svg>;
384
+ // }
385
+ // else if (option.value == JogDistanceAction.Medium) {
386
+ // return <svg xmlns="http://www.w3.org/2000/svg" height="16" viewBox="0 -960 960 960" width="24" fill="white">
387
+ // <path d="M800-80v-800h80v800h-80ZM560-280v-400h120v400H560Zm-240 0v-400h120v400H320Z"/>
388
+ // </svg>;
389
+ // }
390
+ // else {
391
+ // return <svg xmlns="http://www.w3.org/2000/svg" height="16" viewBox="0 -960 960 960" width="24" fill="white">
392
+ // <path d="M800-80v-800h80v800h-80ZM560-280v-400h120v400H560Zm-240 0v-400h120v400H320Zm-240 0v-400h120v400H320Z"/>
393
+ // </svg>;
394
+ // }
395
+ // }
396
+
397
+ return (
398
+ <div className="jogpanel-container">
399
+ <Tooltip target=".distance-selector-button" />
400
+
401
+ <div className="grid-container">
402
+ <div key="0" className="grid-row">
403
+ {this.standardButton(0,0)}
404
+ {this.standardButton(0,1)}
405
+ {this.standardButton(0,2)}
406
+ </div>
407
+ <div key="1" className="grid-row">
408
+ {this.standardButton(1,0)}
409
+ {this.standardButton(1,1)}
410
+ {this.standardButton(1,2)}
411
+ </div>
412
+ <div key="2" className="grid-row">
413
+ {this.standardButton(2,0)}
414
+ {this.standardButton(2,1)}
415
+ {this.standardButton(2,2)}
416
+ </div>
417
+ </div>
418
+
419
+ { this.props.showDistanceControl &&
420
+ <div className="distance-selector p-inputgroup flex-1">
421
+ <span className="p-inputgroup-addon">
422
+ <Distance width={16} height={16} fill="white" />
423
+ </span>
424
+ <SelectButton
425
+ value={this.state.jogDistance}
426
+ onChange={(e) => this.handleDistanceChanged(e.value)}
427
+ optionLabel="name"
428
+ options={this.jogDistanceItems}
429
+ allowEmpty={false}
430
+ itemTemplate={distanceButtonTemplate}
431
+ />
432
+ </div>
433
+ }
434
+
435
+ {this.props.showSpeedControl &&
436
+ <div className="distance-selector p-inputgroup flex-1">
437
+ <span className="p-inputgroup-addon">
438
+ <Speed width={16} height={16} fill="white" />
439
+ </span>
440
+ <SelectButton
441
+ value={this.state.jogSpeed}
442
+ onChange={(e) => this.handleSpeedChanged(e.value)}
443
+ optionLabel="name"
444
+ options={this.jogSpeedItems}
445
+ allowEmpty={false}
446
+ itemTemplate={speedButtonTemplate}
447
+ />
448
+ </div>
449
+ }
450
+
451
+ </div>
452
+ );
453
+ }
454
+ };
455
+
456
+ export default JogPanel;
457
+
458
+
@@ -0,0 +1,243 @@
1
+ /*
2
+ * Copyright (C) 2024 Automated Design Corp. All Rights Reserved.
3
+ * Created Date: 2024-01-16 14:39:41
4
+ * -----
5
+ * Last Modified: 2024-03-12 21:12:29
6
+ * -----
7
+ *
8
+ */
9
+
10
+
11
+
12
+ // import { useContext } from 'react';
13
+ // import clsx from 'clsx';
14
+
15
+ // import DimensionsContext from '../core/DimensionsContext';
16
+
17
+
18
+
19
+ // /**
20
+ // * Displays boolean values<br/>
21
+ // * Supports 3 states: **on**, **off** and **invalid/not available**:
22
+ // */
23
+ // const Indicator = ({
24
+ // value: value,
25
+ // x,
26
+ // y,
27
+ // width = 22,
28
+ // height = width,
29
+ // className,
30
+ // onColor: onColor = IndicatorGreen,
31
+ // offColor: offColor = IndicatorOff,
32
+ // invalidColor: invalidColor = IndicatorInvalid,
33
+ // useAbsolutePositioning = false, // Default to false
34
+ // }: Props): JSX.Element => {
35
+ // const { scale, xOffset, yOffset } = useContext(DimensionsContext);
36
+
37
+ // let color;
38
+ // switch (value) {
39
+ // case true:
40
+ // color = onColor;
41
+ // break;
42
+ // case false:
43
+ // color = offColor;
44
+ // break;
45
+ // default:
46
+ // color = invalidColor;
47
+ // break;
48
+ // }
49
+
50
+ // return (
51
+ // <div
52
+ // className={clsx(className)}
53
+ // style={{
54
+ // position: useAbsolutePositioning ? 'absolute' : 'relative',
55
+ // display: useAbsolutePositioning ? "": "inline-block",
56
+ // verticalAlign: 'middle',
57
+ // top: useAbsolutePositioning && y ? `${yOffset + scale * y}px` : undefined,
58
+ // left: useAbsolutePositioning && x? `${xOffset + scale * x}px` : undefined,
59
+ // width: width ? `${width * scale}px` : undefined,
60
+ // height: height ? `${height * scale}px` : undefined,
61
+ // lineHeight: height ? `${height * scale}px` : undefined,
62
+ // backgroundColor: color,
63
+ // borderRadius: "20px"
64
+ // }}
65
+ // />
66
+ // );
67
+ // };
68
+
69
+ // export { Indicator };
70
+
71
+
72
+
73
+
74
+ import React, { Component } from 'react';
75
+ import clsx from 'clsx';
76
+ import { EventEmitterContext, EventEmitterContextType } from '../core/EventEmitterContext';
77
+ import { IPositionContext } from '../core/PositionContext';
78
+ import {IndicatorColor} from "../core/IndicatorColor";
79
+ export {IndicatorColor}
80
+
81
+
82
+
83
+
84
+ interface LampProps {
85
+ /**
86
+ * State to be displayed<br/>
87
+ *
88
+ * Available states: **on**, **off** and **not available**:
89
+ *
90
+ * * `true` is treated as **on**
91
+ * * `false` is treated as **off**
92
+ * * `undefined` is treated as **not available**
93
+ */
94
+ value?: boolean | undefined;
95
+ /**
96
+ * X position (in pixels)
97
+ */
98
+ x?: number;
99
+ /**
100
+ * Y position (in pixels)
101
+ */
102
+ y?: number;
103
+ /**
104
+ * Width (in pixels)
105
+ */
106
+ width?: number;
107
+ /**
108
+ * Height (in pixels)<br/>
109
+ * @default width
110
+ */
111
+ height?: number;
112
+ /**
113
+ * CSS color for **enabled** state
114
+ */
115
+ onColor?: string;
116
+ /**
117
+ * CSS color for **disabled** state
118
+ */
119
+ offColor?: string;
120
+ /**
121
+ * CSS color for **not available** state
122
+ */
123
+ invalidColor?: string;
124
+ /**
125
+ * Custom class name to be attached
126
+ */
127
+ className?: string;
128
+
129
+
130
+ /**
131
+ * Enable absolute positioning for the component, allowing it to be
132
+ * placed on a specific position of its parent. This is useful when
133
+ * laying components over an image or wireframe.
134
+ */
135
+ useAbsolutePositioning?: boolean;
136
+
137
+ /**
138
+ * The topic to monitor to display. Optional.
139
+ */
140
+ topic?: string;
141
+ }
142
+
143
+
144
+ interface LampState {
145
+ subscribedValue?: boolean | null;
146
+ fontSize?: string;
147
+ }
148
+
149
+
150
+ export class Lamp extends Component<LampProps, LampState> {
151
+ static contextType = EventEmitterContext;
152
+ protected unsubscribeTopicId: number | null = null;
153
+
154
+ // Define default properties
155
+ static defaultProps = {
156
+ width: 22,
157
+ height: 22,
158
+ onColor: "green",
159
+ offColor: "gray",
160
+ invalidColor: "black",
161
+ useAbsolutePositioning: false
162
+ };
163
+
164
+ constructor(props: LampProps) {
165
+ super(props);
166
+ this.state = {
167
+ subscribedValue: props.value,
168
+ fontSize: "100%"
169
+ };
170
+ }
171
+
172
+ componentDidMount() {
173
+ const { topic } = this.props;
174
+ if (topic && this.unsubscribeTopicId === null) {
175
+ const { subscribe } = this.context as EventEmitterContextType;
176
+ this.unsubscribeTopicId = subscribe(topic, (value: any) => {
177
+ this.setState({ subscribedValue: value });
178
+ });
179
+ }
180
+ }
181
+
182
+ componentDidUpdate(prevProps: LampProps) {
183
+ if (prevProps.value !== this.props.value) {
184
+ this.setState({ subscribedValue: this.props.value });
185
+ }
186
+ }
187
+
188
+ componentWillUnmount() {
189
+ if (this.unsubscribeTopicId !== null) {
190
+ const { unsubscribe } = this.context as EventEmitterContextType;
191
+ unsubscribe(this.unsubscribeTopicId);
192
+ this.unsubscribeTopicId = null;
193
+ }
194
+ }
195
+
196
+ render() {
197
+ const { x, y, width, height, className, onColor, offColor, invalidColor, useAbsolutePositioning } = this.props;
198
+ const { scale, xOffset, yOffset } = this.context as IPositionContext;
199
+ const { subscribedValue } = this.state;
200
+
201
+ let adjWidth = width || 10;
202
+ if (adjWidth < 10)
203
+ adjWidth = 10;
204
+ let adjHeight = height || 10;
205
+ if (adjHeight < 10)
206
+ adjHeight = 10;
207
+ let adjScale = scale || 1;
208
+ if (adjScale === 0)
209
+ adjScale = 1;
210
+
211
+ let color;
212
+ switch (subscribedValue) {
213
+ case true:
214
+ color = onColor;
215
+ break;
216
+ case false:
217
+ color = offColor;
218
+ break;
219
+ default:
220
+ color = invalidColor;
221
+ break;
222
+ }
223
+
224
+ const style: React.CSSProperties = {
225
+ position: useAbsolutePositioning ? 'absolute' : 'relative',
226
+ display: useAbsolutePositioning ? "" : "inline-block",
227
+ verticalAlign: 'middle',
228
+ top: useAbsolutePositioning && y ? `${yOffset + adjScale * y}px` : undefined,
229
+ left: useAbsolutePositioning && x ? `${xOffset + adjScale * x}px` : undefined,
230
+ width: adjWidth ? `${adjWidth * adjScale}px` : undefined,
231
+ height: adjHeight ? `${adjHeight * adjScale}px` : undefined,
232
+ lineHeight: adjHeight ? `${adjHeight * adjScale}px` : undefined,
233
+ backgroundColor: color,
234
+ borderRadius: "20px"
235
+ };
236
+
237
+ return (
238
+ <div className={clsx(className)} style={style} />
239
+ );
240
+ }
241
+ }
242
+
243
+ export default Lamp;