Skip to content

Commit

Permalink
Merge pull request #14225 from pete-mcwilliams/#14223
Browse files Browse the repository at this point in the history
fix for option values of null and empty string (#14223)
  • Loading branch information
cetincakiroglu authored Dec 6, 2023
2 parents 9e9af34 + 945ed01 commit 5216781
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/app/components/dropdown/dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV
}

get isVisibleClearIcon(): boolean | undefined {
return this.modelValue() != null && ObjectUtils.isNotEmpty(this.modelValue()) && this.modelValue() !== '' && this.showClear && !this.disabled;
return this.modelValue() != null && this.hasSelectedOption() && this.showClear && !this.disabled;
}

get containerClass() {
Expand Down Expand Up @@ -1134,9 +1134,9 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV
return (
(this.optionGroupLabel
? index -
this.visibleOptions()
.slice(0, index)
.filter((option) => this.isOptionGroup(option)).length
this.visibleOptions()
.slice(0, index)
.filter((option) => this.isOptionGroup(option)).length
: index) + 1
);
}
Expand Down Expand Up @@ -1459,7 +1459,7 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV
}

hasSelectedOption() {
return ObjectUtils.isNotEmpty(this.modelValue());
return this.modelValue() !== undefined;
}

isValidSelectedOption(option) {
Expand Down Expand Up @@ -1487,8 +1487,8 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV
const matchedOptionIndex =
index < this.visibleOptions().length - 1
? this.visibleOptions()
.slice(index + 1)
.findIndex((option) => this.isValidOption(option))
.slice(index + 1)
.findIndex((option) => this.isValidOption(option))
: -1;
return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : index;
}
Expand Down Expand Up @@ -1666,8 +1666,8 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV
optionIndex =
optionIndex === -1
? this.visibleOptions()
.slice(0, this.focusedOptionIndex())
.findIndex((option) => this.isOptionMatched(option))
.slice(0, this.focusedOptionIndex())
.findIndex((option) => this.isOptionMatched(option))
: optionIndex + this.focusedOptionIndex();
} else {
optionIndex = this.visibleOptions().findIndex((option) => this.isOptionMatched(option));
Expand Down

1 comment on commit 5216781

@vercel
Copy link

@vercel vercel bot commented on 5216781 Dec 6, 2023

Choose a reason for hiding this comment

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

Deployment failed with the following error:

The value for maxDuration must be between 1 second and 10 seconds, in order to increase this limit upgrade your plan: https://vercel.com/pricing

Please sign in to comment.