Skip to content

Commit

Permalink
fix(analytics): display new lines in table
Browse files Browse the repository at this point in the history
  • Loading branch information
Yelinz committed Nov 14, 2024
1 parent 6829edf commit 3ac6a6f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/analytics/addon/components/ca-report-preview.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<td
data-t={{this.getXLSXType entry.value}}
data-v={{this.cleanValue entry.value}}
class={{this.getCSSClass entry.value}}
>
{{entry.value}}
</td>
Expand All @@ -45,6 +46,7 @@
<td
data-t={{this.getXLSXType summary.value}}
data-v={{this.cleanValue summary.value}}
class={{this.getCSSClass summary.value}}
>
{{summary.value}}
</td>
Expand Down
8 changes: 8 additions & 0 deletions packages/analytics/addon/components/ca-report-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ export default class CaReportPreviewComponent extends Component {
return "s";
}

getCSSClass(value) {
if (value?.includes("\n")) {
return "multiline-data";
}

return "";
}

// cleaning needed because excel does not support carriage returns
cleanValue = (value) => value?.replaceAll(/\r/g, "");
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@
.sortable-item.is-dragging {
z-index: 10;
}

.multiline-data {
white-space: pre-line;
line-height: normal;
padding-top: 0 !important;
padding-bottom: 0 !important;
}

0 comments on commit 3ac6a6f

Please sign in to comment.