@seniorsistemas/angular-components 15.1.0 → 15.1.2

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.
@@ -4515,11 +4515,27 @@ var TablePagingComponent = /** @class */ (function () {
4515
4515
  TablePagingComponent.prototype.getSelectedRowsToExport = function (columns) {
4516
4516
  return this.mapColumnsTranslations(columns, this.table.selection);
4517
4517
  };
4518
+ TablePagingComponent.prototype.getInnerPropValue = function (obj, path) {
4519
+ return path.split(".").reduce(function (result, prop) { return (result[prop] === undefined ? undefined : result[prop]); }, obj);
4520
+ };
4521
+ TablePagingComponent.prototype.setInnerPropValue = function (obj, path, value) {
4522
+ this.recursionSet(obj, path.split("."), value);
4523
+ };
4524
+ TablePagingComponent.prototype.recursionSet = function (obj, keysList, value) {
4525
+ var key = keysList[0];
4526
+ if (keysList.length === 1) {
4527
+ obj[key] = value;
4528
+ return obj;
4529
+ }
4530
+ obj[key] = (this.recursionSet((obj === null || obj === void 0 ? void 0 : obj[key]) || {}, keysList.slice(1), value));
4531
+ return obj;
4532
+ };
4518
4533
  TablePagingComponent.prototype.mapColumnsTranslations = function (columns, rows) {
4519
4534
  var _this = this;
4520
4535
  var enumColumns = columns.filter(function (p) { return p.enumPrefix; });
4521
- if (!enumColumns.length)
4536
+ if (!enumColumns.length) {
4522
4537
  return rows;
4538
+ }
4523
4539
  return __spread(rows).map(function (row) {
4524
4540
  var newRow = __assign({}, row);
4525
4541
  var _loop_1 = function (i) {
@@ -4529,17 +4545,12 @@ var TablePagingComponent = /** @class */ (function () {
4529
4545
  fields = [fields];
4530
4546
  }
4531
4547
  fields.forEach(function (fieldName) {
4532
- var columnData = row[fieldName];
4533
- if (columnData === null || columnData === undefined)
4548
+ var columnData = _this.getInnerPropValue(row, fieldName);
4549
+ if (columnData === null || columnData === undefined) {
4534
4550
  return;
4535
- var enumValue = columnData.toString().toLowerCase();
4536
- var translationKey = column.enumPrefix + enumValue;
4537
- var translatedValue = _this.translate.instant(translationKey);
4538
- if (translationKey === translatedValue && enumValue.length > 1) {
4539
- translationKey = column.enumPrefix + enumValue.substring(0, 1) + "_" + enumValue.substr(1);
4540
- translatedValue = _this.translate.instant(translationKey);
4541
4551
  }
4542
- newRow[fieldName] = translatedValue;
4552
+ var newValue = _this.translateValue(column, columnData);
4553
+ _this.setInnerPropValue(newRow, fieldName, newValue);
4543
4554
  });
4544
4555
  };
4545
4556
  for (var i = 0; i <= enumColumns.length - 1; i++) {
@@ -4548,6 +4559,16 @@ var TablePagingComponent = /** @class */ (function () {
4548
4559
  return newRow;
4549
4560
  });
4550
4561
  };
4562
+ TablePagingComponent.prototype.translateValue = function (column, columnData) {
4563
+ var enumValue = columnData.toString().toLowerCase();
4564
+ var translationKey = column.enumPrefix + enumValue;
4565
+ var translatedValue = this.translate.instant(translationKey);
4566
+ if (translationKey === translatedValue && enumValue.length > 1) {
4567
+ translationKey = "" + column.enumPrefix + enumValue.substring(0, 1) + "_" + enumValue.substr(1);
4568
+ return this.translate.instant(translationKey);
4569
+ }
4570
+ return translatedValue;
4571
+ };
4551
4572
  TablePagingComponent.prototype.getExportFileName = function () {
4552
4573
  var _a;
4553
4574
  var fileName = (_a = this.exportFileName) !== null && _a !== void 0 ? _a : "download";
@@ -7472,7 +7493,7 @@ var TimelineComponent = /** @class */ (function () {
7472
7493
  TimelineComponent = __decorate([
7473
7494
  Component({
7474
7495
  selector: "s-timeline",
7475
- template: "<div *ngIf=\"changeToVertical(); then vertical else horizontal\"></div>\n\n<ng-template #horizontal>\n <s-horizontal-timeline\n [items]=\"items\"\n [activeIndex]=\"activeIndex\">\n </s-horizontal-timeline>\n</ng-template>\n\n<ng-template #vertical>\n <s-vertical-timeline\n [items]=\"items\"\n [activeIndex]=\"activeIndex\"\n [counterLabel]=\"counterLabel\"\n [collapsable]=\"collapsable\">\n </s-vertical-timeline>\n</ng-template>"
7496
+ template: "<ng-template *ngIf=\"items?.length\">\n <div *ngIf=\"changeToVertical(); then vertical else horizontal\"></div>\n</ng-template>\n\n<ng-template #horizontal>\n <s-horizontal-timeline\n [items]=\"items\"\n [activeIndex]=\"activeIndex\">\n </s-horizontal-timeline>\n</ng-template>\n\n<ng-template #vertical>\n <s-vertical-timeline\n [items]=\"items\"\n [activeIndex]=\"activeIndex\"\n [counterLabel]=\"counterLabel\"\n [collapsable]=\"collapsable\">\n </s-vertical-timeline>\n</ng-template>"
7476
7497
  })
7477
7498
  ], TimelineComponent);
7478
7499
  return TimelineComponent;