@colijnit/corecomponents_v12 257.1.28 → 257.1.29

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.
@@ -10544,6 +10544,7 @@
10544
10544
  };
10545
10545
  SimpleGridComponent.prototype.exportToExcel = function () {
10546
10546
  this.isSettingsMenuOpen = false;
10547
+ var exportData = this._filterSelectedOrReturnAll(this.data);
10547
10548
  var columns = this.headerColumnsCopy.map(function (column) {
10548
10549
  return ({
10549
10550
  key: column.field,
@@ -10551,11 +10552,16 @@
10551
10552
  });
10552
10553
  });
10553
10554
  var headers = columns.map(function (col) { return col.header; });
10554
- var rows = this.data.map(function (row) { return columns.map(function (col) {
10555
+ var rows = exportData.map(function (row) { return columns.map(function (col) {
10555
10556
  var value = row[col.key];
10556
10557
  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());
10558
+ var formattedDate = value.toISOString().split('T')[0];
10559
+ var _a = __read(formattedDate.split('-'), 3), year = _a[0], month = _a[1], day = _a[2];
10560
+ return day + "-" + month + "-" + year;
10561
+ }
10562
+ else if (typeof value === 'number') {
10563
+ var hasDecimal = function (num) { return !Number.isInteger(num); };
10564
+ return hasDecimal ? value.toFixed(2) : value.toFixed(0);
10559
10565
  }
10560
10566
  else if (Array.isArray(value)) {
10561
10567
  return value.join(', ');
@@ -10564,7 +10570,13 @@
10564
10570
  return JSON.stringify(value);
10565
10571
  }
10566
10572
  else {
10567
- return String(value !== null && value !== void 0 ? value : '');
10573
+ if (!value)
10574
+ return '';
10575
+ if (value.includes('T00:00:00')) {
10576
+ var _b = __read(value.replace('T00:00:00', '').split('-'), 3), year = _b[0], month = _b[1], day = _b[2];
10577
+ return day + "-" + month + "-" + year;
10578
+ }
10579
+ return String(value);
10568
10580
  }
10569
10581
  }); });
10570
10582
  var csvContent = __spreadArray([headers], __read(rows)).map(function (row) { return row.map(function (cell) { return "\"" + cell.replace(/"/g, '""') + "\""; }).join(','); }).join('\r\n');
@@ -10577,6 +10589,10 @@
10577
10589
  link.click();
10578
10590
  document.body.removeChild(link);
10579
10591
  };
10592
+ SimpleGridComponent.prototype._filterSelectedOrReturnAll = function (items) {
10593
+ var hasSelectedTrue = items.some(function (item) { return item.selected === true; });
10594
+ return hasSelectedTrue ? items.filter(function (item) { return item.selected === true; }) : items;
10595
+ };
10580
10596
  SimpleGridComponent.prototype.prepareDataRow = function (row, index) {
10581
10597
  this.isRowDisabled(row, index);
10582
10598
  };