slightly better node condition editor
This commit is contained in:
1 parent
334268b5ee
commit
8a33d05ced
7 files changed
+74
-79
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { PropsWithChildren, useState } from "react";
|
||||
import { useToolTip } from "tooltip/context";
|
||||
import TextField from '@mui/material/TextField';
|
||||
import InputWrapper from "./InputWrapper";
|
||||
|
||||
export interface Props {
|
||||
textBoxFor?: string;
|
||||
@@ -25,67 +26,35 @@ export default function InputText({
|
||||
}: PropsWithChildren<Props>) {
|
||||
const tooltip = useToolTip();
|
||||
const [isFocused, setIsFocused] = useState(false)
|
||||
return <TextField multiline={multiline} maxRows={maxRows} fullWidth inputMode="text" variant="filled" focused={isFocused} label={label} value={value}
|
||||
onKeyDown={e => {
|
||||
if (e.key === 'Enter') {
|
||||
onEnter();
|
||||
}
|
||||
}}
|
||||
onChange={e => {
|
||||
e.preventDefault();
|
||||
onChange(e.target.value)
|
||||
}}
|
||||
onBlur={() => {
|
||||
setIsFocused(false)
|
||||
}}
|
||||
onFocus={e => {
|
||||
setIsFocused(true)
|
||||
if (textBoxFor) {
|
||||
tooltip.setFocus(
|
||||
e.target.getBoundingClientRect(),
|
||||
{
|
||||
searchObject: textBoxFor,
|
||||
searchText: value,
|
||||
filterObjects: additionalTooltipFilters,
|
||||
},
|
||||
onChange
|
||||
)
|
||||
}
|
||||
}}
|
||||
>
|
||||
return <InputWrapper label="">
|
||||
<TextField multiline={multiline} maxRows={maxRows} fullWidth inputMode="text" variant="filled" focused={isFocused} label={label} value={value}
|
||||
onKeyDown={e => {
|
||||
if (e.key === 'Enter') {
|
||||
onEnter();
|
||||
}
|
||||
}}
|
||||
onChange={e => {
|
||||
e.preventDefault();
|
||||
onChange(e.target.value)
|
||||
}}
|
||||
onBlur={() => {
|
||||
setIsFocused(false)
|
||||
}}
|
||||
onFocus={e => {
|
||||
setIsFocused(true)
|
||||
if (textBoxFor) {
|
||||
tooltip.setFocus(
|
||||
e.target.getBoundingClientRect(),
|
||||
{
|
||||
searchObject: textBoxFor,
|
||||
searchText: value,
|
||||
filterObjects: additionalTooltipFilters,
|
||||
},
|
||||
onChange
|
||||
)
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{children}
|
||||
</TextField>
|
||||
// return <InputWrapper label={label} labelSize={(value === '') && !isFocused ? 'normal' : 'small'}>
|
||||
// <input
|
||||
// className={classes.input}
|
||||
// value={value}
|
||||
// onKeyDown={e => {
|
||||
// if (e.key === 'Enter') {
|
||||
// onEnter();
|
||||
// }
|
||||
// }}
|
||||
// onChange={e => {
|
||||
// e.preventDefault();
|
||||
// onChange(e.target.value)
|
||||
// }}
|
||||
// onBlur={e => {
|
||||
// setIsFocused(false)
|
||||
// }}
|
||||
// onFocus={e => {
|
||||
// setIsFocused(true)
|
||||
// if (textBoxFor) {
|
||||
// tooltip.setFocus(
|
||||
// e.target.getBoundingClientRect(),
|
||||
// {
|
||||
// searchObject: textBoxFor,
|
||||
// searchText: value,
|
||||
// filterObjects: additionalTooltipFilters,
|
||||
// },
|
||||
// onChange
|
||||
// )
|
||||
// }
|
||||
// }}
|
||||
// />
|
||||
// {children}
|
||||
// </InputWrapper>
|
||||
</InputWrapper>
|
||||
}
|
||||
Reference in new issue
Block a user