mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 13:09:40 +08:00
chore: add focus warning for Input (#34475)
* chore: add focus warning for Input * chore: code clean * chore: remove duplicate variables
This commit is contained in:
parent
14e719295e
commit
c9b6a24978
@ -149,7 +149,7 @@ const Input = forwardRef<InputRef, InputProps>((props, ref) => {
|
||||
const mergedStatus = getMergedStatus(contextStatus, customStatus);
|
||||
|
||||
// ===================== Focus warning =====================
|
||||
const inputHasPrefixSuffix = hasPrefixSuffix(props);
|
||||
const inputHasPrefixSuffix = hasPrefixSuffix(props) || !!hasFeedback;
|
||||
const prevHasPrefixSuffix = useRef<boolean>(inputHasPrefixSuffix);
|
||||
useEffect(() => {
|
||||
if (inputHasPrefixSuffix && !prevHasPrefixSuffix.current) {
|
||||
@ -200,8 +200,6 @@ const Input = forwardRef<InputRef, InputProps>((props, ref) => {
|
||||
</>
|
||||
);
|
||||
|
||||
const withPrefixSuffix = hasPrefixSuffix(props) || hasFeedback;
|
||||
|
||||
// Allow clear
|
||||
let mergedAllowClear;
|
||||
if (typeof allowClear === 'object' && allowClear?.clearIcon) {
|
||||
@ -229,7 +227,7 @@ const Input = forwardRef<InputRef, InputProps>((props, ref) => {
|
||||
[`${prefixCls}-rtl`]: direction === 'rtl',
|
||||
[`${prefixCls}-borderless`]: !bordered,
|
||||
},
|
||||
!withPrefixSuffix && getStatusClassNames(prefixCls, mergedStatus),
|
||||
!inputHasPrefixSuffix && getStatusClassNames(prefixCls, mergedStatus),
|
||||
)}
|
||||
affixWrapperClassName={classNames(
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user