@adcops/autocore-react 3.0.1 → 3.0.4

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 (292) 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 +118 -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/components/ValueInput.d.ts +109 -0
  86. package/dist/components/ValueInput.js +1 -0
  87. package/dist/core/ActionMode.d.ts +9 -0
  88. package/dist/core/ActionMode.js +1 -0
  89. package/dist/core/IndicatorButtonState.d.ts +21 -0
  90. package/dist/core/IndicatorButtonState.js +1 -0
  91. package/dist/core/MaskPatterns.d.ts +4 -0
  92. package/dist/core/MaskPatterns.js +1 -1
  93. package/docs/assets/highlight.css +25 -18
  94. package/docs/assets/navigation.js +1 -1
  95. package/docs/assets/search.js +1 -1
  96. package/docs/classes/components_BlocklyEditor.BlocklyEditor.html +124 -0
  97. package/docs/classes/components_CodeEditor.CodeEditor.html +128 -0
  98. package/docs/classes/components_Indicator.Indicator.html +8 -8
  99. package/docs/classes/components_IndicatorButton.IndicatorButton.html +17 -17
  100. package/docs/classes/components_JogPanel.JogPanel.html +138 -0
  101. package/docs/classes/components_Lamp.Lamp.html +105 -0
  102. package/docs/classes/components_OskDialog.OskDialog.html +5 -5
  103. package/docs/classes/components_ToggleGroup.ToggleGroup.html +118 -0
  104. package/docs/classes/components_ValueDisplay.ValueDisplay.html +4 -4
  105. package/docs/classes/components_ValueInput.ValueInput.html +115 -0
  106. package/docs/classes/core_ValueSimulator.ValueSimulator.html +2 -2
  107. package/docs/classes/hub_HubBase.HubBase.html +4 -4
  108. package/docs/classes/hub_HubSimulate.HubSimulate.html +2 -2
  109. package/docs/classes/hub_HubSocketIo.HubSocketIo.html +5 -5
  110. package/docs/classes/hub_HubTauri.HubTauri.html +5 -5
  111. package/docs/enums/components_JogPanel.JogDistanceAction.html +5 -0
  112. package/docs/enums/components_JogPanel.JogPanelAction.html +18 -0
  113. package/docs/enums/components_JogPanel.JogSpeedAction.html +5 -0
  114. package/docs/enums/core_ActionMode.ActionMode.html +6 -0
  115. package/docs/enums/core_IndicatorColor.IndicatorColor.html +23 -0
  116. package/docs/functions/assets_BlocklyLogo.default.html +1 -0
  117. package/docs/functions/assets_Distance.default.html +1 -0
  118. package/docs/functions/assets_JogLong.default.html +1 -0
  119. package/docs/functions/assets_JogMedium.default.html +1 -0
  120. package/docs/functions/assets_JogShort.default.html +1 -0
  121. package/docs/functions/assets_PythonLogo.default.html +1 -0
  122. package/docs/functions/assets_Rotation3D.default.html +1 -0
  123. package/docs/functions/assets_RotationCcw.default.html +1 -0
  124. package/docs/functions/assets_RotationCcwA.default.html +1 -0
  125. package/docs/functions/assets_RotationCcwB.default.html +1 -0
  126. package/docs/functions/assets_RotationCcwC.default.html +1 -0
  127. package/docs/functions/assets_RotationCw.default.html +1 -0
  128. package/docs/functions/assets_RotationCwA.default.html +1 -0
  129. package/docs/functions/assets_RotationCwB.default.html +1 -0
  130. package/docs/functions/assets_RotationCwC.default.html +1 -0
  131. package/docs/functions/assets_Run.default.html +1 -0
  132. package/docs/functions/assets_Speed.default.html +1 -0
  133. package/docs/functions/assets_SpeedFast.default.html +1 -0
  134. package/docs/functions/assets_SpeedMedium.default.html +1 -0
  135. package/docs/functions/assets_SpeedNone.default.html +1 -0
  136. package/docs/functions/assets_SpeedSlow.default.html +1 -0
  137. package/docs/functions/assets_Walk.default.html +1 -0
  138. package/docs/functions/components_BlocklyEditor.createCustomToolbox.html +6 -0
  139. package/docs/functions/components_Osk.Osk.html +2 -2
  140. package/docs/functions/core_EventEmitterContext.EventEmitterProvider.html +2 -2
  141. package/docs/functions/core_UniqueId.UniqueId.html +2 -2
  142. package/docs/functions/core_hoc.hocAddSubscription.html +2 -2
  143. package/docs/functions/hub.createHub.html +2 -2
  144. package/docs/hierarchy.html +1 -1
  145. package/docs/index.html +18 -2
  146. package/docs/interfaces/components_IndicatorButton.IndicatorButtonProps.html +160 -132
  147. package/docs/interfaces/components_JogPanel.JogPanelButtonDefinition.html +5 -0
  148. package/docs/interfaces/components_ToggleGroup.ToggleGroupProps.html +636 -0
  149. package/docs/interfaces/core_EventEmitterContext.Action.html +2 -2
  150. package/docs/interfaces/core_EventEmitterContext.EventEmitterContextType.html +2 -2
  151. package/docs/interfaces/core_EventEmitterContext.State.html +2 -2
  152. package/docs/interfaces/core_EventEmitterContext.Subscription.html +2 -2
  153. package/docs/interfaces/core_IndicatorButtonState.IndicatorButtonState.html +10 -0
  154. package/docs/interfaces/core_PositionContext.IPositionContext.html +2 -2
  155. package/docs/modules/assets.html +23 -0
  156. package/docs/modules/assets_BlocklyLogo.html +2 -0
  157. package/docs/modules/assets_Distance.html +2 -0
  158. package/docs/modules/assets_JogLong.html +2 -0
  159. package/docs/modules/assets_JogMedium.html +2 -0
  160. package/docs/modules/assets_JogShort.html +2 -0
  161. package/docs/modules/assets_PythonLogo.html +2 -0
  162. package/docs/modules/assets_Rotation3D.html +2 -0
  163. package/docs/modules/assets_RotationCcw.html +2 -0
  164. package/docs/modules/assets_RotationCcwA.html +2 -0
  165. package/docs/modules/assets_RotationCcwB.html +2 -0
  166. package/docs/modules/assets_RotationCcwC.html +2 -0
  167. package/docs/modules/assets_RotationCw.html +2 -0
  168. package/docs/modules/assets_RotationCwA.html +2 -0
  169. package/docs/modules/assets_RotationCwB.html +2 -0
  170. package/docs/modules/assets_RotationCwC.html +2 -0
  171. package/docs/modules/assets_Run.html +2 -0
  172. package/docs/modules/assets_Speed.html +2 -0
  173. package/docs/modules/assets_SpeedFast.html +2 -0
  174. package/docs/modules/assets_SpeedMedium.html +2 -0
  175. package/docs/modules/assets_SpeedNone.html +2 -0
  176. package/docs/modules/assets_SpeedSlow.html +2 -0
  177. package/docs/modules/assets_Walk.html +2 -0
  178. package/docs/modules/components_BlocklyEditor.html +5 -0
  179. package/docs/modules/components_CodeEditor.html +3 -0
  180. package/docs/modules/components_Indicator.html +2 -2
  181. package/docs/modules/components_IndicatorButton.html +4 -4
  182. package/docs/modules/components_JogPanel.html +9 -0
  183. package/docs/modules/components_Lamp.html +4 -0
  184. package/docs/modules/components_Osk.html +2 -2
  185. package/docs/modules/components_OskDialog.html +2 -2
  186. package/docs/modules/components_ToggleGroup.html +5 -0
  187. package/docs/modules/components_ValueDisplay.html +2 -2
  188. package/docs/modules/components_ValueInput.html +2 -0
  189. package/docs/modules/core_ActionMode.html +2 -0
  190. package/docs/modules/core_EventEmitterContext.html +2 -2
  191. package/docs/modules/{components_IndicatorColor.html → core_IndicatorButtonState.html} +2 -2
  192. package/docs/modules/core_IndicatorColor.html +2 -0
  193. package/docs/modules/core_MaskPatterns.html +2 -2
  194. package/docs/modules/core_NumerableTypes.html +2 -2
  195. package/docs/modules/core_PositionContext.html +2 -2
  196. package/docs/modules/core_UniqueId.html +2 -2
  197. package/docs/modules/core_ValueSimulator.html +2 -2
  198. package/docs/modules/core_hoc.html +2 -2
  199. package/docs/modules/hub.html +2 -2
  200. package/docs/modules/hub_HubBase.html +2 -2
  201. package/docs/modules/hub_HubSimulate.html +2 -2
  202. package/docs/modules/hub_HubSocketIo.html +2 -2
  203. package/docs/modules/hub_HubTauri.html +2 -2
  204. package/docs/types/components_IndicatorButton.IndicatorButtonOptionsType.html +1 -0
  205. package/docs/types/core_EventEmitterContext.EmitterDispatchFunction.html +2 -2
  206. package/docs/types/core_EventEmitterContext.EmitterSubscribeFunction.html +2 -2
  207. package/docs/types/core_EventEmitterContext.EmitterUnsubscribeFunction.html +2 -2
  208. package/docs/types/core_NumerableTypes.NumerableFormatOptions.html +2 -2
  209. package/docs/types/core_hoc.HocAddSubscriptionProps.html +2 -2
  210. package/docs/variables/components_BlocklyEditor.StandardToolbox.html +1 -0
  211. package/docs/variables/components_JogPanel.DefaultLinearJogButtons.html +2 -0
  212. package/docs/variables/components_JogPanel.DefaultRotationJogButtons.html +2 -0
  213. package/docs/variables/core_EventEmitterContext.EventEmitterContext.html +6 -6
  214. package/docs/variables/core_MaskPatterns.PrimeReactMaskPatterns.html +2 -2
  215. package/docs/variables/core_MaskPatterns.RegExMaskPatterns.html +3 -2
  216. package/docs/variables/core_PositionContext.DimensionsContext.html +2 -2
  217. package/package.json +8 -4
  218. package/readme.md +33 -0
  219. package/src/assets/BlocklyLogo.tsx +27 -0
  220. package/src/assets/Distance.tsx +18 -0
  221. package/src/assets/JogLong.tsx +13 -0
  222. package/src/assets/JogMedium.tsx +13 -0
  223. package/src/assets/JogShort.tsx +13 -0
  224. package/src/assets/PythonLogo.tsx +83 -0
  225. package/src/assets/Rotation3D.tsx +13 -0
  226. package/src/assets/RotationCcw.tsx +33 -0
  227. package/src/assets/RotationCcwA.tsx +45 -0
  228. package/src/assets/RotationCcwB.tsx +45 -0
  229. package/src/assets/RotationCcwC.tsx +45 -0
  230. package/src/assets/RotationCw.tsx +31 -0
  231. package/src/assets/RotationCwA.tsx +42 -0
  232. package/src/assets/RotationCwB.tsx +42 -0
  233. package/src/assets/RotationCwC.tsx +42 -0
  234. package/src/assets/Run.tsx +13 -0
  235. package/src/assets/Speed.tsx +18 -0
  236. package/src/assets/SpeedFast.tsx +13 -0
  237. package/src/assets/SpeedMedium.tsx +13 -0
  238. package/src/assets/SpeedNone.tsx +13 -0
  239. package/src/assets/SpeedSlow.tsx +13 -0
  240. package/src/assets/Walk.tsx +13 -0
  241. package/src/assets/index.ts +22 -0
  242. package/src/assets/svg/blockly_logo.svg +82 -0
  243. package/src/assets/svg/distance.svg +40 -0
  244. package/src/assets/svg/jog_long.svg +1 -0
  245. package/src/assets/svg/jog_medium.svg +1 -0
  246. package/src/assets/svg/jog_short.svg +1 -0
  247. package/src/assets/svg/python_logo.svg +246 -0
  248. package/src/assets/svg/rotation_3d.svg +1 -0
  249. package/src/assets/svg/rotation_ccw.svg +50 -0
  250. package/src/assets/svg/rotation_ccw_a.svg +57 -0
  251. package/src/assets/svg/rotation_ccw_b.svg +57 -0
  252. package/src/assets/svg/rotation_ccw_c.svg +57 -0
  253. package/src/assets/svg/rotation_cw.svg +49 -0
  254. package/src/assets/svg/rotation_cw_a.svg +30 -0
  255. package/src/assets/svg/rotation_cw_b.svg +30 -0
  256. package/src/assets/svg/rotation_cw_c.svg +30 -0
  257. package/src/assets/svg/run.svg +1 -0
  258. package/src/assets/svg/speed.svg +39 -0
  259. package/src/assets/svg/speed_fast.svg +1 -0
  260. package/src/assets/svg/speed_medium.svg +1 -0
  261. package/src/assets/svg/speed_none.svg +1 -0
  262. package/src/assets/svg/speed_slow.svg +1 -0
  263. package/src/assets/svg/walk.svg +1 -0
  264. package/src/components/BlocklyEditor.css +25 -0
  265. package/src/components/BlocklyEditor.tsx +598 -0
  266. package/src/components/CodeEditor.tsx +156 -0
  267. package/src/components/Indicator.tsx +63 -118
  268. package/src/components/IndicatorButton.tsx +104 -50
  269. package/src/components/JogPanel.css +41 -0
  270. package/src/components/JogPanel.tsx +461 -0
  271. package/src/components/Lamp.tsx +243 -0
  272. package/src/components/ToggleGroup.tsx +429 -0
  273. package/src/components/ValueInput.tsx +261 -0
  274. package/src/core/ActionMode.ts +20 -0
  275. package/src/core/IndicatorButtonState.ts +34 -0
  276. package/src/core/MaskPatterns.ts +7 -1
  277. package/tools/copy-distribution-files.cjs +3 -2
  278. package/dist/components/DPad.css +0 -522
  279. package/dist/components/DPad.d.ts +0 -34
  280. package/dist/components/DPad.js +0 -1
  281. package/docs/enums/components_DPad.VcJoyPadAction.html +0 -10
  282. package/docs/enums/components_DPad.VcJoyPadButtonId.html +0 -7
  283. package/docs/enums/components_IndicatorButton.ActionMode.html +0 -6
  284. package/docs/enums/components_IndicatorColor.IndicatorColor.html +0 -23
  285. package/docs/functions/components_DPad.VcDPad.html +0 -5
  286. package/docs/interfaces/components_IndicatorButton.IndicatorButtonState.html +0 -10
  287. package/docs/modules/components_DPad.html +0 -5
  288. package/src/components/DPad.css +0 -522
  289. package/src/components/DPad.tsx +0 -94
  290. /package/dist/{components → core}/IndicatorColor.d.ts +0 -0
  291. /package/dist/{components → core}/IndicatorColor.js +0 -0
  292. /package/src/{components → core}/IndicatorColor.ts +0 -0
@@ -0,0 +1,156 @@
1
+ /*
2
+ * Copyright (C) 2024 Automated Design Corp.. All Rights Reserved.
3
+ * Created Date: 2024-03-17 08:43:02
4
+ * -----
5
+ * Last Modified: 2024-03-18 11:29:08
6
+ * -----
7
+ *
8
+ */
9
+
10
+
11
+
12
+ import * as React from 'react';
13
+ import { editor } from 'monaco-editor';
14
+ //import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
15
+ import Editor, { Monaco } from '@monaco-editor/react';
16
+
17
+
18
+ interface CodeEditorProps {
19
+
20
+ /**
21
+ * Code content of the editor
22
+ */
23
+ code: string | undefined;
24
+
25
+ /**
26
+ * Programming language type for syntax highlighting
27
+ * @default 'python'
28
+ */
29
+ language : string;
30
+
31
+ /**
32
+ * Visual theme of the editor. vs-dark is generally preferred.
33
+ * @default 'vs-dark'
34
+ */
35
+ theme : 'vs-dark' | 'vs-light';
36
+
37
+ /**
38
+ * Whether the editor is read only
39
+ * @default false
40
+ */
41
+ readOnly: boolean;
42
+
43
+ /**
44
+ * Style of the cursor in the editor.
45
+ * @default 'line'
46
+ */
47
+ cursorStyle: "line" | "block" | "underline" | "line-thin" | "block-outline" | "underline-thin" | undefined;
48
+
49
+
50
+ /** Callback when the user types chances into the editor. */
51
+ onCodeChanged?(code: string | undefined): void;
52
+ }
53
+
54
+
55
+ /**
56
+ * Wrapper for the Microsoft Monaco editor, configured for our most common defaults.
57
+ */
58
+ export class CodeEditor extends React.Component<CodeEditorProps> {
59
+
60
+
61
+ /**
62
+ * Default properties for this component.
63
+ */
64
+ static defaultProps = {
65
+ code: undefined,
66
+ language : 'python',
67
+ theme : 'vs-dark',
68
+ readOnly: false,
69
+ cursorStyle: "line",
70
+ onCodeChanged : undefined
71
+ }
72
+
73
+ /**
74
+ * Constructor
75
+ * @param props PythonEditorProps
76
+ */
77
+ constructor(props: CodeEditorProps) {
78
+ super(props);
79
+ }
80
+
81
+
82
+ /**
83
+ * The editor is initialized and displayed in the view.
84
+ * @param editor
85
+ * @param monaco
86
+ */
87
+ editorDidMount = (editor: editor.IStandaloneCodeEditor, monaco: Monaco) => {
88
+ monaco;
89
+ editor.focus();
90
+ };
91
+
92
+ /**
93
+ * The editor is about to mount into the view.
94
+ * @param monaco Instance of the editor.
95
+ */
96
+ handleEditorWillMount = (monaco: Monaco) => {
97
+ monaco;
98
+ }
99
+
100
+
101
+ /**
102
+ * Handle changes to the editor's contents.
103
+ * @param newValue New value of editor content.
104
+ * @param e
105
+ */
106
+ onChange = (newValue: string | undefined, e: any) => {
107
+ e;
108
+
109
+ if (this.props.onCodeChanged !== undefined && this.props.onCodeChanged !== null)
110
+ this.props.onCodeChanged(newValue);
111
+ };
112
+
113
+
114
+ handleEditorValidation = (markers: editor.IMarker[]) => {
115
+ // model markers
116
+ markers.forEach(marker => console.log('onValidate:', marker.message));
117
+ }
118
+
119
+
120
+ /**
121
+ * Render the component into the view.
122
+ * @returns
123
+ */
124
+ render() {
125
+ const options: editor.IStandaloneEditorConstructionOptions = {
126
+ selectOnLineNumbers: true,
127
+ roundedSelection: false,
128
+ readOnly: this.props.readOnly,
129
+ cursorStyle: this.props.cursorStyle,
130
+ automaticLayout: true,
131
+ theme: this.props.theme,
132
+ language: this.props.language,
133
+ folding: false,
134
+
135
+
136
+ };
137
+
138
+ return (
139
+ <Editor
140
+ value={this.props.code}
141
+ height="100%"
142
+ width="100%"
143
+ defaultLanguage="python"
144
+ defaultValue=""
145
+ onChange={this.onChange}
146
+ onMount={this.editorDidMount}
147
+ beforeMount={this.handleEditorWillMount}
148
+ onValidate={this.handleEditorValidation}
149
+ theme='vs-dark'
150
+ options={options}
151
+ />
152
+ );
153
+ }
154
+ }
155
+
156
+ export default CodeEditor;
@@ -2,86 +2,40 @@
2
2
  * Copyright (C) 2024 Automated Design Corp. All Rights Reserved.
