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

Config provider #12991

Merged
merged 21 commits into from Nov 26, 2018

Conversation

Projects
None yet
5 participants
@zombieJ
Member

zombieJ commented Nov 6, 2018

Add a ConfigProvider for user to customize some global setting.

Currently let's add getPopupContainer first. prefixCls will be in another PR after this merged.

ref: #12985 #10855

zombieJ added some commits Nov 6, 2018

@zombieJ zombieJ requested review from yesmeck, afc163 and ilanus Nov 6, 2018

@@ -26,6 +26,8 @@ import { Layout, Menu, Breadcrumb, Icon, ConfigProvider } from 'antd';
const { Header, Content, Footer, Sider } = Layout;
const SubMenu = Menu.SubMenu;
// 代码中 ConfigProvider 仅用于官网示例修正使用,你的代码并不需要用到 setContainerRef, getPopupContainer 和 ConfigProvider。删除即可。
// `ConfigProvider` in sample is only for site demo fix usag, your real code needn't use setContainerRef, getPopupContainer & ConfigProvider. Just remove them.

This comment has been minimized.

@ztplz

ztplz Nov 6, 2018

Collaborator

usag => usage

@netlify

This comment has been minimized.

netlify bot commented Nov 6, 2018

Deploy preview for ant-design ready!

Built with commit 426eacd

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

zombieJ added some commits Nov 6, 2018

@@ -957,6 +957,7 @@ exports[`renders ./components/layout/demo/side.md correctly 1`] = `
class="ant-layout"
style="min-height:100vh"
>
<div />

This comment has been minimized.

@afc163

afc163 Nov 7, 2018

Member

这是啥

This comment has been minimized.

@zombieJ

zombieJ Nov 7, 2018

Member

menu/tooltip popup 的 container

@codecov

This comment has been minimized.

codecov bot commented Nov 7, 2018

Codecov Report

Merging #12991 into feature will decrease coverage by 0.04%.
The diff coverage is 92.5%.

Impacted file tree graph

@@             Coverage Diff             @@
##           feature   #12991      +/-   ##
===========================================
- Coverage    92.59%   92.54%   -0.05%     
===========================================
  Files          221      222       +1     
  Lines         5763     5793      +30     
  Branches      1661     1678      +17     
===========================================
+ Hits          5336     5361      +25     
- Misses         420      425       +5     
  Partials         7        7
Impacted Files Coverage Δ
components/index.tsx 100% <ø> (ø) ⬆️
components/dropdown/dropdown-button.tsx 100% <100%> (ø) ⬆️
components/select/index.tsx 93.44% <100%> (+0.33%) ⬆️
components/tooltip/index.tsx 96.25% <100%> (+0.09%) ⬆️
components/dropdown/dropdown.tsx 96.77% <100%> (+0.47%) ⬆️
components/time-picker/index.tsx 82.81% <100%> (+0.84%) ⬆️
components/tree-select/index.tsx 86.36% <100%> (+0.99%) ⬆️
components/cascader/index.tsx 97.22% <100%> (+0.04%) ⬆️
components/menu/index.tsx 93.91% <100%> (+0.1%) ⬆️
components/config-provider/index.tsx 50% <50%> (ø)
... and 4 more

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 72d08b3...426eacd. Read the comment docs.

zombieJ added some commits Nov 7, 2018

@zombieJ zombieJ changed the title from [WIP] Config provider to Config provider Nov 9, 2018

@zombieJ

This comment has been minimized.

Member

zombieJ commented Nov 9, 2018

Hi guy, help to review this. Thanks.
@afc163 @ilanus @ztplz @yesmeck

@afc163

This comment has been minimized.

Member

afc163 commented Nov 10, 2018

补个用例?

@afc163

This comment has been minimized.

Member

afc163 commented Nov 10, 2018

是不是可以加入 message.config 和 notification.config 的功能。

@zombieJ

This comment has been minimized.

Member

zombieJ commented Nov 10, 2018

@afc163 ,

  • __mocks__ 里把 rc-trigger 代理掉了。用例没效果。
  • 这个 PR 先搞个 getPopupContainer,其他的后续 PR 慢慢加。
## Usage
`ConfigProvider` takes use of [context](https://facebook.github.io/react/docs/context.html), a feature of React, to accomplish global effectiveness by wrapping the app only once.

This comment has been minimized.

@ilanus

ilanus Nov 12, 2018

Collaborator

This component provides a configuration to all React components underneath itself via the context API, In the render tree all components will have access to the provided config.

render() {
return (
<ConfigConsumer>
{this.renderCascader}

This comment has been minimized.

@ilanus

ilanus Nov 12, 2018

Collaborator

在哪里渲染 ()

@afc163 afc163 referenced this pull request Nov 20, 2018

Closed

Why not provide a way to set `global prefixCls ` #13210

0 of 1 task complete
@zombieJ

This comment has been minimized.

Member

zombieJ commented Nov 21, 2018

merged feature branch. Pls check.

@zombieJ zombieJ merged commit 9b49fb6 into feature Nov 26, 2018

16 of 19 checks passed

Codacy/PR Quality Review Not up to standards. This pull request quality could be better.
Details
codecov/patch 92.5% of diff hit (target 92.59%)
Details
codecov/project 92.54% (-0.05%) compared to 72d08b3
Details
ci/circleci: compile Your tests passed on CircleCI!
Details
ci/circleci: dist Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: setup Your tests passed on CircleCI!
Details
ci/circleci: test_dist Your tests passed on CircleCI!
Details
ci/circleci: test_dist_15 Your tests passed on CircleCI!
Details
ci/circleci: test_dom Your tests passed on CircleCI!
Details
ci/circleci: test_dom_15 Your tests passed on CircleCI!
Details
ci/circleci: test_es Your tests passed on CircleCI!
Details
ci/circleci: test_es_15 Your tests passed on CircleCI!
Details
ci/circleci: test_lib Your tests passed on CircleCI!
Details
ci/circleci: test_lib_15 Your tests passed on CircleCI!
Details
ci/circleci: test_node Your tests passed on CircleCI!
Details
ci/circleci: test_node_15 Your tests passed on CircleCI!
Details
deploy/netlify Deploy preview ready!
Details
security/snyk - package.json (paranoidjk) No new issues
Details

@zombieJ zombieJ deleted the configProvider branch Nov 26, 2018

zy410419243 added a commit to zy410419243/ant-design that referenced this pull request Nov 26, 2018

@ycjcl868

This comment has been minimized.

Member

ycjcl868 commented Dec 2, 2018

test cases need to add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment