mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-05 01:19:45 +08:00
43d45330c5
* feat: switch visible to open for Tooltip * feat: switch visible to open for Popover * feat: switch visible to open for Popconfirm * fix * chore: resolve conflict * 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;
|