@colijnit/corecomponents_v12 258.1.9 → 258.1.10

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.
@@ -10577,7 +10577,38 @@
10577
10577
  header: column.headerText
10578
10578
  });
10579
10579
  });
10580
- this.excelExportService.exportToExcel(this.data, columns, 'ExcelSheet', 'Sheet1');
10580
+ var headers = columns.map(function (col) { return col.header; });
10581
+ var rows = this.data.map(function (row) { return columns.map(function (col) {
10582
+ var value = row[col.key];
10583
+ if (value instanceof Date) {
10584
+ var pad = function (n) { return String(n).padStart(2, '0'); };
10585
+ return value.getFullYear() + "-" + pad(value.getMonth() + 1) + "-" + pad(value.getDate()) + "T" + pad(value.getHours()) + ":" + pad(value.getMinutes()) + ":" + pad(value.getSeconds());
10586
+ }
10587
+ else if (Array.isArray(value)) {
10588
+ return value.join(', ');
10589
+ }
10590
+ else if (typeof value === 'object' && value !== null) {
10591
+ return JSON.stringify(value);
10592
+ }
10593
+ else {
10594
+ return String(value !== null && value !== void 0 ? value : '');
10595
+ }
10596
+ }); });
10597
+ var csvContent = __spreadArray([headers], __read(rows)).map(function (row) { return row.map(function (cell) { return "\"" + cell.replace(/"/g, '""') + "\""; }).join(','); }).join('\r\n');
10598
+ var blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
10599
+ var link = document.createElement('a');
10600
+ var url = URL.createObjectURL(blob);
10601
+ link.href = url;
10602
+ link.setAttribute('download', 'ExcelSheet');
10603
+ document.body.appendChild(link);
10604
+ link.click();
10605
+ document.body.removeChild(link);
10606
+ // this.excelExportService.exportToExcel(
10607
+ // this.data,
10608
+ // columns,
10609
+ // 'ExcelSheet',
10610
+ // 'Sheet1'
10611
+ // );
10581
10612
  };
10582
10613
  SimpleGridComponent.prototype.prepareDataRow = function (row, index) {
10583
10614
  this.isRowDisabled(row, index);