@adcops/autocore-react 3.0.32 → 3.0.34

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 (64) hide show
  1. package/dist/assets/BlocklyLogo.js +9 -1
  2. package/dist/assets/Distance.js +5 -1
  3. package/dist/assets/JogLong.js +3 -1
  4. package/dist/assets/JogMedium.js +3 -1
  5. package/dist/assets/JogShort.js +3 -1
  6. package/dist/assets/PythonLogo.js +21 -1
  7. package/dist/assets/Rotation3D.js +3 -1
  8. package/dist/assets/RotationCcw.js +10 -1
  9. package/dist/assets/RotationCcwA.js +16 -1
  10. package/dist/assets/RotationCcwB.js +16 -1
  11. package/dist/assets/RotationCcwC.js +16 -1
  12. package/dist/assets/RotationCw.js +10 -1
  13. package/dist/assets/RotationCwA.js +16 -1
  14. package/dist/assets/RotationCwB.js +16 -1
  15. package/dist/assets/RotationCwC.js +16 -1
  16. package/dist/assets/Run.js +3 -1
  17. package/dist/assets/Speed.js +5 -1
  18. package/dist/assets/SpeedFast.js +3 -1
  19. package/dist/assets/SpeedMedium.js +3 -1
  20. package/dist/assets/SpeedNone.js +3 -1
  21. package/dist/assets/SpeedSlow.js +3 -1
  22. package/dist/assets/Walk.js +3 -1
  23. package/dist/assets/index.js +22 -1
  24. package/dist/components/BlocklyEditor.js +508 -1
  25. package/dist/components/CodeEditor.js +108 -1
  26. package/dist/components/FileList.js +218 -1
  27. package/dist/components/FileSelect.js +63 -1
  28. package/dist/components/FitText.js +13 -1
  29. package/dist/components/Indicator.js +113 -1
  30. package/dist/components/IndicatorButton.js +187 -1
  31. package/dist/components/IndicatorRect.js +93 -1
  32. package/dist/components/JogPanel.js +295 -1
  33. package/dist/components/Lamp.js +161 -1
  34. package/dist/components/Osk.js +125 -1
  35. package/dist/components/OskDialog.js +128 -1
  36. package/dist/components/ProgressBarWithValue.js +18 -1
  37. package/dist/components/TextInput.js +139 -1
  38. package/dist/components/ToggleGroup.js +204 -1
  39. package/dist/components/ValueDisplay.js +160 -1
  40. package/dist/components/ValueIndicator.js +38 -1
  41. package/dist/components/ValueInput.js +158 -1
  42. package/dist/core/ActionMode.js +18 -1
  43. package/dist/core/EventEmitterContext.js +252 -1
  44. package/dist/core/IndicatorButtonState.js +9 -1
  45. package/dist/core/IndicatorColor.js +36 -1
  46. package/dist/core/MaskPatterns.js +80 -1
  47. package/dist/core/NumerableTypes.js +10 -1
  48. package/dist/core/PositionContext.js +24 -1
  49. package/dist/core/UniqueId.js +32 -1
  50. package/dist/core/ValueSimulator.js +233 -1
  51. package/dist/core/hoc.js +44 -1
  52. package/dist/hooks/adsHooks.js +253 -1
  53. package/dist/hooks/commandHooks.d.ts +1 -1
  54. package/dist/hooks/commandHooks.js +252 -1
  55. package/dist/hooks/index.js +10 -1
  56. package/dist/hooks/useScaledValue.js +86 -1
  57. package/dist/hub/CommandMessage.js +9 -1
  58. package/dist/hub/HubBase.js +310 -1
  59. package/dist/hub/HubSimulate.js +46 -1
  60. package/dist/hub/HubTauri.js +130 -1
  61. package/dist/hub/HubWebSocket.js +240 -1
  62. package/dist/hub/index.js +57 -1
  63. package/package.json +3 -3
  64. package/src/hooks/commandHooks.tsx +11 -8
