Skip to content

Commit

Permalink
fix: highlight selected item
Browse files Browse the repository at this point in the history
  • Loading branch information
ert78gb committed Jul 2, 2018
1 parent 0b70a1b commit a660d86
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/app/lib/ngx-select/ngx-select.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
'ngx-select__item_active active': isOptionActive(option, choiceItem),
'ngx-select__item_disabled disabled': option.disabled
}"
(mouseenter)="optionActivate({
(mouseenter)="onMouseEnter({
activeOption: option,
filteredOptionList: optionsFiltered,
index: optionsFiltered.indexOf(option)
Expand All @@ -110,4 +110,4 @@
{{noResultsFound}}
</ng-template>

</div>
</div>
9 changes: 8 additions & 1 deletion src/app/lib/ngx-select/ngx-select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,13 +442,20 @@ export class NgxSelectComponent implements INgxSelectOptions, ControlValueAccess

/** @internal */
public optionActivate(navigated: INgxOptionNavigated): void {
if (this.autoActiveOnMouseEnter && (this.optionActive !== navigated.activeOption) &&
if ((this.optionActive !== navigated.activeOption) &&
(!navigated.activeOption || !navigated.activeOption.disabled)) {
this.optionActive = navigated.activeOption;
this.navigated.emit(navigated);
}
}

/** @internal */
public onMouseEnter(navigated: INgxOptionNavigated): void {
if (this.autoActiveOnMouseEnter) {
this.optionActivate(navigated);
}
}

private filterOptions(search: string, options: TSelectOption[], selectedOptions: NgxSelectOption[]): TSelectOption[] {
const regExp = new RegExp(escapeString(search), 'i'),
filterOption = (option: NgxSelectOption) => {
Expand Down

0 comments on commit a660d86

Please sign in to comment.