Merge pull request #31186 from ant-design/master-to-merge-feature

chore: sync master into feature
This commit is contained in:
afc163 2021-06-30 11:25:20 +08:00 committed by GitHub
commit 24deedf0f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 428 additions and 294 deletions

View File

@ -2,18 +2,19 @@ name: Verify Files modify
on:
pull_request_target:
types: [opened, edited, reopened, synchronize, ready_for_review]
types: [opened, edited, synchronize, ready_for_review]
jobs:
verify:
runs-on: ubuntu-latest
steps:
- name: verify-version
uses: actions-cool/verify-files-modify@v1.1.1
uses: actions-cool/verify-files-modify@v1.2.2
with:
forbid-paths: '.github/, scripts/'
forbid-files: 'CHANGELOG.zh-CN.md, CHANGELOG.en-US.md, LICENSE'
skip-verify-authority: 'write'
assignees: 'afc163, zombieJ, yesmeck, shaodahong, xrkffgg'
assignees: 'afc163, zombieJ, xrkffgg'
comment: |
Hi @${{ github.event.pull_request.user.login }}. Thanks for your contribution. The path `.github/` or `scripts/` is only maintained by team members. This current PR will be closed and team members will help on this.
Hi @${{ github.event.pull_request.user.login }}. Thanks for your contribution. The path `.github/` or `scripts/` and `CHANGELOG` `package.json` is only maintained by team members. This current PR will be closed and team members will help on this.
close: true

View File

