@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.
- package/dist/assets/BlocklyLogo.js +9 -1
- package/dist/assets/Distance.js +5 -1
- package/dist/assets/JogLong.js +3 -1
- package/dist/assets/JogMedium.js +3 -1
- package/dist/assets/JogShort.js +3 -1
- package/dist/assets/PythonLogo.js +21 -1
- package/dist/assets/Rotation3D.js +3 -1
- package/dist/assets/RotationCcw.js +10 -1
- package/dist/assets/RotationCcwA.js +16 -1
- package/dist/assets/RotationCcwB.js +16 -1
- package/dist/assets/RotationCcwC.js +16 -1
- package/dist/assets/RotationCw.js +10 -1
- package/dist/assets/RotationCwA.js +16 -1
- package/dist/assets/RotationCwB.js +16 -1
- package/dist/assets/RotationCwC.js +16 -1
- package/dist/assets/Run.js +3 -1
- package/dist/assets/Speed.js +5 -1
- package/dist/assets/SpeedFast.js +3 -1
- package/dist/assets/SpeedMedium.js +3 -1
- package/dist/assets/SpeedNone.js +3 -1
- package/dist/assets/SpeedSlow.js +3 -1
- package/dist/assets/Walk.js +3 -1
- package/dist/assets/index.js +22 -1
- package/dist/components/BlocklyEditor.js +508 -1
- package/dist/components/CodeEditor.js +108 -1
- package/dist/components/FileList.js +218 -1
- package/dist/components/FileSelect.js +63 -1
- package/dist/components/FitText.js +13 -1
- package/dist/components/Indicator.js +113 -1
- package/dist/components/IndicatorButton.js +187 -1
- package/dist/components/IndicatorRect.js +93 -1
- package/dist/components/JogPanel.js +295 -1
- package/dist/components/Lamp.js +161 -1
- package/dist/components/Osk.js +125 -1
- package/dist/components/OskDialog.js +128 -1
- package/dist/components/ProgressBarWithValue.js +18 -1
- package/dist/components/TextInput.js +139 -1
- package/dist/components/ToggleGroup.js +204 -1
- package/dist/components/ValueDisplay.js +160 -1
- package/dist/components/ValueIndicator.js +38 -1
- package/dist/components/ValueInput.js +158 -1
- package/dist/core/ActionMode.js +18 -1
- package/dist/core/EventEmitterContext.js +252 -1
- package/dist/core/IndicatorButtonState.js +9 -1
- package/dist/core/IndicatorColor.js +36 -1
- package/dist/core/MaskPatterns.js +80 -1
- package/dist/core/NumerableTypes.js +10 -1
- package/dist/core/PositionContext.js +24 -1
- package/dist/core/UniqueId.js +32 -1
- package/dist/core/ValueSimulator.js +233 -1
- package/dist/core/hoc.js +44 -1
- package/dist/hooks/adsHooks.js +253 -1
- package/dist/hooks/commandHooks.d.ts +1 -1
- package/dist/hooks/commandHooks.js +252 -1
- package/dist/hooks/index.js +10 -1
- package/dist/hooks/useScaledValue.js +86 -1
- package/dist/hub/CommandMessage.js +9 -1
- package/dist/hub/HubBase.js +310 -1
- package/dist/hub/HubSimulate.js +46 -1
- package/dist/hub/HubTauri.js +130 -1
- package/dist/hub/HubWebSocket.js +240 -1
- package/dist/hub/index.js +57 -1
- package/package.json +3 -3
- package/src/hooks/commandHooks.tsx +11 -8
|
@@ -1 +1,93 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";
|
|
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";
|
|
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;
|
package/dist/components/Lamp.js
CHANGED
|
@@ -1 +1,161 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";
|
|
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;
|