From 3ee00c9c06e9068c8ee6a660086bee949b969dd5 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Thu, 1 Dec 2022 09:39:42 +0000 Subject: [PATCH] Revert "Fix #2871: InputNumber duplicating suffix when using decimals (#3615)" This reverts commit 061df71110405b264e909d0951e2d363be20b72e. --- components/lib/inputnumber/InputNumber.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/components/lib/inputnumber/InputNumber.js b/components/lib/inputnumber/InputNumber.js index 7aac9c9a14..ee0b4cf8d3 100644 --- a/components/lib/inputnumber/InputNumber.js +++ b/components/lib/inputnumber/InputNumber.js @@ -891,7 +891,7 @@ export const InputNumber = React.memo( _decimal.current.lastIndex = 0; - return decimalCharIndex !== -1 ? replaceSuffix(val1.split(_decimal.current)[0]) + val2.slice(decimalCharIndex) : val1; + return decimalCharIndex !== -1 ? val1.split(_decimal.current)[0] + val2.slice(decimalCharIndex) : val1; } return val1; @@ -902,17 +902,13 @@ export const InputNumber = React.memo( const valueSplit = value.split(_decimal.current); if (valueSplit.length === 2) { - return replaceSuffix(valueSplit[1]).length; + return valueSplit[1].replace(_suffix.current, '').trim().replace(/\s/g, '').replace(_currency.current, '').length; } } return 0; }; - const replaceSuffix = (value) => { - return value ? value.replace(_suffix.current, '').trim().replace(/\s/g, '').replace(_currency.current, '') : value; - }; - const updateModel = (event, value) => { if (props.onValueChange) { props.onValueChange({