-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat(Ellipsis): add onEllipsis callback to Ellipsis component #6893
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: master
Are you sure you want to change the base?
Conversation
📝 Walkthrough""" Walkthrough本次变更为 Ellipsis 组件新增了一个 Changes
Sequence Diagram(s)sequenceDiagram
participant User as 用户
participant Ellipsis as Ellipsis组件
participant App as 应用/回调
User->>Ellipsis: 点击展开/收起链接
Ellipsis->>App: 触发 onEllipsis(ellipsis, event)
App-->>User: 响应(如提示、处理等)
Poem
""" 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
✨ Finishing Touches
🧪 Generate Unit Tests
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: 3
🔭 Outside diff range comments (2)
src/components/ellipsis/ellipsis.tsx (2)
43-52
: 缺少 onEllipsis 属性的解构在 props 解构中缺少
onEllipsis
属性,导致该回调无法在组件中使用。const { content, direction, rows, expandText, collapseText, stopPropagationForActionButtons, onContentClick, defaultExpanded, + onEllipsis, } = props
60-84
: 缺少 onEllipsis 回调的调用在展开和收起的点击处理函数中需要调用
onEllipsis
回调,否则该功能无法工作。const expandNode = expandText ? withStopPropagation( stopPropagationForActionButtons, <a - onClick={() => { + onClick={(e) => { setExpanded(true) + onEllipsis?.(true, e) }} > {expandText} </a> ) : null const collapseNode = collapseText ? withStopPropagation( stopPropagationForActionButtons, <a - onClick={() => { + onClick={(e) => { setExpanded(false) + onEllipsis?.(false, e) }} > {collapseText} </a> ) : null
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/components/ellipsis/demos/demo1.tsx
(1 hunks)src/components/ellipsis/ellipsis.tsx
(1 hunks)src/components/ellipsis/index.en.md
(1 hunks)src/components/ellipsis/index.zh.md
(1 hunks)src/components/ellipsis/tests/ellipsis.test.tsx
(1 hunks)
🔇 Additional comments (2)
src/components/ellipsis/ellipsis.tsx (1)
23-26
: onEllipsis 属性定义正确类型定义看起来合理,callback 接收 ellipsis 状态和鼠标事件参数。
src/components/ellipsis/tests/ellipsis.test.tsx (1)
106-124
: 测试用例结构良好测试用例正确验证了
onEllipsis
回调的预期行为。一旦组件实现中添加了回调调用,此测试应该能正常通过。
commit: |
41e03ba
to
13219d1
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6893 +/- ##
=======================================
Coverage 92.79% 92.80%
=======================================
Files 336 336
Lines 7235 7237 +2
Branches 1818 1782 -36
=======================================
+ Hits 6714 6716 +2
- Misses 485 513 +28
+ Partials 36 8 -28 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
13219d1
to
388a13a
Compare
Summary by CodeRabbit