@opalkelly/frontpanel-react-components 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/FrontPanel/FrontPanel.props.d.ts +1 -0
- package/dist/cjs/types/components/FrontPanelSelectEntry/FrontPanelSelectEntry.d.ts +1 -0
- package/dist/cjs/types/primitives/Application/Application.props.d.ts +1 -0
- package/dist/cjs/types/primitives/Label/Label.props.d.ts +1 -0
- package/dist/cjs/types/primitives/SelectEntry/SelectEntry.d.ts +1 -0
- package/dist/cjs/types/primitives/Toggle/Toggle.props.d.ts +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/FrontPanel/FrontPanel.props.d.ts +1 -0
- package/dist/esm/types/components/FrontPanelSelectEntry/FrontPanelSelectEntry.d.ts +1 -0
- package/dist/esm/types/primitives/Application/Application.props.d.ts +1 -0
- package/dist/esm/types/primitives/Label/Label.props.d.ts +1 -0
- package/dist/esm/types/primitives/SelectEntry/SelectEntry.d.ts +1 -0
- package/dist/esm/types/primitives/Toggle/Toggle.props.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +3 -5
- package/src/components/FrontPanel/FrontPanel.props.ts +5 -1
- package/src/components/FrontPanelIndicator/FrontPanelIndicator.tsx +1 -1
- package/src/components/FrontPanelNumberDisplay/FrontPanelNumberDisplay.tsx +3 -3
- package/src/components/FrontPanelNumberEntry/FrontPanelNumberEntry.tsx +7 -7
- package/src/components/FrontPanelPushButton/FrontPanelPushButton.tsx +3 -3
- package/src/components/FrontPanelRangeSlider/FrontPanelRangeSlider.tsx +3 -3
- package/src/components/FrontPanelSelectEntry/FrontPanelSelectEntryRoot.tsx +6 -6
- package/src/components/FrontPanelToggleSwitch/FrontPanelToggleSwitch.tsx +3 -3
- package/src/components/FrontPanelTriggerButton/FrontPanelTriggerButton.tsx +2 -2
- package/src/contexts/FrontPanelContext.ts +5 -1
@@ -64,7 +64,7 @@ const FrontPanelRangeSlider = React.forwardRef<
|
|
64
64
|
|
65
65
|
const onUpdateWireValue = React.useCallback(
|
66
66
|
(sender?: IFrontPanel): void => {
|
67
|
-
if (sender != null && workQueue != null) {
|
67
|
+
if ((sender != null) && (workQueue != null)) {
|
68
68
|
const sourceWireValue = sender.getWireInValue(fpEndpoint.epAddress);
|
69
69
|
const sourceValue =
|
70
70
|
(BigInt(sourceWireValue) & targetWireBitMask) >> BigInt(fpEndpoint.bitOffset);
|
@@ -78,7 +78,7 @@ const FrontPanelRangeSlider = React.forwardRef<
|
|
78
78
|
|
79
79
|
const onSelectedValueChangeHandler = React.useCallback(
|
80
80
|
(value: number) => {
|
81
|
-
if (device != null && workQueue != null) {
|
81
|
+
if ((device != null) && (workQueue != null)) {
|
82
82
|
workQueue.Post(async () => {
|
83
83
|
device.setWireInValue(
|
84
84
|
fpEndpoint.epAddress,
|
@@ -100,7 +100,7 @@ const FrontPanelRangeSlider = React.forwardRef<
|
|
100
100
|
<RangeSlider
|
101
101
|
{...rootProps}
|
102
102
|
ref={forwardedRef}
|
103
|
-
disabled={disabled || device == null}
|
103
|
+
disabled={disabled || (device == null)}
|
104
104
|
defaultValue={Number(value)}
|
105
105
|
maximumValue={maximumValue}
|
106
106
|
onValueChange={onSelectedValueChangeHandler}
|
@@ -68,7 +68,7 @@ const FrontPanelSelectEntryRoot: React.FC<FrontPanelSelectEntryRootCombinedProps
|
|
68
68
|
|
69
69
|
const onUpdateWireValue = React.useCallback(
|
70
70
|
(sender?: IFrontPanel): void => {
|
71
|
-
if (sender != null && workQueue != null) {
|
71
|
+
if ((sender != null) && (workQueue != null)) {
|
72
72
|
// Get the wire value for the endpoint
|
73
73
|
let sourceWireValue = sender.getWireInValue(fpEndpoint.epAddress);
|
74
74
|
let targetWireBitMask = targetWireSpanBitMask & 0xffffffffn;
|
@@ -82,8 +82,8 @@ const FrontPanelSelectEntryRoot: React.FC<FrontPanelSelectEntryRootCombinedProps
|
|
82
82
|
|
83
83
|
for (
|
84
84
|
let sourceWireAddress = fpEndpoint.epAddress + 1;
|
85
|
-
sourceWireAddress <= WIREIN_ADDRESS_RANGE.Maximum &&
|
86
|
-
currentWireSpanBitMask > 0n;
|
85
|
+
(sourceWireAddress <= WIREIN_ADDRESS_RANGE.Maximum) &&
|
86
|
+
(currentWireSpanBitMask > 0n);
|
87
87
|
sourceWireAddress++
|
88
88
|
) {
|
89
89
|
// Get the wire value for the next endpoint
|
@@ -108,7 +108,7 @@ const FrontPanelSelectEntryRoot: React.FC<FrontPanelSelectEntryRootCombinedProps
|
|
108
108
|
|
109
109
|
const onSelectedValueChangeHandler = React.useCallback(
|
110
110
|
(value: string) => {
|
111
|
-
if (device != null && workQueue != null) {
|
111
|
+
if ((device != null) && (workQueue != null)) {
|
112
112
|
const targetWireSpanValue = BigInt(value);
|
113
113
|
workQueue.Post(async () => {
|
114
114
|
let targetWireBitMask = targetWireSpanBitMask & 0xffffffffn;
|
@@ -132,7 +132,7 @@ const FrontPanelSelectEntryRoot: React.FC<FrontPanelSelectEntryRootCombinedProps
|
|
132
132
|
|
133
133
|
for (
|
134
134
|
let wireIndex = 1;
|
135
|
-
wireIndex < maxWireCount && currentWireSpanBitMask > 0n;
|
135
|
+
(wireIndex < maxWireCount) && (currentWireSpanBitMask > 0n);
|
136
136
|
wireIndex++
|
137
137
|
) {
|
138
138
|
targetWireBitMask = currentWireSpanBitMask & 0xffffffffn;
|
@@ -169,7 +169,7 @@ const FrontPanelSelectEntryRoot: React.FC<FrontPanelSelectEntryRootCombinedProps
|
|
169
169
|
return (
|
170
170
|
<SelectEntry.Root
|
171
171
|
{...rootProps}
|
172
|
-
disabled={disabled || device == null}
|
172
|
+
disabled={disabled || (device == null)}
|
173
173
|
value={value.toString()}
|
174
174
|
onValueChange={onSelectedValueChangeHandler}
|
175
175
|
/>
|
@@ -59,7 +59,7 @@ const FrontPanelToggleSwitch = React.forwardRef<
|
|
59
59
|
|
60
60
|
const onUpdateWireValue = React.useCallback(
|
61
61
|
(sender?: IFrontPanel): void => {
|
62
|
-
if (sender != null && workQueue != null) {
|
62
|
+
if ((sender != null) && (workQueue != null)) {
|
63
63
|
// Set the toggle state based on the value of the target bit of the Wire endpoint
|
64
64
|
const sourceWireValue = sender.getWireInValue(fpEndpoint.epAddress);
|
65
65
|
const sourceBitValue = (sourceWireValue & targetWireBitMask) === targetWireBitMask;
|
@@ -74,7 +74,7 @@ const FrontPanelToggleSwitch = React.forwardRef<
|
|
74
74
|
|
75
75
|
const onToggleStateChanged = React.useCallback(
|
76
76
|
async (state: ToggleState): Promise<void> => {
|
77
|
-
if (device != null && workQueue != null) {
|
77
|
+
if ((device != null) && (workQueue != null)) {
|
78
78
|
await workQueue.Post(async () => {
|
79
79
|
// Set the value of the target bit of the Wire endpoint based on the toggle state
|
80
80
|
const targetWireValue: WireValue = state === ToggleState.On ? 0xffffffff : 0;
|
@@ -98,7 +98,7 @@ const FrontPanelToggleSwitch = React.forwardRef<
|
|
98
98
|
<ToggleSwitch
|
99
99
|
ref={forwardedRef}
|
100
100
|
{...buttonProps}
|
101
|
-
disabled={disabled || device == null}
|
101
|
+
disabled={disabled || (device == null)}
|
102
102
|
state={state}
|
103
103
|
onToggleStateChanged={onToggleStateChanged}
|
104
104
|
/>
|
@@ -52,7 +52,7 @@ const FrontPanelTriggerButton = React.forwardRef<
|
|
52
52
|
const { fpEndpoint, disabled, ...buttonProps } = props;
|
53
53
|
|
54
54
|
const onButtonDown = React.useCallback(async (): Promise<void> => {
|
55
|
-
if
|
55
|
+
if((device != null) && (workQueue != null)) {
|
56
56
|
await workQueue.Post(async () => {
|
57
57
|
await device.activateTriggerIn(fpEndpoint.epAddress, fpEndpoint.bitOffset);
|
58
58
|
});
|
@@ -63,7 +63,7 @@ const FrontPanelTriggerButton = React.forwardRef<
|
|
63
63
|
<Button
|
64
64
|
{...buttonProps}
|
65
65
|
ref={forwardedRef}
|
66
|
-
disabled={disabled || device == null}
|
66
|
+
disabled={disabled || (device == null)}
|
67
67
|
onButtonDown={onButtonDown}
|
68
68
|
/>
|
69
69
|
);
|
@@ -7,7 +7,11 @@
|
|
7
7
|
|
8
8
|
import React from "react";
|
9
9
|
|
10
|
-
import {
|
10
|
+
import {
|
11
|
+
IFrontPanel,
|
12
|
+
IFrontPanelEventSource,
|
13
|
+
WorkQueue
|
14
|
+
} from "@opalkelly/frontpanel-alloy-core";
|
11
15
|
|
12
16
|
export type FrontPanelContextValue = {
|
13
17
|
device?: IFrontPanel;
|