@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.
@@ -8258,7 +8258,8 @@ var TablePagingComponent = /** @class */ (function () {
8258
8258
  exportable: true,
8259
8259
  field: column.field,
8260
8260
  separator: (_a = column.separator) !== null && _a !== void 0 ? _a : " - ",
8261
- enumPrefix: column.enumPrefix
8261
+ enumPrefix: column.enumPrefix,
8262
+ customExport: column.customExport
8262
8263
  };
8263
8264
  if (column.exportable === false) {
8264
8265
  exportColumn.exportable = false;
@@ -8279,6 +8280,7 @@ var TablePagingComponent = /** @class */ (function () {
8279
8280
  if (this.loadCurrentPageRecords) {
8280
8281
  tableData = this.loadCurrentPageRecords();
8281
8282
  }
8283
+ tableData = this.mapCustomExport(columns, tableData);
8282
8284
  return this.mapColumnsTranslations(columns, tableData);
8283
8285
  };
8284
8286
  TablePagingComponent.prototype.getSelectedRowsToExport = function (columns) {
@@ -8286,6 +8288,7 @@ var TablePagingComponent = /** @class */ (function () {
8286
8288
  if (this.loadSelectedRecords) {
8287
8289
  tableData = this.loadSelectedRecords();
8288
8290
  }
8291
+ tableData = this.mapCustomExport(columns, tableData);
8289
8292
  return this.mapColumnsTranslations(columns, tableData);
8290
8293
  };
8291
8294
  TablePagingComponent.prototype.getPropertyValue = function (obj, path) {
@@ -8325,6 +8328,28 @@ var TablePagingComponent = /** @class */ (function () {
8325
8328
  return newRow;
8326
8329
  });
8327
8330
  };
8331
+ TablePagingComponent.prototype.mapCustomExport = function (columns, rows) {
8332
+ var _this = this;
8333
+ var customColumns = columns.filter(function (p) { return p.customExport; });
8334
+ if (!customColumns.length) {
8335
+ return rows;
8336
+ }
8337
+ return __spread(rows).map(function (row) {
8338
+ var newRow = __assign({}, row);
8339
+ customColumns.forEach(function (column) {
8340
+ var fields = !Array.isArray(column.field) ? [column.field] : column.field;
8341
+ fields.forEach(function (fieldName) {
8342
+ var columnData = _this.getPropertyValue(row, fieldName);
8343
+ if (columnData === null || columnData === undefined) {
8344
+ return;
8345
+ }
8346
+ var newValue = column.customExport(columnData);
8347
+ _this.setPropertyValue(newRow, fieldName, newValue);
8348
+ });
8349
+ });
8350
+ return newRow;
8351
+ });
8352
+ };
8328
8353
  TablePagingComponent.prototype.translateValue = function (column, columnData) {
8329
8354
  // Default usage: ENUM_VALUE -> domain.service.enum_value
8330
8355
  var enumValue = columnData.toString().toLowerCase();
@@ -8379,6 +8404,7 @@ var TablePagingComponent = /** @class */ (function () {
8379
8404
  case 1:
8380
8405
  serverData = _a.sent();
8381
8406
  columns = this.getColumnsToExport();
8407
+ serverData = this.mapCustomExport(columns, serverData);
8382
8408
  dataToExport = this.mapColumnsTranslations(columns, serverData);
8383
8409
  ExportUtils.exportCSV(columns, dataToExport, undefined, this.getExportFileName());
8384
8410
  return [2 /*return*/];
@@ -9979,8 +10005,9 @@ var CustomFieldsComponent = /** @class */ (function () {
9979
10005
  var observables = [this.getCustomFields(), this.localeService.get()];
9980
10006
  forkJoin(observables)
9981
10007
  .pipe(takeUntil(this.ngUsubscribe), finalize(function () {
10008
+ var _a;
9982
10009
  _this.formGroup.markAsPristine();
9983
- _this.parentControl.markAsPristine();
10010
+ (_a = _this.parentControl) === null || _a === void 0 ? void 0 : _a.markAsPristine();
9984
10011
  if (_this.ready$)
9985
10012
  _this.ready$.next(true);
9986
10013
  }))