Skip to content

Commit

Permalink
Merge pull request #14115 from primefaces/issue-14046
Browse files Browse the repository at this point in the history
Fixed #14046 - Fileupload | Unexpected disable behavior fix
  • Loading branch information
cetincakiroglu authored Nov 17, 2023
2 parents 0057be7 + 1993faa commit 666212c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/app/components/fileupload/fileupload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -743,15 +743,22 @@ export class FileUpload implements AfterViewInit, AfterContentInit, OnInit, OnDe
}

isFileLimitExceeded() {
if (this.fileLimit && this.fileLimit <= this.files.length + this.uploadedFileCount && this.focus) {
const isAutoMode = this.auto;
const totalFileCount = isAutoMode ? this.files.length : this.files.length + this.uploadedFileCount;

if (this.fileLimit && this.fileLimit <= totalFileCount && this.focus) {
this.focus = false;
}

return this.fileLimit && this.fileLimit < this.files.length + this.uploadedFileCount;
return this.fileLimit && this.fileLimit < totalFileCount;
}

isChooseDisabled() {
return this.fileLimit && this.fileLimit <= this.files.length + this.uploadedFileCount;
if (this.auto) {
return this.fileLimit && this.fileLimit <= this.files.length;
} else {
return this.fileLimit && this.fileLimit <= this.files.length + this.uploadedFileCount;
}
}

checkFileLimit() {
Expand Down

1 comment on commit 666212c

@vercel
Copy link

@vercel vercel bot commented on 666212c Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.