Skip to content

Commit 6236e35

Browse files
authored
docs: update all site anchors (ant-design#39687)
* docs: update all site anchors * docs: handle hash change from Link component
1 parent 52f484d commit 6236e35

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+232
-224
lines changed

.dumi/theme/layouts/DocLayout/index.tsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useContext, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
22
import 'dayjs/locale/zh-cn';
33
import dayjs from 'dayjs';
4-
import { Helmet, useOutlet } from 'dumi';
4+
import { Helmet, useOutlet, useSiteData } from 'dumi';
55
import '../../static/style';
66
import ConfigProvider from 'antd/es/config-provider';
77
import classNames from 'classnames';
@@ -30,10 +30,11 @@ const locales = {
3030
const DocLayout: React.FC = () => {
3131
const outlet = useOutlet();
3232
const location = useLocation();
33-
const { pathname, search } = location;
33+
const { pathname, search, hash } = location;
3434
const [locale, lang] = useLocale(locales);
3535
const timerRef = useRef<NodeJS.Timeout | null>(null);
3636
const { direction } = useContext(SiteContext);
37+
const { loading } = useSiteData();
3738

3839
useLayoutEffect(() => {
3940
if (lang === 'cn') {
@@ -52,6 +53,13 @@ const DocLayout: React.FC = () => {
5253
}
5354
}, []);
5455

56+
// handle hash change or visit page hash from Link component, and jump after async chunk loaded
57+
useEffect(() => {
58+
const id = hash.replace('#', '');
59+
60+
if (id) document.getElementById(decodeURIComponent(id))?.scrollIntoView();
61+
}, [loading, hash]);
62+
5563
React.useEffect(() => {
5664
if (typeof (window as any).ga !== 'undefined') {
5765
(window as any).ga('send', 'pageview', pathname + search);

components/anchor/index.en-US.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ For displaying anchor hyperlinks on page and jumping between them.
4242
| getCurrentAnchor | Customize the anchor highlight | (activeLink: string) => string | - | |
4343
| offsetTop | Pixels to offset from top when calculating position of scroll | number | 0 | |
4444
| showInkInFixed | Whether show ink-square when `affix={false}` | boolean | false | |
45-
| targetOffset | Anchor scroll offset, default as `offsetTop`, [example](#components-anchor-demo-targetOffset) | number | - | |
45+
| targetOffset | Anchor scroll offset, default as `offsetTop`, [example](#components-anchor-demo-targetoffset) | number | - | |
4646
| onChange | Listening for anchor link change | (currentActiveLink: string) => void | | |
4747
| onClick | Set the handler to handle `click` event | (e: MouseEvent, link: object) => void | - | |
4848
| items | Data configuration option content, support nesting through children | { href, title, target, children }\[] | - | |

components/anchor/index.zh-CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ group:
4343
| getCurrentAnchor | 自定义高亮的锚点 | (activeLink: string) => string | - | |
4444
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | number | | |
4545
| showInkInFixed | `affix={false}` 时是否显示小方块 | boolean | false | |
46-
| targetOffset | 锚点滚动偏移量,默认与 offsetTop 相同,[例子](#components-anchor-demo-targetOffset) | number | - | |
46+
| targetOffset | 锚点滚动偏移量,默认与 offsetTop 相同,[例子](#components-anchor-demo-targetoffset) | number | - | |
4747
| onChange | 监听锚点链接改变 | (currentActiveLink: string) => void | - | |
4848
| onClick | `click` 事件的 handler | (e: MouseEvent, link: object) => void | - | |
4949
| items | 数据化配置选项内容,支持通过 children 嵌套 | { href, title, target, children }\[] | - | |

components/auto-complete/demo/certain-category.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
## zh-CN
22

3-
[查询模式: 确定类目](https://ant.design/docs/spec/reaction#Lookup-Patterns) 示例。
3+
[查询模式: 确定类目](https://ant.design/docs/spec/reaction#lookup-patterns) 示例。
44

55
## en-US
66

7-
Demonstration of [Lookup Patterns: Certain Category](https://ant.design/docs/spec/reaction#Lookup-Patterns). Basic Usage, set options of autocomplete with `options` property.
7+
Demonstration of [Lookup Patterns: Certain Category](https://ant.design/docs/spec/reaction#lookup-patterns). Basic Usage, set options of autocomplete with `options` property.
88

99
```css
1010
.certain-category-search-dropdown .ant-select-dropdown-menu-item-group-title {
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## zh-CN
22

3-
[查询模式: 不确定类目](https://ant.design/docs/spec/reaction#Lookup-Patterns) 示例。
3+
[查询模式: 不确定类目](https://ant.design/docs/spec/reaction#lookup-patterns) 示例。
44

55
## en-US
66

7-
Demonstration of [Lookup Patterns: Uncertain Category](https://ant.design/docs/spec/reaction#Lookup-Patterns).
7+
Demonstration of [Lookup Patterns: Uncertain Category](https://ant.design/docs/spec/reaction#lookup-patterns).

components/breadcrumb/index.en-US.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ A breadcrumb displays the current location within a hierarchy. It allows going b
4343
| className | The additional css class | string | - | |
4444
| dropdownProps | The dropdown props | [Dropdown](/components/dropdown) | - | |
4545
| href | Target of hyperlink | string | - | |
46-
| menu | The menu props | [MenuProps](/components/menu/#API) | - | 4.24.0 |
46+
| menu | The menu props | [MenuProps](/components/menu/#api) | - | 4.24.0 |
4747
| onClick | Set the handler to handle click event | (e:MouseEvent) => void | - | |
4848

4949
### Breadcrumb.Separator

components/breadcrumb/index.zh-CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ demo:
4444
| className | 自定义类名 | string | - | |
4545
| dropdownProps | 弹出下拉菜单的自定义配置 | [Dropdown](/components/dropdown-cn) | - | |
4646
| href | 链接的目的地 | string | - | |
47-
| menu | 菜单配置项 | [MenuProps](/components/menu-cn/#API) | - | 4.24.0 |
47+
| menu | 菜单配置项 | [MenuProps](/components/menu-cn/#api) | - | 4.24.0 |
4848
| onClick | 单击事件 | (e:MouseEvent) => void | - | |
4949

5050
### Breadcrumb.Separator

components/button/index.en-US.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ It accepts all props which native buttons support.
7272

7373
### How to remove space between 2 chinese characters?
7474

75-
Following the Ant Design specification, we will add one space between if Button (exclude Text button and Link button) contains two Chinese characters only. If you don't need that, you can use [ConfigProvider](/components/config-provider/#API) to set `autoInsertSpaceInButton` as `false`.
75+
Following the Ant Design specification, we will add one space between if Button (exclude Text button and Link button) contains two Chinese characters only. If you don't need that, you can use [ConfigProvider](/components/config-provider/#api) to set `autoInsertSpaceInButton` as `false`.
7676

7777
<img src="https://gw.alipayobjects.com/zos/antfincdn/MY%26THAPZrW/38f06cb9-293a-4b42-b183-9f443e79ffea.png" style="box-shadow: none; margin: 0; width: 100px" alt="Button with two Chinese characters" />
7878

components/button/index.zh-CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ group:
7777

7878
### 如何移除两个汉字之间的空格?
7979

80-
根据 Ant Design 设计规范要求,我们会在按钮内(文本按钮和链接按钮除外)只有两个汉字时自动添加空格,如果你不需要这个特性,可以设置 [ConfigProvider](/components/config-provider-cn#API)`autoInsertSpaceInButton``false`
80+
根据 Ant Design 设计规范要求,我们会在按钮内(文本按钮和链接按钮除外)只有两个汉字时自动添加空格,如果你不需要这个特性,可以设置 [ConfigProvider](/components/config-provider-cn#api)`autoInsertSpaceInButton``false`
8181

8282
<img src="https://gw.alipayobjects.com/zos/antfincdn/MY%26THAPZrW/38f06cb9-293a-4b42-b183-9f443e79ffea.png" style="box-shadow: none; margin: 0; width: 100px" alt="移除两个汉字之间的空格" />
8383

components/calendar/index.en-US.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ When data is in the form of dates, such as schedules, timetables, prices calenda
6060

6161
### How to use Calendar with customize date library?
6262

63-
See [Use custom date library](/docs/react/use-custom-date-library#Calendar)
63+
See [Use custom date library](/docs/react/use-custom-date-library#calendar)
6464

6565
### How to set locale for date-related components?
6666

67-
See [How to set locale for date-related components](/components/date-picker/#Localization)
67+
See [How to set locale for date-related components](/components/date-picker/#localization)
6868

6969
### Date-related components locale is not working?
7070

71-
See FAQ [Date-related-components-locale-is-not-working?](/docs/react/faq#Date-related-components-locale-is-not-working?)
71+
See FAQ [Date-related-components-locale-is-not-working?](/docs/react/faq#date-related-components-locale-is-not-working)

components/calendar/index.zh-CN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*nF6_To7pDSAAAAAAAA
6161

6262
### 如何在 Calendar 中使用自定义日期库
6363

64-
参考 [使用自定义日期库](/docs/react/use-custom-date-library#Calendar)
64+
参考 [使用自定义日期库](/docs/react/use-custom-date-library#calendar)
6565

6666
### 如何给日期类组件配置国际化?
6767

6868
参考 [如何给日期类组件配置国际化](/components/date-picker-cn#%E5%9B%BD%E9%99%85%E5%8C%96%E9%85%8D%E7%BD%AE)
6969

7070
### 为什么时间类组件的国际化 locale 设置不生效?
7171

72-
参考 FAQ [为什么时间类组件的国际化 locale 设置不生效?](/docs/react/faq#为什么时间类组件的国际化-locale-设置不生效)
72+
参考 FAQ [为什么时间类组件的国际化 locale 设置不生效?](/docs/react/faq#为什么时间类组件的国际化-locale-设置不生效)

components/card/index.en-US.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ A card can be used to display content related to a single subject. The content c
4848
| size | Size of card | `default` \| `small` | `default` | |
4949
| tabBarExtraContent | Extra content in tab bar | ReactNode | - | |
5050
| tabList | List of TabPane's head | Array&lt;{key: string, tab: ReactNode}> | - | |
51-
| tabProps | [Tabs](/components/tabs/#Tabs) | - | - | |
51+
| tabProps | [Tabs](/components/tabs/#tabs) | - | - | |
5252
| title | Card title | ReactNode | - | |
5353
| type | Card style type, can be set to `inner` or not set | string | - | |
5454
| onTabChange | Callback when tab is switched | (key) => void | - | |

components/card/index.zh-CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*VXtCTp93KPAAAAAAAA
4949
| size | card 的尺寸 | `default` \| `small` | `default` | |
5050
| tabBarExtraContent | tab bar 上额外的元素 | ReactNode | - | |
5151
| tabList | 页签标题列表 | Array&lt;{key: string, tab: ReactNode}> | - | |
52-
| tabProps | [Tabs](/components/tabs-cn#Tabs) | - | - | |
52+
| tabProps | [Tabs](/components/tabs-cn#tabs) | - | - | |
5353
| title | 卡片标题 | ReactNode | - | |
5454
| type | 卡片类型,可设置为 `inner` 或 不设置 | string | - | |
5555
| onTabChange | 页签切换的回调 | (key) => void | - | |

components/cascader/index.en-US.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ Cascade selection box.
6565
| maxTagPlaceholder | Placeholder for not showing tags | ReactNode \| function(omittedValues) | - | 4.17.0 |
6666
| notFoundContent | Specify content to show when no result matches | string | `Not Found` | |
6767
| open | Set visible of cascader popup | boolean | - | 4.17.0 |
68-
| options | The data options of cascade | [Option](#Option)\[] | - | |
68+
| options | The data options of cascade | [Option](#option)\[] | - | |
6969
| placeholder | The input placeholder | string | `Please select` | |
7070
| placement | Use preset popup align config from builtinPlacements | `bottomLeft` `bottomRight` `topLeft` `topRight` | `bottomLeft` | 4.17.0 |
71-
| showSearch | Whether show search input in single mode | boolean \| [Object](#showSearch) | false | |
71+
| showSearch | Whether show search input in single mode | boolean \| [Object](#showsearch) | false | |
7272
| size | The input size | `large` \| `middle` \| `small` | - | |
7373
| status | Set validation status | 'error' \| 'warning' | - | 4.19.0 |
7474
| style | The additional style | CSSProperties | - | |

components/cascader/index.zh-CN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ demo:
6666
| maxTagPlaceholder | 隐藏 tag 时显示的内容 | ReactNode \| function(omittedValues) | - | 4.17.0 |
6767
| notFoundContent | 当下拉列表为空时显示的内容 | string | `Not Found` | |
6868
| open | 控制浮层显隐 | boolean | - | 4.17.0 |
69-
| options | 可选项数据源 | [Option](#Option)\[] | - | |
69+
| options | 可选项数据源 | [Option](#option)\[] | - | |
7070
| placeholder | 输入框占位文本 | string | `请选择` | |
7171
| placement | 浮层预设位置 | `bottomLeft` `bottomRight` `topLeft` `topRight` | `bottomLeft` | 4.17.0 |
72-
| showSearch | 在选择框中显示搜索框 | boolean \| [Object](#showSearch) | false | |
72+
| showSearch | 在选择框中显示搜索框 | boolean \| [Object](#showsearch) | false | |
7373
| size | 输入框大小 | `large` \| `middle` \| `small` | - | |
7474
| status | 设置校验状态 | 'error' \| 'warning' | - | 4.19.0 |
7575
| style | 自定义样式 | CSSProperties | - | |

components/config-provider/index.en-US.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Some components use dynamic style to support wave effect. You can config `csp` p
5252
| csp | Set [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) config | { nonce: string } | - | |
5353
| direction | Set direction of layout. See [demo](#components-config-provider-demo-direction) | `ltr` \| `rtl` | `ltr` | |
5454
| dropdownMatchSelectWidth | Determine whether the dropdown menu and the select input are the same width. Default set `min-width` same as input. Will ignore when value less than select width. `false` will disable virtual scroll | boolean \| number | - | 4.3.0 |
55-
| form | Set Form common props | { validateMessages?: [ValidateMessages](/components/form/#validateMessages), requiredMark?: boolean \| `optional` } | - | requiredMark: 4.8.0 |
55+
| form | Set Form common props | { validateMessages?: [ValidateMessages](/components/form/#validatemessages), requiredMark?: boolean \| `optional` } | - | requiredMark: 4.8.0 |
5656
| getPopupContainer | To set the container of the popup element. The default is to create a `div` element in `body` | function(triggerNode) | () => document.body | |
5757
| getTargetContainer | Config Affix, Anchor scroll target container | () => HTMLElement | () => window | 4.2.0 |
5858
| iconPrefixCls | Set icon prefix className | string | `anticon` | 4.11.0 |
@@ -80,11 +80,11 @@ ConfigProvider.config({
8080

8181
#### How to contribute a new language?
8282

83-
See [&lt;Adding new language&gt;](/docs/react/i18n#Adding-newplanguage).
83+
See [&lt;Adding new language&gt;](/docs/react/i18n#adding-newplanguage).
8484

8585
#### Date-related components locale is not working?
8686

87-
See FAQ [Date-related-components-locale-is-not-working?](/docs/react/faq#Date-related-components-locale-is-not-working?)
87+
See FAQ [Date-related-components-locale-is-not-working?](/docs/react/faq#date-related-components-locale-is-not-working)
8888

8989
#### Modal throw error when setting `getPopupContainer`?
9090

components/config-provider/index.zh-CN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default () => (
5353
| csp | 设置 [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) 配置 | { nonce: string } | - | |
5454
| direction | 设置文本展示方向。 [示例](#components-config-provider-demo-direction) | `ltr` \| `rtl` | `ltr` | |
5555
| dropdownMatchSelectWidth | 下拉菜单和选择器同宽。默认将设置 `min-width`,当值小于选择框宽度时会被忽略。`false` 时会关闭虚拟滚动 | boolean \| number | - | 4.3.0 |
56-
| form | 设置 Form 组件的通用属性 | { validateMessages?: [ValidateMessages](/components/form-cn#validateMessages), requiredMark?: boolean \| `optional`, colon?: boolean} | - | requiredMark: 4.8.0; colon: 4.18.0 |
56+
| form | 设置 Form 组件的通用属性 | { validateMessages?: [ValidateMessages](/components/form-cn#validatemessages), requiredMark?: boolean \| `optional`, colon?: boolean} | - | requiredMark: 4.8.0; colon: 4.18.0 |
5757
| getPopupContainer | 弹出框(Select, Tooltip, Menu 等等)渲染父节点,默认渲染到 body 上。 | function(triggerNode) | () => document.body | |
5858
| getTargetContainer | 配置 Affix、Anchor 滚动监听容器。 | () => HTMLElement | () => window | 4.2.0 |
5959
| iconPrefixCls | 设置图标统一样式前缀 | string | `anticon` | 4.11.0 |
@@ -85,7 +85,7 @@ ConfigProvider.config({
8585

8686
#### 为什么时间类组件的国际化 locale 设置不生效?
8787

88-
参考 FAQ [为什么时间类组件的国际化 locale 设置不生效?](/docs/react/faq#为什么时间类组件的国际化-locale-设置不生效)
88+
参考 FAQ [为什么时间类组件的国际化 locale 设置不生效?](/docs/react/faq#为什么时间类组件的国际化-locale-设置不生效)
8989

9090
#### 配置 `getPopupContainer` 导致 Modal 报错?
9191

components/date-picker/index.en-US.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ The following APIs are shared by DatePicker, RangePicker.
8888
| getPopupContainer | To set the container of the floating layer, while the default is to create a `div` element in `body` | function(trigger) | - | |
8989
| inputReadOnly | Set the `readonly` attribute of the input tag (avoids virtual keyboard on touch devices) | boolean | false | |
9090
| locale | Localization configuration | object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | |
91-
| mode | The picker panel mode( [Cannot select year or month anymore?](/docs/react/faq#When-set-mode-to-DatePicker/RangePicker,-cannot-select-year-or-month-anymore?) ) | `time` \| `date` \| `month` \| `year` \| `decade` | - | |
91+
| mode | The picker panel mode( [Cannot select year or month anymore?](/docs/react/faq#when-set-mode-to-datepickerrangepicker-cannot-select-year-or-month-anymore) ) | `time` \| `date` \| `month` \| `year` \| `decade` | - | |
9292
| nextIcon | The custom next icon | ReactNode | - | 4.17.0 |
9393
| open | The open state of picker | boolean | - | |
9494
| panelRender | Customize panel render | (panelNode) => ReactNode | - | 4.5.0 |
@@ -124,7 +124,7 @@ The following APIs are shared by DatePicker, RangePicker.
124124
| format | To set the date format, refer to [dayjs](https://day.js.org/). When an array is provided, all values are used for parsing and first value is used for formatting, support [Custom Format](#components-date-picker-demo-format) | string \| (value: dayjs) => string \| (string \| (value: dayjs) => string)\[] | `YYYY-MM-DD` | |
125125
| renderExtraFooter | Render extra footer in panel | (mode) => React.ReactNode | - | |
126126
| showNow | Whether to show 'Now' button on panel when `showTime` is set | boolean | - | 4.4.0 |
127-
| showTime | To provide an additional time selection | object \| boolean | [TimePicker Options](/components/time-picker/#API) | |
127+
| showTime | To provide an additional time selection | object \| boolean | [TimePicker Options](/components/time-picker/#api) | |
128128
| showTime.defaultValue | To set default time of selected date, [demo](#components-date-picker-demo-disabled-date) | [dayjs](https://day.js.org/) | dayjs() | |
129129
| showToday | Whether to show `Today` button | boolean | true | |
130130
| value | To set date | [dayjs](https://day.js.org/) | - | |
@@ -193,7 +193,7 @@ Added in `4.1.0`.
193193
| presets | The preset ranges for quick selection | { label: React.ReactNode, value: [dayjs](https://day.js.org/)\[] }[] | - | |
194194
| renderExtraFooter | Render extra footer in panel | () => React.ReactNode | - | |
195195
| separator | Set separator between inputs | React.ReactNode | `<SwapRightOutlined />` | |
196-
| showTime | To provide an additional time selection | object \| boolean | [TimePicker Options](/components/time-picker/#API) | |
196+
| showTime | To provide an additional time selection | object \| boolean | [TimePicker Options](/components/time-picker/#api) | |
197197
| showTime.defaultValue | To set default time of selected date, [demo](#components-date-picker-demo-disabled-date) | [dayjs](https://day.js.org/)\[] | \[dayjs(), dayjs()] | |
198198
| value | To set date | \[[dayjs](https://day.js.org/), [dayjs](https://day.js.org/)] | - | |
199199
| onCalendarChange | Callback function, can be executed when the start time or the end time of the range is changing. `info` argument is added in 4.4.0 | function(dates: \[dayjs, dayjs], dateStrings: \[string, string], info: { range:`start`\|`end` }) | - | |
@@ -203,19 +203,19 @@ Added in `4.1.0`.
203203

204204
### When set mode to DatePicker/RangePicker, cannot select year or month anymore?
205205

206-
Please refer [FAQ](/docs/react/faq#When-set-mode-to-DatePicker/RangePicker,-cannot-select-year-or-month-anymore?)
206+
Please refer [FAQ](/docs/react/faq#when-set-mode-to-datepickerrangepicker-cannot-select-year-or-month-anymore)
207207

208208
### How to use DatePicker with customize date library like dayjs?
209209

210-
Please refer [Use custom date library](/docs/react/use-custom-date-library#DatePicker)
210+
Please refer [Use custom date library](/docs/react/use-custom-date-library#datepicker)
211211

212212
### Why config dayjs.locale globally not work?
213213

214214
DatePicker default set `locale` as `en` in v4. You can config DatePicker `locale` prop or [ConfigProvider `locale`](/components/config-provider) prop instead.
215215

216216
#### Date-related components locale is not working?
217217

218-
See FAQ [Date-related-components-locale-is-not-working?](/docs/react/faq#Date-related-components-locale-is-not-working?)
218+
See FAQ [Date-related-components-locale-is-not-working?](/docs/react/faq#date-related-components-locale-is-not-working)
219219

220220
### How to modify start day of week?
221221

0 commit comments

Comments
 (0)