Skip to content

Commit

Permalink
Fixed #14145 - Refactor condition for clear icon
Browse files Browse the repository at this point in the history
  • Loading branch information
cetincakiroglu committed Nov 17, 2023
1 parent 1e476bf commit 2f9ce2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app/components/multiselect/multiselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export class MultiSelectItem {
</ng-container>
<ng-container *ngTemplateOutlet="selectedItemsTemplate; context: { $implicit: modelValue(), removeChip: removeOption.bind(this) }"></ng-container>
</div>
<ng-container *ngIf="modelValue() != null && filled && !disabled && showClear">
<ng-container *ngIf="isVisibleClearIcon">
<TimesIcon *ngIf="!clearIconTemplate" [styleClass]="'p-multiselect-clear-icon'" (click)="clear($event)" [attr.data-pc-section]="'clearicon'" [attr.aria-hidden]="true" />
<span *ngIf="clearIconTemplate" class="p-multiselect-clear-icon" (click)="clear($event)" [attr.data-pc-section]="'clearicon'" [attr.aria-hidden]="true">
<ng-template *ngTemplateOutlet="clearIconTemplate"></ng-template>
Expand Down Expand Up @@ -1003,7 +1003,7 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft
}

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

get toggleAllAriaLabel() {
Expand Down

0 comments on commit 2f9ce2c

Please sign in to comment.