@colijnit/corecomponents_v12 256.1.26 → 256.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.
@@ -10485,6 +10485,7 @@
10485
10485
  };
10486
10486
  SimpleGridComponent.prototype.exportToExcel = function () {
10487
10487
  this.isSettingsMenuOpen = false;
10488
+ var exportData = this._filterSelectedOrReturnAll(this.data);
10488
10489
  var columns = this.headerColumnsCopy.map(function (column) {
10489
10490
  return ({
10490
10491
  key: column.field,
@@ -10492,11 +10493,16 @@
10492
10493
  });
10493
10494
  });
10494
10495
  var headers = columns.map(function (col) { return col.header; });
10495
- var rows = this.data.map(function (row) { return columns.map(function (col) {
10496
+ var rows = exportData.map(function (row) { return columns.map(function (col) {
10496
10497
  var value = row[col.key];
10497
10498
  if (value instanceof Date) {
10498
- var pad = function (n) { return String(n).padStart(2, '0'); };
10499
- return value.getFullYear() + "-" + pad(value.getMonth() + 1) + "-" + pad(value.getDate()) + "T" + pad(value.getHours()) + ":" + pad(value.getMinutes()) + ":" + pad(value.getSeconds());
10499
+ var formattedDate = value.toISOString().split('T')[0];
10500
+ var _a = __read(formattedDate.split('-'), 3), year = _a[0], month = _a[1], day = _a[2];
10501
+ return day + "-" + month + "-" + year;
10502
+ }
10503
+ else if (typeof value === 'number') {
10504
+ var hasDecimal = function (num) { return !Number.isInteger(num); };
10505
+ return hasDecimal ? value.toFixed(2) : value.toFixed(0);
10500
10506
  }
10501
10507
  else if (Array.isArray(value)) {
10502
10508
  return value.join(', ');
@@ -10505,7 +10511,13 @@
10505
10511
  return JSON.stringify(value);
10506
10512
  }
10507
10513
  else {
10508
- return String(value !== null && value !== void 0 ? value : '');
10514
+ if (!value)
10515
+ return '';
10516
+ if (typeof value === 'string' && value.includes('T00:00:00')) {
10517
+ var _b = __read(value.replace('T00:00:00', '').split('-'), 3), year = _b[0], month = _b[1], day = _b[2];
10518
+ return day + "-" + month + "-" + year;
10519
+ }
10520
+ return String(value);
10509
10521
  }
10510
10522
  }); });
10511
10523
  var csvContent = __spreadArray([headers], __read(rows)).map(function (row) { return row.map(function (cell) { return "\"" + cell.replace(/"/g, '""') + "\""; }).join(','); }).join('\r\n');
@@ -10518,6 +10530,10 @@
10518
10530
  link.click();
10519
10531
  document.body.removeChild(link);
10520
10532
  };
10533
+ SimpleGridComponent.prototype._filterSelectedOrReturnAll = function (items) {
10534
+ var hasSelectedTrue = items.some(function (item) { return item.selected === true; });
10535
+ return hasSelectedTrue ? items.filter(function (item) { return item.selected === true; }) : items;
10536
+ };
10521
10537
  SimpleGridComponent.prototype.prepareDataRow = function (row, index) {
10522
10538
  this.isRowDisabled(row, index);
10523
10539
  };