rc-input-number
Advanced tools
Comparing version 7.1.1 to 7.1.2
@@ -89,3 +89,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
* It will auto generate by `value` & `step`. | ||
* But it will not block user typing when auto generated. | ||
* But it will not block user typing. | ||
* | ||
@@ -101,2 +101,6 @@ * Note: Auto generate `precision` is used for legacy logic. | ||
var getPrecision = React.useCallback(function (numStr, userTyping) { | ||
if (userTyping) { | ||
return undefined; | ||
} | ||
if (precision >= 0) { | ||
@@ -106,6 +110,2 @@ return precision; | ||
if (userTyping) { | ||
return undefined; | ||
} | ||
return Math.max(getNumberPrecision(numStr), getNumberPrecision(step)); | ||
@@ -176,3 +176,6 @@ }, [precision, step]); // >>> Parser | ||
function setInputValue(newValue, userTyping) { | ||
setInternalInputValue(mergedFormatter(newValue.toString(false), userTyping)); | ||
setInternalInputValue(mergedFormatter( // Invalidate number is sometime passed by external control, we should let it go | ||
// Otherwise is controlled by internal interactive logic which check by userTyping | ||
// You can ref 'show limited value when input is not focused' test for more info. | ||
newValue.isInvalidate() ? newValue.toString(false) : newValue.toString(!userTyping), userTyping)); | ||
} // >>> Max & Min limit | ||
@@ -349,3 +352,3 @@ | ||
var flushInputValue = function flushInputValue() { | ||
var flushInputValue = function flushInputValue(userTyping) { | ||
var parsedValue = getMiniDecimal(mergedParser(inputValue)); | ||
@@ -357,3 +360,3 @@ var formatValue = parsedValue; | ||
// Reassign the formatValue within ranged of trigger control | ||
formatValue = triggerValueUpdate(parsedValue, true); | ||
formatValue = triggerValueUpdate(parsedValue, userTyping); | ||
} else { | ||
@@ -381,3 +384,3 @@ formatValue = decimalValue; | ||
flushInputValue(); | ||
flushInputValue(true); | ||
onPressEnter === null || onPressEnter === void 0 ? void 0 : onPressEnter(event); | ||
@@ -403,3 +406,3 @@ } | ||
var onBlur = function onBlur() { | ||
flushInputValue(); | ||
flushInputValue(false); | ||
setFocus(false); | ||
@@ -406,0 +409,0 @@ userTypingRef.current = false; |
@@ -92,4 +92,8 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
if (!safe) { | ||
return this.origin; | ||
} | ||
if (this.isInvalidate()) { | ||
return safe ? '' : this.origin; | ||
return ''; | ||
} | ||
@@ -239,4 +243,8 @@ | ||
if (!safe) { | ||
return this.origin; | ||
} | ||
if (this.isInvalidate()) { | ||
return safe ? '' : this.origin; | ||
return ''; | ||
} | ||
@@ -243,0 +251,0 @@ |
@@ -112,3 +112,3 @@ "use strict"; | ||
* It will auto generate by `value` & `step`. | ||
* But it will not block user typing when auto generated. | ||
* But it will not block user typing. | ||
* | ||
@@ -124,2 +124,6 @@ * Note: Auto generate `precision` is used for legacy logic. | ||
var getPrecision = React.useCallback(function (numStr, userTyping) { | ||
if (userTyping) { | ||
return undefined; | ||
} | ||
if (precision >= 0) { | ||
@@ -129,6 +133,2 @@ return precision; | ||
if (userTyping) { | ||
return undefined; | ||
} | ||
return Math.max((0, _numberUtil.getNumberPrecision)(numStr), (0, _numberUtil.getNumberPrecision)(step)); | ||
@@ -199,3 +199,6 @@ }, [precision, step]); // >>> Parser | ||
function setInputValue(newValue, userTyping) { | ||
setInternalInputValue(mergedFormatter(newValue.toString(false), userTyping)); | ||
setInternalInputValue(mergedFormatter( // Invalidate number is sometime passed by external control, we should let it go | ||
// Otherwise is controlled by internal interactive logic which check by userTyping | ||
// You can ref 'show limited value when input is not focused' test for more info. | ||
newValue.isInvalidate() ? newValue.toString(false) : newValue.toString(!userTyping), userTyping)); | ||
} // >>> Max & Min limit | ||
@@ -372,3 +375,3 @@ | ||
var flushInputValue = function flushInputValue() { | ||
var flushInputValue = function flushInputValue(userTyping) { | ||
var parsedValue = (0, _MiniDecimal.default)(mergedParser(inputValue)); | ||
@@ -380,3 +383,3 @@ var formatValue = parsedValue; | ||
// Reassign the formatValue within ranged of trigger control | ||
formatValue = triggerValueUpdate(parsedValue, true); | ||
formatValue = triggerValueUpdate(parsedValue, userTyping); | ||
} else { | ||
@@ -404,3 +407,3 @@ formatValue = decimalValue; | ||
flushInputValue(); | ||
flushInputValue(true); | ||
onPressEnter === null || onPressEnter === void 0 ? void 0 : onPressEnter(event); | ||
@@ -426,3 +429,3 @@ } | ||
var onBlur = function onBlur() { | ||
flushInputValue(); | ||
flushInputValue(false); | ||
setFocus(false); | ||
@@ -429,0 +432,0 @@ userTypingRef.current = false; |
@@ -105,4 +105,8 @@ "use strict"; | ||
if (!safe) { | ||
return this.origin; | ||
} | ||
if (this.isInvalidate()) { | ||
return safe ? '' : this.origin; | ||
return ''; | ||
} | ||
@@ -253,4 +257,8 @@ | ||
if (!safe) { | ||
return this.origin; | ||
} | ||
if (this.isInvalidate()) { | ||
return safe ? '' : this.origin; | ||
return ''; | ||
} | ||
@@ -257,0 +265,0 @@ |
{ | ||
"name": "rc-input-number", | ||
"version": "7.1.1", | ||
"version": "7.1.2", | ||
"description": "React input-number component", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
94204
2213