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

TreeViewList - expand search items #808

Merged
merged 4 commits into from
Jan 29, 2024

Conversation

syedsalehinipg
Copy link
Contributor

@syedsalehinipg syedsalehinipg commented Jan 25, 2024

Changes

This PR introduces the functionality which expands out the items in the tree which matches the search term.

  • A new flag has been added expandSearchTerm which can be used to control the use the functionality e.g when false items would not be expanded on search
  • When enabled the searchTerm is used to search through a tree structure and return an array of node IDs that match a given search term. This allows users to easily find and navigate to items in the tree.
  • The search is case-insensitive, meaning it will match nodes regardless of whether the search term is in upper case, lower case, or a mix.
  • If a child node matches the search term, the function ensures that its parent node is also included in the result so that the parent is also visible.

UI/UX

image

image

Testing notes

You can test by using the searchTerm input field in the controls of storybook.

Note: expandSearchTerm to control usage and also a reload is required when the flag is changed

Author checklist before assigning a reviewer

  • Reviewed my own code-diff.
  • Branch has been run in docker.
  • PR assigned to me or an appropriate delegate.
  • Relevant labels added to the PR.
  • Appropriate tests have been added.
  • Lint and test workflows pass.

@syedsalehinipg syedsalehinipg added the enhancement New feature or request label Jan 25, 2024
@syedsalehinipg syedsalehinipg self-assigned this Jan 25, 2024
@syedsalehinipg syedsalehinipg changed the title TreeViewList - expand search item TreeViewList - expand search items Jan 25, 2024
@m4manjesh m4manjesh self-requested a review January 26, 2024 13:01
Copy link
Contributor

@m4manjesh m4manjesh left a comment

Choose a reason for hiding this comment

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

Functionality looks good , a small suggestion to avoid disabling warnings.

src/TreeViewList/TreeViewList.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@m4manjesh m4manjesh left a comment

Choose a reason for hiding this comment

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

LGTM

@syedsalehinipg syedsalehinipg merged commit 044d397 into main Jan 29, 2024
3 checks passed
@syedsalehinipg syedsalehinipg deleted the enhancement/expand-tree-item-nodes-by-search branch January 29, 2024 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants