diff --git a/.circleci/config.yml b/.circleci/config.yml
index 0372834b02..33dfb660fd 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -10,13 +10,6 @@ references:
attach_workspace:
at: ~/ant-design
- install_react: &install_react
- run: REACT=15 ./scripts/install-react.sh
-
- react_15: &react_15
- environment:
- REACT: 15
-
react_16: &react_16
environment:
REACT: 16
@@ -51,21 +44,6 @@ references:
- test_node:
requires:
- setup
- - test_dist_15:
- requires:
- - dist
- - test_lib_15:
- requires:
- - compile
- - test_es_15:
- requires:
- - compile
- - test_dom_15:
- requires:
- - setup
- - test_node_15:
- requires:
- - setup
jobs:
setup:
@@ -169,60 +147,6 @@ jobs:
- *attach_workspace
- run: npm run test-node -- -w 1
- test_dist_15:
- <<: *container_config
- <<: *react_15
- steps:
- - checkout
- - *attach_workspace
- - *install_react
- - run:
- command: npm test -- -w 1 -u
- environment:
- LIB_DIR: dist
-
- test_lib_15:
- <<: *container_config
- <<: *react_15
- steps:
- - checkout
- - *attach_workspace
- - *install_react
- - run:
- command: npm test -- -w 1 -u
- environment:
- LIB_DIR: lib
-
- test_es_15:
- <<: *container_config
- <<: *react_15
- steps:
- - checkout
- - *attach_workspace
- - *install_react
- - run:
- command: npm test -- -w 1 -u
- environment:
- LIB_DIR: es
-
- test_dom_15:
- <<: *container_config
- <<: *react_15
- steps:
- - checkout
- - *attach_workspace
- - *install_react
- - run: npm test -- -w 1 -u
-
- test_node_15:
- <<: *container_config
- <<: *react_15
- steps:
- - checkout
- - *attach_workspace
- - *install_react
- - run: npm run test-node -- -w 1 -u
-
workflows:
version: 2
build_test:
diff --git a/.travis.yml b/.travis.yml
index 1254d66280..30d62bdbb2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,19 +13,11 @@ matrix:
fast_finish: true
include:
- env: TEST_TYPE=lint
- - env: REACT=16 TEST_TYPE=test:dist
- - env: REACT=16 TEST_TYPE=test:lib
- - env: REACT=16 TEST_TYPE=test:es
- - env: REACT=16 TEST_TYPE=test:dom
- - env: REACT=16 TEST_TYPE=test:node
- - env: REACT=15 TEST_TYPE=test:dist
- - env: REACT=15 TEST_TYPE=test:lib
- - env: REACT=15 TEST_TYPE=test:es
- - env: REACT=15 TEST_TYPE=test:dom
- - env: REACT=15 TEST_TYPE=test:node
-
-before_script:
- - scripts/install-react.sh
+ - env: TEST_TYPE=test:dist
+ - env: TEST_TYPE=test:lib
+ - env: TEST_TYPE=test:es
+ - env: TEST_TYPE=test:dom
+ - env: TEST_TYPE=test:node
script:
- scripts/travis-script.sh
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 2d77d20ca5..260d7b3ca0 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -33,21 +33,6 @@ jobs:
node-react@16:
REACT: 16
TEST_TYPE: test:node
- dist-react@15:
- REACT: 15
- TEST_TYPE: test:dist
- lib-react@15:
- REACT: 15
- TEST_TYPE: test:lib
- es-react@15:
- REACT: 15
- TEST_TYPE: test:es
- dom-react@15:
- REACT: 15
- TEST_TYPE: test:dom
- node-react@15:
- REACT: 15
- TEST_TYPE: test:node
steps:
- checkout: self
fetchDepth: 1
@@ -57,8 +42,6 @@ jobs:
versionSpec: '10.x'
- script: npm install
displayName: install
- - script: scripts/install-react.sh
- displayName: install-react
- script: scripts/travis-script.sh
displayName: test
- task: PublishBuildArtifacts@1
diff --git a/components/_util/__tests__/util.test.js b/components/_util/__tests__/util.test.js
index 2f581d8089..a7a263b3b2 100644
--- a/components/_util/__tests__/util.test.js
+++ b/components/_util/__tests__/util.test.js
@@ -179,9 +179,6 @@ describe('Test utils function', () => {
});
it('should not throw when no children', () => {
- if (process.env.REACT === '15') {
- return;
- }
expect(() => mount()).not.toThrow();
});
});
diff --git a/components/button/__tests__/index.test.js b/components/button/__tests__/index.test.js
index 4dea37683c..d9cd11a56b 100644
--- a/components/button/__tests__/index.test.js
+++ b/components/button/__tests__/index.test.js
@@ -11,9 +11,6 @@ describe('Button', () => {
});
it('mount correctly', () => {
- if (process.env.REACT === '15') {
- return;
- }
expect(() => renderer.create()).not.toThrow();
});
diff --git a/components/comment/__tests__/__snapshots__/demo.test.js.snap b/components/comment/__tests__/__snapshots__/demo.test.js.snap
index b006039407..e20b6d6e68 100644
--- a/components/comment/__tests__/__snapshots__/demo.test.js.snap
+++ b/components/comment/__tests__/__snapshots__/demo.test.js.snap
@@ -150,46 +150,38 @@ exports[`renders ./components/comment/demo/editor.md correctly 1`] = `
>
diff --git a/components/config-provider/__tests__/__snapshots__/components.test.js.snap b/components/config-provider/__tests__/__snapshots__/components.test.js.snap
index abe53c9504..1986963508 100644
--- a/components/config-provider/__tests__/__snapshots__/components.test.js.snap
+++ b/components/config-provider/__tests__/__snapshots__/components.test.js.snap
@@ -7067,28 +7067,19 @@ exports[`ConfigProvider components Form configProvider 1`] = `
class="config-form config-form-horizontal"
>
@@ -7100,28 +7091,19 @@ exports[`ConfigProvider components Form normal 1`] = `
class="ant-form ant-form-horizontal"
>
@@ -7133,28 +7115,19 @@ exports[`ConfigProvider components Form prefixCls 1`] = `
class="prefix-Form prefix-Form-horizontal"
>
diff --git a/components/config-provider/index.en-US.md b/components/config-provider/index.en-US.md
index 199fa0d8e5..87567c02ca 100644
--- a/components/config-provider/index.en-US.md
+++ b/components/config-provider/index.en-US.md
@@ -39,6 +39,7 @@ Some component use dynamic style to support wave effect. You can config `csp` pr
| --- | --- | --- | --- |
| autoInsertSpaceInButton | Set `false` to remove space between 2 chinese characters on Button | boolean | true |
| csp | Set [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) config | { nonce: string } | - |
+| form | Set Form common props | { validateMessages?: [ValidateMessages](/components/form/#validateMessages) } | - |
| renderEmpty | set empty content of components. Ref [Empty](/components/empty/) | Function(componentName: string): ReactNode | - |
| getPopupContainer | to set the container of the popup element. The default is to create a `div` element in `body`. | Function(triggerNode) | `() => document.body` |
| prefixCls | set prefix class | string | ant |
diff --git a/components/config-provider/index.tsx b/components/config-provider/index.tsx
index ca9e600782..75a81f3490 100644
--- a/components/config-provider/index.tsx
+++ b/components/config-provider/index.tsx
@@ -1,6 +1,6 @@
import * as React from 'react';
-import createReactContext from '@ant-design/create-react-context';
-
+import { FormProvider as RcFormProvider } from 'rc-field-form';
+import { ValidateMessages } from 'rc-field-form/lib/interface';
import defaultRenderEmpty, { RenderEmptyHandler } from './renderEmpty';
export { RenderEmptyHandler };
@@ -34,9 +34,12 @@ export interface ConfigProviderProps {
renderEmpty?: RenderEmptyHandler;
csp?: CSPConfig;
autoInsertSpaceInButton?: boolean;
+ form?: {
+ validateMessages?: ValidateMessages;
+ };
}
-const ConfigContext = createReactContext
({
+export const ConfigContext = React.createContext({
// We provide a default function for Context without provider
getPrefixCls: (suffixCls: string, customizePrefixCls?: string) => {
if (customizePrefixCls) return customizePrefixCls;
@@ -59,7 +62,14 @@ class ConfigProvider extends React.Component {
};
renderProvider = (context: ConfigConsumerProps) => {
- const { children, getPopupContainer, renderEmpty, csp, autoInsertSpaceInButton } = this.props;
+ const {
+ children,
+ getPopupContainer,
+ renderEmpty,
+ csp,
+ autoInsertSpaceInButton,
+ form,
+ } = this.props;
const config: ConfigConsumerProps = {
...context,
@@ -75,7 +85,16 @@ class ConfigProvider extends React.Component {
config.renderEmpty = renderEmpty;
}
- return {children};
+ let childNode = children;
+
+ // Additional Form provider
+ if (form && form.validateMessages) {
+ childNode = (
+ {children}
+ );
+ }
+
+ return {childNode};
};
render() {
diff --git a/components/config-provider/index.zh-CN.md b/components/config-provider/index.zh-CN.md
index f387a1d12d..cc57bb9ea6 100644
--- a/components/config-provider/index.zh-CN.md
+++ b/components/config-provider/index.zh-CN.md
@@ -40,6 +40,7 @@ return (
| --- | --- | --- | --- |
| autoInsertSpaceInButton | 设置为 `false` 时,移除按钮中 2 个汉字之间的空格 | boolean | true |
| csp | 设置 [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) 配置 | { nonce: string } | - |
+| form | 设置 Form 组件的通用属性 | { validateMessages?: [ValidateMessages](/components/form/#validateMessages) } | - |
| renderEmpty | 自定义组件空状态。参考 [空状态](/components/empty/) | Function(componentName: string): ReactNode | - |
| getPopupContainer | 弹出框(Select, Tooltip, Menu 等等)渲染父节点,默认渲染到 body 上。 | Function(triggerNode) | () => document.body |
| prefixCls | 设置统一样式前缀 | string | ant |
diff --git a/components/drawer/demo/form-in-drawer.md b/components/drawer/demo/form-in-drawer.md
index 34945afac5..0fb661c640 100644
--- a/components/drawer/demo/form-in-drawer.md
+++ b/components/drawer/demo/form-in-drawer.md
@@ -34,7 +34,6 @@ class DrawerForm extends React.Component {
};
render() {
- const { getFieldDecorator } = this.props.form;
return (