diff --git a/.prettierignore b/.prettierignore index 5676463006..329a7f4e28 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,8 @@ +**/*.png **/*.svg +CODEOWNERS +.dockerignore +Dockerfile.ui-test package.json .umi .umi-production @@ -17,6 +21,8 @@ yarn-error.log *.snap components/*/*.js components/*/*.jsx +components/*/*.md +docs/**/*.md .gitignore .npmignore .prettierignore diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 1796557dd9..12d134dc76 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -15,6 +15,42 @@ timeline: true --- +## 4.7.2 + +`2020-10-19` + +- 💄 Fix Layout.Sider `light` theme lost styles. [#27227](https://github.com/ant-design/ant-design/pull/27227) [@lingjieee](https://github.com/lingjieee) +- 💄 Fix TextArea wrapped with additional div when `showCount` is `false`, and pass `className` and `style` to outer wrapper when `showCount` is `true`. [#27216](https://github.com/ant-design/ant-design/pull/27216) +- 🐞 Fix Checkbox.Group TS2559 error. [#27231](https://github.com/ant-design/ant-design/pull/27231) + +## 4.7.1 + +`2020-10-18` + +- DatePicker + - 🐞 Fix DatePicker don't work correctly when `showTime` is `true` and `format` is function. [#27156](https://github.com/ant-design/ant-design/pull/27156) + - 💄 Fix DatePicker wrong animation direction when auto overflow. [#27101](https://github.com/ant-design/ant-design/pull/27101) +- Typography + - 💄 Fix Typography miss `pre` and `blockquote` style. [#27150](https://github.com/ant-design/ant-design/pull/27150) + - 🐞 Fix Typography.Link hover color. [#27119](https://github.com/ant-design/ant-design/pull/27119) + - 🐞 Fix Typography.Link hover color when type is danger. [#27104](https://github.com/ant-design/ant-design/pull/27104) +- 💄 Fix Descriptions `ant-descriptions-item-content` and add style `word-break:break-word;`. [#27195](https://github.com/ant-design/ant-design/pull/27195) [@WLyKan](https://github.com/WLyKan) +- 🐞 Fix clear Password value attribute in controlled mode. [#27191](https://github.com/ant-design/ant-design/pull/27191) +- 🐞 Optimize Notification width in small screen. [#27189](https://github.com/ant-design/ant-design/pull/27189) +- 🐞 Fix Cascader className duplicate. [#27187](https://github.com/ant-design/ant-design/pull/27187) [@huntdream](https://github.com/huntdream) +- 🐞 Fix the issue that the Drawer will trigger form submit. [#27175](https://github.com/ant-design/ant-design/pull/27175) +- 🐞 Fix Dropdown icon missing margin. [#27165](https://github.com/ant-design/ant-design/pull/27165) +- 💄 Fix Layout.Sider `collapsedWidth` cannot work without modifying `@menu-collapsed-width`. [#27154](https://github.com/ant-design/ant-design/pull/27154) +- 🐞 Fix Tabs `animated={true}` not working for panels. [#27145](https://github.com/ant-design/ant-design/pull/27145) +- 🐞 Fix Divider color when contains text. [#27134](https://github.com/ant-design/ant-design/pull/27134) +- 💄 Fix the cursor style when the Radio option is selected and disabled. [#27125](https://github.com/ant-design/ant-design/pull/27125) +- 🇪🇸 Add missing translations in es_ES. [#27079](https://github.com/ant-design/ant-design/pull/27079) [@gersongams](https://github.com/gersongams) +- RTL + - 💄 Optimize the style of Input.TextArea character count in RTL mode. [#27098](https://github.com/ant-design/ant-design/pull/27098) +- TypeScript + - 🤖 Button shape remove undeclared doc type. [#27159](https://github.com/ant-design/ant-design/pull/27159) + - 🤖 Add optional `rules` property into `FormListProps`. [#27164](https://github.com/ant-design/ant-design/pull/27164) [@huntdream](https://github.com/huntdream) + ## 4.7.0 `2020-10-10` @@ -35,7 +71,7 @@ timeline: true - 🆕 Table `sticky` now support `getContainer`. [#26973](https://github.com/ant-design/ant-design/pull/26973) - 🐞 Fix Table should not render dropdown filter icon when filterDropdown is `undefined`. [#27002](https://github.com/ant-design/ant-design/pull/27002) [@shangyilim](https://github.com/shangyilim) - Modal - - 🛠 Refactor Modal animation code so that it will remove all dom element when closed. [#26940](https://github.com/ant-design/ant-design/pull/26940) + - 🛠 Refactor Modal animation code so that it will remove all dom element by `destroyOnClose` when closed. [#26940](https://github.com/ant-design/ant-design/pull/26940) - 🆕 Modal add `modalRender` prop which can be used for draggable dialog. [#26507](https://github.com/ant-design/ant-design/pull/26507) [@jhoneybee](https://github.com/jhoneybee) - 🆕 Space add `split` prop. [#26948](https://github.com/ant-design/ant-design/pull/26948) - 🆕 Image `preview` prop now support `visible` and `onVisibleChange`. [#26915](https://github.com/ant-design/ant-design/pull/26915) diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 170aed71a9..49b78dd9fe 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -15,6 +15,42 @@ timeline: true --- +## 4.7.2 + +`2020-10-19` + +- 💄 修复 Layout.Sider `light` 主题失效问题。[#27227](https://github.com/ant-design/ant-design/pull/27227) [@lingjieee](https://github.com/lingjieee) +- 💄 修复 TextArea 没有设置 `showCount` 时仍然会包裹 div 的问题,同时解决 `showCount` 下 `className` 和 `style` 没有传递给最外层节点的问题。[#27216](https://github.com/ant-design/ant-design/pull/27216) +- 🐞 修复 Checkbox.Group TS2559 错误。[#27231](https://github.com/ant-design/ant-design/pull/27231) + +## 4.7.1 + +`2020-10-18` + +- DatePicker + - 🐞 修复 DatePicker `showTime` 为 `true` 并且 `format` 为一个函数时报错的问题。[#27156](https://github.com/ant-design/ant-design/pull/27156) + - 💄 修复 DatePicker 在下拉空间不足时的动画方向问题。[#27101](https://github.com/ant-design/ant-design/pull/27101) +- Typography + - 💄 修复 Typography 没有 `pre` 和 `blockquote` 样式的问题。[#27150](https://github.com/ant-design/ant-design/pull/27150) + - 🐞 修复 Typography.Link 悬浮颜色错误的问题。[#27119](https://github.com/ant-design/ant-design/pull/27119) + - 🐞 修复 Typography.Link 危险类型的悬浮颜色问题。[#27104](https://github.com/ant-design/ant-design/pull/27104) +- 💄 修复 Descriptions 组件的内容含有超长数字时无法换行的问题。[#27195](https://github.com/ant-design/ant-design/pull/27195) [@WLyKan](https://github.com/WLyKan) +- 🐞 修复 Password 在受控模式下未清除 `value` 属性的问题。[#27191](https://github.com/ant-design/ant-design/pull/27191) +- 🐞 修复 Notification 在小尺寸屏幕下的宽度问题。[#27189](https://github.com/ant-design/ant-design/pull/27189) +- 🐞 修复 Cascader 类名重复的问题。[#27187](https://github.com/ant-design/ant-design/pull/27187) [@huntdream](https://github.com/huntdream) +- 🐞 修复 Drawer 会触发 Form 提交事件的问题。[#27175](https://github.com/ant-design/ant-design/pull/27175) +- 🐞 修复 Dropdown 下拉菜单图标间距丢失的问题。[#27165](https://github.com/ant-design/ant-design/pull/27165) +- 💄 修复 Layout.Sider 指定 `collapsedWidth` 后侧边菜单部分宽度不对的问题。[#27154](https://github.com/ant-design/ant-design/pull/27154) +- 🐞 修复 Tabs `animated` 属性为 `true` 时未开启内容切换动画的问题。[#27145](https://github.com/ant-design/ant-design/pull/27145) +- 🐞 修复 Divider 带标题时的分割线颜色。[#27134](https://github.com/ant-design/ant-design/pull/27134) +- 💄 修复 Radio 选项选中并禁用时的鼠标样式。[#27125](https://github.com/ant-design/ant-design/pull/27125) +- 🇪🇸 为西班牙语 es_ES 中添加缺少的翻译。[#27079](https://github.com/ant-design/ant-design/pull/27079) [@gerongams](https://github.com/gersongams) +- RTL + - 💄 优化 Input.TextArea 字数提示在 RTL 模式下的样式。[#27098](https://github.com/ant-design/ant-design/pull/27098) +- TypeScript + - 🤖 Button `shape` 移除文档中未声明的类型。[#27159](https://github.com/ant-design/ant-design/pull/27159) + - 🤖 修复 Form.List `rules` 属性缺失的问题。[#27164](https://github.com/ant-design/ant-design/pull/27164) [@huntdream](https://github.com/huntdream) + ## 4.7.0 `2020-10-10` @@ -35,7 +71,7 @@ timeline: true - 🆕 Table `sticky` 支持 `getContainer` 以指定滚动容器。[#26973](https://github.com/ant-design/ant-design/pull/26973) - 🐞 修复 Table `column.filterDropdown` 为 `undefined` 时依旧会展示筛选菜单的问题。[#27002](https://github.com/ant-design/ant-design/pull/27002) [@shangyilim](https://github.com/shangyilim) - Modal - - 🛠 重构 Modal 组件动画,现在关闭时将完全清理相关 Dom 节点。[#26940](https://github.com/ant-design/ant-design/pull/26940) + - 🛠 重构 Modal 组件动画,现在 `destroyOnClose` 关闭时将完全清理相关 Dom 节点。[#26940](https://github.com/ant-design/ant-design/pull/26940) - 🆕 Modal 新增 `modalRender` 属性,支持可拖拽的对话框。[#26507](https://github.com/ant-design/ant-design/pull/26507) [@jhoneybee](https://github.com/jhoneybee) - 🆕 Space 增加 `split` 属性以支持分隔符间隔。[#26948](https://github.com/ant-design/ant-design/pull/26948) - 🆕 Image `preview` 属性扩展支持 `visible` 和 `onVisibleChange`。[#26915](https://github.com/ant-design/ant-design/pull/26915) @@ -326,7 +362,7 @@ timeline: true - 🐞 修复 Form 垂直布局时 Form.Item 设置 `labelCol={{ offset: number }}` 不生效的问题。[#25713](https://github.com/ant-design/ant-design/pull/25713) [@zhangchen915](https://github.com/zhangchen915) - ⌨️ Form 错误信息节点增加属性 `role="alert"` 以增强可访问性。[#25735](https://github.com/ant-design/ant-design/pull/25735) [@AlbertAZ1992](https://github.com/AlbertAZ1992) - Calendar - - 🐞 修复 Calendar 组件的 `validRange` 导致 `disabledDate` 不生效 。[#25626](https://github.com/ant-design/ant-design/pull/25626) [@zhangchen915](https://github.com/zhangchen915) + - 🐞 修复 Calendar 组件的 `validRange` 导致 `disabledDate` 不生效。[#25626](https://github.com/ant-design/ant-design/pull/25626) [@zhangchen915](https://github.com/zhangchen915) - 🐞 修复 Calendar `validRange` 对月份下拉菜单不生效的问题。[#25626](https://github.com/ant-design/ant-design/pull/25626) [@zhangchen915](https://github.com/zhangchen915) - 🐞 修复 Table `getCheckboxProps` 返回的 `indeterminate` 不生效。[#25649](https://github.com/ant-design/ant-design/pull/25649) - 🐞 修复 Select 清除按钮在 Form.Item 下位置不对的问题。[#25728](https://github.com/ant-design/ant-design/pull/25728) diff --git a/README-zh_CN.md b/README-zh_CN.md index 51359f393a..c0f5062967 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -10,7 +10,6 @@ 一套企业级 UI 设计语言和 React 组件库。 - [![CircleCI status][circleci-image]][circleci-url] [![CI status][github-action-image]][github-action-url] [![codecov][codecov-image]][codecov-url] [![NPM version][npm-image]][npm-url] [![NPM downloads][download-image]][download-url] [![david deps][david-image]][david-url] [![david devDeps][david-dev-image]][david-dev-url] [![Total alerts][lgtm-image]][lgtm-url] [![FOSSA Status][fossa-image]][fossa-url] [![Issues need help][help-wanted-image]][help-wanted-url] diff --git a/SECURITY.md b/SECURITY.md index f707d665a7..b751c38389 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,8 +2,7 @@ ## Supported Versions -Use this section to tell people about which versions of your project are -currently being supported with security updates. +Use this section to tell people about which versions of your project are currently being supported with security updates. | Version | Supported | | ------- | ------------------ | @@ -14,6 +13,4 @@ currently being supported with security updates. Use this section to tell people how to report a vulnerability. -Tell them where to go, how often they can expect to get an update on a -reported vulnerability, what to expect if the vulnerability is accepted or -declined, etc. +Tell them where to go, how often they can expect to get an update on a reported vulnerability, what to expect if the vulnerability is accepted or declined, etc. diff --git a/components/_util/hooks/useCombinedRefs.tsx b/components/_util/hooks/useCombinedRefs.tsx new file mode 100644 index 0000000000..d1ea07de2e --- /dev/null +++ b/components/_util/hooks/useCombinedRefs.tsx @@ -0,0 +1,19 @@ +import * as React from 'react'; +import { fillRef } from '../ref'; + +function useCombinedRefs( + ...refs: Array | ((instance: T) => void) | null> +) { + const targetRef = React.useRef(); + + React.useEffect(() => { + refs.forEach(ref => { + if (!ref) return; + fillRef(ref, targetRef.current); + }); + }, [refs]); + + return targetRef; +} + +export default useCombinedRefs; diff --git a/components/affix/index.en-US.md b/components/affix/index.en-US.md index 0d308594cb..9d903b4753 100644 --- a/components/affix/index.en-US.md +++ b/components/affix/index.en-US.md @@ -19,8 +19,8 @@ Please note that Affix should not cover other content on the page, especially wh | --- | --- | --- | --- | | offsetBottom | Offset from the bottom of the viewport (in pixels) | number | - | | offsetTop | Offset from the top of the viewport (in pixels) | number | 0 | -| onChange | Callback for when Affix state is changed | function(affixed) | - | | target | Specifies the scrollable area DOM node | () => HTMLElement | () => window | +| onChange | Callback for when Affix state is changed | function(affixed) | - | **Note:** Children of `Affix` must not have the property `position: absolute`, but you can set `position: absolute` on `Affix` itself: diff --git a/components/affix/index.zh-CN.md b/components/affix/index.zh-CN.md index e053e73c27..22bdacd8bb 100644 --- a/components/affix/index.zh-CN.md +++ b/components/affix/index.zh-CN.md @@ -20,8 +20,8 @@ cover: https://gw.alipayobjects.com/zos/alicdn/tX6-md4H6/Affix.svg | --- | --- | --- | --- | | offsetBottom | 距离窗口底部达到指定偏移量后触发 | number | - | | offsetTop | 距离窗口顶部达到指定偏移量后触发 | number | - | -| onChange | 固定状态改变时触发的回调函数 | function(affixed) | - | | target | 设置 `Affix` 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 | () => HTMLElement | () => window | +| onChange | 固定状态改变时触发的回调函数 | function(affixed) | - | **注意:**`Affix` 内的元素不要使用绝对定位,如需要绝对定位的效果,可以直接设置 `Affix` 为绝对定位: diff --git a/components/alert/index.en-US.md b/components/alert/index.en-US.md index 9ebb00e6c1..52383692b9 100644 --- a/components/alert/index.en-US.md +++ b/components/alert/index.en-US.md @@ -29,7 +29,7 @@ Alert component for feedback. ### Alert.ErrorBoundary -| Property | Description | Type | Default | Version | -| ----------- | -------------------------------- | --------- | ----------------- | ------- | -| message | Custom error message to show | ReactNode | {{ error }} | | -| description | Custom error description to show | ReactNode | {{ error stack }} | | +| Property | Description | Type | Default | Version | +| --- | --- | --- | --- | --- | +| description | Custom error description to show | ReactNode | {{ error stack }} | | +| message | Custom error message to show | ReactNode | {{ error }} | | diff --git a/components/alert/index.zh-CN.md b/components/alert/index.zh-CN.md index c5fb7294cb..cbbd7288fd 100644 --- a/components/alert/index.zh-CN.md +++ b/components/alert/index.zh-CN.md @@ -32,5 +32,5 @@ cover: https://gw.alipayobjects.com/zos/alicdn/8emPa3fjl/Alert.svg | 参数 | 说明 | 类型 | 默认值 | 版本 | | --- | --- | --- | --- | --- | -| message | 自定义错误标题,如果未指定会展示原生报错信息 | ReactNode | {{ error }} | | | description | 自定义错误内容,如果未指定会展示报错堆栈 | ReactNode | {{ error stack }} | | +| message | 自定义错误标题,如果未指定会展示原生报错信息 | ReactNode | {{ error }} | | diff --git a/components/anchor/index.en-US.md b/components/anchor/index.en-US.md index ce30064c3c..88cd56c209 100644 --- a/components/anchor/index.en-US.md +++ b/components/anchor/index.en-US.md @@ -21,17 +21,17 @@ For displaying anchor hyperlinks on page and jumping between them. | affix | Fixed mode of Anchor | boolean | true | | | bounds | Bounding distance of anchor area | number | 5 | | | getContainer | Scrolling container | () => HTMLElement | () => window | | +| getCurrentAnchor | Customize the anchor highlight | () => string | - | | | offsetTop | Pixels to offset from top when calculating position of scroll | number | 0 | | | showInkInFixed | Whether show ink-balls when `affix={false}` | boolean | false | | -| onClick | Set the handler to handle `click` event | function(e: Event, link: Object) | - | | -| getCurrentAnchor | Customize the anchor highlight | () => string | - | | | targetOffset | Anchor scroll offset, default as `offsetTop`, [example](#components-anchor-demo-targetOffset) | number | - | | | onChange | Listening for anchor link change | (currentActiveLink: string) => void | | | +| onClick | Set the handler to handle `click` event | function(e: Event, link: Object) | - | | ### Link Props -| Property | Description | Type | Default | Version | -| -------- | ----------------------------------------- | --------- | ------- | ------- | -| href | The target of hyperlink | string | | | -| title | The content of hyperlink | ReactNode | | | -| target | Specifies where to display the linked URL | string | | | +| Property | Description | Type | Default | Version | +| --- | --- | --- | --- | --- | +| href | The target of hyperlink | string | | | +| target | Specifies where to display the linked URL | string | | | +| title | The content of hyperlink | ReactNode | | | diff --git a/components/anchor/index.zh-CN.md b/components/anchor/index.zh-CN.md index fdd0b2bfc7..e23d113489 100644 --- a/components/anchor/index.zh-CN.md +++ b/components/anchor/index.zh-CN.md @@ -22,17 +22,17 @@ cover: https://gw.alipayobjects.com/zos/alicdn/_1-C1JwsC/Anchor.svg | affix | 固定模式 | boolean | true | | | bounds | 锚点区域边界 | number | 5 | | | getContainer | 指定滚动的容器 | () => HTMLElement | () => window | | +| getCurrentAnchor | 自定义高亮的锚点 | () => string | - | | | offsetTop | 距离窗口顶部达到指定偏移量后触发 | number | | | | showInkInFixed | `affix={false}` 时是否显示小圆点 | boolean | false | | -| onClick | `click` 事件的 handler | function(e: Event, link: Object) | - | | -| getCurrentAnchor | 自定义高亮的锚点 | () => string | - | | | targetOffset | 锚点滚动偏移量,默认与 offsetTop 相同,[例子](#components-anchor-demo-targetOffset) | number | - | | | onChange | 监听锚点链接改变 | (currentActiveLink: string) => void | - | | +| onClick | `click` 事件的 handler | function(e: Event, link: Object) | - | | ### Link Props -| 成员 | 说明 | 类型 | 默认值 | 版本 | -| ------ | -------------------------------- | --------- | ------ | ---- | -| href | 锚点链接 | string | - | | -| title | 文字内容 | ReactNode | - | | -| target | 该属性指定在何处显示链接的资源。 | string | - | | +| 成员 | 说明 | 类型 | 默认值 | 版本 | +| --- | --- | --- | --- | --- | +| href | 锚点链接 | string | - | | +| target | 该属性指定在何处显示链接的资源。 | string | - | | +| title | 文字内容 | ReactNode | - | | diff --git a/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap b/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap index 13886be425..da9038498e 100644 --- a/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap +++ b/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap @@ -147,23 +147,19 @@ exports[`renders ./components/auto-complete/demo/custom.md correctly 1`] = ` -
- -
, + The autoSize property applies to textarea nodes, and only the height changes automatically. In addition, autoSize can be set to an object, specifying the minimum number of rows and the maximum number of rows. The autoSize property applies to textarea nodes, and only the height changes automatically. In addition, autoSize can be set to an object, specifying the minimum number of rows and the maximum number of rows. + , ] `; diff --git a/components/input/__tests__/__snapshots__/textarea.test.js.snap b/components/input/__tests__/__snapshots__/textarea.test.js.snap index a8c15bcc7c..313529a898 100644 --- a/components/input/__tests__/__snapshots__/textarea.test.js.snap +++ b/components/input/__tests__/__snapshots__/textarea.test.js.snap @@ -1,315 +1,271 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`TextArea allowClear should change type when click 1`] = ` -
- - - - - - -
-`; - -exports[`TextArea allowClear should change type when click 2`] = ` -
- - + + + + +`; + +exports[`TextArea allowClear should change type when click 2`] = ` +