@seniorsistemas/angular-components 14.16.3 → 14.16.4

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.
@@ -4383,24 +4383,28 @@ var TablePagingComponent = /** @class */ (function () {
4383
4383
  return exportColumn;
4384
4384
  });
4385
4385
  };
4386
- TablePagingComponent.prototype.getRowsToExport = function () {
4386
+ TablePagingComponent.prototype.getCurrentPageRowsToExport = function () {
4387
+ return this.mapColumnsTranslations(this.table.columns, this.table.value);
4388
+ };
4389
+ TablePagingComponent.prototype.getSelectedRowsToExport = function () {
4390
+ return this.mapColumnsTranslations(this.table.columns, this.table.selection);
4391
+ };
4392
+ TablePagingComponent.prototype.mapColumnsTranslations = function (columns, rows) {
4387
4393
  var _this = this;
4388
- var enumColumns = this.table.columns.filter(function (p) { return p.enumPrefix; });
4394
+ var enumColumns = columns.filter(function (p) { return p.enumPrefix; });
4389
4395
  if (!enumColumns.length)
4390
- return this.table.value;
4391
- return __spread(this.table.value).map(function (row) {
4396
+ return rows;
4397
+ return __spread(rows).map(function (row) {
4398
+ var newRow = __assign({}, row);
4392
4399
  for (var i = 0; i <= enumColumns.length - 1; i++) {
4393
4400
  var column = enumColumns[i];
4394
4401
  var fieldName = column.field;
4395
4402
  var columnData = row[fieldName];
4396
- row[fieldName] = _this.translate.instant(column.enumPrefix + columnData.toString().toLowerCase());
4403
+ newRow[fieldName] = _this.translate.instant(column.enumPrefix + columnData.toString().toLowerCase());
4397
4404
  }
4398
- return row;
4405
+ return newRow;
4399
4406
  });
4400
4407
  };
4401
- TablePagingComponent.prototype.getSelectedRowsToExport = function () {
4402
- return this.table.selection;
4403
- };
4404
4408
  TablePagingComponent.prototype.getExportFileName = function () {
4405
4409
  var _a;
4406
4410
  var fileName = (_a = this.exportFileName) !== null && _a !== void 0 ? _a : "download";
@@ -4409,7 +4413,7 @@ var TablePagingComponent = /** @class */ (function () {
4409
4413
  };
4410
4414
  TablePagingComponent.prototype.exportCurrentPage = function () {
4411
4415
  this.validateComponent();
4412
- ExportUtils.exportCSV(this.getColumnsToExport(), this.getRowsToExport(), undefined, this.getExportFileName());
4416
+ ExportUtils.exportCSV(this.getColumnsToExport(), this.getCurrentPageRowsToExport(), undefined, this.getExportFileName());
4413
4417
  };
4414
4418
  TablePagingComponent.prototype.exportSelectedRecords = function () {
4415
4419
  this.validateComponent();
@@ -4417,15 +4421,16 @@ var TablePagingComponent = /** @class */ (function () {
4417
4421
  };
4418
4422
  TablePagingComponent.prototype.exportAllRecords = function () {
4419
4423
  return __awaiter(this, void 0, void 0, function () {
4420
- var data;
4424
+ var serverData, dataToExport;
4421
4425
  return __generator(this, function (_a) {
4422
4426
  switch (_a.label) {
4423
4427
  case 0:
4424
4428
  this.validateComponent();
4425
4429
  return [4 /*yield*/, this.loadAllRecords()];
4426
4430
  case 1:
4427
- data = _a.sent();
4428
- ExportUtils.exportCSV(this.getColumnsToExport(), data, undefined, this.getExportFileName());
4431
+ serverData = _a.sent();
4432
+ dataToExport = this.mapColumnsTranslations(this.table.columns, serverData);
4433
+ ExportUtils.exportCSV(this.getColumnsToExport(), dataToExport, undefined, this.getExportFileName());
4429
4434
  return [2 /*return*/];
4430
4435
  }
4431
4436
  });