Skip to content
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

Merged
merged 13 commits into from
Aug 4, 2022
Merged

feat(select): options search #3091

merged 13 commits into from
Aug 4, 2022

Conversation

sashaqred
Copy link
Member

Please read and mark the following check list before creating a pull request:

Short description of what this resolves:

@sashaqred sashaqred self-assigned this Aug 2, 2022
@sashaqred sashaqred changed the title Feat/initial select search feat: initial select search Aug 2, 2022
@@ -1,4 +1,5 @@
<button
[hidden]="isOptionSearchInputAllowed"
Copy link
Member

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?

Copy link
Member Author

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;
Copy link
Member

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?

Copy link
Member Author

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;
Copy link
Member

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?

Copy link
Member Author

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.

@Tibing
Copy link
Member

Tibing commented Aug 3, 2022

Also, let's add tests

@Tibing Tibing changed the title feat: initial select search feat(select): options search Aug 4, 2022
@Tibing Tibing merged commit ff4f738 into master Aug 4, 2022
@Tibing Tibing deleted the feat/initial-select-search branch August 4, 2022 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants