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 visible to filterDropdown function #17614

Merged
merged 7 commits into from Sep 17, 2019

Conversation

sedx
Copy link
Contributor

@sedx sedx commented Jul 12, 2019

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

👻 What's the background?

In some cases in my project I need to get actual visibility status of table's filterDropdown component.

There are now easy way to get it, because it's render when table is mount and not only when column's filter shown.

So I need to use something to like this (ugly and markup dependent 🤦‍♂️):

    const { current: someElement } = elementRef;
    if (someElement.parentNode.parentNode.parentNode.offsetHeight === 0) {
      return;
    }
    someElement.focus();

To trigger focus when filterDropdown shown.

💡 Solution

Currently FilterMenu contains current visibility status, just pass it to filterDropdown.

📝 Changelog

Add yet another attribute to call of filterDropdown, which contain result of FilterMenu#getDropdownVisible() call

Also update doc of filterDropdown prop. Now it contains info that filterDropdown can accept function (in previous doc revision was only ReactNode) and add link to ts defenition of arguments of this function.

Language Changelog
🇺🇸 English Add visible attrbiute to argument of filterDropdown
🇨🇳 Chinese

☑️ Self Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

View rendered components/table/index.en-US.md
View rendered components/table/index.zh-CN.md

Copy link

@tests-checker tests-checker bot left a comment

Choose a reason for hiding this comment

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

Could you please add tests to make sure this change works as expected?

@sedx sedx changed the title Add visible to filterDropdown function feat: Add visible to filterDropdown function Jul 15, 2019
sedx added 2 commits July 16, 2019 11:10
# Conflicts:
#	components/table/__tests__/Table.filter.test.js
#	components/table/filterDropdown.tsx
@netlify
Copy link

netlify bot commented Aug 7, 2019

Deploy preview for ant-design ready!

Built with commit 2012834

https://deploy-preview-17614--ant-design.netlify.com

@buildsize
Copy link

buildsize bot commented Sep 10, 2019

File name Previous Size New Size Change
package-lock.json 851.16 KB 848.89 KB -2.27 KB (0%)

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.

None yet

3 participants