chore: code style improve for tooltip (#52543)

This commit is contained in:
thinkasany 2025-01-23 17:59:42 +08:00 committed by GitHub
parent 860d7b084a
commit 42a7e5dc2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -150,6 +150,17 @@ const InternalTooltip = React.forwardRef<TooltipRef, TooltipProps>((props, ref)
builtinPlacements,
arrowPointAtCenter = false,
autoAdjustOverflow = true,
motion,
getPopupContainer,
placement = 'top',
mouseEnterDelay = 0.1,
mouseLeaveDelay = 0.1,
overlayStyle,
rootClassName,
overlayClassName,
styles,
classNames: tooltipClassNames,
...restProps
} = props;
const mergedShowArrow = !!arrow;
@ -257,19 +268,6 @@ const InternalTooltip = React.forwardRef<TooltipRef, TooltipProps>((props, ref)
</ContextIsolator>
);
const {
getPopupContainer,
placement = 'top',
mouseEnterDelay = 0.1,
mouseLeaveDelay = 0.1,
overlayStyle,
rootClassName,
overlayClassName,
styles,
classNames: tooltipClassNames,
...otherProps
} = props;
const prefixCls = getPrefixCls('tooltip', customizePrefixCls);
const rootPrefixCls = getPrefixCls();
@ -314,11 +312,11 @@ const InternalTooltip = React.forwardRef<TooltipRef, TooltipProps>((props, ref)
const bodyClassNames = classNames(tooltip?.classNames?.body, tooltipClassNames?.body);
// ============================ zIndex ============================
const [zIndex, contextZIndex] = useZIndex('Tooltip', otherProps.zIndex);
const [zIndex, contextZIndex] = useZIndex('Tooltip', restProps.zIndex);
const content = (
<RcTooltip
{...otherProps}
{...restProps}
zIndex={zIndex}
showArrow={mergedShowArrow}
placement={placement}