Skip to content

Commit

Permalink
Fix primefaces#15332 | Fileupload and autocomplete: problems with inp…
Browse files Browse the repository at this point in the history
…ut transform function
  • Loading branch information
mtarantinoRly committed May 2, 2024
1 parent 950d6d3 commit 39f3d47
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/app/components/autocomplete/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ export class AutoComplete implements AfterViewChecked, AfterContentInit, OnDestr
* Maximum number of character allows in the input field.
* @group Props
*/
@Input({ transform: numberAttribute }) maxlength: number | undefined;
@Input({ transform: (value: unknown) => numberAttribute(value, null) }) maxlength: number | undefined;
/**
* Name of the input element.
* @group Props
Expand Down Expand Up @@ -1078,7 +1078,10 @@ export class AutoComplete implements AfterViewChecked, AfterContentInit, OnDestr
clearTimeout(this.searchTimeout);
}

let query = event.target.value.split('').slice(0, this.maxlength).join('');
let query = event.target.value;
if (this.maxlength !== null) {
query = query.split('').slice(0, this.maxlength).join('');
}

if (!this.multiple && !this.forceSelection) {
this.updateModel(query);
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/fileupload/fileupload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ export class FileUpload implements AfterViewInit, AfterContentInit, OnInit, OnDe
* Maximum number of files that can be uploaded.
* @group Props
*/
@Input({ transform: numberAttribute }) fileLimit: number | undefined;
@Input({ transform: (value: unknown) => numberAttribute(value, null) }) fileLimit: number | undefined;
/**
* Style class of the upload button.
* @group Props
Expand Down

0 comments on commit 39f3d47

Please sign in to comment.