@seniorsistemas/angular-components 14.16.18 → 14.16.20

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.
@@ -2810,6 +2810,7 @@ var FileUploadComponent = /** @class */ (function () {
2810
2810
  this.cancelLabel = "Cancelar";
2811
2811
  this.successTooltip = "Arquivo anexado com sucesso";
2812
2812
  this.ariaLabelProgress = "Carregando arquivo";
2813
+ this.disabled = false;
2813
2814
  this.uploadHandler = new EventEmitter();
2814
2815
  this.removeFile = new EventEmitter();
2815
2816
  this.cancelUpload = new EventEmitter();
@@ -2973,6 +2974,9 @@ var FileUploadComponent = /** @class */ (function () {
2973
2974
  __decorate([
2974
2975
  Input()
2975
2976
  ], FileUploadComponent.prototype, "formGroup", void 0);
2977
+ __decorate([
2978
+ Input()
2979
+ ], FileUploadComponent.prototype, "disabled", void 0);
2976
2980
  __decorate([
2977
2981
  Output()
2978
2982
  ], FileUploadComponent.prototype, "uploadHandler", void 0);
@@ -2997,7 +3001,7 @@ var FileUploadComponent = /** @class */ (function () {
2997
3001
  FileUploadComponent = FileUploadComponent_1 = __decorate([
2998
3002
  Component({
2999
3003
  selector: "s-file-upload",
3000
- template: "<div class=\"s-fileupload\" [id]=\"id\">\n <div class=\"s-fileupload-choose\">\n <input type=\"file\" name=\"file\" [accept]=\"accept\" [multiple]=\"multiple\"\n (change)=\"onFileSelect($event.dataTransfer ? $event.dataTransfer.files : $event.target.files)\" #inputUpload>\n <s-button [id]=\"id + 'upload-button'\" [label]=\"chooseLabel\" (onClick)=\"inputUpload.click()\" priority=\"primary\"\n [disabled]=\"!!formGroup?.disabled\" [auxiliary]=\"false\"></s-button>\n </div>\n\n <section [id]=\"id + 'fileupload-list'\" class=\"s-fileupload-list\" *ngIf=\"files.length\" role=\"grid\">\n <ng-container *ngFor=\"let file of files; let i = index\">\n <div class=\"s-fileupload-list-file\" role=\"row\">\n <div [id]=\"id + '-file-' + i + '-name'\" class=\"s-fileupload-list-file-name\" role=\"gridcell\">\n <ng-container\n *ngTemplateOutlet=\"file.savedFile || file.progress === 100 ? descriptionUrl : description; context: { $implicit: file, index: i }\">\n </ng-container>\n </div>\n <div class=\"s-fileupload-list-file-status\" role=\"gridcell\">\n <p-progressBar *ngIf=\"file.isUploading && !isSmallDevice\"\n [style]=\"{ 'width': '250px', 'background-color': '#d8d8d8', 'border-radius': '0px', 'height': '14px'}\"\n [value]=\"file.progress\" [showValue]=\"false\" role=\"alert\" [attr.aria-label]=\"ariaLabelProgress\">\n </p-progressBar>\n <span [id]=\"id + '-file-' + i + '-spin'\" class=\"fas fa-circle-notch fa-spin\"\n *ngIf=\"file.isUploading && isSmallDevice\" [attr.aria-label]=\"ariaLabelProgress\"></span>\n <span [id]=\"id + '-file-' + i + '-check'\" class=\"fas fa-check\" role=\"alert\"\n *ngIf=\"!file.isUploading && !file.error && file.progress === 100\"\n [attr.aria-label]=\"ariaLabelSuccess || successTooltip\" [pTooltip]=\"successTooltip\"\n tooltipPosition=\"top\" showDelay=\"500\" [appendTo]=\"'body'\"></span>\n <span [id]=\"id + '-file-' + i + '-error'\" class=\"fas fa-times\" role=\"alert\"\n *ngIf=\"file.error?.message\" [pTooltip]=\"file.error?.message\" tooltipPosition=\"top\"\n showDelay=\"500\" [appendTo]=\"'body'\"></span>\n </div>\n <div class=\"s-fileupload-list-file-actions\" role=\"gridcell\">\n <a [id]=\"id + '-file-' + i + '-cancel'\" class=\"s-fileupload-list-file-actions-action\"\n (click)=\"onCancelUpload($event, i)\" *ngIf=\"file.isUploading\">{{cancelLabel}}</a>\n <a role=\"button\" tabindex=\"0\" [id]=\"id + '-file-' + i + '-remove'\"\n class=\"s-fileupload-list-file-actions-action\" (click)=\"onRemoveFile($event, file)\"\n *ngIf=\"!file.isUploading\" [attr.aria-label]=\"ariaLabelRemove || removeLabel\">{{removeLabel}}</a>\n </div>\n </div>\n </ng-container>\n </section>\n</div>\n\n<ng-template #descriptionUrl let-file let-i = index>\n <a [id]=\"id + '-file-' + i + '-name-link'\" tabindex=\"0\" (click)=\"onDowloadFile($event, i)\"\n [attr.aria-label]=\"ariaLabelFileName || file.name\">{{file.name}}</a>\n <a style=\"display: none;\" [href]=\"file.objectURL\" target=\"_blank\" download #anchor></a>\n</ng-template>\n\n<ng-template #description let-file>\n <span tabindex=\"0\" [attr.aria-label]=\"ariaLabelFileName || file.name\">\n {{file.name}}\n </span>\n</ng-template>\n",
3004
+ template: "<div class=\"s-fileupload\" [id]=\"id\">\n <div class=\"s-fileupload-choose\">\n <input type=\"file\" name=\"file\" [accept]=\"accept\" [multiple]=\"multiple\"\n (change)=\"onFileSelect($event.dataTransfer ? $event.dataTransfer.files : $event.target.files)\" #inputUpload>\n <s-button [id]=\"id + 'upload-button'\" [label]=\"chooseLabel\" (onClick)=\"inputUpload.click()\" priority=\"primary\"\n [disabled]=\"disabled || !!formGroup?.disabled\" [auxiliary]=\"false\"></s-button>\n </div>\n\n <section [id]=\"id + 'fileupload-list'\" class=\"s-fileupload-list\" *ngIf=\"files.length\" role=\"grid\">\n <ng-container *ngFor=\"let file of files; let i = index\">\n <div class=\"s-fileupload-list-file\" role=\"row\">\n <div [id]=\"id + '-file-' + i + '-name'\" class=\"s-fileupload-list-file-name\" role=\"gridcell\">\n <ng-container\n *ngTemplateOutlet=\"file.savedFile || file.progress === 100 ? descriptionUrl : description; context: { $implicit: file, index: i }\">\n </ng-container>\n </div>\n <div class=\"s-fileupload-list-file-status\" role=\"gridcell\">\n <p-progressBar *ngIf=\"file.isUploading && !isSmallDevice\"\n [style]=\"{ 'width': '250px', 'background-color': '#d8d8d8', 'border-radius': '0px', 'height': '14px'}\"\n [value]=\"file.progress\" [showValue]=\"false\" role=\"alert\" [attr.aria-label]=\"ariaLabelProgress\">\n </p-progressBar>\n <span [id]=\"id + '-file-' + i + '-spin'\" class=\"fas fa-circle-notch fa-spin\"\n *ngIf=\"file.isUploading && isSmallDevice\" [attr.aria-label]=\"ariaLabelProgress\"></span>\n <span [id]=\"id + '-file-' + i + '-check'\" class=\"fas fa-check\" role=\"alert\"\n *ngIf=\"!file.isUploading && !file.error && file.progress === 100\"\n [attr.aria-label]=\"ariaLabelSuccess || successTooltip\" [pTooltip]=\"successTooltip\"\n tooltipPosition=\"top\" showDelay=\"500\" [appendTo]=\"'body'\"></span>\n <span [id]=\"id + '-file-' + i + '-error'\" class=\"fas fa-times\" role=\"alert\"\n *ngIf=\"file.error?.message\" [pTooltip]=\"file.error?.message\" tooltipPosition=\"top\"\n showDelay=\"500\" [appendTo]=\"'body'\"></span>\n </div>\n <div class=\"s-fileupload-list-file-actions\" role=\"gridcell\">\n <a [id]=\"id + '-file-' + i + '-cancel'\" class=\"s-fileupload-list-file-actions-action\"\n (click)=\"onCancelUpload($event, i)\" *ngIf=\"file.isUploading\">{{cancelLabel}}</a>\n <a role=\"button\" tabindex=\"0\" [id]=\"id + '-file-' + i + '-remove'\"\n class=\"s-fileupload-list-file-actions-action\" (click)=\"onRemoveFile($event, file)\"\n *ngIf=\"!file.isUploading && !(disabled || !!formGroup?.disabled)\" [attr.aria-label]=\"ariaLabelRemove || removeLabel\">{{removeLabel}}</a>\n </div>\n </div>\n </ng-container>\n </section>\n</div>\n\n<ng-template #descriptionUrl let-file let-i = index>\n <a [id]=\"id + '-file-' + i + '-name-link'\" tabindex=\"0\" (click)=\"onDowloadFile($event, i)\"\n [attr.aria-label]=\"ariaLabelFileName || file.name\">{{file.name}}</a>\n <a style=\"display: none;\" [href]=\"file.objectURL\" target=\"_blank\" download #anchor></a>\n</ng-template>\n\n<ng-template #description let-file>\n <span tabindex=\"0\" [attr.aria-label]=\"ariaLabelFileName || file.name\">\n {{file.name}}\n </span>\n</ng-template>\n",
3001
3005
  styles: [".s-fileupload .s-fileupload-choose{position:relative;margin:15px 0;width:-webkit-max-content;width:max-content}.s-fileupload input[type=file]{display:none}.s-fileupload-list{border:1px solid #ccc}.s-fileupload-list-file:not(:first-child){border-top:1px solid #ccc}.s-fileupload-list .s-fileupload-list-file{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-pack:justify;justify-content:space-between;padding:15px}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-name{-ms-flex-item-align:center;-ms-grid-row-align:center;align-self:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-name>a{cursor:pointer;text-decoration:none}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-status{-ms-flex-item-align:center;-ms-grid-row-align:center;align-self:center}.s-fileupload-list .s-fileupload-list-file .fas.fa-circle-notch{color:#d8d8d8;font-size:12px}.s-fileupload-list .s-fileupload-list-file .fas.fa-check{color:#0c9348;font-size:12px}.s-fileupload-list .s-fileupload-list-file .fas.fa-times{color:#c13018;font-size:12px}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions{margin-top:15px;-ms-flex-item-align:center;-ms-grid-row-align:center;align-self:center;width:100%}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions a.s-fileupload-list-file-actions-action{text-decoration:none;color:#428bca}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions a.s-fileupload-list-file-actions-action :focus,.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions a.s-fileupload-list-file-actions-action :visited,.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions a.s-fileupload-list-file-actions-action:hover{text-decoration:none}@media (min-width:768px){.s-fileupload-list .s-fileupload-list-file{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-name{width:auto;-ms-flex-positive:2;flex-grow:2}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-status{margin:0 15px}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions{margin:0;width:auto}}"]
3002
3006
  })
3003
3007
  ], FileUploadComponent);
@@ -4424,7 +4428,8 @@ var TablePagingComponent = /** @class */ (function () {
4424
4428
  header: column.header,
4425
4429
  exportable: true,
4426
4430
  field: column.field,
4427
- separator: (_a = column.separator) !== null && _a !== void 0 ? _a : " - "
4431
+ separator: (_a = column.separator) !== null && _a !== void 0 ? _a : " - ",
4432
+ enumPrefix: column.enumPrefix
4428
4433
  };
4429
4434
  if (column.exportable === false) {
4430
4435
  exportColumn.exportable = false;
@@ -4440,11 +4445,11 @@ var TablePagingComponent = /** @class */ (function () {
4440
4445
  return exportColumn;
4441
4446
  });
4442
4447
  };
4443
- TablePagingComponent.prototype.getCurrentPageRowsToExport = function () {
4444
- return this.mapColumnsTranslations(this.table.columns, this.table.value);
4448
+ TablePagingComponent.prototype.getCurrentPageRowsToExport = function (columns) {
4449
+ return this.mapColumnsTranslations(columns, this.table.value);
4445
4450
  };
4446
- TablePagingComponent.prototype.getSelectedRowsToExport = function () {
4447
- return this.mapColumnsTranslations(this.table.columns, this.table.selection);
4451
+ TablePagingComponent.prototype.getSelectedRowsToExport = function (columns) {
4452
+ return this.mapColumnsTranslations(columns, this.table.selection);
4448
4453
  };
4449
4454
  TablePagingComponent.prototype.mapColumnsTranslations = function (columns, rows) {
4450
4455
  var _this = this;
@@ -4453,11 +4458,28 @@ var TablePagingComponent = /** @class */ (function () {
4453
4458
  return rows;
4454
4459
  return __spread(rows).map(function (row) {
4455
4460
  var newRow = __assign({}, row);
4456
- for (var i = 0; i <= enumColumns.length - 1; i++) {
4461
+ var _loop_1 = function (i) {
4457
4462
  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());
4463
+ var fields = column.field;
4464
+ if (!Array.isArray(fields)) {
4465
+ fields = [fields];
4466
+ }
4467
+ fields.forEach(function (fieldName) {
4468
+ var columnData = row[fieldName];
4469
+ if (!columnData)
4470
+ return;
4471
+ var enumValue = columnData.toString().toLowerCase();
4472
+ var translationKey = column.enumPrefix + enumValue;
4473
+ var translatedValue = _this.translate.instant(translationKey);
4474
+ if (translationKey === translatedValue && enumValue.length > 1) {
4475
+ translationKey = column.enumPrefix + enumValue.substring(0, 1) + "_" + enumValue.substr(1);
4476
+ translatedValue = _this.translate.instant(translationKey);
4477
+ }
4478
+ newRow[fieldName] = translatedValue;
4479
+ });
4480
+ };
4481
+ for (var i = 0; i <= enumColumns.length - 1; i++) {
4482
+ _loop_1(i);
4461
4483
  }
4462
4484
  return newRow;
4463
4485
  });
@@ -4470,15 +4492,19 @@ var TablePagingComponent = /** @class */ (function () {
4470
4492
  };
4471
4493
  TablePagingComponent.prototype.exportCurrentPage = function () {
4472
4494
  this.validateComponent();
4473
- ExportUtils.exportCSV(this.getColumnsToExport(), this.getCurrentPageRowsToExport(), undefined, this.getExportFileName());
4495
+ var columns = this.getColumnsToExport();
4496
+ var dataToExport = this.getCurrentPageRowsToExport(columns);
4497
+ ExportUtils.exportCSV(columns, dataToExport, undefined, this.getExportFileName());
4474
4498
  };
4475
4499
  TablePagingComponent.prototype.exportSelectedRecords = function () {
4476
4500
  this.validateComponent();
4477
- ExportUtils.exportCSV(this.getColumnsToExport(), this.getSelectedRowsToExport(), undefined, this.getExportFileName());
4501
+ var columns = this.getColumnsToExport();
4502
+ var dataToExport = this.getSelectedRowsToExport(columns);
4503
+ ExportUtils.exportCSV(columns, dataToExport, undefined, this.getExportFileName());
4478
4504
  };
4479
4505
  TablePagingComponent.prototype.exportAllRecords = function () {
4480
4506
  return __awaiter(this, void 0, void 0, function () {
4481
- var serverData, dataToExport;
4507
+ var serverData, columns, dataToExport;
4482
4508
  return __generator(this, function (_a) {
4483
4509
  switch (_a.label) {
4484
4510
  case 0:
@@ -4486,8 +4512,9 @@ var TablePagingComponent = /** @class */ (function () {
4486
4512
  return [4 /*yield*/, this.loadAllRecords()];
4487
4513
  case 1:
4488
4514
  serverData = _a.sent();
4489
- dataToExport = this.mapColumnsTranslations(this.table.columns, serverData);
4490
- ExportUtils.exportCSV(this.getColumnsToExport(), dataToExport, undefined, this.getExportFileName());
4515
+ columns = this.getColumnsToExport();
4516
+ dataToExport = this.mapColumnsTranslations(columns, serverData);
4517
+ ExportUtils.exportCSV(columns, dataToExport, undefined, this.getExportFileName());
4491
4518
  return [2 /*return*/];
4492
4519
  }
4493
4520
  });