@ -15,6 +15,32 @@ timeline: true
---
## 4.16.6
`2021-06-29`
- 🐞 Fix Tree loading status not been restored when `loadData` throw error. [#31170](https://github.com/ant-design/ant-design/pull/31170)
- ⚡️ Optimize Progress animation CPU usage. [#31128](https://github.com/ant-design/ant-design/pull/31128) [@stygian-desolator](https://github.com/stygian-desolator)
- 🐞 Fix Popover arrow cannot show correct color. [#31127](https://github.com/ant-design/ant-design/pull/31127) [@A113n1003](https://github.com/A113n1003)
## 4.16.5
`2021-06-23`
- 🐞 Fix Menu to import `@ant-design/icons` icon directly to reduce bundle size without tree shaking. [#31011](https://github.com/ant-design/ant-design/pull/31011)
- 🐞 Fix Menu with overflow indicator popup do not follow current theme. [#31043](https://github.com/ant-design/ant-design/pull/31043)
- 🐞 Fix Table styles not using `@{table-prefix-cls}` less variable. [#30983](https://github.com/ant-design/ant-design/pull/30983)
- 🐞 Fix Input.Password hover border color in Form validation. [#30999](https://github.com/ant-design/ant-design/pull/30999)
- 🐞 Fix Space with wrap takes additional negative margin style. [#31000](https://github.com/ant-design/ant-design/pull/31000)
- 🐞 Fix Typography warning for non-boolean attribute when set `italic` property. [#31004](https://github.com/ant-design/ant-design/pull/31004)
- 🐞 Fix Badge not passing markup validation. [#31042](https://github.com/ant-design/ant-design/pull/31042) [@conwnet](https://github.com/conwnet)
## 4.16.4
`2021-06-23`
- Broken version, don't use it.
## 4.16.3
`2021-06-14`

View File

@ -15,6 +15,30 @@ timeline: true
---
## 4.16.6
- 🐞 修复 Tree `loadData` 失败后节点 `loading` 效果没有重置的问题。[#31170](https://github.com/ant-design/ant-design/pull/31170)
- ⚡️ 优化 Progress 动画性能,显著降低 CPU 使用率。[#31128](https://github.com/ant-design/ant-design/pull/31128) [@stygian-desolator](https://github.com/stygian-desolator)
- 🐞 修复 Popover 箭头颜色和内容不匹配的问题。[#31127](https://github.com/ant-design/ant-design/pull/31127) [@A113n1003](https://github.com/A113n1003)
## 4.16.5
`2021-06-23`
- 🐞 修复 Menu 直接导入 `@ant-design/icons` 的方式以减少不使用 Tree Shaking 的打包尺寸。[#31011](https://github.com/ant-design/ant-design/pull/31011)
- 🐞 修复 Menu 过长省略弹层没有跟随 `theme` 配置的问题。[#31043](https://github.com/ant-design/ant-design/pull/31043)
- 🐞 修复 Table 某处样式代码没有使用 `@{table-prefix-cls}` less 变量可能导致样式覆盖失效的问题。[#30983](https://github.com/ant-design/ant-design/pull/30983)
- 🐞 修复 Input.Password 校验失败时的 hover 边框色。[#30999](https://github.com/ant-design/ant-design/pull/30999)
- 🐞 修复 Space 设置 `wrap` 时额外设置了负 `margin` 的样式问题。[#31000](https://github.com/ant-design/ant-design/pull/31000)
- 🐞 修复 Typography 配置 `italic` 时会警告不是一个合法 DOM 属性的问题。[#31004](https://github.com/ant-design/ant-design/pull/31004)
- 🐞 修复 Badge 没有通过 html 标签嵌套校验的问题。[#31042](https://github.com/ant-design/ant-design/pull/31042) [@conwnet](https://github.com/conwnet)
## 4.16.4
`2021-06-23`
- npm 发布出问题了,这个版本无法使用。
## 4.16.3
`2021-06-14`

View File

@ -40,11 +40,11 @@ Array [
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
1
</p>
</span>
</span>
</sup>
</span>

View File

@ -20,14 +20,14 @@ function UnitNumber({ prefixCls, value, current, offset = 0 }: UnitNumberProps)
}
return (
<p
<span
style={style}
className={classNames(`${prefixCls}-only-unit`, {
current,
})}
>
{value}
</p>
</span>
);
}

View File

@ -18,11 +18,11 @@ exports[`renders ./components/badge/demo/basic.md correctly 1`] = `
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
5
</p>
</span>
</span>
</sup>
</span>
@ -94,11 +94,11 @@ exports[`renders ./components/badge/demo/change.md correctly 1`] = `
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
5
</p>
</span>
</span>
</sup>
</span>
@ -568,11 +568,11 @@ exports[`renders ./components/badge/demo/link.md correctly 1`] = `
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
5
</p>
</span>
</span>
</sup>
</span>
@ -617,21 +617,21 @@ exports[`renders ./components/badge/demo/no-wrapper.md correctly 1`] = `
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
2
</p>
</span>
</span>
<span
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
5
</p>
</span>
</span>
</sup>
</span>
@ -684,11 +684,11 @@ exports[`renders ./components/badge/demo/no-wrapper.md correctly 1`] = `
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
4
</p>
</span>
</span>
</sup>
</span>
@ -730,11 +730,11 @@ exports[`renders ./components/badge/demo/offset.md correctly 1`] = `
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
5
</p>
</span>
</span>
</sup>
</span>
@ -758,21 +758,21 @@ exports[`renders ./components/badge/demo/overflow.md correctly 1`] = `
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
9
</p>
</span>
</span>
<span
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
9
</p>
</span>
</span>
</sup>
</span>
@ -1033,11 +1033,11 @@ Array [
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
5
</p>
</span>
</span>
</sup>
</span>,
@ -1057,11 +1057,11 @@ Array [
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
5
</p>
</span>
</span>
</sup>
</span>,
@ -1206,11 +1206,11 @@ exports[`renders ./components/badge/demo/title.md correctly 1`] = `
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
5
</p>
</span>
</span>
</sup>
</span>
@ -1230,21 +1230,21 @@ exports[`renders ./components/badge/demo/title.md correctly 1`] = `
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
-
</p>
</span>
</span>
<span
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
5
</p>
</span>
</span>
</sup>
</span>

View File

@ -50,31 +50,31 @@ exports[`Badge render correct with negative number 1`] = `
class="ant-scroll-number-only"
style="transition: none;"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
-
</p>
</span>
</span>
<span
class="ant-scroll-number-only"
style="transition: none;"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
1
</p>
</span>
</span>
<span
class="ant-scroll-number-only"
style="transition: none;"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
0
</p>
</span>
</span>
</sup>
</span>
@ -90,31 +90,31 @@ exports[`Badge render correct with negative number 1`] = `
class="ant-scroll-number-only"
style="transition: none;"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
-
</p>
</span>
</span>
<span
class="ant-scroll-number-only"
style="transition: none;"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
1
</p>
</span>
</span>
<span
class="ant-scroll-number-only"
style="transition: none;"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
0
</p>
</span>
</span>
</sup>
</span>
@ -147,11 +147,11 @@ exports[`Badge rtl render component should be rendered correctly in RTL directio
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
5
</p>
</span>
</span>
</sup>
</span>
@ -171,11 +171,11 @@ exports[`Badge should be compatible with borderColor style 1`] = `
class="ant-scroll-number-only"
style="transition: none;"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
4
</p>
</span>
</span>
</sup>
</span>
@ -194,81 +194,81 @@ exports[`Badge should render when count is changed 1`] = `
class="ant-scroll-number-only"
style="transition: none;"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
1
</p>
</span>
</span>
<span
class="ant-scroll-number-only"
style="transform: translateY(-100%);"
>
<p
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: -900%; left: 0px;"
>
0
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: -800%; left: 0px;"
>
1
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: -700%; left: 0px;"
>
2
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: -600%; left: 0px;"
>
3
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: -500%; left: 0px;"
>
4
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: -400%; left: 0px;"
>
5
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: -300%; left: 0px;"
>
6
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: -200%; left: 0px;"
>
7
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: -100%; left: 0px;"
>
8
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit current"
>
9
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: 100%; left: 0px;"
>
0
</p>
</span>
</span>
</sup>
</span>
@ -287,81 +287,81 @@ exports[`Badge should render when count is changed 2`] = `
class="ant-scroll-number-only"
style="transition: none;"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
1
</p>
</span>
</span>
<span
class="ant-scroll-number-only"
style="transform: translateY(-100%);"
>
<p
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: -900%; left: 0px;"
>
1
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: -800%; left: 0px;"
>
2
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: -700%; left: 0px;"
>
3
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: -600%; left: 0px;"
>
4
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: -500%; left: 0px;"
>
5
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: -400%; left: 0px;"
>
6
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: -300%; left: 0px;"
>
7
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: -200%; left: 0px;"
>
8
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: -100%; left: 0px;"
>
9
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit current"
>
0
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: 100%; left: 0px;"
>
1
</p>
</span>
</span>
</sup>
</span>
@ -380,22 +380,22 @@ exports[`Badge should render when count is changed 3`] = `
class="ant-scroll-number-only"
style="transition: none;"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
1
</p>
</span>
</span>
<span
class="ant-scroll-number-only"
style="transition: none;"
>
<p
<span
class="ant-scroll-number-only-unit current"
style=""
>
1
</p>
</span>
</span>
</sup>
</span>
@ -428,21 +428,21 @@ exports[`Badge should render when count is changed 5`] = `
class="ant-scroll-number-only"
style="transition: none;"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
1
</p>
</span>
</span>
<span
class="ant-scroll-number-only"
style="transition: none;"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
0
</p>
</span>
</span>
</sup>
</span>
@ -461,71 +461,71 @@ exports[`Badge should render when count is changed 6`] = `
class="ant-scroll-number-only"
style="transform: translateY(100%);"
>
<p
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: -100%; left: 0px;"
>
9
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit current"
>
0
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: 100%; left: 0px;"
>
1
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: 200%; left: 0px;"
>
2
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: 300%; left: 0px;"
>
3
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: 400%; left: 0px;"
>
4
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: 500%; left: 0px;"
>
5
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: 600%; left: 0px;"
>
6
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: 700%; left: 0px;"
>
7
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: 800%; left: 0px;"
>
8
</p>
<p
</span>
<span
class="ant-scroll-number-only-unit"
style="position: absolute; top: 900%; left: 0px;"
>
9
</p>
</span>
</span>
</sup>
</span>

View File

@ -819,11 +819,11 @@ exports[`ConfigProvider components Badge configProvider 1`] = `
class="config-scroll-number-only"
style="transition:none"
>
<p
<span
class="config-scroll-number-only-unit current"
>
5
</p>
</span>
</span>
</sup>
</span>
@ -854,11 +854,11 @@ exports[`ConfigProvider components Badge configProvider componentSize large 1`]
class="config-scroll-number-only"
style="transition:none"
>
<p
<span
class="config-scroll-number-only-unit current"
>
5
</p>
</span>
</span>
</sup>
</span>
@ -889,11 +889,11 @@ exports[`ConfigProvider components Badge configProvider componentSize middle 1`]
class="config-scroll-number-only"
style="transition:none"
>
<p
<span
class="config-scroll-number-only-unit current"
>
5
</p>
</span>
</span>
</sup>
</span>
@ -924,11 +924,11 @@ exports[`ConfigProvider components Badge configProvider virtual and dropdownMatc
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
5
</p>
</span>
</span>
</sup>
</span>
@ -959,11 +959,11 @@ exports[`ConfigProvider components Badge normal 1`] = `
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
5
</p>
</span>
</span>
</sup>
</span>
@ -994,11 +994,11 @@ exports[`ConfigProvider components Badge prefixCls 1`] = `
class="prefix-scroll-number-only"
style="transition:none"
>
<p
<span
class="prefix-scroll-number-only-unit current"
>
5
</p>
</span>
</span>
</sup>
</span>

View File

@ -240,8 +240,8 @@ Provide linkage between forms. If a sub form with `name` prop update, it will au
| getFieldValue | Get the value by the field name | (name: [NamePath](#NamePath)) => any | |
| isFieldsTouched | Check if fields have been operated. Check if all fields is touched when `allTouched` is `true` | (nameList?: [NamePath](#NamePath)\[], allTouched?: boolean) => boolean | |
| isFieldTouched | Check if a field has been operated | (name: [NamePath](#NamePath)) => boolean | |
| isFieldValidating | Check fields if is in validating | (name: [NamePath](#NamePath)) => boolean | |
| resetFields | Reset fields to `initialValues` | (fields?: [NamePath](#NamePath)\[]) => void | |
| isFieldValidating | Check field if is in validating | (name: [NamePath](#NamePath)) => boolean | |
| resetFields | Reset fields to `initialValues` | (fields?: [FieldData](#FieldData)\[]) => void | |
| scrollToField | Scroll to field position | (name: [NamePath](#NamePath), options: \[[ScrollOptions](https://github.com/stipsan/scroll-into-view-if-needed/tree/ece40bd9143f48caf4b99503425ecb16b0ad8249#options)]) => void | |
| setFields | Set fields status | (fields: [FieldData](#FieldData)\[]) => void | |
| setFieldsValue | Set fields value | (values) => void | |

View File

@ -239,8 +239,8 @@ Form.List 渲染表单相关操作函数。
| getFieldValue | 获取对应字段名的值 | (name: [NamePath](#NamePath)) => any | |
| isFieldsTouched | 检查一组字段是否被用户操作过,`allTouched` 为 `true` 时检查是否所有字段都被操作过 | (nameList?: [NamePath](#NamePath)\[], allTouched?: boolean) => boolean | |
| isFieldTouched | 检查对应字段是否被用户操作过 | (name: [NamePath](#NamePath)) => boolean | |
| isFieldValidating | 检查一组字段是否正在校验 | (name: [NamePath](#NamePath)) => boolean | |
| resetFields | 重置一组字段到 `initialValues` | (fields?: [NamePath](#NamePath)\[]) => void | |
| isFieldValidating | 检查对应字段是否正在校验 | (name: [NamePath](#NamePath)) => boolean | |
| resetFields | 重置一组字段到 `initialValues` | (fields?: [FieldData](#FieldData)\[]) => void | |
| scrollToField | 滚动到对应字段位置 | (name: [NamePath](#NamePath), options: \[[ScrollOptions](https://github.com/stipsan/scroll-into-view-if-needed/tree/ece40bd9143f48caf4b99503425ecb16b0ad8249#options)]) => void | |
| setFields | 设置一组字段状态 | (fields: [FieldData](#FieldData)\[]) => void | |
| setFieldsValue | 设置表单的值 | (values) => void | |

View File

@ -142526,9 +142526,9 @@ exports[`Locale Provider should display the text as ja 1`] = `
</span>
<span
class="ant-select-selection-item"
title="10 / ページ"
title="10 / ページ"
>
10 / ページ
10 / ページ
</span>
</div>
<span

View File

@ -14,6 +14,9 @@ Navigation is an important part of any website, as a good navigation setup allow
More layouts with navigation: [Layout](/components/layout).
- Menu render as `ul` element. So it only support [`li` and `script-supporting` elements](https://html.spec.whatwg.org/multipage/grouping-content.html#the-ul-element) as children node。Your customize node should wrapped by `Menu.Item`.
- Menu need collect node structure. So it's children node should be `Menu.*` or HOC which used by it.
## API
```jsx
@ -55,13 +58,13 @@ More layouts with navigation: [Layout](/components/layout).
### Menu.Item
| Param | Description | Type | Default value | Version |
| --- | --- | --- | --- | --- |
| danger | Display the danger style | boolean | false | 4.3.0 |
| disabled | Whether menu item is disabled | boolean | false | |
| icon | The icon of the menu item | ReactNode | - | 4.2.0 |
| key | Unique ID of the menu item | string | - | |
| title | Set display title for collapsed item | string | - | |
| Param | Description | Type | Default value | Version |
| -------- | ------------------------------------ | --------- | ------------- | ------- |
| danger | Display the danger style | boolean | false | 4.3.0 |
| disabled | Whether menu item is disabled | boolean | false | |
| icon | The icon of the menu item | ReactNode | - | 4.2.0 |
| key | Unique ID of the menu item | string | - | |
| title | Set display title for collapsed item | string | - | |
> Note: `icon` is a newly added prop in `4.2.0`. For previous versions, please use the following method to define the icon.
>
@ -97,11 +100,17 @@ More layouts with navigation: [Layout](/components/layout).
### Menu.ItemGroup
| Param | Description | Type | Default value | Version |
| --- | --- | --- | --- | --- |
| children | Sub-menu items | MenuItem\[] | - | |
| title | The title of the group | ReactNode | - | |
| Param | Description | Type | Default value | Version |
| -------- | ---------------------- | ----------- | ------------- | ------- |
| children | Sub-menu items | MenuItem\[] | - | |
| title | The title of the group | ReactNode | - | |
### Menu.Divider
Divider line in between menu items, only used in vertical popup Menu or Dropdown Menu.
## FAQ
### Why Menu children node will render twice?
Menu collect structure info with [twice-render](https://github.com/react-component/menu/blob/f4684514096d6b7123339cbe72e7b0f68db0bce2/src/Menu.tsx#L543) to support HOC usage. Merge into one render may cause the logic much complex, welcome contribute to help improve collection logic.

View File

@ -91,6 +91,7 @@ class InternalMenu extends React.Component<InternalMenuProps> {
<RcMenu
getPopupContainer={getPopupContainer}
overflowedIndicator={<EllipsisOutlined />}
overflowedIndicatorPopupClassName={`${prefixCls}-${theme}`}
{...passedProps}
inlineCollapsed={inlineCollapsed}
className={menuClassName}

View File

@ -15,6 +15,9 @@ cover: https://gw.alipayobjects.com/zos/alicdn/3XZcjGpvK/Menu.svg
更多布局和导航的使用可以参考:[通用布局](/components/layout)。
- Menu 元素为 `ul`,因而仅支持 [`li` 以及 `script-supporting` 子元素](https://html.spec.whatwg.org/multipage/grouping-content.html#the-ul-element)。因而你的子节点元素应该都在 `Menu.Item` 内使用。
- Menu 需要计算节点结构,因而其子元素仅支持 `Menu.*` 以及对此进行封装的 HOC 组件。
## API
```jsx
@ -56,13 +59,13 @@ cover: https://gw.alipayobjects.com/zos/alicdn/3XZcjGpvK/Menu.svg
### Menu.Item
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| danger | 展示错误状态样式 | boolean | false | 4.3.0 |
| disabled | 是否禁用 | boolean | false | |
| icon | 菜单图标 | ReactNode | - | 4.2.0 |
| key | item 的唯一标志 | string | - | |
| title | 设置收缩时展示的悬浮标题 | string | - | |
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| -------- | ------------------------ | --------- | ------ | ----- |
| danger | 展示错误状态样式 | boolean | false | 4.3.0 |
| disabled | 是否禁用 | boolean | false | |
| icon | 菜单图标 | ReactNode | - | 4.2.0 |
| key | item 的唯一标志 | string | - | |
| title | 设置收缩时展示的悬浮标题 | string | - | |
> 注意:`icon` 是 `4.2.0` 新增的属性,之前的版本请使用下面的方式定义图标。
>
@ -98,11 +101,17 @@ cover: https://gw.alipayobjects.com/zos/alicdn/3XZcjGpvK/Menu.svg
### Menu.ItemGroup
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| children | 分组的菜单项 | MenuItem\[] | - | |
| title | 分组标题 | ReactNode | - | |
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| -------- | ------------ | ----------- | ------ | ---- |
| children | 分组的菜单项 | MenuItem\[] | - | |
| title | 分组标题 | ReactNode | - | |
### Menu.Divider
菜单项分割线,只用在弹出菜单内。
## FAQ
### 为何 Menu 的子元素会渲染两次?
Menu 通过[二次渲染](https://github.com/react-component/menu/blob/f4684514096d6b7123339cbe72e7b0f68db0bce2/src/Menu.tsx#L543)收集嵌套结构信息以支持 HOC 的结构。合并成一个推导结构会使得逻辑变得十分复杂,欢迎 PR 以协助改进该设计。

View File

@ -87,12 +87,12 @@ message.config({
| Argument | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
| duration | Time before auto-dismiss, in seconds | number | 1.5 | |
| duration | Time before auto-dismiss, in seconds | number | 3 | |
| getContainer | Return the mount node for Message | () => HTMLElement | () => document.body | |
| maxCount | Max message show, drop oldest if exceed limit | number | - | |
| prefixCls | The prefix className of message node | string | `ant-message` | 4.5.0 |
| rtl | Whether to enable RTL mode | boolean | false | |
| top | Distance from top | number | 24 | |
| top | Distance from top | number | 8 | |
## FAQ

View File

@ -93,7 +93,7 @@ message.config({
| maxCount | 最大显示数, 超过限制时,最早的消息会被自动关闭 | number | - | |
| prefixCls | 消息节点的 className 前缀 | string | `ant-message` | 4.5.0 |
| rtl | 是否开启 RTL 模式 | boolean | false | |
| top | 消息距离顶部的位置 | number | 24 | |
| top | 消息距离顶部的位置 | number | 8 | |
## FAQ

View File

@ -3,6 +3,11 @@
@popover-prefix-cls: ~'@{ant-prefix}-popover';
@popover-arrow-rotate-width: sqrt(@popover-arrow-width * @popover-arrow-width * 2);
@popover-arrow-offset-vertical: 12px;
@popover-arrow-offset-horizontal: 16px;
.@{popover-prefix-cls} {
.reset-component();
@ -109,102 +114,139 @@
}
// Arrows
// .popover-arrow is outer, .popover-arrow:after is inner
&-arrow {
position: absolute;
display: block;
width: sqrt(@popover-arrow-width * @popover-arrow-width * 2);
height: sqrt(@popover-arrow-width * @popover-arrow-width * 2);
width: @popover-arrow-rotate-width;
height: @popover-arrow-rotate-width;
overflow: hidden;
background: transparent;
border-style: solid;
border-width: (sqrt(@popover-arrow-width * @popover-arrow-width * 2) / 2);
transform: rotate(45deg);
pointer-events: none;
&-content {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: block;
width: @popover-arrow-width;
height: @popover-arrow-width;
margin: auto;
background-color: @popover-bg;
content: '';
pointer-events: auto;
}
}
&-placement-top > &-content > &-arrow,
&-placement-topLeft > &-content > &-arrow,
&-placement-topRight > &-content > &-arrow {
bottom: @popover-distance - @popover-arrow-width + 2.2px;
border-top-color: transparent;
border-right-color: @popover-bg;
border-bottom-color: @popover-bg;
border-left-color: transparent;
box-shadow: 3px 3px 7px fade(@black, 7%);
&-placement-top &-arrow,
&-placement-topLeft &-arrow,
&-placement-topRight &-arrow {
bottom: @popover-distance - @popover-arrow-rotate-width;
&-content {
box-shadow: 3px 3px 7px fade(@black, 7%);
transform: translateY((-@popover-arrow-rotate-width / 2)) rotate(45deg);
}
}
&-placement-top > &-content > &-arrow {
&-placement-top &-arrow {
left: 50%;
transform: translateX(-50%) rotate(45deg);
}
&-placement-topLeft > &-content > &-arrow {
left: 16px;
}
&-placement-topRight > &-content > &-arrow {
right: 16px;
transform: translateX(-50%);
}
&-placement-right > &-content > &-arrow,
&-placement-rightTop > &-content > &-arrow,
&-placement-rightBottom > &-content > &-arrow {
left: @popover-distance - @popover-arrow-width + 2px;
border-top-color: transparent;
border-right-color: transparent;
border-bottom-color: @popover-bg;
border-left-color: @popover-bg;
box-shadow: -3px 3px 7px fade(@black, 7%);
&-placement-topLeft &-arrow {
left: @popover-arrow-offset-horizontal;
}
&-placement-right > &-content > &-arrow {
&-placement-topRight &-arrow {
right: @popover-arrow-offset-horizontal;
}
&-placement-right &-arrow,
&-placement-rightTop &-arrow,
&-placement-rightBottom &-arrow {
left: @popover-distance - @popover-arrow-rotate-width;
&-content {
box-shadow: -3px 3px 7px fade(@black, 7%);
transform: translateX((@popover-arrow-rotate-width / 2)) rotate(45deg);
}
}
&-placement-right &-arrow {
top: 50%;
transform: translateY(-50%) rotate(45deg);
transform: translateY(-50%);
}
&-placement-rightTop > &-content > &-arrow {
top: 12px;
&-placement-rightTop &-arrow {
top: @popover-arrow-offset-vertical;
}
&-placement-rightBottom > &-content > &-arrow {
bottom: 12px;
&-placement-rightBottom &-arrow {
bottom: @popover-arrow-offset-vertical;
}
&-placement-bottom > &-content > &-arrow,
&-placement-bottomLeft > &-content > &-arrow,
&-placement-bottomRight > &-content > &-arrow {
top: @popover-distance - @popover-arrow-width + 2px;
border-top-color: @popover-bg;
border-right-color: transparent;
border-bottom-color: transparent;
border-left-color: @popover-bg;
box-shadow: -2px -2px 5px fade(@black, 6%);
&-placement-bottom &-arrow,
&-placement-bottomLeft &-arrow,
&-placement-bottomRight &-arrow {
top: @popover-distance - @popover-arrow-rotate-width;
&-content {
box-shadow: -2px -2px 5px fade(@black, 6%);
transform: translateY((@popover-arrow-rotate-width / 2)) rotate(45deg);
}
}
&-placement-bottom > &-content > &-arrow {
&-placement-bottom &-arrow {
left: 50%;
transform: translateX(-50%) rotate(45deg);
}
&-placement-bottomLeft > &-content > &-arrow {
left: 16px;
}
&-placement-bottomRight > &-content > &-arrow {
right: 16px;
transform: translateX(-50%);
}
&-placement-left > &-content > &-arrow,
&-placement-leftTop > &-content > &-arrow,
&-placement-leftBottom > &-content > &-arrow {
right: @popover-distance - @popover-arrow-width + 2px;
border-top-color: @popover-bg;
border-right-color: @popover-bg;
border-bottom-color: transparent;
border-left-color: transparent;
box-shadow: 3px -3px 7px fade(@black, 7%);
&-placement-bottomLeft &-arrow {
left: @popover-arrow-offset-horizontal;
}
&-placement-left > &-content > &-arrow {
&-placement-bottomRight &-arrow {
right: @popover-arrow-offset-horizontal;
}
&-placement-left &-arrow,
&-placement-leftTop &-arrow,
&-placement-leftBottom &-arrow {
right: @popover-distance - @popover-arrow-rotate-width;
&-content {
box-shadow: 3px -3px 7px fade(@black, 7%);
transform: translateX((-@popover-arrow-rotate-width / 2)) rotate(45deg);
}
}
&-placement-left &-arrow {
top: 50%;
transform: translateY(-50%) rotate(45deg);
transform: translateY(-50%);
}
&-placement-leftTop > &-content > &-arrow {
top: 12px;
&-placement-leftTop &-arrow {
top: @popover-arrow-offset-vertical;
}
&-placement-leftBottom > &-content > &-arrow {
bottom: 12px;
&-placement-leftBottom &-arrow {
bottom: @popover-arrow-offset-vertical;
}
}
.generator-popover-preset-color(@i: length(@preset-colors)) when (@i > 0) {
.generator-popover-preset-color(@i - 1);
@color: extract(@preset-colors, @i);
@lightColor: '@{color}-6';
.@{popover-prefix-cls}-@{color} {
.@{popover-prefix-cls}-inner {
background-color: @@lightColor;
}
.@{popover-prefix-cls}-arrow {
&-content {
background-color: @@lightColor;
}
}
}
}
.generator-popover-preset-color();
@import './rtl';

View File

@ -189,15 +189,15 @@
@keyframes ~"@{ant-prefix}-progress-active" {
0% {
width: 0;
transform: translateX(-100%) scaleX(0);
opacity: 0.1;
}
20% {
width: 0;
transform: translateX(-100%) scaleX(0);
opacity: 0.5;
}
100% {
width: 100%;
transform: translateX(0) scaleX(1);
opacity: 0;
}
}

View File

@ -35,11 +35,11 @@ exports[`renders ./components/radio/demo/badge.md correctly 1`] = `
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
1
</p>
</span>
</span>
</sup>
</span>
@ -74,11 +74,11 @@ exports[`renders ./components/radio/demo/badge.md correctly 1`] = `
class="ant-scroll-number-only"
style="transition:none"
>
<p
<span
class="ant-scroll-number-only-unit current"
>
2
</p>
</span>
</span>
</sup>
</span>

View File

@ -14,9 +14,9 @@ A simple text popup tip.
## API
| Property | Description | Type | Default |
| --- | --- | --- | --- |
| title | The text shown in the tooltip | ReactNode \| () => ReactNode | - |
| Property | Description | Type | Default |
| -------- | ----------------------------- | ---------------------------- | ------- |
| title | The text shown in the tooltip | ReactNode \| () => ReactNode | - |
### Common API
@ -35,6 +35,7 @@ The following APIs are shared by Tooltip, Popconfirm, Popover.
| mouseLeaveDelay | Delay in seconds, before tooltip is hidden on mouse leave | number | 0.1 | |
| overlayClassName | Class name of the tooltip card | string | - | |
| overlayStyle | Style of the tooltip card | object | - | |
| overlayInnerStyle | Style of the tooltip inner content | object | - | |
| placement | The position of the tooltip relative to the target, which can be one of `top` `left` `right` `bottom` `topLeft` `topRight` `bottomLeft` `bottomRight` `leftTop` `leftBottom` `rightTop` `rightBottom` | string | `top` | |
| trigger | Tooltip trigger mode. Could be multiple by passing an array | `hover` \| `focus` \| `click` \| `contextMenu` \| Array&lt;string> | `hover` | |
| visible | Whether the floating tooltip card is visible or not | boolean | false | |

View File

@ -16,9 +16,9 @@ cover: https://gw.alipayobjects.com/zos/alicdn/Vyyeu8jq2/Tooltp.svg
## API
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| title | 提示文字 | ReactNode \| () => ReactNode | - |
| 参数 | 说明 | 类型 | 默认值 |
| ----- | -------- | ---------------------------- | ------ |
| title | 提示文字 | ReactNode \| () => ReactNode | - |
### 共同的 API
@ -37,6 +37,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/Vyyeu8jq2/Tooltp.svg
| mouseLeaveDelay | 鼠标移出后延时多少才隐藏 Tooltip单位秒 | number | 0.1 | |
| overlayClassName | 卡片类名 | string | - | |
| overlayStyle | 卡片样式 | object | - | |
| overlayInnerStyle | 卡片内容区域的样式对象 | object | - | |
| placement | 气泡框位置,可选 `top` `left` `right` `bottom` `topLeft` `topRight` `bottomLeft` `bottomRight` `leftTop` `leftBottom` `rightTop` `rightBottom` | string | `top` | |
| trigger | 触发行为,可选 `hover` \| `focus` \| `click` \| `contextMenu`,可使用数组设置多个触发行为 | string \| string\[] | `hover` | |
| visible | 用于手动控制浮层显隐 | boolean | false | |

View File

@ -1,6 +1,6 @@
{
"name": "antd",
"version": "4.16.3",
"version": "4.16.6",
"description": "An enterprise-class UI design language and React components implementation",
"title": "Ant Design",
"keywords": [
@ -126,7 +126,7 @@
"rc-image": "~5.2.4",
"rc-input-number": "~7.2.0",
"rc-mentions": "~1.6.1",
"rc-menu": "~9.0.9",
"rc-menu": "~9.0.12",
"rc-motion": "^2.4.4",
"rc-notification": "~4.5.7",
"rc-pagination": "~3.1.6",
@ -142,7 +142,7 @@
"rc-tabs": "~11.9.1",
"rc-textarea": "~0.3.0",
"rc-tooltip": "~5.1.1",
"rc-tree": "~4.1.0",
"rc-tree": "~4.2.1",
"rc-tree-select": "~4.3.0",
"rc-trigger": "^5.2.1",
"rc-upload": "~4.3.0",
@ -159,7 +159,7 @@
"@stackblitz/sdk": "^1.3.0",
"@types/classnames": "^2.2.8",
"@types/enzyme": "^3.10.5",
"@types/gtag.js": "^0.0.5",
"@types/gtag.js": "^0.0.6",
"@types/jest": "^26.0.0",
"@types/jest-environment-puppeteer": "^4.4.0",
"@types/jest-image-snapshot": "^4.1.0",
@ -206,7 +206,7 @@
"eslint-plugin-markdown": "^2.0.0",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.1.2",
"eslint-plugin-unicorn": "^33.0.0",
"eslint-plugin-unicorn": "^34.0.0",
"fetch-jsonp": "^1.1.3",
"fs-extra": "^10.0.0",
"full-icu": "^1.3.0",
@ -220,7 +220,7 @@
"inquirer": "^8.0.0",
"intersection-observer": "^0.12.0",
"jest": "^27.0.3",
"jest-image-snapshot": "^4.0.0",
"jest-image-snapshot": "^4.5.1",
"jest-puppeteer": "^5.0.1",
"jquery": "^3.4.1",
"jsdom": "^16.0.0",
@ -230,7 +230,7 @@
"mockdate": "^3.0.0",
"node-fetch": "^2.6.0",
"open": "^8.0.1",
"prettier": "^2.2.0",
"prettier": "^2.3.2",
"prettier-plugin-jsdoc": "^0.3.0",
"pretty-quick": "^3.0.0",
"querystring": "^0.2.0",
@ -250,7 +250,7 @@
"react-helmet-async": "^1.0.4",
"react-highlight-words": "^0.17.0",
"react-infinite-scroller": "^1.2.4",
"react-intl": "^5.3.0",
"react-intl": "^5.20.4",
"react-resizable": "^3.0.1",
"react-router-dom": "^5.0.1",
"react-sortable-hoc": "^2.0.0",
@ -267,7 +267,7 @@
"rimraf": "^3.0.0",
"scrollama": "^2.0.0",
"simple-git": "^2.23.0",
"string-replace-loader": "^3.0.1",
"string-replace-loader": "^3.0.3",
"stylelint": "^13.0.0",
"stylelint-config-prettier": "^8.0.0",
"stylelint-config-rational-order": "^0.1.2",

View File

@ -1,3 +1,21 @@
@font-face {
font-weight: normal;
font-family: PuHuiTi;
src: url('//at.alicdn.com/t/webfont_6e11e43nfj.woff2') format('woff2'),
url('//at.alicdn.com/t/webfont_6e11e43nfj.woff') format('woff'),
/* chrome、firefox */ url('//at.alicdn.com/t/webfont_6e11e43nfj.ttf') format('truetype'); /* chrome、firefox、opera、Safari, Android, iOS 4.2+ */
font-display: swap;
}
@font-face {
font-weight: bold;
font-family: PuHuiTi;
src: url('//at.alicdn.com/t/webfont_exesdog9toj.woff2') format('woff2'),
url('//at.alicdn.com/t/webfont_exesdog9toj.woff') format('woff'),
/* chrome、firefox */ url('//at.alicdn.com/t/webfont_exesdog9toj.ttf') format('truetype'); /* chrome、firefox、opera、Safari, Android, iOS 4.2+ */
font-display: swap;
}
html {
&.rtl {
direction: rtl;

View File

@ -3,14 +3,14 @@
.home-card-logo {
position: relative;
display: inline-block;
max-width: 490px;
max-width: 500px;
margin: 0 32px;
cursor: pointer;
.home-card-logo-icon {
position: absolute;
top: -35px;
left: 334px;
top: -38px;
left: 339px;
display: none;
width: 64px;
height: 64px;

View File

@ -71,10 +71,10 @@ export default function Logo() {
className="home-banner-mini"
/>
<img
width="490"
width="500"
height="87"
alt="Ant Design"
src="https://gw.alipayobjects.com/zos/basement_prod/5b153736-dfe3-4a73-9454-68607c8103e4.svg"
src="https://gw.alipayobjects.com/zos/antfincdn/6UYtAUYPXE/AntDesign.svg"
className="home-banner-normal"
/>
<Hitu

View File

@ -7,9 +7,11 @@
padding-left: 40px;
overflow: hidden;
color: @site-heading-color;
font-weight: bold;
font-size: 18px;
font-family: Avenir, @font-family, sans-serif;
font-family: PuHuiTi, @font-family, sans-serif;
line-height: @header-height;
letter-spacing: -0.18px;
white-space: nowrap;
text-decoration: none;
@ -20,10 +22,8 @@
}
img {
position: relative;
top: -1.5px;
height: 32px;
margin-right: 16px;
margin-right: 12px;
.ant-row-rtl & {
margin-right: 0;

View File

@ -1,6 +1,6 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Link, browserHistory } from 'bisheng/router';
import { Link } from 'bisheng/router';
import classNames from 'classnames';
import { Helmet } from 'react-helmet-async';
import canUseDom from 'rc-util/lib/Dom/canUseDom';
@ -8,7 +8,6 @@ import { Input, Tooltip, Typography } from 'antd';
import { SearchOutlined } from '@ant-design/icons';
import { DocSearchProps, useDocSearchKeyboardEvents, DocSearchModalProps } from '@docsearch/react';
import '@docsearch/css';
import { SharedProps } from './interface';
import { IAlgoliaConfig, transformHitUrl } from './algolia-config';
@ -20,6 +19,7 @@ export interface SearchBarProps extends SharedProps {
onTriggerFocus?: (focus: boolean) => void;
responsive: null | 'narrow' | 'crowded';
algoliaConfig: IAlgoliaConfig;
router: any;
}
let SearchModal: React.FC<DocSearchModalProps> | null = null;
@ -42,11 +42,12 @@ function isAppleDevice() {
* - [@docusaurus-theme-search-algolia](https://docusaurus.io/docs/api/themes/@docusaurus/theme-search-algolia)
* - [DocSearchModal Docs](https://autocomplete-experimental.netlify.app/docs/DocSearchModal)
*/
export const SearchBar = ({
const SearchBar = ({
isZhCN,
responsive,
onTriggerFocus,
algoliaConfig,
router,
}: SearchBarProps) => {
const [isInputFocus, setInputFocus] = React.useState(false);
const [inputSearch, setInputSearch] = React.useState('');
@ -114,9 +115,7 @@ export const SearchBar = ({
const navigator = React.useRef({
navigate({ itemUrl }: { itemUrl: string }) {
browserHistory.push(itemUrl);
// should use history from bisheng and remove this `reload` calls
window.location.reload(false);
router.push(itemUrl);
},
}).current;
@ -196,3 +195,5 @@ export const SearchBar = ({
</div>
);
};
export default SearchBar;

View File

@ -4,12 +4,10 @@ import classNames from 'classnames';
import { UnorderedListOutlined } from '@ant-design/icons';
import { Select, Row, Col, Popover, Button } from 'antd';
import canUseDom from 'rc-util/lib/Dom/canUseDom';
// import { browserHistory } from 'bisheng/router';
import * as utils from '../../utils';
import packageJson from '../../../../../package.json';
import Logo from './Logo';
import { SearchBar } from './SearchBar';
import SearchBar from './SearchBar';
import More from './More';
import Navigation from './Navigation';
import Github from './Github';
@ -47,7 +45,7 @@ const triggerDocSearchImport = () => {
});
};
function initDocSearch(isZhCN: boolean) {
function initDocSearch({ isZhCN, router }: { isZhCN: boolean; router: any }) {
if (!canUseDom()) {
return;
}
@ -62,14 +60,12 @@ function initDocSearch(isZhCN: boolean) {
transformData: AlgoliaConfig.transformData,
debug: AlgoliaConfig.debug,
// https://docsearch.algolia.com/docs/behavior#handleselected
// handleSelected: (input, _$1, suggestion, _$2, context) => {
// doesn't refresh
// // Prevents the default behavior on click
// if (context.selectionMethod === 'click') {
// input.setVal('');
// browserHistory.push(suggestion.url);
// }
// },
handleSelected: (input: any, _$1: unknown, suggestion: any) => {
router.push(suggestion.url);
setTimeout(() => {
input.setVal('');
});
},
});
});
}
@ -97,7 +93,10 @@ class Header extends React.Component<HeaderProps, HeaderState> {
const { intl, router } = this.props;
router.listen(this.handleHideMenu);
initDocSearch(intl.locale === 'zh');
initDocSearch({
isZhCN: intl.locale === 'zh-CN',
router,
});
window.addEventListener('resize', this.onWindowResize);
this.onWindowResize();
@ -216,6 +215,7 @@ class Header extends React.Component<HeaderProps, HeaderState> {
location,
themeConfig,
intl: { locale },
router,
} = this.props;
const docVersions: Record<string, string> = {
[antdVersion]: antdVersion,
@ -348,6 +348,7 @@ class Header extends React.Component<HeaderProps, HeaderState> {
<SearchBar
key="search"
{...sharedProps}
router={router}
algoliaConfig={AlgoliaConfig}
responsive={responsive}
onTriggerFocus={this.onTriggerSearching}