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: Image support getPopupContainer #26713

Merged
merged 18 commits into from
Oct 15, 2020
Merged

Conversation

rfreling
Copy link
Contributor

@rfreling rfreling commented Sep 12, 2020

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

Add getPreviewContainer to Image Preview

rc-image PR react-component/image#29

📝 Changelog

Language Changelog
🇺🇸 English Add getContainer to Image preview property
🇨🇳 Chinese Image 支持 preview.getContainer 属性用于指定预览对话框的容器。

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • 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

@rfreling rfreling changed the title Image | getPreviewContainer feat: Image | getPreviewContainer Sep 12, 2020
@ant-design-bot
Copy link
Contributor

ant-design-bot commented Sep 12, 2020

@ant-design-bot
Copy link
Contributor

ant-design-bot commented Sep 12, 2020

@rfreling
Copy link
Contributor Author

Note: dependent on react-component/image#29

@rfreling
Copy link
Contributor Author

rfreling commented Sep 22, 2020

👋 @shaodahong

After this suggestion: react-component/image#29 (comment)

The build fails because of this type conflict:

getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;


Which do you suggest?

(1) [ant-design] https://share.getcloudapp.com/z8uZN4Nr

or

(2) [react-component/Image] https://share.getcloudapp.com/Blu5rYgv

@codecov
Copy link

codecov bot commented Sep 23, 2020

Codecov Report

Merging #26713 into feature will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           feature    #26713   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          388       388           
  Lines         7396      7396           
  Branches      2072      2072           
=========================================
  Hits          7396      7396           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2788140...ea9857b. Read the comment docs.

@shaodahong
Copy link
Member

👋 @shaodahong

After this suggestion: react-component/image#29 (comment)

The build fails because of this type conflict:

getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;

Which do you suggest?

(1) [ant-design] https://share.getcloudapp.com/z8uZN4Nr

or

(2) [react-component/Image] https://share.getcloudapp.com/Blu5rYgv

https://github.com/react-component/util/blob/69046a6bb2a111cb1909bf5b6a661b27a846e0f5/src/PortalWrapper.js#L30

I don't find triggerNode, @zombieJ getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement; it's same getContainer ?

@zombieJ zombieJ changed the title feat: Image | getPreviewContainer feat: Image support getPopupContainer Sep 23, 2020
components/image/index.tsx Outdated Show resolved Hide resolved
@zombieJ
Copy link
Member

zombieJ commented Sep 23, 2020

Also need update doc.

@zombieJ
Copy link
Member

zombieJ commented Sep 24, 2020

/rebase

@rfreling
Copy link
Contributor Author

rfreling commented Sep 24, 2020

/rebase

@zombieJ Thanks for reviews. The build is failing because of the type conflict here: #26713 (comment)

Do you have a suggestion for how to handle before rebasing?

image

@zombieJ
Copy link
Member

zombieJ commented Sep 24, 2020

You can ref https://ant.design/components/modal-cn/#header. Preview use rc-dialog internal. It may no need pass triggerNode currently.

Copy link
Contributor Author

@rfreling rfreling left a comment

Choose a reason for hiding this comment

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

@zombieJ These suggested changes will fix the type conflict so that the build will pass.

I was following the patterns here which somehow passes the type check:

const { getPopupContainer: getContextPopupContainer, getPrefixCls, direction } = React.useContext(

getContainer={getContainer === undefined ? getContextPopupContainer : getContainer}

components/image/index.tsx Outdated Show resolved Hide resolved
components/image/index.tsx Outdated Show resolved Hide resolved
@zombieJ
Copy link
Member

zombieJ commented Sep 25, 2020

CI failed

@afc163
Copy link
Member

afc163 commented Oct 10, 2020

We should move this into preview: { getContainer: () => node } like https://github.com/ant-design/ant-design/pull/26915/files#diff-9c8ad9832b6e737e1c26715f227f1edcR28

Ignore getContextPopupContainer
Ignore getContextPopupContainer
@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 12, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit ea9857b:

Sandbox Source
antd reproduction template Configuration

@afc163
Copy link
Member

afc163 commented Oct 13, 2020

wait for react-component/image#34

@hengkx
Copy link
Member

hengkx commented Oct 14, 2020

@afc163
Copy link
Member

afc163 commented Oct 15, 2020

You have to upgrade rc-image to 4.0.0

@ant-design ant-design deleted a comment from rfreling Oct 15, 2020
@hengkx
Copy link
Member

hengkx commented Oct 15, 2020

Please check
image

@afc163
Copy link
Member

afc163 commented Oct 15, 2020

Please fill changelog part in PR.

@rfreling
Copy link
Contributor Author

Please fill changelog part in PR.

The Chinese is my best guess – will gladly accept edits :)

image

@afc163
Copy link
Member

afc163 commented Oct 15, 2020

The Chinese is my best guess – will gladly accept edits :)

You could leave chinese changelog to us. 😹

@afc163 afc163 merged commit 7d59890 into ant-design:feature Oct 15, 2020
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.

6 participants