@seniorsistemas/angular-components 17.3.17 → 17.3.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.
@@ -8405,7 +8405,8 @@
8405
8405
  exportable: true,
8406
8406
  field: column.field,
8407
8407
  separator: (_a = column.separator) !== null && _a !== void 0 ? _a : " - ",
8408
- enumPrefix: column.enumPrefix
8408
+ enumPrefix: column.enumPrefix,
8409
+ customExport: column.customExport
8409
8410
  };
8410
8411
  if (column.exportable === false) {
8411
8412
  exportColumn.exportable = false;
@@ -8426,6 +8427,7 @@
8426
8427
  if (this.loadCurrentPageRecords) {
8427
8428
  tableData = this.loadCurrentPageRecords();
8428
8429
  }
8430
+ tableData = this.mapCustomExport(columns, tableData);
8429
8431
  return this.mapColumnsTranslations(columns, tableData);
8430
8432
  };
8431
8433
  TablePagingComponent.prototype.getSelectedRowsToExport = function (columns) {
@@ -8433,6 +8435,7 @@
8433
8435
  if (this.loadSelectedRecords) {
8434
8436
  tableData = this.loadSelectedRecords();
8435
8437
  }
8438
+ tableData = this.mapCustomExport(columns, tableData);
8436
8439
  return this.mapColumnsTranslations(columns, tableData);
8437
8440
  };
8438
8441
  TablePagingComponent.prototype.getPropertyValue = function (obj, path) {
@@ -8472,6 +8475,28 @@
8472
8475
  return newRow;
8473
8476
  });
8474
8477
  };
8478
+ TablePagingComponent.prototype.mapCustomExport = function (columns, rows) {
8479
+ var _this = this;
8480
+ var customColumns = columns.filter(function (p) { return p.customExport; });
8481
+ if (!customColumns.length) {
8482
+ return rows;
8483
+ }
8484
+ return __spread(rows).map(function (row) {
8485
+ var newRow = __assign({}, row);
8486
+ customColumns.forEach(function (column) {
8487
+ var fields = !Array.isArray(column.field) ? [column.field] : column.field;
8488
+ fields.forEach(function (fieldName) {
8489
+ var columnData = _this.getPropertyValue(row, fieldName);
8490
+ if (columnData === null || columnData === undefined) {
8491
+ return;
8492
+ }
8493
+ var newValue = column.customExport(columnData);
8494
+ _this.setPropertyValue(newRow, fieldName, newValue);
8495
+ });
8496
+ });
8497
+ return newRow;
8498
+ });
8499
+ };
8475
8500
  TablePagingComponent.prototype.translateValue = function (column, columnData) {
8476
8501
  // Default usage: ENUM_VALUE -> domain.service.enum_value
8477
8502
  var enumValue = columnData.toString().toLowerCase();
@@ -8526,6 +8551,7 @@
8526
8551
  case 1:
8527
8552
  serverData = _a.sent();
8528
8553
  columns = this.getColumnsToExport();
8554
+ serverData = this.mapCustomExport(columns, serverData);
8529
8555
  dataToExport = this.mapColumnsTranslations(columns, serverData);
8530
8556
  ExportUtils.exportCSV(columns, dataToExport, undefined, this.getExportFileName());
8531
8557
  return [2 /*return*/];
@@ -10126,8 +10152,9 @@
10126
10152
  var observables = [this.getCustomFields(), this.localeService.get()];
10127
10153
  rxjs.forkJoin(observables)
10128
10154
  .pipe(operators.takeUntil(this.ngUsubscribe), operators.finalize(function () {
10155
+ var _a;
10129
10156
  _this.formGroup.markAsPristine();
10130
- _this.parentControl.markAsPristine();
10157
+ (_a = _this.parentControl) === null || _a === void 0 ? void 0 : _a.markAsPristine();
10131
10158
  if (_this.ready$)
10132
10159
  _this.ready$.next(true);
10133
10160
  }))