test
This commit is contained in:
parent
b6e2fd8c9e
commit
93542667e6
2 changed files with 127 additions and 54 deletions
|
|
@ -26,16 +26,9 @@ function CellWithTooltip({ children, className }: { children: React.ReactNode; c
|
|||
const textContent = element.textContent || '';
|
||||
setTooltipContent(textContent);
|
||||
|
||||
console.log('Element dimensions:', {
|
||||
scrollWidth: element.scrollWidth,
|
||||
clientWidth: element.clientWidth,
|
||||
textContent,
|
||||
isOverflowing: element.scrollWidth > element.clientWidth
|
||||
});
|
||||
|
||||
// Check if content is overflowing by comparing scroll width to client width
|
||||
const isOverflowing = element.scrollWidth > element.clientWidth;
|
||||
if (isOverflowing || textContent.length > 10) { // Temporarily show tooltip for testing
|
||||
if (isOverflowing && textContent.trim().length > 0) {
|
||||
setShowTooltip(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -174,9 +167,15 @@ export function DataTable<T>({
|
|||
maxWidth: `${cell.column.getSize()}px`,
|
||||
}}
|
||||
>
|
||||
<CellWithTooltip className="truncate overflow-hidden text-ellipsis whitespace-nowrap">
|
||||
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
||||
</CellWithTooltip>
|
||||
{(cell.column.columnDef as any).disableTooltip ? (
|
||||
<div className="truncate overflow-hidden text-ellipsis whitespace-nowrap">
|
||||
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
||||
</div>
|
||||
) : (
|
||||
<CellWithTooltip className="truncate overflow-hidden text-ellipsis whitespace-nowrap">
|
||||
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
||||
</CellWithTooltip>
|
||||
)}
|
||||
</td>
|
||||
))}
|
||||
</tr>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue