@seniorsistemas/angular-components 14.16.18 → 14.16.19

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.
@@ -4424,7 +4424,8 @@ var TablePagingComponent = /** @class */ (function () {
4424
4424
  header: column.header,
4425
4425
  exportable: true,
4426
4426
  field: column.field,
4427
- separator: (_a = column.separator) !== null && _a !== void 0 ? _a : " - "
4427
+ separator: (_a = column.separator) !== null && _a !== void 0 ? _a : " - ",
4428
+ enumPrefix: column.enumPrefix
4428
4429
  };
4429
4430
  if (column.exportable === false) {
4430
4431
  exportColumn.exportable = false;
@@ -4440,11 +4441,11 @@ var TablePagingComponent = /** @class */ (function () {
4440
4441
  return exportColumn;
4441
4442
  });
4442
4443
  };
4443
- TablePagingComponent.prototype.getCurrentPageRowsToExport = function () {
4444
- return this.mapColumnsTranslations(this.table.columns, this.table.value);
4444
+ TablePagingComponent.prototype.getCurrentPageRowsToExport = function (columns) {
4445
+ return this.mapColumnsTranslations(columns, this.table.value);
4445
4446
  };
4446
- TablePagingComponent.prototype.getSelectedRowsToExport = function () {
4447
- return this.mapColumnsTranslations(this.table.columns, this.table.selection);
4447
+ TablePagingComponent.prototype.getSelectedRowsToExport = function (columns) {
4448
+ return this.mapColumnsTranslations(columns, this.table.selection);
4448
4449
  };
4449
4450
  TablePagingComponent.prototype.mapColumnsTranslations = function (columns, rows) {
4450
4451
  var _this = this;
@@ -4453,11 +4454,28 @@ var TablePagingComponent = /** @class */ (function () {
4453
4454
  return rows;
4454
4455
  return __spread(rows).map(function (row) {
4455
4456
  var newRow = __assign({}, row);
4456
- for (var i = 0; i <= enumColumns.length - 1; i++) {
4457
+ var _loop_1 = function (i) {
4457
4458
  var column = enumColumns[i];
4458
- var fieldName = column.field;
4459
- var columnData = row[fieldName];
4460
- newRow[fieldName] = _this.translate.instant(column.enumPrefix + columnData.toString().toLowerCase());
4459
+ var fields = column.field;
4460
+ if (!Array.isArray(fields)) {
4461
+ fields = [fields];
4462
+ }
4463
+ fields.forEach(function (fieldName) {
4464
+ var columnData = row[fieldName];
4465
+ if (!columnData)
4466
+ return;
4467
+ var enumValue = columnData.toString().toLowerCase();
4468
+ var translationKey = column.enumPrefix + enumValue;
4469
+ var translatedValue = _this.translate.instant(translationKey);
4470
+ if (translationKey === translatedValue && enumValue.length > 1) {
4471
+ translationKey = column.enumPrefix + enumValue.substring(0, 1) + "_" + enumValue.substr(1);
4472
+ translatedValue = _this.translate.instant(translationKey);
4473
+ }
4474
+ newRow[fieldName] = translatedValue;
4475
+ });
4476
+ };
4477
+ for (var i = 0; i <= enumColumns.length - 1; i++) {
4478
+ _loop_1(i);
4461
4479
  }
4462
4480
  return newRow;
4463
4481
  });
@@ -4470,15 +4488,19 @@ var TablePagingComponent = /** @class */ (function () {
4470
4488
  };
4471
4489
  TablePagingComponent.prototype.exportCurrentPage = function () {
4472
4490
  this.validateComponent();
4473
- ExportUtils.exportCSV(this.getColumnsToExport(), this.getCurrentPageRowsToExport(), undefined, this.getExportFileName());
4491
+ var columns = this.getColumnsToExport();
4492
+ var dataToExport = this.getCurrentPageRowsToExport(columns);
4493
+ ExportUtils.exportCSV(columns, dataToExport, undefined, this.getExportFileName());
4474
4494
  };
4475
4495
  TablePagingComponent.prototype.exportSelectedRecords = function () {
4476
4496
  this.validateComponent();
4477
- ExportUtils.exportCSV(this.getColumnsToExport(), this.getSelectedRowsToExport(), undefined, this.getExportFileName());
4497
+ var columns = this.getColumnsToExport();
4498
+ var dataToExport = this.getSelectedRowsToExport(columns);
4499
+ ExportUtils.exportCSV(columns, dataToExport, undefined, this.getExportFileName());
4478
4500
  };
4479
4501
  TablePagingComponent.prototype.exportAllRecords = function () {
4480
4502
  return __awaiter(this, void 0, void 0, function () {
4481
- var serverData, dataToExport;
4503
+ var serverData, columns, dataToExport;
4482
4504
  return __generator(this, function (_a) {
4483
4505
  switch (_a.label) {
4484
4506
  case 0:
@@ -4486,8 +4508,9 @@ var TablePagingComponent = /** @class */ (function () {
4486
4508
  return [4 /*yield*/, this.loadAllRecords()];
4487
4509
  case 1:
4488
4510
  serverData = _a.sent();
4489
- dataToExport = this.mapColumnsTranslations(this.table.columns, serverData);
4490
- ExportUtils.exportCSV(this.getColumnsToExport(), dataToExport, undefined, this.getExportFileName());
4511
+ columns = this.getColumnsToExport();
4512
+ dataToExport = this.mapColumnsTranslations(columns, serverData);
4513
+ ExportUtils.exportCSV(columns, dataToExport, undefined, this.getExportFileName());
4491
4514
  return [2 /*return*/];
4492
4515
  }
4493
4516
  });