[Lens][Datatable] Ellipsis truncation is not visible in cells. Letters are just cut off. (#134065)

* [Lens][Datatable] Ellipsis truncation is not visible in cells. Letters are just cut off.

Closes: #133902

* remove extra arguments

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Alexey Antonov 2022-06-14 20:14:14 +03:00 committed by GitHub
parent 3819bf12ce
commit 1a702ab45f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 32 deletions

View file

@ -6,9 +6,8 @@
*/
import React, { useContext, useEffect } from 'react';
import { EuiDataGridCellValueElementProps } from '@elastic/eui';
import { IUiSettingsClient } from '@kbn/core/public';
import classNames from 'classnames';
import type { EuiDataGridCellValueElementProps } from '@elastic/eui';
import type { IUiSettingsClient } from '@kbn/core/public';
import type { FormatFactory } from '../../../common';
import { getOriginalId } from '../../../common/expressions';
import type { ColumnConfig } from '../../../common/expressions';
@ -19,9 +18,7 @@ export const createGridCell = (
formatters: Record<string, ReturnType<FormatFactory>>,
columnConfig: ColumnConfig,
DataContext: React.Context<DataContextType>,
uiSettings: IUiSettingsClient,
fitRowToContent?: boolean,
rowHeight?: number
uiSettings: IUiSettingsClient
) => {
// Changing theme requires a full reload of the page, so we can cache here
const IS_DARK_THEME = uiSettings.get('theme:darkMode');
@ -30,10 +27,6 @@ export const createGridCell = (
const rowValue = table?.rows[rowIndex]?.[columnId];
const content = formatters[columnId]?.convert(rowValue, 'html');
const currentAlignment = alignments && alignments[columnId];
const alignmentClassName = `lnsTableCell--${currentAlignment}`;
const className = classNames(alignmentClassName, {
lnsTableCell: !fitRowToContent && rowHeight === 1,
});
const { colorMode, palette } =
columnConfig.columns.find(({ columnId: id }) => id === columnId) || {};
@ -81,7 +74,7 @@ export const createGridCell = (
*/
dangerouslySetInnerHTML={{ __html: content }} // eslint-disable-line react/no-danger
data-test-subj="lnsTableCellContent"
className={className}
className={`lnsTableCell--${currentAlignment}`}
/>
);
};

View file

@ -2,11 +2,6 @@
height: 100%;
}
// only apply truncation inside of a table cell (not within popover)
.lnsDataTableContainer .lnsTableCell {
@include euiTextTruncate;
}
.lnsTableCell--left {
text-align: left;
}

View file

@ -337,22 +337,8 @@ export const DatatableComponent = (props: DatatableRenderProps) => {
]);
const renderCellValue = useMemo(
() =>
createGridCell(
formatters,
columnConfig,
DataContext,
props.uiSettings,
props.args.fitRowToContent,
props.args.rowHeightLines
),
[
formatters,
columnConfig,
props.uiSettings,
props.args.fitRowToContent,
props.args.rowHeightLines,
]
() => createGridCell(formatters, columnConfig, DataContext, props.uiSettings),
[formatters, columnConfig, props.uiSettings]
);
const columnVisibility = useMemo(