Skip to content

Commit d9fd1fc

Browse files
authored
fix: truncate table cell text if too long (#2211)
## Description Added CSS text truncation with text-overflow: ellipsis for table cells so long content is clipped and displayed with “…” at the end. <img width="854" height="359" alt="image" src="https://github.com/user-attachments/assets/8a520b3c-2aeb-4ffb-aa05-fb101db4d404" /> ## Motivation long texts were cut off without indication ## Fixes: Please provide a list of the fixes implemented in this PR * Items added ## Changes: Please provide a list of the changes implemented by this PR * changes made ## Tests included - [ ] Included for each change/fix? - [ ] Passing? (Merge will not be approved unless this is checked) ## Documentation - [ ] swagger documentation updated \[required\] - [ ] official documentation updated \[nice-to-have\] ### official documentation info If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included ## Backend version - [ ] Does it require a specific version of the backend - which version of the backend is required: ## Summary by Sourcery Improve table cell text handling and header tooltips for dynamic material tables. Bug Fixes: - Ensure long table cell labels are truncated with ellipsis instead of overflowing or being cut off without indication. Enhancements: - Adjust label cell styling to use block layout with pointer cursor and full-width ellipsis truncation. - Refine header cell tooltip behavior by positioning it above, anchoring it at the origin, and adding a slight show delay. - Simplify cell tooltip styling by removing extra padding for a more compact appearance.
1 parent 460ea5b commit d9fd1fc

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/app/shared/modules/dynamic-material-table/table/dynamic-mat-table.component.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@
153153
| translate: localization
154154
"
155155
matTooltipClass="cell-tooltip"
156+
matTooltipPosition="above"
157+
matTooltipPositionAtOrigin
158+
matTooltipShowDelay="500"
156159
[disabled]="column.sort === 'none'"
157160
class="header-caption"
158161
>

src/app/shared/modules/dynamic-material-table/table/dynamic-mat-table.component.scss

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@
4242
}
4343

4444
.label-cell {
45-
display: flex;
46-
cursor: inherit;
47-
justify-content: flex-start;
45+
display: block;
46+
overflow: hidden;
47+
white-space: nowrap;
48+
text-overflow: ellipsis;
49+
max-width: 100%;
50+
cursor: pointer;
4851
}
4952

5053
mat-cell .label-cell {
@@ -263,7 +266,6 @@ cdk-virtual-scroll-viewport {
263266
}
264267

265268
::ng-deep .cell-tooltip {
266-
padding: 8px;
267269
font-size: 12px;
268270
min-width: 100px;
269271
text-align: center;

0 commit comments

Comments
 (0)