diff --git a/components/config-provider/__tests__/form.test.js b/components/config-provider/__tests__/form.test.js index f5617ce56d..76ba1b872b 100644 --- a/components/config-provider/__tests__/form.test.js +++ b/components/config-provider/__tests__/form.test.js @@ -91,4 +91,34 @@ describe('ConfigProvider.Form', () => { expect(wrapper).toMatchRenderedSnapshot(); }); }); + + describe('form colon', () => { + it('set colon false', async () => { + const wrapper = mount( + +
+ + + +
+
, + ); + + expect(wrapper.exists('.ant-form-item-no-colon')).toBeTruthy(); + }); + + it('set colon default', async () => { + const wrapper = mount( + +
+ + + +
+
, + ); + + expect(wrapper.exists('.ant-form-item-no-colon')).toBeFalsy(); + }); + }); }); diff --git a/components/config-provider/context.tsx b/components/config-provider/context.tsx index 71b0d6927e..8e9566d6bd 100644 --- a/components/config-provider/context.tsx +++ b/components/config-provider/context.tsx @@ -43,6 +43,7 @@ export interface ConfigConsumerProps { dropdownMatchSelectWidth?: boolean; form?: { requiredMark?: RequiredMark; + colon?: boolean; }; } diff --git a/components/config-provider/index.tsx b/components/config-provider/index.tsx index 7eb7d2e853..bb98b5164a 100644 --- a/components/config-provider/index.tsx +++ b/components/config-provider/index.tsx @@ -64,6 +64,7 @@ export interface ConfigProviderProps { form?: { validateMessages?: ValidateMessages; requiredMark?: RequiredMark; + colon?: boolean; }; input?: { autoComplete?: string; diff --git a/components/config-provider/index.zh-CN.md b/components/config-provider/index.zh-CN.md index 3d79fffa63..f5efcda6d7 100644 --- a/components/config-provider/index.zh-CN.md +++ b/components/config-provider/index.zh-CN.md @@ -44,7 +44,7 @@ export default () => ( | csp | 设置 [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) 配置 | { nonce: string } | - | | | direction | 设置文本展示方向。 [示例](#components-config-provider-demo-direction) | `ltr` \| `rtl` | `ltr` | | | dropdownMatchSelectWidth | 下拉菜单和选择器同宽。默认将设置 `min-width`,当值小于选择框宽度时会被忽略。`false` 时会关闭虚拟滚动 | boolean \| number | - | 4.3.0 | -| form | 设置 Form 组件的通用属性 | { validateMessages?: [ValidateMessages](/components/form/#validateMessages), requiredMark?: boolean \| `optional` } | - | requiredMark: 4.8.0 | +| form | 设置 Form 组件的通用属性 | { validateMessages?: [ValidateMessages](/components/form/#validateMessages), requiredMark?: boolean \| `optional`, colon?: boolean} | - | requiredMark: 4.8.0; colon: 4.18.0 | | getPopupContainer | 弹出框(Select, Tooltip, Menu 等等)渲染父节点,默认渲染到 body 上。 | function(triggerNode) | () => document.body | | | getTargetContainer | 配置 Affix、Anchor 滚动监听容器。 | () => HTMLElement | () => window | 4.2.0 | | iconPrefixCls | 设置图标统一样式前缀。注意:需要配合 `less` 变量 [@iconfont-css-prefix](https://github.com/ant-design/ant-design/blob/d943b85a523bdf181dabc12c928226f3b4b893de/components/style/themes/default.less#L106) 使