@colijnit/corecomponents_v12 257.1.27 → 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.
- package/bundles/colijnit-corecomponents_v12.umd.js +49 -1
- package/bundles/colijnit-corecomponents_v12.umd.js.map +1 -1
- package/colijnit-corecomponents_v12.metadata.json +1 -1
- package/esm2015/lib/components/simple-grid/simple-grid.component.js +50 -2
- package/fesm2015/colijnit-corecomponents_v12.js +49 -1
- package/fesm2015/colijnit-corecomponents_v12.js.map +1 -1
- package/lib/components/simple-grid/simple-grid.component.d.ts +1 -0
- package/lib/components/simple-grid/style/_layout.scss +5 -0
- package/package.json +1 -1
|
@@ -10543,7 +10543,55 @@
|
|
|
10543
10543
|
this.headerColumnsCopy = this.headerColumns;
|
|
10544
10544
|
};
|
|
10545
10545
|
SimpleGridComponent.prototype.exportToExcel = function () {
|
|
10546
|
-
this.
|
|
10546
|
+
this.isSettingsMenuOpen = false;
|
|
10547
|
+
var exportData = this._filterSelectedOrReturnAll(this.data);
|
|
10548
|
+
var columns = this.headerColumnsCopy.map(function (column) {
|
|
10549
|
+
return ({
|
|
10550
|
+
key: column.field,
|
|
10551
|
+
header: column.headerText
|
|
10552
|
+
});
|
|
10553
|
+
});
|
|
10554
|
+
var headers = columns.map(function (col) { return col.header; });
|
|
10555
|
+
var rows = exportData.map(function (row) { return columns.map(function (col) {
|
|
10556
|
+
var value = row[col.key];
|
|
10557
|
+
if (value instanceof Date) {
|
|
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);
|
|
10565
|
+
}
|
|
10566
|
+
else if (Array.isArray(value)) {
|
|
10567
|
+
return value.join(', ');
|
|
10568
|
+
}
|
|
10569
|
+
else if (typeof value === 'object' && value !== null) {
|
|
10570
|
+
return JSON.stringify(value);
|
|
10571
|
+
}
|
|
10572
|
+
else {
|
|
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);
|
|
10580
|
+
}
|
|
10581
|
+
}); });
|
|
10582
|
+
var csvContent = __spreadArray([headers], __read(rows)).map(function (row) { return row.map(function (cell) { return "\"" + cell.replace(/"/g, '""') + "\""; }).join(','); }).join('\r\n');
|
|
10583
|
+
var blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
|
|
10584
|
+
var link = document.createElement('a');
|
|
10585
|
+
var url = URL.createObjectURL(blob);
|
|
10586
|
+
link.href = url;
|
|
10587
|
+
link.setAttribute('download', 'ExcelSheet');
|
|
10588
|
+
document.body.appendChild(link);
|
|
10589
|
+
link.click();
|
|
10590
|
+
document.body.removeChild(link);
|
|
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;
|
|
10547
10595
|
};
|
|
10548
10596
|
SimpleGridComponent.prototype.prepareDataRow = function (row, index) {
|
|
10549
10597
|
this.isRowDisabled(row, index);
|