import React from 'react'; import { getCellLinks } from '../../utils'; import { DataLinksContextMenu } from '../DataLinks/DataLinksContextMenu'; import { TableCellProps } from './types'; const DATALINKS_HEIGHT_OFFSET = 10; export const ImageCell = (props: TableCellProps) => { const { field, cell, tableStyles, row, cellProps } = props; const displayValue = field.display!(cell.value); const hasLinks = Boolean(getCellLinks(field, row)?.length); return (
{!hasLinks && } {hasLinks && ( getCellLinks(field, row) || []} > {(api) => { const img = ( ); if (api.openMenu) { return (
{ if (e.key === 'Enter' && api.openMenu) { // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/consistent-type-assertions api.openMenu(e as any); } }} > {img}
); } else { return img; } }}
)}
); };