Comparing version 1.4.2 to 1.4.3
@@ -43,3 +43,3 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
setFocused = _useState2[1]; | ||
var compositionRef = React.useRef(false); | ||
var compositionRef = useRef(false); | ||
var inputRef = useRef(null); | ||
@@ -62,6 +62,6 @@ var focus = function focus(option) { | ||
// =================== Select Range =================== | ||
var _React$useState = React.useState(null), | ||
_React$useState2 = _slicedToArray(_React$useState, 2), | ||
selection = _React$useState2[0], | ||
setSelection = _React$useState2[1]; | ||
var _useState3 = useState(null), | ||
_useState4 = _slicedToArray(_useState3, 2), | ||
selection = _useState4[0], | ||
setSelection = _useState4[1]; | ||
@@ -98,3 +98,3 @@ // ====================== Count ======================= | ||
}, [disabled]); | ||
var triggerChange = function triggerChange(e, currentValue) { | ||
var triggerChange = function triggerChange(e, currentValue, info) { | ||
var cutValue = currentValue; | ||
@@ -109,2 +109,6 @@ if (!compositionRef.current && countConfig.exceedFormatter && countConfig.max && countConfig.strategy(currentValue) > countConfig.max) { | ||
} | ||
} else if (info.source === 'compositionEnd') { | ||
// Avoid triggering twice | ||
// https://github.com/ant-design/ant-design/issues/46587 | ||
return; | ||
} | ||
@@ -116,3 +120,3 @@ setValue(cutValue); | ||
}; | ||
React.useEffect(function () { | ||
useEffect(function () { | ||
if (selection) { | ||
@@ -124,7 +128,11 @@ var _inputRef$current6; | ||
var onInternalChange = function onInternalChange(e) { | ||
triggerChange(e, e.target.value); | ||
triggerChange(e, e.target.value, { | ||
source: 'change' | ||
}); | ||
}; | ||
var onInternalCompositionEnd = function onInternalCompositionEnd(e) { | ||
compositionRef.current = false; | ||
triggerChange(e, e.currentTarget.value); | ||
triggerChange(e, e.currentTarget.value, { | ||
source: 'compositionEnd' | ||
}); | ||
onCompositionEnd === null || onCompositionEnd === void 0 || onCompositionEnd(e); | ||
@@ -131,0 +139,0 @@ }; |
@@ -101,2 +101,5 @@ import type { CSSProperties, InputHTMLAttributes, KeyboardEventHandler, MouseEventHandler, ReactElement, ReactNode } from 'react'; | ||
} | ||
export interface ChangeEventInfo { | ||
source: 'compositionEnd' | 'change'; | ||
} | ||
export {}; |
@@ -25,2 +25,5 @@ export function hasAddon(props) { | ||
// A bug report filed on WebKit's Bugzilla tracker, dating back to 2009, specifically addresses the issue of cloneNode() not copying files of <input type="file"> elements. | ||
// As of the last update, this bug was still marked as "NEW," indicating that it might not have been resolved yet. | ||
// https://bugs.webkit.org/show_bug.cgi?id=28123 | ||
var currentTarget = target.cloneNode(true); | ||
@@ -43,3 +46,8 @@ | ||
// Trigger by composition event, this means we need force change the input value | ||
if (targetValue !== undefined) { | ||
// https://github.com/ant-design/ant-design/issues/45737 | ||
// https://github.com/ant-design/ant-design/issues/46598 | ||
if (target.type !== 'file' && targetValue !== undefined) { | ||
// A bug report filed on WebKit's Bugzilla tracker, dating back to 2009, specifically addresses the issue of cloneNode() not copying files of <input type="file"> elements. | ||
// As of the last update, this bug was still marked as "NEW," indicating that it might not have been resolved yet. | ||
// https://bugs.webkit.org/show_bug.cgi?id=28123 | ||
var _currentTarget = target.cloneNode(true); | ||
@@ -54,6 +62,3 @@ event = Object.create(e, { | ||
}); | ||
// https://github.com/ant-design/ant-design/issues/45737 | ||
if (_currentTarget.type !== 'file') { | ||
_currentTarget.value = targetValue; | ||
} | ||
_currentTarget.value = targetValue; | ||
onChange(event); | ||
@@ -60,0 +65,0 @@ return; |
@@ -53,3 +53,3 @@ "use strict"; | ||
setFocused = _useState2[1]; | ||
var compositionRef = _react.default.useRef(false); | ||
var compositionRef = (0, _react.useRef)(false); | ||
var inputRef = (0, _react.useRef)(null); | ||
@@ -72,6 +72,6 @@ var focus = function focus(option) { | ||
// =================== Select Range =================== | ||
var _React$useState = _react.default.useState(null), | ||
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), | ||
selection = _React$useState2[0], | ||
setSelection = _React$useState2[1]; | ||
var _useState3 = (0, _react.useState)(null), | ||
_useState4 = (0, _slicedToArray2.default)(_useState3, 2), | ||
selection = _useState4[0], | ||
setSelection = _useState4[1]; | ||
@@ -108,3 +108,3 @@ // ====================== Count ======================= | ||
}, [disabled]); | ||
var triggerChange = function triggerChange(e, currentValue) { | ||
var triggerChange = function triggerChange(e, currentValue, info) { | ||
var cutValue = currentValue; | ||
@@ -119,2 +119,6 @@ if (!compositionRef.current && countConfig.exceedFormatter && countConfig.max && countConfig.strategy(currentValue) > countConfig.max) { | ||
} | ||
} else if (info.source === 'compositionEnd') { | ||
// Avoid triggering twice | ||
// https://github.com/ant-design/ant-design/issues/46587 | ||
return; | ||
} | ||
@@ -126,3 +130,3 @@ setValue(cutValue); | ||
}; | ||
_react.default.useEffect(function () { | ||
(0, _react.useEffect)(function () { | ||
if (selection) { | ||
@@ -134,7 +138,11 @@ var _inputRef$current6; | ||
var onInternalChange = function onInternalChange(e) { | ||
triggerChange(e, e.target.value); | ||
triggerChange(e, e.target.value, { | ||
source: 'change' | ||
}); | ||
}; | ||
var onInternalCompositionEnd = function onInternalCompositionEnd(e) { | ||
compositionRef.current = false; | ||
triggerChange(e, e.currentTarget.value); | ||
triggerChange(e, e.currentTarget.value, { | ||
source: 'compositionEnd' | ||
}); | ||
onCompositionEnd === null || onCompositionEnd === void 0 || onCompositionEnd(e); | ||
@@ -141,0 +149,0 @@ }; |
@@ -101,2 +101,5 @@ import type { CSSProperties, InputHTMLAttributes, KeyboardEventHandler, MouseEventHandler, ReactElement, ReactNode } from 'react'; | ||
} | ||
export interface ChangeEventInfo { | ||
source: 'compositionEnd' | 'change'; | ||
} | ||
export {}; |
@@ -34,2 +34,5 @@ "use strict"; | ||
// A bug report filed on WebKit's Bugzilla tracker, dating back to 2009, specifically addresses the issue of cloneNode() not copying files of <input type="file"> elements. | ||
// As of the last update, this bug was still marked as "NEW," indicating that it might not have been resolved yet. | ||
// https://bugs.webkit.org/show_bug.cgi?id=28123 | ||
var currentTarget = target.cloneNode(true); | ||
@@ -52,3 +55,8 @@ | ||
// Trigger by composition event, this means we need force change the input value | ||
if (targetValue !== undefined) { | ||
// https://github.com/ant-design/ant-design/issues/45737 | ||
// https://github.com/ant-design/ant-design/issues/46598 | ||
if (target.type !== 'file' && targetValue !== undefined) { | ||
// A bug report filed on WebKit's Bugzilla tracker, dating back to 2009, specifically addresses the issue of cloneNode() not copying files of <input type="file"> elements. | ||
// As of the last update, this bug was still marked as "NEW," indicating that it might not have been resolved yet. | ||
// https://bugs.webkit.org/show_bug.cgi?id=28123 | ||
var _currentTarget = target.cloneNode(true); | ||
@@ -63,6 +71,3 @@ event = Object.create(e, { | ||
}); | ||
// https://github.com/ant-design/ant-design/issues/45737 | ||
if (_currentTarget.type !== 'file') { | ||
_currentTarget.value = targetValue; | ||
} | ||
_currentTarget.value = targetValue; | ||
onChange(event); | ||
@@ -69,0 +74,0 @@ return; |
{ | ||
"name": "rc-input", | ||
"version": "1.4.2", | ||
"version": "1.4.3", | ||
"description": "React input 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
70664
1246