@adcops/autocore-react 3.0.34 → 3.0.38
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 +1 -9
- package/dist/assets/Distance.js +1 -5
- package/dist/assets/JogLong.js +1 -3
- package/dist/assets/JogMedium.js +1 -3
- package/dist/assets/JogShort.js +1 -3
- package/dist/assets/PythonLogo.js +1 -21
- package/dist/assets/Rotation3D.js +1 -3
- package/dist/assets/RotationCcw.js +1 -10
- package/dist/assets/RotationCcwA.js +1 -16
- package/dist/assets/RotationCcwB.js +1 -16
- package/dist/assets/RotationCcwC.js +1 -16
- package/dist/assets/RotationCw.js +1 -10
- package/dist/assets/RotationCwA.js +1 -16
- package/dist/assets/RotationCwB.js +1 -16
- package/dist/assets/RotationCwC.js +1 -16
- package/dist/assets/Run.js +1 -3
- package/dist/assets/Speed.js +1 -5
- package/dist/assets/SpeedFast.js +1 -3
- package/dist/assets/SpeedMedium.js +1 -3
- package/dist/assets/SpeedNone.js +1 -3
- package/dist/assets/SpeedSlow.js +1 -3
- package/dist/assets/Walk.js +1 -3
- package/dist/assets/index.js +1 -22
- package/dist/components/BlocklyEditor.css +71 -2
- package/dist/components/BlocklyEditor.js +1 -508
- package/dist/components/CodeEditor.js +1 -108
- package/dist/components/FileList.js +1 -218
- package/dist/components/FileSelect.js +1 -63
- package/dist/components/FitText.js +1 -13
- package/dist/components/Indicator.js +1 -113
- package/dist/components/IndicatorButton.js +1 -187
- package/dist/components/IndicatorRect.js +1 -93
- package/dist/components/JogPanel.js +1 -295
- package/dist/components/Lamp.js +1 -161
- package/dist/components/Osk.js +1 -125
- package/dist/components/OskDialog.js +1 -128
- package/dist/components/ProgressBarWithValue.js +1 -18
- package/dist/components/TextInput.js +1 -139
- package/dist/components/ToggleGroup.js +1 -204
- package/dist/components/ValueDisplay.js +1 -160
- package/dist/components/ValueIndicator.js +1 -38
- package/dist/components/ValueInput.js +1 -158
- package/dist/core/ActionMode.js +1 -18
- package/dist/core/EventEmitterContext.js +1 -252
- package/dist/core/IndicatorButtonState.js +1 -9
- package/dist/core/IndicatorColor.js +1 -36
- package/dist/core/MaskPatterns.js +1 -80
- package/dist/core/NumerableTypes.js +1 -10
- package/dist/core/PositionContext.js +1 -24
- package/dist/core/UniqueId.js +1 -32
- package/dist/core/ValueSimulator.js +1 -233
- package/dist/core/hoc.js +1 -44
- package/dist/hooks/adsHooks.js +1 -253
- package/dist/hooks/commandHooks.js +1 -252
- package/dist/hooks/index.js +1 -10
- package/dist/hooks/useScaledValue.js +1 -86
- package/dist/hub/CommandMessage.js +1 -9
- package/dist/hub/HubBase.js +1 -310
- package/dist/hub/HubSimulate.js +1 -46
- package/dist/hub/HubTauri.js +1 -130
- package/dist/hub/HubWebSocket.js +1 -240
- package/dist/hub/index.js +1 -57
- package/dist/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleMono-Italic-VariableFont_wght.ttf +0 -0
- package/dist/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleMono-VariableFont_wght.ttf +0 -0
- package/dist/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleNext-Italic-VariableFont_wght.ttf +0 -0
- package/dist/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleNext-Regular.woff2 +0 -0
- package/dist/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleNext-RegularItalic.woff2 +0 -0
- package/dist/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleNext-VariableFont_wght.ttf +0 -0
- package/dist/themes/adc-dark/blue/theme.css +7097 -0
- package/dist/themes/adc-dark/blue/theme.css.map +1 -0
- package/package.json +8 -2
- package/src/components/BlocklyEditor.css +71 -2
- package/src/themes/adc-dark/_extensions.scss +166 -0
- package/src/themes/adc-dark/_variables.scss +913 -0
- package/src/themes/adc-dark/blue/_fonts.scss +24 -0
- package/src/themes/adc-dark/blue/adc_theme.scss +32 -0
- package/src/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleMono-Italic-VariableFont_wght.ttf +0 -0
- package/src/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleMono-VariableFont_wght.ttf +0 -0
- package/src/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleNext-Italic-VariableFont_wght.ttf +0 -0
- package/src/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleNext-Regular.woff2 +0 -0
- package/src/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleNext-RegularItalic.woff2 +0 -0
- package/src/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleNext-VariableFont_wght.ttf +0 -0
- package/src/themes/adc-dark/blue/theme.scss +14 -0
- package/src/themes/theme-base/_colors.scss +18 -0
- package/src/themes/theme-base/_common.scss +75 -0
- package/src/themes/theme-base/_components.scss +111 -0
- package/src/themes/theme-base/_mixins.scss +243 -0
- package/src/themes/theme-base/components/button/_button.scss +644 -0
- package/src/themes/theme-base/components/button/_speeddial.scss +91 -0
- package/src/themes/theme-base/components/button/_splitbutton.scss +359 -0
- package/src/themes/theme-base/components/data/_carousel.scss +39 -0
- package/src/themes/theme-base/components/data/_datascroller.scss +47 -0
- package/src/themes/theme-base/components/data/_datatable.scss +389 -0
- package/src/themes/theme-base/components/data/_dataview.scss +47 -0
- package/src/themes/theme-base/components/data/_filter.scss +138 -0
- package/src/themes/theme-base/components/data/_orderlist.scss +86 -0
- package/src/themes/theme-base/components/data/_organizationchart.scss +50 -0
- package/src/themes/theme-base/components/data/_paginator.scss +91 -0
- package/src/themes/theme-base/components/data/_picklist.scss +74 -0
- package/src/themes/theme-base/components/data/_timeline.scss +38 -0
- package/src/themes/theme-base/components/data/_tree.scss +184 -0
- package/src/themes/theme-base/components/data/_treetable.scss +431 -0
- package/src/themes/theme-base/components/file/_fileupload.scss +41 -0
- package/src/themes/theme-base/components/input/_autocomplete.scss +95 -0
- package/src/themes/theme-base/components/input/_calendar.scss +251 -0
- package/src/themes/theme-base/components/input/_cascadeselect.scss +107 -0
- package/src/themes/theme-base/components/input/_checkbox.scss +181 -0
- package/src/themes/theme-base/components/input/_chips.scss +102 -0
- package/src/themes/theme-base/components/input/_colorpicker.scss +18 -0
- package/src/themes/theme-base/components/input/_dropdown.scss +252 -0
- package/src/themes/theme-base/components/input/_editor.scss +122 -0
- package/src/themes/theme-base/components/input/_iconfield.scss +10 -0
- package/src/themes/theme-base/components/input/_inputgroup.scss +74 -0
- package/src/themes/theme-base/components/input/_inputicon.scss +15 -0
- package/src/themes/theme-base/components/input/_inputnumber.scss +5 -0
- package/src/themes/theme-base/components/input/_inputotp.scss +10 -0
- package/src/themes/theme-base/components/input/_inputswitch.scss +100 -0
- package/src/themes/theme-base/components/input/_inputtext.scss +101 -0
- package/src/themes/theme-base/components/input/_listbox.scss +139 -0
- package/src/themes/theme-base/components/input/_mention.scss +31 -0
- package/src/themes/theme-base/components/input/_multiselect.scss +278 -0
- package/src/themes/theme-base/components/input/_password.scss +33 -0
- package/src/themes/theme-base/components/input/_radiobutton.scss +170 -0
- package/src/themes/theme-base/components/input/_rating.scss +81 -0
- package/src/themes/theme-base/components/input/_selectbutton.scss +50 -0
- package/src/themes/theme-base/components/input/_slider.scss +49 -0
- package/src/themes/theme-base/components/input/_togglebutton.scss +99 -0
- package/src/themes/theme-base/components/input/_treeselect.scss +151 -0
- package/src/themes/theme-base/components/input/_tristatecheckbox.scss +46 -0
- package/src/themes/theme-base/components/menu/_breadcrumb.scss +42 -0
- package/src/themes/theme-base/components/menu/_contextmenu.scss +39 -0
- package/src/themes/theme-base/components/menu/_dock.scss +109 -0
- package/src/themes/theme-base/components/menu/_megamenu.scss +141 -0
- package/src/themes/theme-base/components/menu/_menu.scss +33 -0
- package/src/themes/theme-base/components/menu/_menubar.scss +216 -0
- package/src/themes/theme-base/components/menu/_panelmenu.scss +153 -0
- package/src/themes/theme-base/components/menu/_slidemenu.scss +60 -0
- package/src/themes/theme-base/components/menu/_steps.scss +57 -0
- package/src/themes/theme-base/components/menu/_tabmenu.scss +50 -0
- package/src/themes/theme-base/components/menu/_tieredmenu.scss +43 -0
- package/src/themes/theme-base/components/messages/_inlinemessage.scss +69 -0
- package/src/themes/theme-base/components/messages/_message.scss +107 -0
- package/src/themes/theme-base/components/messages/_toast.scss +100 -0
- package/src/themes/theme-base/components/misc/_avatar.scss +34 -0
- package/src/themes/theme-base/components/misc/_badge.scss +77 -0
- package/src/themes/theme-base/components/misc/_blockui.scss +0 -0
- package/src/themes/theme-base/components/misc/_chip.scss +39 -0
- package/src/themes/theme-base/components/misc/_inplace.scss +17 -0
- package/src/themes/theme-base/components/misc/_metergroup.scss +81 -0
- package/src/themes/theme-base/components/misc/_progressbar.scss +17 -0
- package/src/themes/theme-base/components/misc/_scrolltop.scss +25 -0
- package/src/themes/theme-base/components/misc/_skeleton.scss +8 -0
- package/src/themes/theme-base/components/misc/_tag.scss +40 -0
- package/src/themes/theme-base/components/misc/_terminal.scss +12 -0
- package/src/themes/theme-base/components/multimedia/_galleria.scss +153 -0
- package/src/themes/theme-base/components/multimedia/_image.scss +54 -0
- package/src/themes/theme-base/components/overlay/_confirmpopup.scss +72 -0
- package/src/themes/theme-base/components/overlay/_dialog.scss +78 -0
- package/src/themes/theme-base/components/overlay/_overlaypanel.scss +64 -0
- package/src/themes/theme-base/components/overlay/_sidebar.scss +23 -0
- package/src/themes/theme-base/components/overlay/_tooltip.scss +33 -0
- package/src/themes/theme-base/components/panel/_accordion.scss +118 -0
- package/src/themes/theme-base/components/panel/_card.scss +30 -0
- package/src/themes/theme-base/components/panel/_divider.scss +31 -0
- package/src/themes/theme-base/components/panel/_fieldset.scss +47 -0
- package/src/themes/theme-base/components/panel/_panel.scss +47 -0
- package/src/themes/theme-base/components/panel/_scrollpanel.scss +10 -0
- package/src/themes/theme-base/components/panel/_splitter.scss +23 -0
- package/src/themes/theme-base/components/panel/_stepper.scss +136 -0
- package/src/themes/theme-base/components/panel/_tabview.scss +147 -0
- package/src/themes/theme-base/components/panel/_toolbar.scss +11 -0
- package/tools/build-themes.cjs +66 -0
- package/tools/copy-distribution-files.cjs +20 -16
|
@@ -1,93 +1 @@
|
|
|
1
|
-
import
|
|
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
|
+
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,295 +1 @@
|
|
|
1
|
-
import
|
|
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
|
+
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;
|
package/dist/components/Lamp.js
CHANGED
|
@@ -1,161 +1 @@
|
|
|
1
|
-
import
|
|
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;
|
|
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;
|