@indigina/ui-kit 1.1.177 → 1.1.178
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/fesm2022/indigina-ui-kit.mjs +25 -2
- package/fesm2022/indigina-ui-kit.mjs.map +1 -1
- package/lib/widgets/kit-grid-management/kit-grid-export/kit-grid-export.component.d.ts +1 -0
- package/lib/widgets/kit-grid-management/kit-grid-management.util.d.ts +1 -1
- package/lib/widgets/kit-grid-management/store/kit-grid.model.d.ts +2 -1
- package/package.json +1 -1
|
@@ -6832,7 +6832,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
6832
6832
|
type: Injectable
|
|
6833
6833
|
}], propDecorators: { setGridSkip: [], setGridTake: [], setGridSearch: [], removeGridSearch: [], setGridSort: [], setGridColumns: [], addGridFilter: [], removeGridFilter: [], updateGridFilter: [], setGridFilters: [] } });
|
|
6834
6834
|
|
|
6835
|
-
const kitBuildGridColumn = (field, title, type, sortable = true, hidden = false, width, filterType) => ({
|
|
6835
|
+
const kitBuildGridColumn = (field, title, type, sortable = true, hidden = false, width, filterType, excelFormat) => ({
|
|
6836
6836
|
field,
|
|
6837
6837
|
title,
|
|
6838
6838
|
sortable,
|
|
@@ -6840,6 +6840,7 @@ const kitBuildGridColumn = (field, title, type, sortable = true, hidden = false,
|
|
|
6840
6840
|
width,
|
|
6841
6841
|
filterType,
|
|
6842
6842
|
type,
|
|
6843
|
+
excelFormat,
|
|
6843
6844
|
});
|
|
6844
6845
|
const kitBuildGridDataResults = (data, loading, total) => ({
|
|
6845
6846
|
results: {
|
|
@@ -8549,11 +8550,33 @@ class KitGridExportComponent {
|
|
|
8549
8550
|
getExportedExcelRows(columns, data, gridColumns) {
|
|
8550
8551
|
const rows = [{ cells: columns, type: 'header' }];
|
|
8551
8552
|
data.forEach(row => {
|
|
8552
|
-
const rowCells = gridColumns.map((column) =>
|
|
8553
|
+
const rowCells = gridColumns.map((column) => {
|
|
8554
|
+
const value = row[column.field];
|
|
8555
|
+
if (column.excelFormat) {
|
|
8556
|
+
switch (column.type) {
|
|
8557
|
+
case 'time':
|
|
8558
|
+
return { format: column.excelFormat, value: this.timeStringToExcelFraction(value) };
|
|
8559
|
+
case 'dateTime':
|
|
8560
|
+
case 'dateTimeLocal':
|
|
8561
|
+
return { format: column.excelFormat, value: value ? new Date(value) : '' };
|
|
8562
|
+
}
|
|
8563
|
+
}
|
|
8564
|
+
return { value: this.gridCellService.createCellValue(column.type, column.field, row, this.translationMap()) };
|
|
8565
|
+
});
|
|
8553
8566
|
rows.push({ cells: rowCells, type: 'data' });
|
|
8554
8567
|
});
|
|
8555
8568
|
return rows;
|
|
8556
8569
|
}
|
|
8570
|
+
timeStringToExcelFraction(time) {
|
|
8571
|
+
if (!time) {
|
|
8572
|
+
return '';
|
|
8573
|
+
}
|
|
8574
|
+
;
|
|
8575
|
+
const [hoursStr, minutesStr,] = time.split(':');
|
|
8576
|
+
const hours = parseInt(hoursStr, 10);
|
|
8577
|
+
const minutes = parseInt(minutesStr, 10);
|
|
8578
|
+
return (hours * 60 + minutes) / (24 * 60);
|
|
8579
|
+
}
|
|
8557
8580
|
onExportCSV() {
|
|
8558
8581
|
return new Promise((resolve, reject) => this.getExportedData()().subscribe({
|
|
8559
8582
|
next: ({ data }) => {
|