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

feat: add toggle callback to Ellipsis component #6576

Conversation

damonyoungcc
Copy link
Collaborator

@damonyoungcc damonyoungcc commented Mar 21, 2024

close #6570

Copy link
Contributor

PR preview has been successfully built and deployed to https://antd-mobile-preview-pr-6576.surge.sh

Copy link

codecov bot commented Mar 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.34%. Comparing base (937f845) to head (04d4353).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6576   +/-   ##
=======================================
  Coverage   92.34%   92.34%           
=======================================
  Files         318      318           
  Lines        6910     6912    +2     
  Branches     1729     1731    +2     
=======================================
+ Hits         6381     6383    +2     
  Misses        493      493           
  Partials       36       36           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@damonyoungcc
Copy link
Collaborator Author

这里我只是先发出来讨论一下,感觉用toggle这个名字不太好

  1. 或者加上受控的方案,用onChange
  2. 或者参考arco,增加onEllipsisNodeClickonCollapseNodeClick

@@ -21,6 +21,10 @@ export type EllipsisProps = {
stopPropagationForActionButtons?: PropagationEvent[]
onContentClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void
defaultExpanded?: boolean
toggle?: (
Copy link
Member

Choose a reason for hiding this comment

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

Could we use onEllipsis instead. It's same as the antd API:
https://ant.design/components/typography-cn#api

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indeed, the design of onEllipsis in antd is more reasonable. The correct logic is to trigger onEllipsis based on whether the text is ellipsized or not. I'll continue working on it.

@zombieJ
Copy link
Member

zombieJ commented Apr 1, 2024

Why close?

1 similar comment
@zombieJ
Copy link
Member

zombieJ commented Apr 1, 2024

Why close?

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.

Ellipsis 组件添加展开折叠的回调函数
2 participants