mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 11:10:01 +08:00
6b658dab76
* feat: switch visible to open for Tooltip & Popover & Popconfirm * fix lint * fix: merge state * chore: Update ts part * test: add legacy test * test: fix test case Co-authored-by: 二货机器人 <smith3816@gmail.com>
34 lines
726 B
TypeScript
34 lines
726 B
TypeScript
import * as React from 'react';
|
|
import Tooltip from '../../tooltip';
|
|
import type { TooltipProps } from '../../tooltip';
|
|
|
|
export interface EllipsisTooltipProps {
|
|
tooltipProps?: TooltipProps;
|
|
enabledEllipsis: boolean;
|
|
isEllipsis?: boolean;
|
|
children: React.ReactElement;
|
|
}
|
|
|
|
const EllipsisTooltip = ({
|
|
enabledEllipsis,
|
|
isEllipsis,
|
|
children,
|
|
tooltipProps,
|
|
}: EllipsisTooltipProps) => {
|
|
if (!tooltipProps?.title || !enabledEllipsis) {
|
|
return children;
|
|
}
|
|
|
|
return (
|
|
<Tooltip open={isEllipsis ? undefined : false} {...tooltipProps}>
|
|
{children}
|
|
</Tooltip>
|
|
);
|
|
};
|
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
EllipsisTooltip.displayName = 'EllipsisTooltip';
|
|
}
|
|
|
|
export default EllipsisTooltip;
|