Skip to content

feat: update combo-box to account for 'create new' autocomplete use cases #854

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

Merged
merged 3 commits into from
May 17, 2021

Conversation

jake-bassett
Copy link
Contributor

Description

This adds the ability to "Create new" value using combo-box autocomplete.

@jake-bassett jake-bassett requested a review from a team as a code owner May 17, 2021 22:26
@codecov
Copy link

codecov bot commented May 17, 2021

Codecov Report

Merging #854 (1fddcaf) into main (a4e07b8) will decrease coverage by 0.00%.
The diff coverage is 89.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #854      +/-   ##
==========================================
- Coverage   85.47%   85.47%   -0.01%     
==========================================
  Files         796      797       +1     
  Lines       16310    16351      +41     
  Branches     1940     1955      +15     
==========================================
+ Hits        13941    13976      +35     
- Misses       2337     2343       +6     
  Partials       32       32              
Impacted Files Coverage Δ
...lities/dom/dom-element-scroll-into-view.service.ts 50.00% <50.00%> (ø)
...ts/components/src/combo-box/combo-box.component.ts 89.51% <92.00%> (-0.21%) ⬇️
projects/common/src/public-api.ts 100.00% <100.00%> (ø)
.../src/utilities/formatters/string/highlight.pipe.ts 90.47% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a4e07b8...1fddcaf. Read the comment docs.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

anandtiwary
anandtiwary previously approved these changes May 17, 2021
private setFilteredOptions(text?: string): void {
this.filteredOptions = (this.options ?? []).filter(option => text === undefined || option.text.includes(text));
this.filteredOptions = (this.options ?? []).filter(
option => text === undefined || option.text.toLowerCase().includes(text.toLowerCase())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if text is undefined then we don't need to call filter.

private setFilteredOptions(text?: string): void {
this.filteredOptions = (this.options ?? []).filter(option => text === undefined || option.text.includes(text));
this.filteredOptions = (this.options ?? []).filter(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call it searchText?

}

this.scrollIntoViewService.scrollIntoView(this.optionElements.get(this.highlightedOptionIndex)?.nativeElement);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Is it this easy to scroll and show a particular element in the view? I can use it at so many other places now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! Just this easy.

@github-actions

This comment has been minimized.

@jake-bassett jake-bassett merged commit 6fc0297 into main May 17, 2021
@jake-bassett jake-bassett deleted the autocomplete-component branch May 17, 2021 23:04
@github-actions
Copy link

Unit Test Results

    4 files  252 suites   14m 54s ⏱️
908 tests 908 ✔️ 0 💤 0 ❌
914 runs  914 ✔️ 0 💤 0 ❌

Results for commit 6fc0297.

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