-
-
Notifications
You must be signed in to change notification settings - Fork 362
feat(SelectTree): add auto active value function #6691
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
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideIntroduces auto-activation of tree nodes in SelectTree by capturing a TreeView reference and invoking SetActiveItem when the bound value changes, removes the NET6_0 conditional wrapper around the EditorRequired attribute on Items, and revises sample usage and localization entries to reflect the new IsEditable parameter. Sequence diagram for auto-activation of tree node in SelectTreesequenceDiagram
participant SelectTree
participant TreeView
participant User as actor
User->>SelectTree: Change value (e.g., selects a node)
SelectTree->>SelectTree: OnChange(args)
SelectTree->>TreeView: SetActiveItem(Value)
TreeView->>TreeView: Activates node matching Value
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Pull Request Overview
This PR adds automatic active value functionality to the SelectTree component, enabling the TreeView to automatically highlight the selected item when the input value changes in editable mode. The changes enhance user experience by visually synchronizing the TreeView selection with the input value.
- Adds
@ref="_tv"to TreeView and calls_tv.SetActiveItem(Value)in OnChange method - Removes conditional NET6_0_OR_GREATER compilation for EditorRequired attribute
- Updates documentation to clarify editable mode behavior
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| SelectTree.razor.cs | Adds TreeView reference field and auto-active functionality in OnChange method |
| SelectTree.razor | Adds reference binding to TreeView component |
| zh-CN.json | Adds Chinese documentation for editable mode behavior |
| en-US.json | Adds English documentation for editable mode behavior |
| SelectTrees.razor | Updates demo section name and adds descriptive text |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
Hey there - I've reviewed your changes - here's some feedback:
- Consider initializing the active tree item on first render (e.g. in OnAfterRender) so the initial Value is highlighted without waiting for a ChangeEvent.
- You could make the TreeView reference nullable (
TreeView<TValue>?) instead of usingdefault!to explicitly handle its uninitialized state and avoid hidden null‐ref issues. - After renaming the DemoBlock Name to
IsEditable, please verify any related localization keys or anchors are also updated to stay in sync.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider initializing the active tree item on first render (e.g. in OnAfterRender) so the initial Value is highlighted without waiting for a ChangeEvent.
- You could make the TreeView reference nullable (`TreeView<TValue>?`) instead of using `default!` to explicitly handle its uninitialized state and avoid hidden null‐ref issues.
- After renaming the DemoBlock Name to `IsEditable`, please verify any related localization keys or anchors are also updated to stay in sync.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6691 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 739 739
Lines 31698 31706 +8
Branches 4462 4462
=========================================
+ Hits 31698 31706 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Link issues
fixes #6684
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Enable SelectTree to automatically set the active tree node when its bound value changes, remove obsolete conditional directive on the Items parameter, and refresh the sample demo accordingly
New Features:
Enhancements:
Documentation: