@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.
@@ -6233,6 +6233,7 @@ var ValidateErrors;
6233
6233
  (function (ValidateErrors) {
6234
6234
  ValidateErrors["MAX_FILE_SIZE"] = "MAX_FILE_SIZE";
6235
6235
  ValidateErrors["MAX_FILE_LIMIT"] = "MAX_FILE_LIMIT";
6236
+ ValidateErrors["MAX_COMBINED_FILE_SIZE"] = "MAX_COMBINED_FILE_SIZE";
6236
6237
  ValidateErrors["UNSUPPORTED_EXTENSION"] = "UNSUPPORTED_EXTENSION";
6237
6238
  })(ValidateErrors || (ValidateErrors = {}));
6238
6239
 
@@ -6320,6 +6321,14 @@ var FileUploadComponent = /** @class */ (function () {
6320
6321
  this.clearFileInput();
6321
6322
  return;
6322
6323
  }
6324
+ if (this.isFileCombinedSizeExceeded(files)) {
6325
+ this.validateErrors.emit({
6326
+ files: files,
6327
+ validation: ValidateErrors.MAX_COMBINED_FILE_SIZE,
6328
+ });
6329
+ this.clearFileInput();
6330
+ return;
6331
+ }
6323
6332
  try {
6324
6333
  for (var files_1 = __values(files), files_1_1 = files_1.next(); !files_1_1.done; files_1_1 = files_1.next()) {
6325
6334
  var file = files_1_1.value;
@@ -6388,6 +6397,14 @@ var FileUploadComponent = /** @class */ (function () {
6388
6397
  }
6389
6398
  return this.files.length + files.length > this.fileLimit;
6390
6399
  };
6400
+ FileUploadComponent.prototype.isFileCombinedSizeExceeded = function (files) {
6401
+ if (!this.maxCombinedFileSize) {
6402
+ return false;
6403
+ }
6404
+ var filesList = __spread(files, this.files);
6405
+ var combinedSize = filesList.reduce(function (combinedSize, file) { return combinedSize + file.size; }, 0);
6406
+ return combinedSize > this.maxCombinedFileSize;
6407
+ };
6391
6408
  FileUploadComponent.prototype.isFileSizeExceeded = function (file) {
6392
6409
  if (!this.maxFileSize) {
6393
6410
  return false;
@@ -6464,6 +6481,9 @@ var FileUploadComponent = /** @class */ (function () {
6464
6481
  __decorate([
6465
6482
  Input()
6466
6483
  ], FileUploadComponent.prototype, "maxFileSize", void 0);
6484
+ __decorate([
6485
+ Input()
6486
+ ], FileUploadComponent.prototype, "maxCombinedFileSize", void 0);
6467
6487
  __decorate([
6468
6488
  Input()
6469
6489
  ], FileUploadComponent.prototype, "fileLimit", void 0);