-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat(select): options search #3091
Conversation
@@ -1,4 +1,5 @@ | |||
<button | |||
[hidden]="isOptionSearchInputAllowed" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is it hidden? why not *ngIf?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just simpler. Nebular subscribes to some button events like focus. And with *ngIf
we should implement unsubscription and resubscription mechanisms. Looks too complicated for now
@@ -849,7 +862,7 @@ export class NbSelectComponent | |||
return this.selectionModel.map((option: NbOptionComponent) => option.content).join(', '); | |||
} | |||
|
|||
return this.selectionModel[0].content; | |||
return this.selectionModel[0]?.content; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Earlier selectionView
variable was used in the button only when something was selected. Now it is used in optionSearchInput
all the time
@@ -927,6 +950,10 @@ export class NbSelectComponent | |||
if (this.isOpen) { | |||
this.ref.detach(); | |||
this.cd.markForCheck(); | |||
this.selectClose.emit(); | |||
|
|||
this.optionSearchInput.nativeElement.value = this.selectionView; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't we use FormControl for optionSearchInput?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FormControl
adds some complexity to updating search input value when something in select is updated. Probably should be improved, but for now, I think it's not bad.
Also, let's add tests |
Please read and mark the following check list before creating a pull request:
Short description of what this resolves: