mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-21 00:40:01 +02:00
Merge pull request #119 from tiqi-group/fix/component_display
Fix/component display
This commit is contained in:
commit
81c05d2e14
@ -40,7 +40,13 @@ export const ButtonComponent = React.memo((props: ButtonComponentProps) => {
|
|||||||
}, [props.value]);
|
}, [props.value]);
|
||||||
|
|
||||||
const setChecked = (checked: boolean) => {
|
const setChecked = (checked: boolean) => {
|
||||||
changeCallback(checked);
|
changeCallback({
|
||||||
|
type: 'bool',
|
||||||
|
value: checked,
|
||||||
|
full_access_path: fullAccessPath,
|
||||||
|
readonly: readOnly,
|
||||||
|
doc: docString
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -69,7 +69,12 @@ export const EnumComponent = React.memo((props: EnumComponentProps) => {
|
|||||||
{readOnly ? (
|
{readOnly ? (
|
||||||
// Display the Form.Control when readOnly is true
|
// Display the Form.Control when readOnly is true
|
||||||
<Form.Control
|
<Form.Control
|
||||||
value={enumDict[enumValue]}
|
style={
|
||||||
|
attribute.type == 'ColouredEnum'
|
||||||
|
? { backgroundColor: enumDict[enumValue] }
|
||||||
|
: {}
|
||||||
|
}
|
||||||
|
value={attribute.type == 'ColouredEnum' ? enumValue : enumDict[enumValue]}
|
||||||
name={fullAccessPath}
|
name={fullAccessPath}
|
||||||
disabled={true}
|
disabled={true}
|
||||||
/>
|
/>
|
||||||
|
@ -174,7 +174,6 @@ export const NumberComponent = React.memo((props: NumberComponentProps) => {
|
|||||||
// Create a state for the input string
|
// Create a state for the input string
|
||||||
const [inputString, setInputString] = useState(value.toString());
|
const [inputString, setInputString] = useState(value.toString());
|
||||||
const renderCount = useRef(0);
|
const renderCount = useRef(0);
|
||||||
const name = fullAccessPath.split('.').at(-1);
|
|
||||||
|
|
||||||
const handleKeyDown = (event) => {
|
const handleKeyDown = (event) => {
|
||||||
const { key, target } = event;
|
const { key, target } = event;
|
||||||
@ -329,7 +328,9 @@ export const NumberComponent = React.memo((props: NumberComponentProps) => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Set the cursor position after the component re-renders
|
// Set the cursor position after the component re-renders
|
||||||
const inputElement = document.getElementsByName(name)[0] as HTMLInputElement;
|
const inputElement = document.getElementsByName(
|
||||||
|
fullAccessPath
|
||||||
|
)[0] as HTMLInputElement;
|
||||||
if (inputElement && cursorPosition !== null) {
|
if (inputElement && cursorPosition !== null) {
|
||||||
inputElement.setSelectionRange(cursorPosition, cursorPosition);
|
inputElement.setSelectionRange(cursorPosition, cursorPosition);
|
||||||
}
|
}
|
||||||
@ -351,7 +352,7 @@ export const NumberComponent = React.memo((props: NumberComponentProps) => {
|
|||||||
type="text"
|
type="text"
|
||||||
value={inputString}
|
value={inputString}
|
||||||
disabled={readOnly}
|
disabled={readOnly}
|
||||||
name={name}
|
name={fullAccessPath}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
onBlur={handleBlur}
|
onBlur={handleBlur}
|
||||||
className={isInstantUpdate && !readOnly ? 'instantUpdate' : ''}
|
className={isInstantUpdate && !readOnly ? 'instantUpdate' : ''}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"files": {
|
"files": {
|
||||||
"main.css": "/static/css/main.7ef670d5.css",
|
"main.css": "/static/css/main.7ef670d5.css",
|
||||||
"main.js": "/static/js/main.9c35da6c.js",
|
"main.js": "/static/js/main.27a065cb.js",
|
||||||
"index.html": "/index.html",
|
"index.html": "/index.html",
|
||||||
"main.7ef670d5.css.map": "/static/css/main.7ef670d5.css.map",
|
"main.7ef670d5.css.map": "/static/css/main.7ef670d5.css.map",
|
||||||
"main.9c35da6c.js.map": "/static/js/main.9c35da6c.js.map"
|
"main.27a065cb.js.map": "/static/js/main.27a065cb.js.map"
|
||||||
},
|
},
|
||||||
"entrypoints": [
|
"entrypoints": [
|
||||||
"static/css/main.7ef670d5.css",
|
"static/css/main.7ef670d5.css",
|
||||||
"static/js/main.9c35da6c.js"
|
"static/js/main.27a065cb.js"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -1 +1 @@
|
|||||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site displaying a pydase UI."/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>pydase App</title><script defer="defer" src="/static/js/main.9c35da6c.js"></script><link href="/static/css/main.7ef670d5.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site displaying a pydase UI."/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>pydase App</title><script defer="defer" src="/static/js/main.27a065cb.js"></script><link href="/static/css/main.7ef670d5.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
File diff suppressed because one or more lines are too long
1
src/pydase/frontend/static/js/main.27a065cb.js.map
Normal file
1
src/pydase/frontend/static/js/main.27a065cb.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user