diff --git a/packages/desktop-client/src/components/table.tsx b/packages/desktop-client/src/components/table.tsx index 59ff2f19565..96fd84131b6 100644 --- a/packages/desktop-client/src/components/table.tsx +++ b/packages/desktop-client/src/components/table.tsx @@ -339,11 +339,25 @@ function InputValue({ } } + const ops = ['+', '-', '*', '/', '^']; + + function valueIsASingleOperator(text) { + return text?.length === 1 && ops.includes(text.charAt(0)); + } + + function setValue_(text) { + if (valueIsASingleOperator(text)) { + setValue(defaultValue + text); + } else { + setValue(text); + } + } + return ( setValue(text)} + onChangeValue={text => setValue_(text)} onBlur={onBlur_} onUpdate={onUpdate} onKeyDown={onKeyDown} diff --git a/upcoming-release-notes/2523.md b/upcoming-release-notes/2523.md new file mode 100644 index 00000000000..42f0c8ac804 --- /dev/null +++ b/upcoming-release-notes/2523.md @@ -0,0 +1,6 @@ +--- +category: Enhancements +authors: [JazzyJosh] +--- + +Using any math operator on an input will begin a calculation starting with the existing value.