Skip to content

Commit

Permalink
Merge pull request #15436 from Kue2/master
Browse files Browse the repository at this point in the history
Fix: Fileupload and autocomplete problems with input transform function
  • Loading branch information
cetincakiroglu authored May 3, 2024
2 parents 18c05de + d1abb8e commit a1b42a9
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 @@ -1084,7 +1084,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 @@ -336,7 +336,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 a1b42a9

Please sign in to comment.