-
Notifications
You must be signed in to change notification settings - Fork 7.8k
feat: [vben-tree]增加数据disabled #6343
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
base: main
Are you sure you want to change the base?
Conversation
|
WalkthroughA new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant TreeComponent
participant Node
User->>TreeComponent: Attempt to interact with Node
TreeComponent->>Node: Check isNodeDisabled
alt Node is disabled
TreeComponent-->>User: Ignore interaction, visually indicate disabled
else Node is enabled
TreeComponent->>Node: Proceed with selection/toggle
Node-->>TreeComponent: Update model/value
end
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/@core/ui-kit/shadcn-ui/src/ui/tree/tree.vue
(5 hunks)packages/@core/ui-kit/shadcn-ui/src/ui/tree/types.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: post-update (windows-latest)
- GitHub Check: post-update (ubuntu-latest)
🔇 Additional comments (6)
packages/@core/ui-kit/shadcn-ui/src/ui/tree/types.ts (1)
25-26
: LGTM!The addition of the optional
disabledField
property to theTreeProps
interface is well-structured and follows the existing pattern for field customization properties.packages/@core/ui-kit/shadcn-ui/src/ui/tree/tree.vue (5)
26-26
: LGTM!The prop definition with a sensible default value of
'disabled'
follows Vue best practices.
105-124
: Well-implemented disabled node filtering!The logic correctly filters out disabled nodes from the selection and ensures the model value stays synchronized. The approach of updating
modelValue
when disabled nodes are detected prevents inconsistent state.
128-136
: Consistent disabled node handling!The function correctly filters out disabled nodes before updating the model value, maintaining consistency with
updateTreeValue
.
174-176
: Good abstraction for disabled state checking!The helper function properly checks both the global disabled state and individual node disabled state.
182-185
: Comprehensive disabled state handling throughout the UI!The event handlers and UI bindings correctly:
- Prevent interactions with disabled nodes
- Apply appropriate visual styling for disabled state
- Stop event propagation to avoid unintended side effects
- Blur focus from disabled nodes
Also applies to: 257-264, 267-277, 305-316, 322-331
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Description
目前
VbenTree
不支持树形数据中的disabled属性来控制节点是否可选,解决 #6342const formDisabled = ref(false);
const formDisabled = ref(true);
Summary by CodeRabbit
New Features
Bug Fixes