@colijnit/corecomponents_v12 257.1.27 → 257.1.28

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.
@@ -10543,7 +10543,39 @@
10543
10543
  this.headerColumnsCopy = this.headerColumns;
10544
10544
  };
10545
10545
  SimpleGridComponent.prototype.exportToExcel = function () {
10546
- this.excelExportService.exportTableToExcel('simple-grid-table', 'ExcelSheet', 'Sheet1');
10546
+ this.isSettingsMenuOpen = false;
10547
+ var columns = this.headerColumnsCopy.map(function (column) {
10548
+ return ({
10549
+ key: column.field,
10550
+ header: column.headerText
10551
+ });
10552
+ });
10553
+ var headers = columns.map(function (col) { return col.header; });
10554
+ var rows = this.data.map(function (row) { return columns.map(function (col) {
10555
+ var value = row[col.key];
10556
+ if (value instanceof Date) {
10557
+ var pad = function (n) { return String(n).padStart(2, '0'); };
10558
+ return value.getFullYear() + "-" + pad(value.getMonth() + 1) + "-" + pad(value.getDate()) + "T" + pad(value.getHours()) + ":" + pad(value.getMinutes()) + ":" + pad(value.getSeconds());
10559
+ }
10560
+ else if (Array.isArray(value)) {
10561
+ return value.join(', ');
10562
+ }
10563
+ else if (typeof value === 'object' && value !== null) {
10564
+ return JSON.stringify(value);
10565
+ }
10566
+ else {
10567
+ return String(value !== null && value !== void 0 ? value : '');
10568
+ }
10569
+ }); });
10570
+ var csvContent = __spreadArray([headers], __read(rows)).map(function (row) { return row.map(function (cell) { return "\"" + cell.replace(/"/g, '""') + "\""; }).join(','); }).join('\r\n');
10571
+ var blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
10572
+ var link = document.createElement('a');
10573
+ var url = URL.createObjectURL(blob);
10574
+ link.href = url;
10575
+ link.setAttribute('download', 'ExcelSheet');
10576
+ document.body.appendChild(link);
10577
+ link.click();
10578
+ document.body.removeChild(link);
10547
10579
  };
10548
10580
  SimpleGridComponent.prototype.prepareDataRow = function (row, index) {
10549
10581
  this.isRowDisabled(row, index);