Skip to content

Commit

Permalink
fix(module:select): activate first item or first selected item (#6148)
Browse files Browse the repository at this point in the history
close #6041
  • Loading branch information
yangjunhan authored Dec 7, 2020
1 parent 13f2281 commit a456c93
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions components/select/select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,8 @@ export class NzSelectComponent implements ControlValueAccessor, OnInit, AfterVie
this.activatedValue = matchedItem.nzValue;
}
}
if (
this.listOfValue.length !== 0 &&
listOfContainerItem.findIndex(item => this.compareWith(item.nzValue, this.activatedValue)) === -1
) {
const activatedItem = listOfContainerItem.find(item => this.compareWith(item.nzValue, this.listOfValue[0])) || listOfContainerItem[0];
this.activatedValue = (activatedItem && activatedItem.nzValue) || null;
}
const activatedItem = listOfContainerItem.find(item => this.compareWith(item.nzValue, this.listOfValue[0])) || listOfContainerItem[0];
this.activatedValue = (activatedItem && activatedItem.nzValue) || null;
let listOfGroupLabel: Array<string | TemplateRef<NzSafeAny> | null> = [];
if (this.isReactiveDriven) {
listOfGroupLabel = [...new Set(this.nzOptions.filter(o => o.groupLabel).map(o => o.groupLabel!))];
Expand Down

0 comments on commit a456c93

Please sign in to comment.