fix(style): hide table cell content if too long

This commit is contained in:
jialin
2024-09-28 19:23:56 +08:00
parent 197488bff6
commit bc921ff835
13 changed files with 46 additions and 21 deletions
+7 -3
View File
@@ -1,4 +1,4 @@
import { Tag, Tooltip } from 'antd';
import { Tag, Tooltip, type TagProps } from 'antd';
import debounce from 'lodash/debounce';
import React, {
useCallback,
@@ -8,12 +8,15 @@ import React, {
useState
} from 'react';
interface AutoTooltipProps extends React.ComponentProps<typeof Tag> {
// type TagProps = React.ComponentProps<typeof Tag>;
interface AutoTooltipProps extends Omit<TagProps, 'title'> {
children: React.ReactNode;
maxWidth?: number | string;
color?: string;
style?: React.CSSProperties;
ghost?: boolean;
title?: React.ReactNode;
showTitle?: boolean;
}
@@ -21,6 +24,7 @@ const AutoTooltip: React.FC<AutoTooltipProps> = ({
children,
maxWidth = '100%',
ghost = false,
title,
showTitle = false,
...tagProps
}) => {
@@ -64,7 +68,7 @@ const AutoTooltip: React.FC<AutoTooltipProps> = ({
);
return (
<Tooltip title={isOverflowing || showTitle ? children : ''}>
<Tooltip title={isOverflowing || showTitle ? title || children : ''}>
{ghost ? (
<div ref={contentRef} style={tagStyle}>
{children}