mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-20 08:20:02 +02:00
frontend: updated NumberComponent
- ignoring F1 and F12 keys, as well - emitting parent_path, as well - changing Form.Control readOnly -> disabled - only show buttons when Form isn't read only
This commit is contained in:
parent
d9a4dd2aeb
commit
ca794948d0
@ -134,7 +134,13 @@ export const NumberComponent = React.memo((props: NumberComponentProps) => {
|
|||||||
};
|
};
|
||||||
const handleKeyDown = (event) => {
|
const handleKeyDown = (event) => {
|
||||||
const { key, target } = event;
|
const { key, target } = event;
|
||||||
if (key === 'F5' || key === 'ArrowRight' || key === 'ArrowLeft') {
|
if (
|
||||||
|
key === 'F1' ||
|
||||||
|
key === 'F5' ||
|
||||||
|
key === 'F12' ||
|
||||||
|
key === 'ArrowRight' ||
|
||||||
|
key === 'ArrowLeft'
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@ -189,6 +195,7 @@ export const NumberComponent = React.memo((props: NumberComponentProps) => {
|
|||||||
// Update the input value and maintain the cursor position
|
// Update the input value and maintain the cursor position
|
||||||
socket.emit('frontend_update', {
|
socket.emit('frontend_update', {
|
||||||
name: name,
|
name: name,
|
||||||
|
parent_path: parent_path,
|
||||||
value: Number(newValue)
|
value: Number(newValue)
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -209,24 +216,26 @@ export const NumberComponent = React.memo((props: NumberComponentProps) => {
|
|||||||
<Form.Control
|
<Form.Control
|
||||||
type="text"
|
type="text"
|
||||||
value={value}
|
value={value}
|
||||||
readOnly={readOnly}
|
disabled={readOnly}
|
||||||
name={name}
|
name={name}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
/>
|
/>
|
||||||
</InputGroup>
|
</InputGroup>
|
||||||
<div className="d-flex flex-column">
|
{!readOnly && (
|
||||||
<Button
|
<div className="d-flex flex-column">
|
||||||
style={{ padding: '0.2em 6px', fontSize: '0.70rem' }}
|
<Button
|
||||||
// className="mb-1"
|
style={{ padding: '0.2em 6px', fontSize: '0.70rem' }}
|
||||||
variant="outline-secondary">
|
// className="mb-1"
|
||||||
+
|
variant="outline-secondary">
|
||||||
</Button>
|
+
|
||||||
<Button
|
</Button>
|
||||||
style={{ padding: '0.2em 6px', fontSize: '0.70rem' }}
|
<Button
|
||||||
variant="outline-secondary">
|
style={{ padding: '0.2em 6px', fontSize: '0.70rem' }}
|
||||||
-
|
variant="outline-secondary">
|
||||||
</Button>
|
-
|
||||||
</div>
|
</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user