Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
fix: text ellipsing (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbt1 authored Oct 19, 2023
1 parent 6e4953a commit 4515bfa
Show file tree
Hide file tree
Showing 12 changed files with 6 additions and 13 deletions.
6 changes: 2 additions & 4 deletions src/pivot-table/components/cells/PseudoDimensionCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ interface LabelCellProps {

const getTextStyle = (clampCount: number): React.CSSProperties => ({
...textStyle,
overflow: "hidden",
textOverflow: "ellipsis",
...getLineClampStyle(clampCount),
});

Expand Down Expand Up @@ -75,7 +73,7 @@ const PseudoDimensionCell = ({
}}
data-testid={testId}
>
<div
<span
style={{
...getTextStyle(lineClamp),
...stickyCell,
Expand All @@ -88,7 +86,7 @@ const PseudoDimensionCell = ({
}}
>
{cell.ref.qText}
</div>
</span>
{columnAdjuster}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ export const getTextStyle = ({
...totalValueStyling,
...nullValueStyling,
...(isCellSelected && { color: selectedStyle.color }),
overflow: "hidden",
textOverflow: "ellipsis",
...getLineClampStyle(isLeftColumn ? styleService.grid.lineClamp : DEFAULT_LINE_CLAMP),
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ export const containerStyle: React.CSSProperties = {
justifyContent: "center",
};

const getGridTextClampStyle = (clampCount: number): React.CSSProperties => ({
overflow: "hidden",
textOverflow: "ellipsis",
...getLineClampStyle(clampCount),
});

export const getCellStyle = (
styleService: StyleService,
isNull: boolean,
Expand Down Expand Up @@ -62,7 +56,7 @@ export const getTextStyle = (
const { fontFamily, fontSize } = styleService.measureValues;
const sharedStyle = {
...textStyle,
...(!isNumeric && getGridTextClampStyle(styleService.grid.lineClamp)),
...(!isNumeric && getLineClampStyle(styleService.grid.lineClamp)),
...(expressionColor && { color: expressionColor }),
alignSelf: "flex-start",
fontFamily,
Expand Down
3 changes: 3 additions & 0 deletions src/pivot-table/components/shared-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ export const getLineClampStyle = (clampCount: number): React.CSSProperties => ({
WebkitLineClamp: clampCount,
WebkitBoxOrient: "vertical",
lineBreak: "auto",
overflow: "hidden",
textOverflow: "ellipsis",
wordBreak: "break-all",
});

export const stickyCell: Pick<React.CSSProperties, "width" | "maxWidth" | "position" | "left" | "top"> = {
Expand Down
Binary file modified test/rendering/render.mjs-snapshots/scenario-2-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/rendering/render.mjs-snapshots/scenario-2-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/rendering/render.mjs-snapshots/scenario-9-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/rendering/render.mjs-snapshots/scenario-9-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4515bfa

Please sign in to comment.