@seniorsistemas/angular-components 17.8.11 → 17.8.12

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.
@@ -6379,6 +6379,7 @@
6379
6379
  (function (ValidateErrors) {
6380
6380
  ValidateErrors["MAX_FILE_SIZE"] = "MAX_FILE_SIZE";
6381
6381
  ValidateErrors["MAX_FILE_LIMIT"] = "MAX_FILE_LIMIT";
6382
+ ValidateErrors["MAX_COMBINED_FILE_SIZE"] = "MAX_COMBINED_FILE_SIZE";
6382
6383
  ValidateErrors["UNSUPPORTED_EXTENSION"] = "UNSUPPORTED_EXTENSION";
6383
6384
  })(exports.ValidateErrors || (exports.ValidateErrors = {}));
6384
6385
 
@@ -6466,6 +6467,14 @@
6466
6467
  this.clearFileInput();
6467
6468
  return;
6468
6469
  }
6470
+ if (this.isFileCombinedSizeExceeded(files)) {
6471
+ this.validateErrors.emit({
6472
+ files: files,
6473
+ validation: exports.ValidateErrors.MAX_COMBINED_FILE_SIZE,
6474
+ });
6475
+ this.clearFileInput();
6476
+ return;
6477
+ }
6469
6478
  try {
6470
6479
  for (var files_1 = __values(files), files_1_1 = files_1.next(); !files_1_1.done; files_1_1 = files_1.next()) {
6471
6480
  var file = files_1_1.value;
@@ -6534,6 +6543,14 @@
6534
6543
  }
6535
6544
  return this.files.length + files.length > this.fileLimit;
6536
6545
  };
6546
+ FileUploadComponent.prototype.isFileCombinedSizeExceeded = function (files) {
6547
+ if (!this.maxCombinedFileSize) {
6548
+ return false;
6549
+ }
6550
+ var filesList = __spread(files, this.files);
6551
+ var combinedSize = filesList.reduce(function (combinedSize, file) { return combinedSize + file.size; }, 0);
6552
+ return combinedSize > this.maxCombinedFileSize;
6553
+ };
6537
6554
  FileUploadComponent.prototype.isFileSizeExceeded = function (file) {
6538
6555
  if (!this.maxFileSize) {
6539
6556
  return false;
@@ -6610,6 +6627,9 @@
6610
6627
  __decorate([
6611
6628
  core.Input()
6612
6629
  ], FileUploadComponent.prototype, "maxFileSize", void 0);
6630
+ __decorate([
6631
+ core.Input()
6632
+ ], FileUploadComponent.prototype, "maxCombinedFileSize", void 0);
6613
6633
  __decorate([
6614
6634
  core.Input()
6615
6635
  ], FileUploadComponent.prototype, "fileLimit", void 0);