diff --git a/kafka-ui-react-app/src/components/common/Input/Input.tsx b/kafka-ui-react-app/src/components/common/Input/Input.tsx index 58a3bb92c8..d6c6416bfe 100644 --- a/kafka-ui-react-app/src/components/common/Input/Input.tsx +++ b/kafka-ui-react-app/src/components/common/Input/Input.tsx @@ -17,6 +17,7 @@ const Input: React.FC = ({ hookFormOptions, search, inputSize = 'L', + type, ...rest }) => { const methods = useFormContext(); @@ -28,10 +29,30 @@ const Input: React.FC = ({ inputSize={inputSize} {...methods.register(name, { ...hookFormOptions })} hasLeftIcon={!!search} + type={type} {...rest} + onKeyDown={(e) => { + if (type === 'number') { + if (e.key === 'e') { + e.preventDefault(); + } + } + }} + onPaste={(e) => { + if (type === 'number') { + e.preventDefault(); + const value = e.clipboardData.getData('Text'); + methods.setValue(name, value.replace(/[^\d.]/g, '')); + } + }} /> ) : ( - + )} );