3
3
  * Created Date: 2024-01-16 14:39:41
4
4
  * -----
5
- * Last Modified: 2024-03-08 07:48:42
5
+ * Last Modified: 2024-03-12 21:53:48
6
6
  * -----
7
7
  *
8
8
  */
9
9
 
10
10
 
11
+ import React, { Component } from 'react';
12
+ //import clsx from 'clsx';
13
+ import { EventEmitterContext, EventEmitterContextType } from '../core/EventEmitterContext';
14
+ //import { IPositionContext } from '../core/PositionContext';
15
+ import {IndicatorColor} from "../core/IndicatorColor";
16
+ export {IndicatorColor}
11
17
 
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 };
18
+ //import {Lamp} from "./Lamp";
70
19
 
71
20
 
72
21
 
73
22
 
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 "./IndicatorColor";
79
- export {IndicatorColor}
23
+ interface IndicatorProps {
80
24
 
81
25
 
26
+ /**
27
+ * Label of the group/row. Can be any element.
28
+ *
29
+ * ## Examples
30
+ * ```
31
+ * <Indicator label="Simple Text" />
32
+ * <Indicator label={<span><i className="pi pi-check"></i> Icon and Text</span>} />
33
+ * <Indicator label={<YourCustomIconComponent />} />
34
+ * ```
35
+ */
36
+ label? : React.ReactNode;
82
37
 
83
38
 
84
- interface IndicatorProps {
85
39
  /**
86
40
  * State to be displayed<br/>
87
41
  *
@@ -92,23 +46,6 @@ interface IndicatorProps {
92
46
  * * `undefined` is treated as **not available**
93
47
  */
94
48
  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
49
  /**
113
50
  * CSS color for **enabled** state
114
51
  */
@@ -126,18 +63,12 @@ interface IndicatorProps {
126
63
  */
127
64
  className?: string;
128
65
 
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
66
  /**
138
67
  * The topic to monitor to display. Optional.
139
68
  */
140
69
  topic?: string;
70
+
71
+
141
72
  }
142
73
 
143
74
 
@@ -153,12 +84,9 @@ export class Indicator extends Component<IndicatorProps, IndicatorState> {
153
84
 
154
85
  // Define default properties
155
86
  static defaultProps = {
156
- width: 22,
157
- height: 22,
158
87
  onColor: "green",
159
88
  offColor: "gray",
160
- invalidColor: "yellow",
161
- useAbsolutePositioning: false
89
+ invalidColor: "black"
162
90
  };
163
91
 
164
92
  constructor(props: IndicatorProps) {
@@ -194,22 +122,20 @@ export class Indicator extends Component<IndicatorProps, IndicatorState> {
194
122
  }
195
123
 
196
124
  render() {
197
- const { x, y, width, height, className, onColor, offColor, invalidColor, useAbsolutePositioning } = this.props;
198
- const { scale, xOffset, yOffset } = this.context as IPositionContext;
125
+ const { label, value, onColor, offColor, invalidColor } = this.props;
199
126
  const { subscribedValue } = this.state;
200
127
 
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;
128
+ //
129
+ // Load the value from the proper source.
130
+ // If the `value` property is undefined, that takes precedence.
131
+ //
132
+ let displayValue = subscribedValue;
133
+ if (value !== undefined) {
134
+ displayValue = value;
135
+ }
210
136
 
211
137
  let color;
212
- switch (subscribedValue) {
138
+ switch (displayValue) {
213
139
  case true:
214
140
  color = onColor;
215
141
  break;
@@ -221,21 +147,40 @@ export class Indicator extends Component<IndicatorProps, IndicatorState> {
221
147
  break;
222
148
  }
223
149
 
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,
150
+ // const style: React.CSSProperties = {
151
+ // position: useAbsolutePositioning ? 'absolute' : 'relative',
152
+ // display: useAbsolutePositioning ? "" : "inline-block",
153
+ // verticalAlign: 'middle',
154
+ // top: useAbsolutePositioning && y ? `${yOffset + adjScale * y}px` : undefined,
155
+ // left: useAbsolutePositioning && x ? `${xOffset + adjScale * x}px` : undefined,
156
+ // width: adjWidth ? `${adjWidth * adjScale}px` : undefined,
157
+ // height: adjHeight ? `${adjHeight * adjScale}px` : undefined,
158
+ // lineHeight: adjHeight ? `${adjHeight * adjScale}px` : undefined,
159
+ // backgroundColor: color,
160
+ // borderRadius: "20px"
161
+ // };
162
+
163
+
164
+ const groupStyle : React.CSSProperties = {
165
+ alignItems: "center !important"
166
+ };
167
+
168
+ const lampDivStyle : React.CSSProperties = {
233
169
  backgroundColor: color,
234
- borderRadius: "20px"
170
+ width: "22px"
235
171
  };
236
172
 
237
173
  return (
238
- <div className={clsx(className)} style={style} />
174
+
175
+ <div className="p-inputgroup flex-1" style={groupStyle} >
176
+ <span className="p-inputgroup-addon" style={lampDivStyle} >
177
+ &nbsp;
178
+ </span>
179
+ <span className="p-inputgroup-addon">
180
+ {label}
181
+ </span>
182
+ </div>
183
+
239
184
  );
240
185
  }
241
186
  }
@@ -2,7 +2,7 @@
2
2
  * Copyright (C) 2024 Automated Design Corp. All Rights Reserved.
3
3
  * Created Date: 2024-01-21 10:33:58
4
4
  * -----
5
- * Last Modified: 2024-03-08 07:17:08
5
+ * Last Modified: 2024-03-12 20:55:17
6
6
  * Modified By: ADC
7
7
  * -----
8
8
  *
@@ -12,31 +12,58 @@
12
12
  import { Component } from 'react';
13
13
  import { Button, ButtonProps} from 'primereact/button';
14
14
  import { EventEmitterContext, EventEmitterContextType } from '../core/EventEmitterContext';
15
- import {IndicatorColor} from "./IndicatorColor";
15
+ import {IndicatorColor} from "../core/IndicatorColor";
16
16
  export {IndicatorColor}
17
+ import { ActionMode } from '../core/ActionMode';
18
+ export {ActionMode};
19
+
20
+ import { IndicatorButtonState } from '../core/IndicatorButtonState';
21
+
22
+ export declare type IndicatorButtonOptionsType = string[] | undefined[] | undefined;
17
23
 
18
- /**
19
- * Enum for different input modes of the IndicatorButton.
20
- */
21
- export enum ActionMode {
22
- Tap = 'Tap',
23
- Toggle = 'Toggle',
24
- Pressed = 'Pressed',
25
- Released = 'Released'
26
- }
27
24
 
28
25
  /**
29
- * Properties for the IndicatorButton.
26
+ * Common properties for an indicating button, toggle or similar component.
27
+ * These types of components both indicate a state and execute commands/signals.
28
+ * This type of component is very common in industrial HMIs.
29
+ *
30
+ * These properties support displaying values of boolean, number and string states.
31
+ *
32
+ * Available boolean states: **on**, **off** and **not available**:
33
+ *
34
+ * * `true` is treated as **on**
35
+ * * `false` is treated as **off**
36
+ * * `undefined` is treated as **not available**
37
+ *
38
+ * Numeric values can be used. When there is only 2 or less possible states,
39
+ * 0 will be considered false (OFF), anything else will be considered true (ON).
40
+ * Undefined will be treated as "not available.""
41
+ *
42
+ * When the indicator contains more than 2 states, then the number will be matched
43
+ * to the available state, in order. More than two states requires usage of the
44
+ * options field, and declaring more than two states there.
45
+ *
46
+ * If a string state is used, it will be matched exactly to the matching
47
+ * label in the `options` field.
48
+ *
30
49
  *
31
50
  * For more information on the AutoCore Button API Specification, see
32
51
  * [Additional Documentation](../additional-docs/ButtonApiSpecs.md).
33
52
  */
34
- export interface IndicatorButtonProps extends ButtonProps {
53
+ export interface IndicatorButtonProps extends Omit<ButtonProps, 'value'> {
54
+
35
55
  /**
36
56
  * Topic name to monitor for state indication.
57
+ * If `value` field is not undefined, then that value is used instead.
37
58
  */
38
59
  topic?: string;
39
60
 
61
+ /**
62
+ * State to be displayed.
63
+ *
64
+ */
65
+ value?: boolean | number | string;
66
+
40
67
  /**
41
68
  * Color for the button when the state is TRUE.
42
69
  */
@@ -47,15 +74,47 @@ export interface IndicatorButtonProps extends ButtonProps {
47
74
  */
48
75
  offColor?: IndicatorColor;
49
76
 
77
+ // /**
78
+ // * Text displayed when the state is TRUE. Falls back to `label` if undefined.
79
+ // */
80
+ // onLabel?: string;
81
+
82
+ // /**
83
+ // * Text displayed when the state is FALSE. Falls back to `label` if undefined.
84
+ // */
85
+ // offLabel?: string;
86
+
87
+
50
88
  /**
51
- * Text displayed when the state is TRUE. Falls back to `label` if undefined.
89
+ * An array of string labels to display as the available options.
90
+ *
91
+ * For items with 2 states or less:
92
+ * Index 0 is the label when value is OFF.
93
+ * Index 1 is the label when value is ON.
94
+ *
95
+ * If only only value is given (Index 0), then that value is used for all states.
96
+ * For many controls, this is the same as setting the `label` field and leaving this
97
+ * field undefined.
52
98
  */
53
- onLabel?: string;
99
+ options? : IndicatorButtonOptionsType;
100
+
54
101
 
55
102
  /**
56
- * Text displayed when the state is FALSE. Falls back to `label` if undefined.
103
+ * Icon to be displayed on the button. Overrideen by onIcon or offIcon if those
104
+ * are not undefined.
57
105
  */
58
- offLabel?: string;
106
+ icon? : string;
107
+
108
+ /**
109
+ * Icon displayed when the state is TRUE. Falls back to `icon` if undefined.
110
+ */
111
+ onIcon? : string;
112
+
113
+ /**
114
+ * Icon displayed when the state is FALSE. Falls back to `icon` if undefined.
115
+ */
116
+ offIcon? : string;
117
+
59
118
 
60
119
  /**
61
120
  * Name of the command to invoke on button events.
@@ -97,32 +156,6 @@ export interface IndicatorButtonProps extends ButtonProps {
97
156
  invert?: boolean;
98
157
  }
99
158
 
100
- /**
101
- * State for the IndicatorButton.
102
- */
103
- export interface IndicatorButtonState {
104
- /**
105
- * Current value/state of the button based on the subscribed topic.
106
- */
107
- currentValue?: boolean;
108
-
109
- /**
110
- * Indicates whether the button is disabled.
111
- */
112
- isDisabled?: boolean;
113
-
114
- /**
115
- * Indicates whether the button is invisible.
116
- */
117
- isInvisible?: boolean;
118
-
119
- /**
120
- * The button is in the "down" state.
121
- */
122
- isPressed : boolean;
123
- }
124
-
125
-
126
159
 
127
160
 
128
161
  export class IndicatorButton extends Component<IndicatorButtonProps, IndicatorButtonState> {
@@ -266,22 +299,42 @@ export class IndicatorButton extends Component<IndicatorButtonProps, IndicatorBu
266
299
 
267
300
  render() {
268
301
  const { currentValue, isDisabled, isInvisible } = this.state;
269
- const { className, severity, label, raised,
270
- onColor, offColor, onLabel, offLabel, topic, command,
302
+ const { className, severity, label, raised, value,
303
+ onColor, offColor, options, topic, command,
271
304
  commandArgs, disableTopic, invisibleTopic, inputMode, invert,
305
+ onIcon, offIcon, icon,
272
306
  ...restProps
273
307
  } = this.props;
274
308
 
275
309
 
310
+ //
311
+ // Load the value from the proper source.
312
+ // If the `value` property is undefined, that takes precedence.
313
+ //
314
+ let displayValue = currentValue;
315
+ if (value !== undefined) {
316
+ displayValue = value;
317
+ }
318
+
276
319
  // Determine the label and color based on the current state
277
- let btnLabel = currentValue ? onLabel : offLabel;
278
- if (btnLabel === undefined || btnLabel === null || btnLabel.length === 0)
320
+ let btnLabel = undefined;
321
+ if (options !== undefined && options !== null) {
322
+ btnLabel = displayValue ? options[1] : options[0];
323
+ if (btnLabel === undefined || btnLabel === null || btnLabel.length === 0)
324
+ btnLabel = label;
325
+ }
326
+ else {
279
327
  btnLabel = label;
328
+ }
329
+
330
+ let btnIcon = displayValue ? onIcon : offIcon;
331
+ if (btnIcon === undefined || btnIcon === null || btnIcon.length === 0)
332
+ btnIcon = icon;
280
333
 
281
- let color = currentValue ? onColor : offColor;
334
+ let color = displayValue ? onColor : offColor;
282
335
 
283
336
  // Handle special cases like undefined state or specific input modes
284
- if (currentValue === undefined) {
337
+ if (displayValue === undefined) {
285
338
  color = IndicatorColor.IndicatorInvalid;
286
339
  }
287
340
 
@@ -289,6 +342,7 @@ export class IndicatorButton extends Component<IndicatorButtonProps, IndicatorBu
289
342
  return (
290
343
  <Button {...restProps}
291
344
  label={btnLabel}
345
+ icon={`pi ${btnIcon}`}
292
346
  className={className}
293
347
  style={{ color: "white", backgroundColor: color, display: isInvisible ? 'none' : 'block' }}
294
348
  disabled={isDisabled}
@@ -296,7 +350,7 @@ export class IndicatorButton extends Component<IndicatorButtonProps, IndicatorBu
296
350
  onTouchStart={() => this.handleOnPressed() }
297
351
  onMouseUp={() => this.handleOnReleased() }
298
352
  onTouchEnd={() => this.handleOnReleased() }
299
-
353
+ value={disableTopic}
300
354
  raised
301
355
  />
302
356
  );
@@ -0,0 +1,41 @@
1
+ /*
2
+ * Copyright (C) 2024 Automated Design Corp. All Rights Reserved.
3
+ * Created Date: 2024-01-16 13:17:33
4
+ * -----
5
+ * Last Modified: 2024-03-19 10:37:26
6
+ * -----
7
+ *
8
+ */
9
+
10
+ .jogpanel-container {
11
+ margin: 2mm;
12
+ display: flex;
13
+ flex-direction: column; /* Stack children vertically */
14
+ align-items: center; /* Center children horizontally within the container */
15
+ }
16
+
17
+ .grid-container {
18
+ display: flex;
19
+ flex-direction: column;
20
+ gap: 10px; /* Adjust the gap between rows */
21
+
22
+ }
23
+
24
+ .grid-row {
25
+ display: flex;
26
+ justify-content: space-between;
27
+ gap: 10px; /* Adjust the gap between buttons */
28
+ }
29
+
30
+ .button-item {
31
+ flex: 1; /* Make buttons expand to fill the row */
32
+ }
33
+
34
+ .distance-selector {
35
+ margin-top: 2mm; /* Gap between buttons and distance selector */
36
+ margin-left: auto;
37
+ margin-right: auto;
38
+ width: -moz-fit-content;
39
+ width: fit-content;
40
+ }
41
+