@@ -1 +1,93 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{Component}from"react";import{EventEmitterContext}from"../core/EventEmitterContext";import{IndicatorColor}from"../core/IndicatorColor";export{IndicatorColor};export class IndicatorRect extends Component{constructor(t){super(t),Object.defineProperty(this,"handleTopicUpdate",{enumerable:!0,configurable:!0,writable:!0,value:t=>{this.setState({currentValue:t})}}),this.state={currentValue:void 0}}componentDidMount(){this.setupSubscriptions()}componentWillUnmount(){}setupSubscriptions(){const{topic:t}=this.props,{subscribe:e}=this.context;t&&e(t,this.handleTopicUpdate)}render(){const{currentValue:t}=this.state,{className:e,style:o,value:r,onColor:n,offColor:i,options:c}=this.props;let a,l=t;void 0!==r&&(l=r),void 0!==c&&c.length>0&&(a=l?c[1]:c[0]);let s=l?n:i;return void 0===l&&(s=IndicatorColor.IndicatorInvalid),_jsx("div",{className:`indicator-rect ${e||""}`,style:{backgroundColor:s,color:"white",width:"100px",height:"100px",display:"flex",alignItems:"center",justifyContent:"center",...o},children:a})}}Object.defineProperty(IndicatorRect,"contextType",{enumerable:!0,configurable:!0,writable:!0,value:EventEmitterContext}),Object.defineProperty(IndicatorRect,"defaultProps",{enumerable:!0,configurable:!0,writable:!0,value:{onColor:IndicatorColor.IndicatorGreen,offColor:"gray"}});export default IndicatorRect;
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright (C) 2025 Automated Design Corp.. All Rights Reserved.
4
+ * Created Date: 2025-01-20 15:09:55
5
+ * -----
6
+ * Last Modified: 2025-01-20 15:10:06
7
+ * -----
8
+ *
9
+ */
10
+ import { Component } from 'react';
11
+ import { EventEmitterContext } from '../core/EventEmitterContext';
12
+ import { IndicatorColor } from "../core/IndicatorColor";
13
+ export { IndicatorColor };
14
+ export class IndicatorRect extends Component {
15
+ constructor(props) {
16
+ super(props);
17
+ /**
18
+ * Handles updates for the main topic.
19
+ */
20
+ Object.defineProperty(this, "handleTopicUpdate", {
21
+ enumerable: true,
22
+ configurable: true,
23
+ writable: true,
24
+ value: (value) => {
25
+ this.setState({ currentValue: value });
26
+ }
27
+ });
28
+ this.state = {
29
+ currentValue: undefined,
30
+ };
31
+ }
32
+ componentDidMount() {
33
+ this.setupSubscriptions();
34
+ }
35
+ componentWillUnmount() {
36
+ // Unsubscribe logic if needed
37
+ }
38
+ /**
39
+ * Sets up subscriptions based on the provided topic.
40
+ */
41
+ setupSubscriptions() {
42
+ const { topic } = this.props;
43
+ const { subscribe } = this.context;
44
+ if (topic) {
45
+ subscribe(topic, this.handleTopicUpdate);
46
+ }
47
+ }
48
+ render() {
49
+ const { currentValue } = this.state;
50
+ const { className, style, value, onColor, offColor, options } = this.props;
51
+ // Load the value from the proper source
52
+ let displayValue = currentValue;
53
+ if (value !== undefined) {
54
+ displayValue = value;
55
+ }
56
+ // Determine the label and color based on the current state
57
+ let rectLabel = undefined;
58
+ if (options !== undefined && options.length > 0) {
59
+ rectLabel = displayValue ? options[1] : options[0];
60
+ }
61
+ let color = displayValue ? onColor : offColor;
62
+ if (displayValue === undefined) {
63
+ color = IndicatorColor.IndicatorInvalid;
64
+ }
65
+ return (_jsx("div", { className: `indicator-rect ${className || ""}`, style: {
66
+ backgroundColor: color,
67
+ color: "white",
68
+ width: "100px",
69
+ height: "100px",
70
+ display: "flex",
71
+ alignItems: "center",
72
+ justifyContent: "center",
73
+ ...style,
74
+ }, children: rectLabel }));
75
+ }
76
+ }
77
+ Object.defineProperty(IndicatorRect, "contextType", {
78
+ enumerable: true,
79
+ configurable: true,
80
+ writable: true,
81
+ value: EventEmitterContext
82
+ });
83
+ // Define default props
84
+ Object.defineProperty(IndicatorRect, "defaultProps", {
85
+ enumerable: true,
86
+ configurable: true,
87
+ writable: true,
88
+ value: {
89
+ onColor: IndicatorColor.IndicatorGreen,
90
+ offColor: "gray", // Default offColor
91
+ }
92
+ });
93
+ export default IndicatorRect;
@@ -1 +1,295 @@
1
- import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import React from"react";import{Button}from"primereact/button";import{SelectButton}from"primereact/selectbutton";import{Tooltip}from"primereact/tooltip";import"./JogPanel.css";import{Distance,JogShort,JogMedium,JogLong}from"../assets";import{Speed,SpeedSlow,SpeedMedium,SpeedFast}from"../assets";import{RotationCcwA,RotationCcwB,RotationCcwC}from"../assets";import{RotationCwA,RotationCwB,RotationCwC}from"../assets";export var JogPanelAction;!function(t){t[t.Invalid=0]="Invalid",t[t.xPositive=1]="xPositive",t[t.xNegative=2]="xNegative",t[t.yPositive=3]="yPositive",t[t.yNegative=4]="yNegative",t[t.zPositive=5]="zPositive",t[t.zNegative=6]="zNegative",t[t.aPositive=7]="aPositive",t[t.aNegative=8]="aNegative",t[t.bPositive=9]="bPositive",t[t.bNegative=16]="bNegative",t[t.cPositive=17]="cPositive",t[t.cNegative=18]="cNegative",t[t.Stop=255]="Stop"}(JogPanelAction||(JogPanelAction={}));export var JogDistanceAction;!function(t){t[t.Short=0]="Short",t[t.Medium=16]="Medium",t[t.Long=32]="Long"}(JogDistanceAction||(JogDistanceAction={}));export var JogSpeedAction;!function(t){t[t.Slow=0]="Slow",t[t.Medium=16]="Medium",t[t.Fast=32]="Fast"}(JogSpeedAction||(JogSpeedAction={}));export const DefaultLinearJogButtons=[[{icon:"pi pi-arrow-up-left",action:JogPanelAction.yPositive,alt:"Y Positive"},{icon:"pi pi-arrow-up",action:JogPanelAction.zPositive,alt:"Z Positive"},void 0],[{icon:"pi pi-arrow-left",action:JogPanelAction.xNegative,alt:"X Negative"},void 0,{icon:"pi pi-arrow-right",action:JogPanelAction.xPositive,alt:"X Positive"}],[void 0,{icon:"pi pi-arrow-down",action:JogPanelAction.zNegative,alt:"Z Negative"},{icon:"pi pi-arrow-down-right",action:JogPanelAction.yNegative,alt:"Y Negative"}]];export const DefaultRotationJogButtons=[[{icon:"pi",action:JogPanelAction.bPositive,alt:"Rot B Positive"},{icon:"pi",action:JogPanelAction.cPositive,alt:"Rot C Positive"},void 0],[{icon:"pi",action:JogPanelAction.aNegative,alt:"Rot A Negative"},void 0,{icon:"pi",action:JogPanelAction.aPositive,alt:"Rot A Positive"}],[void 0,{icon:"pi",action:JogPanelAction.cNegative,alt:"Rot C Negative"},{icon:"pi ",action:JogPanelAction.bNegative,alt:"Rot B Negative"}]];export class JogPanel extends React.Component{constructor(t){super(t),Object.defineProperty(this,"jogDistanceItems",{enumerable:!0,configurable:!0,writable:!0,value:[{name:"S",value:JogDistanceAction.Short},{name:"M",value:JogDistanceAction.Medium},{name:"L",value:JogDistanceAction.Long}]}),Object.defineProperty(this,"jogSpeedItems",{enumerable:!0,configurable:!0,writable:!0,value:[{name:"S",value:JogSpeedAction.Slow},{name:"M",value:JogSpeedAction.Medium},{name:"F",value:JogSpeedAction.Fast}]}),this.state={jogDistance:t.defaultJogDistance,jogSpeed:t.defaultJogSpeed}}handleClicked(t){null!=t&&this.props.onClicked&&this.props.onClicked(t)}handleDistanceChanged(t){this.setState({jogDistance:t}),this.props.onJogDistanceChanged&&this.props.onJogDistanceChanged(t)}handleSpeedChanged(t){this.setState({jogSpeed:t}),this.props.onJogSpeedChanged&&this.props.onJogSpeedChanged(t)}emptyRow(){return _jsxs("div",{className:"grid-row",children:[_jsx("div",{className:"button-item empty-slot"}),_jsx("div",{className:"button-item empty-slot"}),_jsx("div",{className:"button-item empty-slot"})]})}actionToIcon(t){return t==JogPanelAction.Invalid||t==JogPanelAction.Stop?_jsx("i",{}):t==JogPanelAction.xNegative?_jsx("i",{className:"pi pi-arrow-left"}):t==JogPanelAction.xPositive?_jsx("i",{className:"pi pi-arrow-right"}):t==JogPanelAction.yNegative?_jsx("i",{className:"pi pi-arrow-up-left"}):t==JogPanelAction.yPositive?_jsx("i",{className:"pi pi-arrow-down-right"}):t==JogPanelAction.zNegative?_jsx("i",{className:"pi pi-up"}):t==JogPanelAction.zPositive?_jsx("i",{className:"pi pi-down"}):t==JogPanelAction.aNegative?_jsx(RotationCcwA,{}):t==JogPanelAction.aPositive?_jsx(RotationCwA,{}):t==JogPanelAction.bNegative?_jsx(RotationCcwB,{}):t==JogPanelAction.bPositive?_jsx(RotationCwB,{}):t==JogPanelAction.cNegative?_jsx(RotationCcwC,{}):t==JogPanelAction.cPositive?_jsx(RotationCwC,{}):_jsx("i",{})}standardButton(t,i){if(void 0!==this.props.buttonDefinitions&&void 0!==this.props.buttonDefinitions[t]&&void 0!==this.props.buttonDefinitions[t][i]&&void 0!==this.props.buttonDefinitions[t][i]?.action){const o=this.props.buttonDefinitions[t][i]?.action;return void 0!==o&&o<JogPanelAction.aPositive?_jsx(Button,{icon:this.props.buttonDefinitions[t][i]?.icon,tooltip:this.props.buttonDefinitions[t][i]?.alt,onClick:()=>this.handleClicked(o),className:"button-item"},`${t}-${i}`):_jsx(Button,{tooltip:this.props.buttonDefinitions[t][i]?.alt,onClick:()=>this.handleClicked(o),className:"button-item",icon:()=>this.actionToIcon(o)},`${t}-${i}`)}return _jsx(Button,{icon:"pi",disabled:!0,className:"button-item empty-slot"},`${t}-${i}`)}render(){return _jsxs("div",{className:"jogpanel-container",children:[_jsx(Tooltip,{target:".distance-selector-button"}),_jsxs("div",{className:"grid-container",children:[_jsxs("div",{className:"grid-row",children:[this.standardButton(0,0),this.standardButton(0,1),this.standardButton(0,2)]},"0"),_jsxs("div",{className:"grid-row",children:[this.standardButton(1,0),this.standardButton(1,1),this.standardButton(1,2)]},"1"),_jsxs("div",{className:"grid-row",children:[this.standardButton(2,0),this.standardButton(2,1),this.standardButton(2,2)]},"2")]}),this.props.showDistanceControl&&_jsxs("div",{className:"distance-selector p-inputgroup flex-1",children:[_jsx("span",{className:"p-inputgroup-addon",children:_jsx(Distance,{width:16,height:16,fill:"white"})}),_jsx(SelectButton,{value:this.state.jogDistance,onChange:t=>this.handleDistanceChanged(t.value),optionLabel:"name",options:this.jogDistanceItems,allowEmpty:!1,itemTemplate:t=>t.value==JogDistanceAction.Short?_jsx(JogShort,{className:"distance-selector-button",width:16,height:16,"data-pr-tooltip":"Short Distance","data-pr-position":"bottom",fill:"white"}):t.value==JogDistanceAction.Medium?_jsx(JogMedium,{className:"distance-selector-button",width:16,height:16,"data-pr-tooltip":"Medium Distance","data-pr-position":"bottom",fill:"white"}):_jsx(JogLong,{className:"distance-selector-button",width:16,height:16,"data-pr-tooltip":"Long Distance","data-pr-position":"bottom",fill:"white"})})]}),this.props.showSpeedControl&&_jsxs("div",{className:"distance-selector p-inputgroup flex-1",children:[_jsx("span",{className:"p-inputgroup-addon",children:_jsx(Speed,{width:16,height:16,fill:"white"})}),_jsx(SelectButton,{value:this.state.jogSpeed,onChange:t=>this.handleSpeedChanged(t.value),optionLabel:"name",options:this.jogSpeedItems,allowEmpty:!1,itemTemplate:t=>t.value==JogSpeedAction.Slow?_jsx(SpeedSlow,{className:"distance-selector-button",width:16,height:16,"data-pr-tooltip":"Slow Speed","data-pr-position":"bottom",fill:"white"}):t.value==JogSpeedAction.Medium?_jsx(SpeedMedium,{className:"distance-selector-button",width:16,height:16,"data-pr-tooltip":"Medium Speed","data-pr-position":"bottom",fill:"white"}):_jsx(SpeedFast,{className:"distance-selector-button",width:16,height:16,"data-pr-tooltip":"Fast Speed","data-pr-position":"bottom",fill:"white"})})]})]})}}Object.defineProperty(JogPanel,"defaultProps",{enumerable:!0,configurable:!0,writable:!0,value:{onClicked:void 0,onJogDistanceChanged:void 0,buttonDefinitions:DefaultLinearJogButtons,defaultJogDistance:JogDistanceAction.Short,defaultJogSpeed:JogSpeedAction.Medium,showDistanceControl:!0,showSpeedControl:!0}});export default JogPanel;
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright (C) 2024 Automated Design Corp. All Rights Reserved.
4
+ * Created Date: 2024-01-16 13:17:23
5
+ * -----
6
+ * Last Modified: 2024-03-20 13:16:29
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
+ import './JogPanel.css';
15
+ //import _default from '@monaco-editor/react';
16
+ import { Distance, JogShort, JogMedium, JogLong } from '../assets';
17
+ import { Speed, SpeedSlow, SpeedMedium, SpeedFast } from '../assets';
18
+ import { RotationCcwA, RotationCcwB, RotationCcwC } from '../assets';
19
+ import { RotationCwA, RotationCwB, RotationCwC } from '../assets';
20
+ /**
21
+ * Enumerates the source button or action when an event occurs.
22
+ */
23
+ export var JogPanelAction;
24
+ (function (JogPanelAction) {
25
+ /** Invalid - Ignore this button */
26
+ JogPanelAction[JogPanelAction["Invalid"] = 0] = "Invalid";
27
+ // Horizontal Right
28
+ JogPanelAction[JogPanelAction["xPositive"] = 1] = "xPositive";
29
+ // Vertical left
30
+ JogPanelAction[JogPanelAction["xNegative"] = 2] = "xNegative";
31
+ // Away, back
32
+ JogPanelAction[JogPanelAction["yPositive"] = 3] = "yPositive";
33
+ // Towards, forward
34
+ JogPanelAction[JogPanelAction["yNegative"] = 4] = "yNegative";
35
+ // Vertical UP
36
+ JogPanelAction[JogPanelAction["zPositive"] = 5] = "zPositive";
37
+ // Vertical down
38
+ JogPanelAction[JogPanelAction["zNegative"] = 6] = "zNegative";
39
+ // Rotate positive around the X axis
40
+ JogPanelAction[JogPanelAction["aPositive"] = 7] = "aPositive";
41
+ // Rotate negative around the X axis
42
+ JogPanelAction[JogPanelAction["aNegative"] = 8] = "aNegative";
43
+ // Rotate positive around the Y axis
44
+ JogPanelAction[JogPanelAction["bPositive"] = 9] = "bPositive";
45
+ // Rotate negative around the Y axis
46
+ JogPanelAction[JogPanelAction["bNegative"] = 16] = "bNegative";
47
+ // Rotate positive around the Z axis
48
+ JogPanelAction[JogPanelAction["cPositive"] = 17] = "cPositive";
49
+ // Rotate negative around the Z axis
50
+ JogPanelAction[JogPanelAction["cNegative"] = 18] = "cNegative";
51
+ /** Stop, clear or reset */
52
+ JogPanelAction[JogPanelAction["Stop"] = 255] = "Stop";
53
+ })(JogPanelAction || (JogPanelAction = {}));
54
+ /**
55
+ * Enumerates the selected jog distance.
56
+ */
57
+ export var JogDistanceAction;
58
+ (function (JogDistanceAction) {
59
+ JogDistanceAction[JogDistanceAction["Short"] = 0] = "Short";
60
+ JogDistanceAction[JogDistanceAction["Medium"] = 16] = "Medium";
61
+ JogDistanceAction[JogDistanceAction["Long"] = 32] = "Long";
62
+ })(JogDistanceAction || (JogDistanceAction = {}));
63
+ /**
64
+ * Enumerates the selected jog distance.
65
+ */
66
+ export var JogSpeedAction;
67
+ (function (JogSpeedAction) {
68
+ JogSpeedAction[JogSpeedAction["Slow"] = 0] = "Slow";
69
+ JogSpeedAction[JogSpeedAction["Medium"] = 16] = "Medium";
70
+ JogSpeedAction[JogSpeedAction["Fast"] = 32] = "Fast";
71
+ })(JogSpeedAction || (JogSpeedAction = {}));
72
+ /**
73
+ * A default jog button configuration for linear 3D motion.
74
+ */
75
+ export const DefaultLinearJogButtons = [
76
+ [{ icon: "pi pi-arrow-up-left", action: JogPanelAction.yPositive, alt: "Y Positive" }, { icon: "pi pi-arrow-up", action: JogPanelAction.zPositive, alt: "Z Positive" }, undefined],
77
+ [{ icon: "pi pi-arrow-left", action: JogPanelAction.xNegative, alt: "X Negative" }, undefined, { icon: "pi pi-arrow-right", action: JogPanelAction.xPositive, alt: "X Positive" }],
78
+ [undefined, { icon: "pi pi-arrow-down", action: JogPanelAction.zNegative, alt: "Z Negative" }, { icon: "pi pi-arrow-down-right", action: JogPanelAction.yNegative, alt: "Y Negative" }],
79
+ ];
80
+ /**
81
+ * A default jog button configuration for rotational 3D motion.
82
+ */
83
+ export const DefaultRotationJogButtons = [
84
+ [{ icon: "pi", action: JogPanelAction.bPositive, alt: "Rot B Positive" }, { icon: "pi", action: JogPanelAction.cPositive, alt: "Rot C Positive" }, undefined],
85
+ [{ icon: "pi", action: JogPanelAction.aNegative, alt: "Rot A Negative" }, undefined, { icon: "pi", action: JogPanelAction.aPositive, alt: "Rot A Positive" }],
86
+ [undefined, { icon: "pi", action: JogPanelAction.cNegative, alt: "Rot C Negative" }, { icon: "pi ", action: JogPanelAction.bNegative, alt: "Rot B Negative" }],
87
+ ];
88
+ /**
89
+ * Jogging panel that supports 3D motion. In 3D:
90
+ * - Z is Up and Down,
91
+ * - Y is towards and away
92
+ * - X is left and right
93
+ *
94
+ * This Jog Panel is based upon a standard CNC mill and industrial standards.
95
+ *
96
+ * ## Parameters
97
+ * @param onClicked Callback any time a button is clicked. Includes argument for direction.
98
+ * @param buttonDefinitions A 3x3 matrix of (JogPanelButtonDefinition | undefined) that defines the button. If a button is undefined, it is disabled.
99
+ *
100
+ * ## Button definitions
101
+ *
102
+ * Example:
103
+ * ```
104
+ * export const kDefaultButtonDefinitions : (JogPanelButtonDefinition | undefined)[][] = [
105
+ * [{ icon: "pi pi-arrow-up-left", action: JogPanelAction.yPositive, alt: "Y Positive" }, { icon: "pi pi-arrow-up", action: JogPanelAction.zPositive, alt: "Z Positive" }, undefined],
106
+ * [{ icon: "pi pi-arrow-left", action: JogPanelAction.xNegative, alt: "X Negative" }, undefined, { icon: "pi pi-arrow-right", action: JogPanelAction.xPositive, alt: "X Positive" }],
107
+ * [undefined, { icon: "pi pi-arrow-down", action: JogPanelAction.zNegative, alt: "Z Negative" }, { icon: "pi pi-arrow-down-right", action: JogPanelAction.yNegative, alt: "Y Negative" }],
108
+ * ];
109
+ * ```
110
+ *
111
+ */
112
+ export class JogPanel extends React.Component {
113
+ constructor(props) {
114
+ super(props);
115
+ Object.defineProperty(this, "jogDistanceItems", {
116
+ enumerable: true,
117
+ configurable: true,
118
+ writable: true,
119
+ value: [
120
+ { name: 'S', value: JogDistanceAction.Short },
121
+ { name: 'M', value: JogDistanceAction.Medium },
122
+ { name: 'L', value: JogDistanceAction.Long }
123
+ ]
124
+ });
125
+ Object.defineProperty(this, "jogSpeedItems", {
126
+ enumerable: true,
127
+ configurable: true,
128
+ writable: true,
129
+ value: [
130
+ { name: 'S', value: JogSpeedAction.Slow },
131
+ { name: 'M', value: JogSpeedAction.Medium },
132
+ { name: 'F', value: JogSpeedAction.Fast }
133
+ ]
134
+ });
135
+ this.state = {
136
+ jogDistance: props.defaultJogDistance,
137
+ jogSpeed: props.defaultJogSpeed
138
+ };
139
+ }
140
+ /**
141
+ * Handle a user action on the DirectionalPad
142
+ * @param action DirectionalPadAction
143
+ */
144
+ handleClicked(action) {
145
+ if (action === undefined || action === null)
146
+ return;
147
+ if (this.props.onClicked) {
148
+ this.props.onClicked(action);
149
+ }
150
+ }
151
+ ;
152
+ /**
153
+ * The user has selected a different jog distance.
154
+ * @param {JogDistanceAction} action The newly-selected distance.
155
+ */
156
+ handleDistanceChanged(action) {
157
+ this.setState({ jogDistance: action });
158
+ if (this.props.onJogDistanceChanged) {
159
+ this.props.onJogDistanceChanged(action);
160
+ }
161
+ }
162
+ handleSpeedChanged(action) {
163
+ this.setState({ jogSpeed: action });
164
+ if (this.props.onJogSpeedChanged) {
165
+ this.props.onJogSpeedChanged(action);
166
+ }
167
+ }
168
+ emptyRow() {
169
+ return _jsxs("div", { className: "grid-row", children: [_jsx("div", { className: "button-item empty-slot" }), _jsx("div", { className: "button-item empty-slot" }), _jsx("div", { className: "button-item empty-slot" })] });
170
+ }
171
+ actionToIcon(action) {
172
+ if (action == JogPanelAction.Invalid) {
173
+ return _jsx("i", {});
174
+ }
175
+ else if (action == JogPanelAction.Stop) {
176
+ return _jsx("i", {});
177
+ }
178
+ else if (action == JogPanelAction.xNegative) {
179
+ return _jsx("i", { className: "pi pi-arrow-left" });
180
+ }
181
+ else if (action == JogPanelAction.xPositive) {
182
+ return _jsx("i", { className: "pi pi-arrow-right" });
183
+ }
184
+ else if (action == JogPanelAction.yNegative) {
185
+ return _jsx("i", { className: "pi pi-arrow-up-left" });
186
+ }
187
+ else if (action == JogPanelAction.yPositive) {
188
+ return _jsx("i", { className: "pi pi-arrow-down-right" });
189
+ }
190
+ else if (action == JogPanelAction.zNegative) {
191
+ return _jsx("i", { className: "pi pi-up" });
192
+ }
193
+ else if (action == JogPanelAction.zPositive) {
194
+ return _jsx("i", { className: "pi pi-down" });
195
+ }
196
+ else if (action == JogPanelAction.aNegative) {
197
+ return _jsx(RotationCcwA, {});
198
+ }
199
+ else if (action == JogPanelAction.aPositive) {
200
+ return _jsx(RotationCwA, {});
201
+ }
202
+ else if (action == JogPanelAction.bNegative) {
203
+ return _jsx(RotationCcwB, {});
204
+ }
205
+ else if (action == JogPanelAction.bPositive) {
206
+ return _jsx(RotationCwB, {});
207
+ }
208
+ else if (action == JogPanelAction.cNegative) {
209
+ return _jsx(RotationCcwC, {});
210
+ }
211
+ else if (action == JogPanelAction.cPositive) {
212
+ return _jsx(RotationCwC, {});
213
+ }
214
+ else {
215
+ return _jsx("i", {});
216
+ }
217
+ }
218
+ standardButton(row, col) {
219
+ if (this.props.buttonDefinitions !== undefined
220
+ && this.props.buttonDefinitions[row] !== undefined
221
+ && this.props.buttonDefinitions[row][col] !== undefined
222
+ && this.props.buttonDefinitions[row][col]?.action !== undefined) {
223
+ const action = this.props.buttonDefinitions[row][col]?.action;
224
+ if (action !== undefined && action < JogPanelAction.aPositive) {
225
+ return _jsx(Button, { icon: this.props.buttonDefinitions[row][col]?.icon, tooltip: this.props.buttonDefinitions[row][col]?.alt, onClick: () => this.handleClicked(action), className: "button-item" }, `${row}-${col}`);
226
+ }
227
+ else {
228
+ return _jsx(Button, { tooltip: this.props.buttonDefinitions[row][col]?.alt, onClick: () => this.handleClicked(action), className: "button-item", icon: () => this.actionToIcon(action) }, `${row}-${col}`);
229
+ }
230
+ }
231
+ else {
232
+ return _jsx(Button, { icon: "pi", disabled: true, className: "button-item empty-slot" }, `${row}-${col}`);
233
+ }
234
+ }
235
+ render() {
236
+ const distanceButtonTemplate = (option) => {
237
+ if (option.value == JogDistanceAction.Short) {
238
+ return _jsx(JogShort, { className: "distance-selector-button", width: 16, height: 16, "data-pr-tooltip": "Short Distance", "data-pr-position": "bottom", fill: "white" });
239
+ }
240
+ else if (option.value == JogDistanceAction.Medium) {
241
+ return _jsx(JogMedium, { className: "distance-selector-button", width: 16, height: 16, "data-pr-tooltip": "Medium Distance", "data-pr-position": "bottom", fill: "white" });
242
+ }
243
+ else {
244
+ return _jsx(JogLong, { className: "distance-selector-button", width: 16, height: 16, "data-pr-tooltip": "Long Distance", "data-pr-position": "bottom", fill: "white" });
245
+ }
246
+ };
247
+ const speedButtonTemplate = (option) => {
248
+ if (option.value == JogSpeedAction.Slow) {
249
+ return _jsx(SpeedSlow, { className: "distance-selector-button", width: 16, height: 16, "data-pr-tooltip": "Slow Speed", "data-pr-position": "bottom", fill: "white" });
250
+ }
251
+ else if (option.value == JogSpeedAction.Medium) {
252
+ return _jsx(SpeedMedium, { className: "distance-selector-button", width: 16, height: 16, "data-pr-tooltip": "Medium Speed", "data-pr-position": "bottom", fill: "white" });
253
+ }
254
+ else {
255
+ return _jsx(SpeedFast, { className: "distance-selector-button", width: 16, height: 16, "data-pr-tooltip": "Fast Speed", "data-pr-position": "bottom", fill: "white" });
256
+ }
257
+ };
258
+ // const jogButtonTemplate = (option: JogDistanceItem) => {
259
+ // if (option.value == JogDistanceAction.Short) {
260
+ // return <svg xmlns="http://www.w3.org/2000/svg" height="16" viewBox="0 -960 960 960" width="24" fill="white">
261
+ // <path d="M800-80v-800h80v800h-80ZM560-280v-400h120v400H560Zm-240 0"/>
262
+ // </svg>;
263
+ // }
264
+ // else if (option.value == JogDistanceAction.Medium) {
265
+ // return <svg xmlns="http://www.w3.org/2000/svg" height="16" viewBox="0 -960 960 960" width="24" fill="white">
266
+ // <path d="M800-80v-800h80v800h-80ZM560-280v-400h120v400H560Zm-240 0v-400h120v400H320Z"/>
267
+ // </svg>;
268
+ // }
269
+ // else {
270
+ // return <svg xmlns="http://www.w3.org/2000/svg" height="16" viewBox="0 -960 960 960" width="24" fill="white">
271
+ // <path d="M800-80v-800h80v800h-80ZM560-280v-400h120v400H560Zm-240 0v-400h120v400H320Zm-240 0v-400h120v400H320Z"/>
272
+ // </svg>;
273
+ // }
274
+ // }
275
+ return (_jsxs("div", { className: "jogpanel-container", children: [_jsx(Tooltip, { target: ".distance-selector-button" }), _jsxs("div", { className: "grid-container", children: [_jsxs("div", { className: "grid-row", children: [this.standardButton(0, 0), this.standardButton(0, 1), this.standardButton(0, 2)] }, "0"), _jsxs("div", { className: "grid-row", children: [this.standardButton(1, 0), this.standardButton(1, 1), this.standardButton(1, 2)] }, "1"), _jsxs("div", { className: "grid-row", children: [this.standardButton(2, 0), this.standardButton(2, 1), this.standardButton(2, 2)] }, "2")] }), this.props.showDistanceControl &&
276
+ _jsxs("div", { className: "distance-selector p-inputgroup flex-1", children: [_jsx("span", { className: "p-inputgroup-addon", children: _jsx(Distance, { width: 16, height: 16, fill: "white" }) }), _jsx(SelectButton, { value: this.state.jogDistance, onChange: (e) => this.handleDistanceChanged(e.value), optionLabel: "name", options: this.jogDistanceItems, allowEmpty: false, itemTemplate: distanceButtonTemplate })] }), this.props.showSpeedControl &&
277
+ _jsxs("div", { className: "distance-selector p-inputgroup flex-1", children: [_jsx("span", { className: "p-inputgroup-addon", children: _jsx(Speed, { width: 16, height: 16, fill: "white" }) }), _jsx(SelectButton, { value: this.state.jogSpeed, onChange: (e) => this.handleSpeedChanged(e.value), optionLabel: "name", options: this.jogSpeedItems, allowEmpty: false, itemTemplate: speedButtonTemplate })] })] }));
278
+ }
279
+ }
280
+ Object.defineProperty(JogPanel, "defaultProps", {
281
+ enumerable: true,
282
+ configurable: true,
283
+ writable: true,
284
+ value: {
285
+ onClicked: undefined,
286
+ onJogDistanceChanged: undefined,
287
+ buttonDefinitions: DefaultLinearJogButtons,
288
+ defaultJogDistance: JogDistanceAction.Short,
289
+ defaultJogSpeed: JogSpeedAction.Medium,
290
+ showDistanceControl: true,
291
+ showSpeedControl: true
292
+ }
293
+ });
294
+ ;
295
+ export default JogPanel;
@@ -1 +1,161 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{Component}from"react";import clsx from"clsx";import{EventEmitterContext}from"../core/EventEmitterContext";import{IndicatorColor}from"../core/IndicatorColor";export{IndicatorColor};export class Lamp extends Component{constructor(e){super(e),Object.defineProperty(this,"unsubscribeTopicId",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.state={subscribedValue:e.value,fontSize:"100%"}}componentDidMount(){const{topic:e}=this.props;if(e&&null===this.unsubscribeTopicId){const{subscribe:t}=this.context;this.unsubscribeTopicId=t(e,(e=>{this.setState({subscribedValue:e})}))}}componentDidUpdate(e){e.value!==this.props.value&&this.setState({subscribedValue:this.props.value})}componentWillUnmount(){if(null!==this.unsubscribeTopicId){const{unsubscribe:e}=this.context;e(this.unsubscribeTopicId),this.unsubscribeTopicId=null}}render(){const{x:e,y:t,width:o,height:i,className:s,onColor:r,offColor:n,invalidColor:l,useAbsolutePositioning:c}=this.props,{scale:a,xOffset:u,yOffset:p}=this.context,{subscribedValue:b}=this.state;let d=o||10;d<10&&(d=10);let m=i||10;m<10&&(m=10);let h,f=a||1;switch(0===f&&(f=1),b){case!0:h=r;break;case!1:h=n;break;default:h=l}const x={position:c?"absolute":"relative",display:c?"":"inline-block",verticalAlign:"middle",top:c&&t?`${p+f*t}px`:void 0,left:c&&e?`${u+f*e}px`:void 0,width:d?d*f+"px":void 0,height:m?m*f+"px":void 0,lineHeight:m?m*f+"px":void 0,backgroundColor:h,borderRadius:"20px"};return _jsx("div",{className:clsx(s),style:x})}}Object.defineProperty(Lamp,"contextType",{enumerable:!0,configurable:!0,writable:!0,value:EventEmitterContext}),Object.defineProperty(Lamp,"defaultProps",{enumerable:!0,configurable:!0,writable:!0,value:{width:22,height:22,onColor:"green",offColor:"gray",invalidColor:"black",useAbsolutePositioning:!1}});export default Lamp;
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright (C) 2024 Automated Design Corp. All Rights Reserved.
4
+ * Created Date: 2024-01-16 14:39:41
5
+ * -----
6
+ * Last Modified: 2024-03-12 21:12:29
7
+ * -----
8
+ *
9
+ */
10
+ // import { useContext } from 'react';
11
+ // import clsx from 'clsx';
12
+ // import DimensionsContext from '../core/DimensionsContext';
13
+ // /**
14
+ // * Displays boolean values<br/>
15
+ // * Supports 3 states: **on**, **off** and **invalid/not available**:
16
+ // */
17
+ // const Indicator = ({
18
+ // value: value,
19
+ // x,
20
+ // y,
21
+ // width = 22,
22
+ // height = width,
23
+ // className,
24
+ // onColor: onColor = IndicatorGreen,
25
+ // offColor: offColor = IndicatorOff,
26
+ // invalidColor: invalidColor = IndicatorInvalid,
27
+ // useAbsolutePositioning = false, // Default to false
28
+ // }: Props): JSX.Element => {
29
+ // const { scale, xOffset, yOffset } = useContext(DimensionsContext);
30
+ // let color;
31
+ // switch (value) {
32
+ // case true:
33
+ // color = onColor;
34
+ // break;
35
+ // case false:
36
+ // color = offColor;
37
+ // break;
38
+ // default:
39
+ // color = invalidColor;
40
+ // break;
41
+ // }
42
+ // return (
43
+ // <div
44
+ // className={clsx(className)}
45
+ // style={{
46
+ // position: useAbsolutePositioning ? 'absolute' : 'relative',
47
+ // display: useAbsolutePositioning ? "": "inline-block",
48
+ // verticalAlign: 'middle',
49
+ // top: useAbsolutePositioning && y ? `${yOffset + scale * y}px` : undefined,
50
+ // left: useAbsolutePositioning && x? `${xOffset + scale * x}px` : undefined,
51
+ // width: width ? `${width * scale}px` : undefined,
52
+ // height: height ? `${height * scale}px` : undefined,
53
+ // lineHeight: height ? `${height * scale}px` : undefined,
54
+ // backgroundColor: color,
55
+ // borderRadius: "20px"
56
+ // }}
57
+ // />
58
+ // );
59
+ // };
60
+ // export { Indicator };
61
+ import { Component } from 'react';
62
+ import clsx from 'clsx';
63
+ import { EventEmitterContext } from '../core/EventEmitterContext';
64
+ import { IndicatorColor } from "../core/IndicatorColor";
65
+ export { IndicatorColor };
66
+ export class Lamp extends Component {
67
+ constructor(props) {
68
+ super(props);
69
+ Object.defineProperty(this, "unsubscribeTopicId", {
70
+ enumerable: true,
71
+ configurable: true,
72
+ writable: true,
73
+ value: null
74
+ });
75
+ this.state = {
76
+ subscribedValue: props.value,
77
+ fontSize: "100%"
78
+ };
79
+ }
80
+ componentDidMount() {
81
+ const { topic } = this.props;
82
+ if (topic && this.unsubscribeTopicId === null) {
83
+ const { subscribe } = this.context;
84
+ this.unsubscribeTopicId = subscribe(topic, (value) => {
85
+ this.setState({ subscribedValue: value });
86
+ });
87
+ }
88
+ }
89
+ componentDidUpdate(prevProps) {
90
+ if (prevProps.value !== this.props.value) {
91
+ this.setState({ subscribedValue: this.props.value });
92
+ }
93
+ }
94
+ componentWillUnmount() {
95
+ if (this.unsubscribeTopicId !== null) {
96
+ const { unsubscribe } = this.context;
97
+ unsubscribe(this.unsubscribeTopicId);
98
+ this.unsubscribeTopicId = null;
99
+ }
100
+ }
101
+ render() {
102
+ const { x, y, width, height, className, onColor, offColor, invalidColor, useAbsolutePositioning } = this.props;
103
+ const { scale, xOffset, yOffset } = this.context;
104
+ const { subscribedValue } = this.state;
105
+ let adjWidth = width || 10;
106
+ if (adjWidth < 10)
107
+ adjWidth = 10;
108
+ let adjHeight = height || 10;
109
+ if (adjHeight < 10)
110
+ adjHeight = 10;
111
+ let adjScale = scale || 1;
112
+ if (adjScale === 0)
113
+ adjScale = 1;
114
+ let color;
115
+ switch (subscribedValue) {
116
+ case true:
117
+ color = onColor;
118
+ break;
119
+ case false:
120
+ color = offColor;
121
+ break;
122
+ default:
123
+ color = invalidColor;
124
+ break;
125
+ }
126
+ const style = {
127
+ position: useAbsolutePositioning ? 'absolute' : 'relative',
128
+ display: useAbsolutePositioning ? "" : "inline-block",
129
+ verticalAlign: 'middle',
130
+ top: useAbsolutePositioning && y ? `${yOffset + adjScale * y}px` : undefined,
131
+ left: useAbsolutePositioning && x ? `${xOffset + adjScale * x}px` : undefined,
132
+ width: adjWidth ? `${adjWidth * adjScale}px` : undefined,
133
+ height: adjHeight ? `${adjHeight * adjScale}px` : undefined,
134
+ lineHeight: adjHeight ? `${adjHeight * adjScale}px` : undefined,
135
+ backgroundColor: color,
136
+ borderRadius: "20px"
137
+ };
138
+ return (_jsx("div", { className: clsx(className), style: style }));
139
+ }
140
+ }
141
+ Object.defineProperty(Lamp, "contextType", {
142
+ enumerable: true,
143
+ configurable: true,
144
+ writable: true,
145
+ value: EventEmitterContext
146
+ });
147
+ // Define default properties
148
+ Object.defineProperty(Lamp, "defaultProps", {
149
+ enumerable: true,
150
+ configurable: true,
151
+ writable: true,
152
+ value: {
153
+ width: 22,
154
+ height: 22,
155
+ onColor: "green",
156
+ offColor: "gray",
157
+ invalidColor: "black",
158
+ useAbsolutePositioning: false
159
+ }
160
+ });
161
+ export default Lamp;