mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-20 00:10:03 +02:00
removes unused customEmitUpdate prop from NumberComponent
This commit is contained in:
parent
83cd07feee
commit
dc4c9ff58f
@ -18,12 +18,6 @@ interface NumberComponentProps {
|
|||||||
isInstantUpdate: boolean;
|
isInstantUpdate: boolean;
|
||||||
unit?: string;
|
unit?: string;
|
||||||
showName?: boolean;
|
showName?: boolean;
|
||||||
customEmitUpdate?: (
|
|
||||||
name: string,
|
|
||||||
parent_path: string,
|
|
||||||
value: number,
|
|
||||||
callback?: (ack: unknown) => void
|
|
||||||
) => void;
|
|
||||||
addNotification: (message: string, levelname?: LevelName) => void;
|
addNotification: (message: string, levelname?: LevelName) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,10 +117,6 @@ export const NumberComponent = React.memo((props: NumberComponentProps) => {
|
|||||||
|
|
||||||
// Whether to show the name infront of the component (false if used with a slider)
|
// Whether to show the name infront of the component (false if used with a slider)
|
||||||
const showName = props.showName !== undefined ? props.showName : true;
|
const showName = props.showName !== undefined ? props.showName : true;
|
||||||
// If emitUpdate is passed, use this instead of the setAttribute from the socket
|
|
||||||
// Also used when used with a slider
|
|
||||||
const emitUpdate =
|
|
||||||
props.customEmitUpdate !== undefined ? props.customEmitUpdate : setAttribute;
|
|
||||||
|
|
||||||
const renderCount = useRef(0);
|
const renderCount = useRef(0);
|
||||||
// Create a state for the cursor position
|
// Create a state for the cursor position
|
||||||
@ -263,7 +253,7 @@ export const NumberComponent = React.memo((props: NumberComponentProps) => {
|
|||||||
selectionEnd
|
selectionEnd
|
||||||
));
|
));
|
||||||
} else if (key === 'Enter' && !isInstantUpdate) {
|
} else if (key === 'Enter' && !isInstantUpdate) {
|
||||||
emitUpdate(name, parentPath, Number(newValue));
|
setAttribute(name, parentPath, Number(newValue));
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
console.debug(key);
|
console.debug(key);
|
||||||
@ -272,7 +262,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
|
||||||
if (isInstantUpdate) {
|
if (isInstantUpdate) {
|
||||||
emitUpdate(name, parentPath, Number(newValue));
|
setAttribute(name, parentPath, Number(newValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
setInputString(newValue);
|
setInputString(newValue);
|
||||||
@ -284,7 +274,7 @@ export const NumberComponent = React.memo((props: NumberComponentProps) => {
|
|||||||
const handleBlur = () => {
|
const handleBlur = () => {
|
||||||
if (!isInstantUpdate) {
|
if (!isInstantUpdate) {
|
||||||
// If not in "instant update" mode, emit an update when the input field loses focus
|
// If not in "instant update" mode, emit an update when the input field loses focus
|
||||||
emitUpdate(name, parentPath, Number(inputString));
|
setAttribute(name, parentPath, Number(inputString));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user