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

fix(components): [table] tooltipOptions.showAfter is not effective #13175

Merged
merged 8 commits into from
Nov 2, 2023

Conversation

xingyixiang
Copy link
Contributor

@xingyixiang xingyixiang commented Jun 12, 2023

Please make sure these boxes are checked before submitting your PR, thank you!

  • Make sure you follow contributing guide English | (中文 | Español | Français).
  • Make sure you are merging your commits to dev branch.
  • Add some descriptions and refer to relative issues for your PR.

Description

🤖 Generated by Copilot at bd69775

Add showAfter option for table tooltip and improve popper logic in util.ts. This allows users to customize the tooltip delay and fixes some bugs with the popper positioning and visibility.

Related Issue

Fixes #12564, #14678.

Explanation of Changes

🤖 Generated by Copilot at bd69775

  • Add showAfter option for table tooltip to delay popper appearance (link, link, link, link)
  • Define togglePopperVisible function to modify popper display style based on parameter (link)
  • Simplify onOpen and onClose handlers assignment from useDelayedToggle hook (link)
  • Add modifier to popper instance to initially hide popper if showAfter is enabled (link)
  • Call onOpen at the end of createTablePopper function to create and update popper instance and start delay timer (link)

@pull-request-triage
Copy link

👋 @xingyixiang, seems like this is your first time contribution to element-plus.

  • Please make sure that you have read our guidelines and code of conduct before making a contribution.
  • You can comment with /label Components:[component_name] to add a label for which component you are working on.
  • You may join our Discord for staying tuned.

@pull-request-triage pull-request-triage bot added 1st contribution Their very first contribution Needs Review labels Jun 12, 2023
@github-actions
Copy link

github-actions bot commented Jun 12, 2023

@github-actions
Copy link

Hello @xingyixiang, thank you for contributing to element-plus, please see our guideline to see how to make contribution

@btea
Copy link
Collaborator

btea commented Jun 14, 2023

Seems to be the same as #12578

@github-actions
Copy link

github-actions bot commented Jun 14, 2023

🧪 Playground Preview: https://element-plus.run/?pr=13175
Please comment the example via this playground if needed.

@xingyixiang
Copy link
Contributor Author

xingyixiang commented Jun 14, 2023

Playground

@btea btea requested a review from plainheart June 15, 2023 13:36
@xingyixiang
Copy link
Contributor Author

@btea No one review the code

@ryuhangyeong ryuhangyeong changed the title fix(components): [table]tooltipOptions.showAfter is not effective fix(components): [table] tooltipOptions.showAfter is not effective Jul 17, 2023
@ryuhangyeong
Copy link
Member

I'll take a look when I can afford it~

@PeiJM
Copy link

PeiJM commented Sep 23, 2023

还是无效啊?

@xingyixiang
Copy link
Contributor Author

@PeiJM 代码没合入,没人review

@btea btea requested review from a team and removed request for tolking, plainheart and ryuhangyeong October 28, 2023 10:00
@xingyixiang
Copy link
Contributor Author

@btea When can the code be incorporated?

@btea
Copy link
Collaborator

btea commented Nov 2, 2023

Thank you for your contribution. It looks good, let's merge it now.

@btea btea merged commit 6238ec8 into element-plus:dev Nov 2, 2023
10 checks passed
@xingyixiang
Copy link
Contributor Author

@btea Sorry, there is something wrong with this mr. After tooltipOptions.showAfter is set, the popper will be closed when the mouse is moved to the popper and then to the table cell. You can roll back this mr. I'll study how to modify it.

@xingyixiang
Copy link
Contributor Author

@btea 之前因为showAfter不生效,所以鼠标进入popper后,重新进入table的cell,会触发销毁removePopper。并重新走createTablePopper流程,此方法会立刻创建出一个新的popper并立刻展示,所以实际效果是再次移入table的cell不会关闭popper。现在showAfter生效,就需要一段时间才能重新展示。导致出现这个现象
(In the previous version, the showAfter command does not take effect. Therefore, after the cursor is moved to the popper and the cell of the table is re-entered, the removePopper will be destroyed. The createTablePopper process is used again. This method creates a new popper immediately and displays it immediately. Therefore, the actual effect is that the popper will not be closed when the cell is moved to the table again. Now that showAfter takes effect, it takes a while to redisplay it. Causes this phenomenon)

@element-bot element-bot mentioned this pull request Nov 3, 2023
3 tasks
tolking pushed a commit that referenced this pull request Nov 3, 2023
#14735)

Revert "fix(components): [table] tooltipOptions.showAfter is not effective (#13175)"

This reverts commit 6238ec8.
@btea
Copy link
Collaborator

btea commented Nov 4, 2023

Indeed, the reason is exactly as you said. Maybe we can add a flag, if showAfter is set, we can delay the popper from closing, and then close it if the creation is not triggered again in a short period of time.
What do you think? @xingyixiang @tolking

@xingyixiang
Copy link
Contributor Author

@btea @tolking
微信图片_20231104110732
Just delete removePopper?.(), I don't know if it has any other effects

@xingyixiang
Copy link
Contributor Author

@btea @tolking
#14741

consultation-applio pushed a commit to consultation-applio/element-plus that referenced this pull request Nov 10, 2023
…lement-plus#13175)

* fix(components): [table]
tooltipOptions.showAfter is not effective

* fix(components): [table]
tooltipOptions.showAfter is not effective

---------

Co-authored-by: btea <2356281422@qq.com>
consultation-applio pushed a commit to consultation-applio/element-plus that referenced this pull request Nov 10, 2023
element-plus#14735)

Revert "fix(components): [table] tooltipOptions.showAfter is not effective (element-plus#13175)"

This reverts commit 6238ec8.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Component] [table] table组件,tooltipOptions.showAfter不生效
5 participants