@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.
@@ -4597,7 +4597,8 @@
4597
4597
  header: column.header,
4598
4598
  exportable: true,
4599
4599
  field: column.field,
4600
- separator: (_a = column.separator) !== null && _a !== void 0 ? _a : " - "
4600
+ separator: (_a = column.separator) !== null && _a !== void 0 ? _a : " - ",
4601
+ enumPrefix: column.enumPrefix
4601
4602
  };
4602
4603
  if (column.exportable === false) {
4603
4604
  exportColumn.exportable = false;
@@ -4613,11 +4614,11 @@
4613
4614
  return exportColumn;
4614
4615
  });
4615
4616
  };
4616
- TablePagingComponent.prototype.getCurrentPageRowsToExport = function () {
4617
- return this.mapColumnsTranslations(this.table.columns, this.table.value);
4617
+ TablePagingComponent.prototype.getCurrentPageRowsToExport = function (columns) {
4618
+ return this.mapColumnsTranslations(columns, this.table.value);
4618
4619
  };
4619
- TablePagingComponent.prototype.getSelectedRowsToExport = function () {
4620
- return this.mapColumnsTranslations(this.table.columns, this.table.selection);
4620
+ TablePagingComponent.prototype.getSelectedRowsToExport = function (columns) {
4621
+ return this.mapColumnsTranslations(columns, this.table.selection);
4621
4622
  };
4622
4623
  TablePagingComponent.prototype.mapColumnsTranslations = function (columns, rows) {
4623
4624
  var _this = this;
@@ -4626,11 +4627,28 @@
4626
4627
  return rows;
4627
4628
  return __spread(rows).map(function (row) {
4628
4629
  var newRow = __assign({}, row);
4629
- for (var i = 0; i <= enumColumns.length - 1; i++) {
4630
+ var _loop_1 = function (i) {
4630
4631
  var column = enumColumns[i];
4631
- var fieldName = column.field;
4632
- var columnData = row[fieldName];
4633
- newRow[fieldName] = _this.translate.instant(column.enumPrefix + columnData.toString().toLowerCase());
4632
+ var fields = column.field;
4633
+ if (!Array.isArray(fields)) {
4634
+ fields = [fields];
4635
+ }
4636
+ fields.forEach(function (fieldName) {
4637
+ var columnData = row[fieldName];
4638
+ if (!columnData)
4639
+ return;
4640
+ var enumValue = columnData.toString().toLowerCase();
4641
+ var translationKey = column.enumPrefix + enumValue;
4642
+ var translatedValue = _this.translate.instant(translationKey);
4643
+ if (translationKey === translatedValue && enumValue.length > 1) {
4644
+ translationKey = column.enumPrefix + enumValue.substring(0, 1) + "_" + enumValue.substr(1);
4645
+ translatedValue = _this.translate.instant(translationKey);
4646
+ }
4647
+ newRow[fieldName] = translatedValue;
4648
+ });
4649
+ };
4650
+ for (var i = 0; i <= enumColumns.length - 1; i++) {
4651
+ _loop_1(i);
4634
4652
  }
4635
4653
  return newRow;
4636
4654
  });
@@ -4643,15 +4661,19 @@
4643
4661
  };
4644
4662
  TablePagingComponent.prototype.exportCurrentPage = function () {
4645
4663
  this.validateComponent();
4646
- ExportUtils.exportCSV(this.getColumnsToExport(), this.getCurrentPageRowsToExport(), undefined, this.getExportFileName());
4664
+ var columns = this.getColumnsToExport();
4665
+ var dataToExport = this.getCurrentPageRowsToExport(columns);
4666
+ ExportUtils.exportCSV(columns, dataToExport, undefined, this.getExportFileName());
4647
4667
  };
4648
4668
  TablePagingComponent.prototype.exportSelectedRecords = function () {
4649
4669
  this.validateComponent();
4650
- ExportUtils.exportCSV(this.getColumnsToExport(), this.getSelectedRowsToExport(), undefined, this.getExportFileName());
4670
+ var columns = this.getColumnsToExport();
4671
+ var dataToExport = this.getSelectedRowsToExport(columns);
4672
+ ExportUtils.exportCSV(columns, dataToExport, undefined, this.getExportFileName());
4651
4673
  };
4652
4674
  TablePagingComponent.prototype.exportAllRecords = function () {
4653
4675
  return __awaiter(this, void 0, void 0, function () {
4654
- var serverData, dataToExport;
4676
+ var serverData, columns, dataToExport;
4655
4677
  return __generator(this, function (_a) {
4656
4678
  switch (_a.label) {
4657
4679
  case 0:
@@ -4659,8 +4681,9 @@
4659
4681
  return [4 /*yield*/, this.loadAllRecords()];
4660
4682
  case 1:
4661
4683
  serverData = _a.sent();
4662
- dataToExport = this.mapColumnsTranslations(this.table.columns, serverData);
4663
- ExportUtils.exportCSV(this.getColumnsToExport(), dataToExport, undefined, this.getExportFileName());
4684
+ columns = this.getColumnsToExport();
4685
+ dataToExport = this.mapColumnsTranslations(columns, serverData);
4686
+ ExportUtils.exportCSV(columns, dataToExport, undefined, this.getExportFileName());
4664
4687
  return [2 /*return*/];
4665
4688
  }
4666
4689
  });