Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Fileupload and autocomplete problems with input transform function #15436

Merged
merged 2 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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