@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.
@@ -2983,6 +2983,7 @@
2983
2983
  this.cancelLabel = "Cancelar";
2984
2984
  this.successTooltip = "Arquivo anexado com sucesso";
2985
2985
  this.ariaLabelProgress = "Carregando arquivo";
2986
+ this.disabled = false;
2986
2987
  this.uploadHandler = new core.EventEmitter();
2987
2988
  this.removeFile = new core.EventEmitter();
2988
2989
  this.cancelUpload = new core.EventEmitter();
@@ -3146,6 +3147,9 @@
3146
3147
  __decorate([
3147
3148
  core.Input()
3148
3149
  ], FileUploadComponent.prototype, "formGroup", void 0);
3150
+ __decorate([
3151
+ core.Input()
3152
+ ], FileUploadComponent.prototype, "disabled", void 0);
3149
3153
  __decorate([
3150
3154
  core.Output()
3151
3155
  ], FileUploadComponent.prototype, "uploadHandler", void 0);
@@ -3170,7 +3174,7 @@
3170
3174
  FileUploadComponent = FileUploadComponent_1 = __decorate([
3171
3175
  core.Component({
3172
3176
  selector: "s-file-upload",
3173
- 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",
3177
+ 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",
3174
3178
  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}}"]
3175
3179
  })
3176
3180
  ], FileUploadComponent);
@@ -4597,7 +4601,8 @@
4597
4601
  header: column.header,
4598
4602
  exportable: true,
4599
4603
  field: column.field,
4600
- separator: (_a = column.separator) !== null && _a !== void 0 ? _a : " - "
4604
+ separator: (_a = column.separator) !== null && _a !== void 0 ? _a : " - ",
4605
+ enumPrefix: column.enumPrefix
4601
4606
  };
4602
4607
  if (column.exportable === false) {
4603
4608
  exportColumn.exportable = false;
@@ -4613,11 +4618,11 @@
4613
4618
  return exportColumn;
4614
4619
  });
4615
4620
  };
4616
- TablePagingComponent.prototype.getCurrentPageRowsToExport = function () {
4617
- return this.mapColumnsTranslations(this.table.columns, this.table.value);
4621
+ TablePagingComponent.prototype.getCurrentPageRowsToExport = function (columns) {
4622
+ return this.mapColumnsTranslations(columns, this.table.value);
4618
4623
  };
4619
- TablePagingComponent.prototype.getSelectedRowsToExport = function () {
4620
- return this.mapColumnsTranslations(this.table.columns, this.table.selection);
4624
+ TablePagingComponent.prototype.getSelectedRowsToExport = function (columns) {
4625
+ return this.mapColumnsTranslations(columns, this.table.selection);
4621
4626
  };
4622
4627
  TablePagingComponent.prototype.mapColumnsTranslations = function (columns, rows) {
4623
4628
  var _this = this;
@@ -4626,11 +4631,28 @@
4626
4631
  return rows;
4627
4632
  return __spread(rows).map(function (row) {
4628
4633
  var newRow = __assign({}, row);
4629
- for (var i = 0; i <= enumColumns.length - 1; i++) {
4634
+ var _loop_1 = function (i) {
4630
4635
  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());
4636
+ var fields = column.field;
4637
+ if (!Array.isArray(fields)) {
4638
+ fields = [fields];
4639
+ }
4640
+ fields.forEach(function (fieldName) {
4641
+ var columnData = row[fieldName];
4642
+ if (!columnData)
4643
+ return;
4644
+ var enumValue = columnData.toString().toLowerCase();
4645
+ var translationKey = column.enumPrefix + enumValue;
4646
+ var translatedValue = _this.translate.instant(translationKey);
4647
+ if (translationKey === translatedValue && enumValue.length > 1) {
4648
+ translationKey = column.enumPrefix + enumValue.substring(0, 1) + "_" + enumValue.substr(1);
4649
+ translatedValue = _this.translate.instant(translationKey);
4650
+ }
4651
+ newRow[fieldName] = translatedValue;
4652
+ });
4653
+ };
4654
+ for (var i = 0; i <= enumColumns.length - 1; i++) {
4655
+ _loop_1(i);
4634
4656
  }
4635
4657
  return newRow;
4636
4658
  });
@@ -4643,15 +4665,19 @@
4643
4665
  };
4644
4666
  TablePagingComponent.prototype.exportCurrentPage = function () {
4645
4667
  this.validateComponent();
4646
- ExportUtils.exportCSV(this.getColumnsToExport(), this.getCurrentPageRowsToExport(), undefined, this.getExportFileName());
4668
+ var columns = this.getColumnsToExport();
4669
+ var dataToExport = this.getCurrentPageRowsToExport(columns);
4670
+ ExportUtils.exportCSV(columns, dataToExport, undefined, this.getExportFileName());
4647
4671
  };
4648
4672
  TablePagingComponent.prototype.exportSelectedRecords = function () {
4649
4673
  this.validateComponent();
4650
- ExportUtils.exportCSV(this.getColumnsToExport(), this.getSelectedRowsToExport(), undefined, this.getExportFileName());
4674
+ var columns = this.getColumnsToExport();
4675
+ var dataToExport = this.getSelectedRowsToExport(columns);
4676
+ ExportUtils.exportCSV(columns, dataToExport, undefined, this.getExportFileName());
4651
4677
  };
4652
4678
  TablePagingComponent.prototype.exportAllRecords = function () {
4653
4679
  return __awaiter(this, void 0, void 0, function () {
4654
- var serverData, dataToExport;
4680
+ var serverData, columns, dataToExport;
4655
4681
  return __generator(this, function (_a) {
4656
4682
  switch (_a.label) {
4657
4683
  case 0:
@@ -4659,8 +4685,9 @@
4659
4685
  return [4 /*yield*/, this.loadAllRecords()];
4660
4686
  case 1:
4661
4687
  serverData = _a.sent();
4662
- dataToExport = this.mapColumnsTranslations(this.table.columns, serverData);
4663
- ExportUtils.exportCSV(this.getColumnsToExport(), dataToExport, undefined, this.getExportFileName());
4688
+ columns = this.getColumnsToExport();
4689
+ dataToExport = this.mapColumnsTranslations(columns, serverData);
4690
+ ExportUtils.exportCSV(columns, dataToExport, undefined, this.getExportFileName());
4664
4691
  return [2 /*return*/];
4665
4692
  }
4666
4693
  });