@onecx/angular-accelerator 6.8.0 → 6.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5698,12 +5698,12 @@ class ExportDataService {
|
|
|
5698
5698
|
const dataString = dataToExport
|
|
5699
5699
|
.map((d) => columns
|
|
5700
5700
|
.reduce((arr, c) => [...arr, d[c.id]], [])
|
|
5701
|
-
.map((d) => this.
|
|
5701
|
+
.map((d) => this.escapeDelimiterAndLineBreaks(delimiter, d))
|
|
5702
5702
|
.join(delimiter))
|
|
5703
5703
|
.join('\r\n');
|
|
5704
5704
|
const headerString = (await firstValueFrom(this.translateColumnNames(columns)))
|
|
5705
5705
|
.map((c) => c.name)
|
|
5706
|
-
.map((c) => this.
|
|
5706
|
+
.map((c) => this.escapeDelimiterAndLineBreaks(delimiter, c))
|
|
5707
5707
|
.join(delimiter);
|
|
5708
5708
|
const csvString = headerString + '\r\n' + dataString;
|
|
5709
5709
|
const blob = new Blob(['\ufeff' + csvString], {
|
|
@@ -5747,7 +5747,7 @@ class ExportDataService {
|
|
|
5747
5747
|
}
|
|
5748
5748
|
return of(data);
|
|
5749
5749
|
}
|
|
5750
|
-
|
|
5750
|
+
escapeDelimiterAndLineBreaks(delimiter, data) {
|
|
5751
5751
|
if (data === null || data === undefined) {
|
|
5752
5752
|
return data;
|
|
5753
5753
|
}
|
|
@@ -5755,7 +5755,7 @@ class ExportDataService {
|
|
|
5755
5755
|
if (str.includes('"')) {
|
|
5756
5756
|
str = str.replaceAll('"', '""');
|
|
5757
5757
|
}
|
|
5758
|
-
if (str.includes(delimiter)) {
|
|
5758
|
+
if (str.includes(delimiter) || str.includes('\n') || str.includes('\r')) {
|
|
5759
5759
|
str = `"${str}"`;
|
|
5760
5760
|
}
|
|
5761
5761
|
return str;
|