@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.
@@ -2619,6 +2619,7 @@ let FileUploadComponent = FileUploadComponent_1 = class FileUploadComponent {
2619
2619
  this.cancelLabel = "Cancelar";
2620
2620
  this.successTooltip = "Arquivo anexado com sucesso";
2621
2621
  this.ariaLabelProgress = "Carregando arquivo";
2622
+ this.disabled = false;
2622
2623
  this.uploadHandler = new EventEmitter();
2623
2624
  this.removeFile = new EventEmitter();
2624
2625
  this.cancelUpload = new EventEmitter();
@@ -2777,6 +2778,9 @@ __decorate([
2777
2778
  __decorate([
2778
2779
  Input()
2779
2780
  ], FileUploadComponent.prototype, "formGroup", void 0);
2781
+ __decorate([
2782
+ Input()
2783
+ ], FileUploadComponent.prototype, "disabled", void 0);
2780
2784
  __decorate([
2781
2785
  Output()
2782
2786
  ], FileUploadComponent.prototype, "uploadHandler", void 0);
@@ -2801,7 +2805,7 @@ __decorate([
2801
2805
  FileUploadComponent = FileUploadComponent_1 = __decorate([
2802
2806
  Component({
2803
2807
  selector: "s-file-upload",
2804
- 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",
2808
+ 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",
2805
2809
  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}}"]
2806
2810
  })
2807
2811
  ], FileUploadComponent);
@@ -4086,7 +4090,8 @@ let TablePagingComponent = class TablePagingComponent {
4086
4090
  header: column.header,
4087
4091
  exportable: true,
4088
4092
  field: column.field,
4089
- separator: (_a = column.separator) !== null && _a !== void 0 ? _a : " - "
4093
+ separator: (_a = column.separator) !== null && _a !== void 0 ? _a : " - ",
4094
+ enumPrefix: column.enumPrefix
4090
4095
  };
4091
4096
  if (column.exportable === false) {
4092
4097
  exportColumn.exportable = false;
@@ -4102,11 +4107,11 @@ let TablePagingComponent = class TablePagingComponent {
4102
4107
  return exportColumn;
4103
4108
  });
4104
4109
  }
4105
- getCurrentPageRowsToExport() {
4106
- return this.mapColumnsTranslations(this.table.columns, this.table.value);
4110
+ getCurrentPageRowsToExport(columns) {
4111
+ return this.mapColumnsTranslations(columns, this.table.value);
4107
4112
  }
4108
- getSelectedRowsToExport() {
4109
- return this.mapColumnsTranslations(this.table.columns, this.table.selection);
4113
+ getSelectedRowsToExport(columns) {
4114
+ return this.mapColumnsTranslations(columns, this.table.selection);
4110
4115
  }
4111
4116
  mapColumnsTranslations(columns, rows) {
4112
4117
  const enumColumns = columns.filter(p => p.enumPrefix);
@@ -4116,9 +4121,23 @@ let TablePagingComponent = class TablePagingComponent {
4116
4121
  const newRow = Object.assign({}, row);
4117
4122
  for (let i = 0; i <= enumColumns.length - 1; i++) {
4118
4123
  const column = enumColumns[i];
4119
- const fieldName = column.field;
4120
- const columnData = row[fieldName];
4121
- newRow[fieldName] = this.translate.instant(column.enumPrefix + columnData.toString().toLowerCase());
4124
+ let fields = column.field;
4125
+ if (!Array.isArray(fields)) {
4126
+ fields = [fields];
4127
+ }
4128
+ fields.forEach((fieldName) => {
4129
+ const columnData = row[fieldName];
4130
+ if (!columnData)
4131
+ return;
4132
+ const enumValue = columnData.toString().toLowerCase();
4133
+ let translationKey = column.enumPrefix + enumValue;
4134
+ let translatedValue = this.translate.instant(translationKey);
4135
+ if (translationKey === translatedValue && enumValue.length > 1) {
4136
+ translationKey = column.enumPrefix + enumValue.substring(0, 1) + "_" + enumValue.substr(1);
4137
+ translatedValue = this.translate.instant(translationKey);
4138
+ }
4139
+ newRow[fieldName] = translatedValue;
4140
+ });
4122
4141
  }
4123
4142
  return newRow;
4124
4143
  });
@@ -4131,18 +4150,23 @@ let TablePagingComponent = class TablePagingComponent {
4131
4150
  }
4132
4151
  exportCurrentPage() {
4133
4152
  this.validateComponent();
4134
- ExportUtils.exportCSV(this.getColumnsToExport(), this.getCurrentPageRowsToExport(), undefined, this.getExportFileName());
4153
+ const columns = this.getColumnsToExport();
4154
+ const dataToExport = this.getCurrentPageRowsToExport(columns);
4155
+ ExportUtils.exportCSV(columns, dataToExport, undefined, this.getExportFileName());
4135
4156
  }
4136
4157
  exportSelectedRecords() {
4137
4158
  this.validateComponent();
4138
- ExportUtils.exportCSV(this.getColumnsToExport(), this.getSelectedRowsToExport(), undefined, this.getExportFileName());
4159
+ const columns = this.getColumnsToExport();
4160
+ const dataToExport = this.getSelectedRowsToExport(columns);
4161
+ ExportUtils.exportCSV(columns, dataToExport, undefined, this.getExportFileName());
4139
4162
  }
4140
4163
  exportAllRecords() {
4141
4164
  return __awaiter(this, void 0, void 0, function* () {
4142
4165
  this.validateComponent();
4143
4166
  const serverData = yield this.loadAllRecords();
4144
- const dataToExport = this.mapColumnsTranslations(this.table.columns, serverData);
4145
- ExportUtils.exportCSV(this.getColumnsToExport(), dataToExport, undefined, this.getExportFileName());
4167
+ const columns = this.getColumnsToExport();
4168
+ const dataToExport = this.mapColumnsTranslations(columns, serverData);
4169
+ ExportUtils.exportCSV(columns, dataToExport, undefined, this.getExportFileName());
4146
4170
  });
4147
4171
  }
4148
4172
  };