Merge pull request #24630 from ant-design/master

chore: Feature merge master
This commit is contained in:
二货机器人 2020-06-01 10:14:25 +08:00 committed by GitHub
commit a9cc869524
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
167 changed files with 6121 additions and 527 deletions

View File

@ -1,24 +1,11 @@
name: Lighthouse Check
on: [pull_request]
name: CI
on: [push]
jobs:
lighthouse-check:
lighthouseci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- run: mkdir /tmp/artifacts
- name: Run Lighthouse
uses: foo-software/lighthouse-check-action@master
id: lighthouseCheck
with:
accessToken: ${{ secrets.GITHUB_TOKEN }}
outputDirectory: /tmp/artifacts
emulatedFormFactor: desktop
timeout: 1200
prCommentEnabled: false
urls: 'https://preview-${{ github.event.pull_request.number }}-ant-design.surge.sh,https://preview-${{ github.event.pull_request.number }}-ant-design.surge.sh/components/button'
- name: Upload artifacts
uses: actions/upload-artifact@master
with:
name: Lighthouse reports
path: /tmp/artifacts
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- run: npm install && npm install -g @lhci/cli@0.4.x
- run: npm run site
- run: lhci autorun --upload.target=temporary-public-storage

View File

@ -15,8 +15,78 @@ timeline: true
---
## 4.3.0
`2020-05-31`
- 🔥 Rewrite Tabs for better user experience. [#24552](https://github.com/ant-design/ant-design/pull/24552)
- 📖 Add components [overview page](https://ant.design/components/overview). [#24491](https://github.com/ant-design/ant-design/pull/24491) [@arvinxx](https://github.com/arvinxx)
- 🛠 Optimize dependencies to reduce overall package size. [#24584](https://github.com/ant-design/ant-design/pull/24584)
- Button
- 🆕 New `type="text"` Button. [#22552](https://github.com/ant-design/ant-design/pull/22552)
- 💄 Improve button background variable usage. [#24372](https://github.com/ant-design/ant-design/pull/24372) [@morenyang](https://github.com/morenyang)
- Upload
- 🆕 `data` could return `Promise` now. [#24546](https://github.com/ant-design/ant-design/pull/24546) [@Kermit-Xuan](https://github.com/Kermit-Xuan)
- 🆕 Support `progress` to customize progress bar. [#24319](https://github.com/ant-design/ant-design/pull/24319) [@morenyang](https://github.com/morenyang)
- 🐞 Fix progress bar override by accident. [#24339](https://github.com/ant-design/ant-design/pull/24339) [@morenyang](https://github.com/morenyang)
- Table
- 🆕 Table support `rowSelection.hideSelectAll` to hide selectAll checkbox. [#24592](https://github.com/ant-design/ant-design/pull/24592) [@Kermit-Xuan](https://github.com/Kermit-Xuan)
- 🆕 `ellipsis` support `showTitle` to config `title` show. [#24056](https://github.com/ant-design/ant-design/pull/24056) [@lijinke666](https://github.com/lijinke666)
- 🆕 Table `columns` support `shouldCellUpdate`. [#23872](https://github.com/ant-design/ant-design/pull/23872)
- Input
- 🆕 Input.Passowrd support custom icon. [#23792](https://github.com/ant-design/ant-design/pull/23792)
- 🐞 Fix Input.Password still show `value` attribute in DOM after blur it. [#24535](https://github.com/ant-design/ant-design/pull/24535)
- 💄 Add less variable `@input-disabled-color`. [#23775](https://github.com/ant-design/ant-design/pull/23775) [@alwaysloseall](https://github.com/alwaysloseall)
- Form
- 🐞 Fix Form.Item inline `label` collapsed when in narrow space. [#24531](https://github.com/ant-design/ant-design/pull/24531)
- 🐞 Fix Form.List field status sync logic and add a nest fields demo. [#24009](https://github.com/ant-design/ant-design/pull/24009)
- 🆕 Form support `validateTrigger` to config children fields validate trigger. [#23972](https://github.com/ant-design/ant-design/pull/23972)
- Menu
- 🆕 Adjust text shows the first character when Menu is collapsed in `inline` mode. [#24330](https://github.com/ant-design/ant-design/pull/24330)
- 🆕 Menu.Item support `danger` prop. [#23785](https://github.com/ant-design/ant-design/pull/23785)
- Avatar
- 🆕 Avatar support `gap` to set the unit distance between left and right sides. [#24357](https://github.com/ant-design/ant-design/pull/24357)
- 🐞 Fix Avatar `onError` trigger twice. [#24506](https://github.com/ant-design/ant-design/pull/24506) [@sanonz](https://github.com/sanonz)
- Typography
- 🆕 Support Typography.Paragraph custom expand style. [#24385](https://github.com/ant-design/ant-design/pull/24385) [@fireairforce](https://github.com/fireairforce)
- 🆕 Typography.Text support `keyboard` style. [#24195](https://github.com/ant-design/ant-design/pull/24195)
- 🆕 Add Link component. [#24019](https://github.com/ant-design/ant-design/pull/24019)
- 🐞 Fix Typography `title` prop support. [#24440](https://github.com/ant-design/ant-design/pull/24440) [@Kermit-Xuan](https://github.com/Kermit-Xuan)
- 🆕 Tooltip support `color` to config background color. [#23155](https://github.com/ant-design/ant-design/pull/23155)
- 🆕 Popconfirm can be closed by pressing `ESC` now. [#24420](https://github.com/ant-design/ant-design/pull/24420)
- 🆕 Tooltip `destroyTooltipOnHide` support `keepParent` config. [#24362](https://github.com/ant-design/ant-design/pull/24362) [@Kermit-Xuan](https://github.com/Kermit-Xuan)
- 🆕 Notification support to config `prefixCls`. [#24295](https://github.com/ant-design/ant-design/pull/24295) [@tdida](https://github.com/tdida)
- 🆕 RangePicker `dateRender` support additional argument to detect is `start` or `end` field. [#24278](https://github.com/ant-design/ant-design/pull/24278)
- 🆕 Skeleton add `round` prop to enable paragraph and title show radius. [#24137](https://github.com/ant-design/ant-design/pull/24137) [@xilihuasi](https://github.com/xilihuasi)
- 🆕 Transfer support `oneWay` and `pagination`. [#24041](https://github.com/ant-design/ant-design/pull/24041)
- 🆕 Message support customize `className` and `style`. [#24024](https://github.com/ant-design/ant-design/pull/24024) [@Kermit-Xuan](https://github.com/Kermit-Xuan)
- 🆕 ConfigProvider support `virtual` and `dropdownMatchSelectWidth`. [#23841](https://github.com/ant-design/ant-design/pull/23841) [@hengkx](https://github.com/hengkx)
- 🐞 Fix Breadcrumb icon margin missing when using links. [#24490](https://github.com/ant-design/ant-design/pull/24490) [@EscapeB](https://github.com/EscapeB)
- 🐞 Fix Cascader expand icon color when disabled. [#24521](https://github.com/ant-design/ant-design/pull/24521)
- 🐞 Fix List warning about `React does not recognize colStyle prop`. [#24568](https://github.com/ant-design/ant-design/pull/24568)
- 🐞 Fix Progress with `steps` don't update `percent` expectedly. [#24534](https://github.com/ant-design/ant-design/pull/24534) [@ChuckJonas](https://github.com/ChuckJonas)
- 🐞 Fix Steps `subtitle` transition style. [#24593](https://github.com/ant-design/ant-design/pull/24593)
- 🐞 Fix Alert close icon `padding` style. [#24471](https://github.com/ant-design/ant-design/pull/24471)
- 🐞 Fix Tree `@tree-directory-selected-bg` don't work. [#24468](https://github.com/ant-design/ant-design/pull/24468) [@morenyang](https://github.com/morenyang)
- 🐞 Fix `@ant-prefix` don't work on some styles. [#24459](https://github.com/ant-design/ant-design/pull/24459) [@morenyang](https://github.com/morenyang)
- 💄 Descriptions add less variables `@descriptions-item-trailing-colon` and etc. [#24032](https://github.com/ant-design/ant-design/pull/24032) [@hengkx](https://github.com/hengkx)
- 🌐 Localization
- 🇮🇪 Add Irish(ga_IE) locale. [#24609](https://github.com/ant-design/ant-design/pull/24609) [@AbhijeetGaware](https://github.com/AbhijeetGaware)
- 🇫🇮 Improve Typography `fi_FI` locale. [#24591](https://github.com/ant-design/ant-design/pull/24591) [@sagge](https://github.com/sagge)
- 🇧🇷 Improve `pt_BR` locale. [#24518](https://github.com/ant-design/ant-design/pull/24518) [@arturpfb](https://github.com/arturpfb)
- 🇬🇧 Improve Form `en_GB` locale. [#24404](https://github.com/ant-design/ant-design/pull/24404) [@morenyang](https://github.com/morenyang)
- RTL
- 💄 Optimize Tree checkbox style in RTL. [#24563](https://github.com/ant-design/ant-design/pull/24563)
- 💄 Optimize Calendar notice content text style in RTL. [#24528](https://github.com/ant-design/ant-design/pull/24528)
- 💄 Optimize Table filter dropdown style in RTL. [#24529](https://github.com/ant-design/ant-design/pull/24529)
- 💄 Fix Cascader dropdown style in RTL. [#24520](https://github.com/ant-design/ant-design/pull/24520)
- TypeScript
- Form export `RuleObject` and `RuleRender` types. [#24541](https://github.com/ant-design/ant-design/pull/24541) [@sorteam](https://github.com/sorteam)
## 4.2.5
`2020-05-25`
- 🐞 Fix Table selection arrow out of column when `size` is `small/middle`. [#24394](https://github.com/ant-design/ant-design/pull/24394)
- 🐞 Fix Input.TextArea clear icon disappears in Input.Group when hover it. [#24360](https://github.com/ant-design/ant-design/pull/24360) [@Mr-jiangzhiguo](https://github.com/Mr-jiangzhiguo)
- 🐞 Fixed an issue where the `RowSelection.onChange` will still be cached when the Table removes entries in `dataSource`. [#24338](https://github.com/ant-design/ant-design/pull/24338)

View File

@ -15,8 +15,78 @@ timeline: true
---
## 4.3.0
`2020-05-31`
- 🔥 重做 Tabs 以提升多标签在不同环境下的用户体验。[#24552](https://github.com/ant-design/ant-design/pull/24552)
- 📖 新增组件[总览页面](https://ant.design/components/overview-cn)。[#24491](https://github.com/ant-design/ant-design/pull/24491) [@arvinxx](https://github.com/arvinxx)
- 🛠 增加大量功能,同时减少了包体积(相比 `4.2.5` 减少了 2KB。[#24584](https://github.com/ant-design/ant-design/pull/24584)
- Button
- 🆕 新增文本类型按钮 `type="text"`。[#22552](https://github.com/ant-design/ant-design/pull/22552)
- 💄 优化 Button 背景 less 变量的影响范围。[#24372](https://github.com/ant-design/ant-design/pull/24372) [@morenyang](https://github.com/morenyang)
- Upload
- 🆕 `data` 属性支持返回 `Promise`。[#24546](https://github.com/ant-design/ant-design/pull/24546) [@Kermit-Xuan](https://github.com/Kermit-Xuan)
- 🆕 添加 `progress` 属性以支持自定义进度条。[#24319](https://github.com/ant-design/ant-design/pull/24319) [@morenyang](https://github.com/morenyang)
- 🐞 修复进度条类型会被意外覆盖的问题。[#24339](https://github.com/ant-design/ant-design/pull/24339) [@morenyang](https://github.com/morenyang)
- Table
- 🆕 Table 新增 `rowSelection.hideSelectAll` 用于隐藏全选框。[#24592](https://github.com/ant-design/ant-design/pull/24592) [@Kermit-Xuan](https://github.com/Kermit-Xuan)
- 🆕 `ellipsis` 支持 `showTitle` 以关闭自动设置 `title` 属性。[#24056](https://github.com/ant-design/ant-design/pull/24056) [@lijinke666](https://github.com/lijinke666)
- 🆕 Table `columns` 支持 `shouldCellUpdate` 属性。[#23872](https://github.com/ant-design/ant-design/pull/23872)
- Input
- 🆕 Input.Passowrd 支持自定义图标。[#23792](https://github.com/ant-design/ant-design/pull/23792)
- 🐞 修复 Input.Password 一个明文显示 `value` 的问题。[#24535](https://github.com/ant-design/ant-design/pull/24535)
- 💄 添加 `@input-disabled-color` less 变量。[#23775](https://github.com/ant-design/ant-design/pull/23775) [@alwaysloseall](https://github.com/alwaysloseall)
- Form
- 🆕 Form 添加 `validateTrigger` 支持全局设置子字段校验时机。[#23972](https://github.com/ant-design/ant-design/pull/23972)
- 🐞 修复 Form.Item 内联样式下 `label` 在狭窄空间被挤压的问题。[#24531](https://github.com/ant-design/ant-design/pull/24531)
- 🐞 修复 Form.List 字段状态同步逻辑并添加嵌套字段示例。[#24009](https://github.com/ant-design/ant-design/pull/24009)
- Menu
- 🆕 调整 Menu `inline` 模式下未设置 `icon` 的菜单收起时文字显示第一个字符。[#24330](https://github.com/ant-design/ant-design/pull/24330)
- 🆕 Menu.Item 支持 `danger` 属性。[#23785](https://github.com/ant-design/ant-design/pull/23785)
- Avatar
- 🆕 Avatar 新增 `gap` 来设置字符类型距离左右两侧边界单位像素。[#24357](https://github.com/ant-design/ant-design/pull/24357)
- 🐞 修复 Avatar `onError` 会触发两次的问题。[#24506](https://github.com/ant-design/ant-design/pull/24506) [@sanonz](https://github.com/sanonz)
- Typography
- 🆕 Typography.Paragraph 支持自定义展开样式。[#24385](https://github.com/ant-design/ant-design/pull/24385) [@fireairforce](https://github.com/fireairforce)
- 🆕 Typography.Text 支持 `keyboard` 样式。[#24195](https://github.com/ant-design/ant-design/pull/24195)
- 🆕 添加 Link 组件。[#24019](https://github.com/ant-design/ant-design/pull/24019)
- 🐞 修复 Typography 不支持 `title` 属性的问题。[#24440](https://github.com/ant-design/ant-design/pull/24440) [@Kermit-Xuan](https://github.com/Kermit-Xuan)
- 🆕 Tooltip 支持配置背景颜色。[#23155](https://github.com/ant-design/ant-design/pull/23155)
- 🆕 Popconfirm 支持按 `ESC` 关闭。[#24420](https://github.com/ant-design/ant-design/pull/24420)
- 🆕 Tooltip `destroyTooltipOnHide` 支持 `keepParent` 配置。[#24362](https://github.com/ant-design/ant-design/pull/24362) [@Kermit-Xuan](https://github.com/Kermit-Xuan)
- 🆕 Notification 支持全局配置 `prefixCls`。[#24295](https://github.com/ant-design/ant-design/pull/24295) [@tdida](https://github.com/tdida)
- 🆕 RangePicker `dateRender` 支持额外参数来判断是 `start` 还是 `end` 字段。[#24278](https://github.com/ant-design/ant-design/pull/24278)
- 🆕 Skeleton 添加 `round` 属性,允许段落和标题显示圆角。[#24137](https://github.com/ant-design/ant-design/pull/24137) [@xilihuasi](https://github.com/xilihuasi)
- 🆕 Transfer 支持 `oneWay` 配置单向选择以及 `pagination` 配置分页。[#24041](https://github.com/ant-design/ant-design/pull/24041)
- 🆕 Message 支持自定义样式通过使用`className`和`style`。[#24024](https://github.com/ant-design/ant-design/pull/24024) [@Kermit-Xuan](https://github.com/Kermit-Xuan)
- 🆕 ConfigProvider 支持 `virtual``dropdownMatchSelectWidth` 配置。[#23841](https://github.com/ant-design/ant-design/pull/23841) [@hengkx](https://github.com/hengkx)
- 🐞 修复 Cascader 下拉框中扩展按钮在禁用时的颜色。[#24521](https://github.com/ant-design/ant-design/pull/24521)
- 🐞 修复 Alert 关闭按钮 `padding` 样式。[#24471](https://github.com/ant-design/ant-design/pull/24471)
- 🐞 修复 Tree `@tree-directory-selected-bg` 变量不生效的问题。[#24468](https://github.com/ant-design/ant-design/pull/24468) [@morenyang](https://github.com/morenyang)
- 🐞 修复 `@ant-prefix` 变量在部分样式里不生效的问题。[#24459](https://github.com/ant-design/ant-design/pull/24459) [@morenyang](https://github.com/morenyang)
- 🐞 修复 Steps `subtitle` hover 渐变过渡。[#24593](https://github.com/ant-design/ant-design/pull/24593)
- 🐞 修复 List 报 `React does not recognize colStyle prop` 的问题。[#24568](https://github.com/ant-design/ant-design/pull/24568)
- 🐞 修复步骤 Progress `percent` 样式未正确更新的问题。[#24534](https://github.com/ant-design/ant-design/pull/24534) [@ChuckJonas](https://github.com/ChuckJonas)
- 🐞 修复 Breadcrumb 内使用链接时图标间距丢失的问题。[#24490](https://github.com/ant-design/ant-design/pull/24490) [@EscapeB](https://github.com/EscapeB)
- 💄 Descriptions 新增 `@descriptions-item-trailing-colon` 等 less 变量。[#24032](https://github.com/ant-design/ant-design/pull/24032) [@hengkx](https://github.com/hengkx)
- 🌐 国际化
- 🇮🇪 新增爱尔兰语言包。[#24609](https://github.com/ant-design/ant-design/pull/24609) [@AbhijeetGaware](https://github.com/AbhijeetGaware)
- 🇫🇮 改进 Typography `fi_FI` 国际化。[#24591](https://github.com/ant-design/ant-design/pull/24591) [@sagge](https://github.com/sagge)
- 🇧🇷 改进 `pt_BR` 国际化。[#24518](https://github.com/ant-design/ant-design/pull/24518) [@arturpfb](https://github.com/arturpfb)
- 🇬🇧 改进 Form `en_GB` 国际化。[#24404](https://github.com/ant-design/ant-design/pull/24404) [@morenyang](https://github.com/morenyang)
- RTL
- 💄 优化 Tree RTL 模式下选项框样式。[#24563](https://github.com/ant-design/ant-design/pull/24563)
- 💄 优化 Calendar 通知事项文字在 RTL 模式下的样式。[#24528](https://github.com/ant-design/ant-design/pull/24528)
- 💄 优化 Table 筛选下拉框在 RTL 模式下样式。[#24529](https://github.com/ant-design/ant-design/pull/24529)
- 💄 优化 Cascader RTL 模式下拉框的样式。[#24520](https://github.com/ant-design/ant-design/pull/24520)
- TypeScript
- Form 导出 `RuleObject``RuleRender` 定义。[#24541](https://github.com/ant-design/ant-design/pull/24541) [@sorteam](https://github.com/sorteam)
## 4.2.5
`2020-05-25`
- 🐞 修复 Table 在 `dataSource` 移除条目时,`rowSelection.onChange` 仍然会缓存的问题。[#24338](https://github.com/ant-design/ant-design/pull/24338)
- 🐞 修复 Table 的选中箭头在 `size=small/middle` 时超出的问题。[#24394](https://github.com/ant-design/ant-design/pull/24394)
- 🐞 修复 Input.Group 内 Input.TextArea `hover` 时清除图标消失的问题。[#24360](https://github.com/ant-design/ant-design/pull/24360) [@Mr-jiangzhiguo](https://github.com/Mr-jiangzhiguo)

View File

@ -110,7 +110,7 @@ Veja [i18n](https://ant.design/docs/react/i18n).
## 🔗 Links
- [Página inicial](https://ant.design/)
- [Componentes](https://ant.design/components/button)
- [Componentes](https://ant.design/components/overview)
- [Ant Design Pro](http://pro.ant.design/)
- [Ant Design Charts](https://charts.ant.design)
- [Change Log](CHANGELOG.en-US.md)

View File

@ -114,7 +114,7 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
## 🔗 链接
- [首页](https://ant.design/)
- [组件库](https://ant.design/docs/react/introduce)
- [组件库](https://ant.design/components/overview-cn)
- [Ant Design Pro](http://pro.ant.design/)
- [Ant Design Charts](https://charts.ant.design)
- [更新日志](CHANGELOG.en-US.md)

View File

@ -110,7 +110,7 @@ Dozens of languages supported in `antd`, see [i18n](https://ant.design/docs/reac
## 🔗 Links
- [Home page](https://ant.design/)
- [Components](https://ant.design/components/button/)
- [Components](https://ant.design/components/overview)
- [Ant Design Pro](http://pro.ant.design/)
- [Ant Design Charts](https://charts.ant.design)
- [Change Log](CHANGELOG.en-US.md)

View File

@ -2,6 +2,7 @@
category: Components
type: Navigation
title: Affix
cover: https://gw.alipayobjects.com/zos/alicdn/SQGCQ7gOO/Affix.svg
---
Wrap Affix around another component to make it stick the viewport.

View File

@ -3,6 +3,7 @@ category: Components
subtitle: 固钉
type: 导航
title: Affix
cover: https://gw.alipayobjects.com/zos/alicdn/SQGCQ7gOO/Affix.svg
---
将页面元素钉在可视范围。

View File

@ -2,6 +2,7 @@
category: Components
type: Feedback
title: Alert
cover: https://gw.alipayobjects.com/zos/antfincdn/nuhf3vdRno/Alert.svg
---
Alert component for feedback.

View File

@ -3,6 +3,7 @@ category: Components
subtitle: 警告提示
type: 反馈
title: Alert
cover: https://gw.alipayobjects.com/zos/antfincdn/nuhf3vdRno/Alert.svg
---
警告提示,展现需要关注的信息。

View File

@ -3,6 +3,7 @@ category: Components
type: Other
cols: 2
title: Anchor
cover: https://gw.alipayobjects.com/zos/alicdn/ep_L42LFy/Anchor.svg
---
Hyperlinks to scroll on one page.

View File

@ -4,6 +4,7 @@ subtitle: 锚点
cols: 2
type: 其他
title: Anchor
cover: https://gw.alipayobjects.com/zos/alicdn/ep_L42LFy/Anchor.svg
---
用于跳转到页面指定位置。

View File

@ -3,6 +3,7 @@ category: Components
type: Data Entry
cols: 2
title: AutoComplete
cover: https://gw.alipayobjects.com/zos/alicdn/gtGCgVDKv/AutoComplete.svg
---
Autocomplete function of input field.

View File

@ -4,6 +4,7 @@ subtitle: 自动完成
type: 数据录入
cols: 2
title: AutoComplete
cover: https://gw.alipayobjects.com/zos/alicdn/gtGCgVDKv/AutoComplete.svg
---
输入框自动完成功能。

View File

@ -2,6 +2,7 @@
category: Components
type: Data Display
title: Avatar
cover: https://gw.alipayobjects.com/zos/antfincdn/aBcnbw68hP/Avatar.svg
---
Avatars can be used to represent people or objects. It supports images, `Icon`s, or letters.

View File

@ -3,6 +3,7 @@ category: Components
subtitle: 头像
type: 数据展示
title: Avatar
cover: https://gw.alipayobjects.com/zos/antfincdn/aBcnbw68hP/Avatar.svg
---
用来代表用户或事物,支持图片、图标或字符展示。

View File

@ -2,6 +2,7 @@
category: Components
type: Other
title: BackTop
cover: https://gw.alipayobjects.com/zos/alicdn/Ji3PnAAMT/BackTop.svg
---
`BackTop` makes it easy to go back to the top of the page.

View File

@ -3,6 +3,7 @@ category: Components
type: 其他
subtitle: 回到顶部
title: BackTop
cover: https://gw.alipayobjects.com/zos/alicdn/Ji3PnAAMT/BackTop.svg
---
返回页面顶部的操作按钮。

View File

@ -1,7 +1,6 @@
import * as React from 'react';
import omit from 'omit.js';
import classNames from 'classnames';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
import { ConfigContext } from '../config-provider';
import { cloneElement } from '../_util/reactNode';
function getNumberArray(num: string | number | undefined | null) {
@ -51,15 +50,27 @@ export interface ScrollNumberState {
count?: string | number | null;
}
const ScrollNumber: React.FC<ScrollNumberProps> = props => {
const ScrollNumber: React.FC<ScrollNumberProps> = ({
prefixCls: customizePrefixCls,
count: customizeCount,
className,
style,
title,
component = 'sup',
displayComponent,
onAnimated = () => {},
...restProps
}) => {
const [animateStarted, setAnimateStarted] = React.useState(true);
const [count, setCount] = React.useState(props.count);
const [prevCount, setPrevCount] = React.useState(props.count);
const [lastCount, setLastCount] = React.useState(props.count);
const [count, setCount] = React.useState(customizeCount);
const [prevCount, setPrevCount] = React.useState(customizeCount);
const [lastCount, setLastCount] = React.useState(customizeCount);
const { getPrefixCls } = React.useContext(ConfigContext);
const prefixCls = getPrefixCls('scroll-number', customizePrefixCls);
if (prevCount !== props.count) {
if (prevCount !== customizeCount) {
setAnimateStarted(true);
setPrevCount(props.count);
setPrevCount(customizeCount);
}
React.useEffect(() => {
@ -70,10 +81,8 @@ const ScrollNumber: React.FC<ScrollNumberProps> = props => {
// performing the transition.
timeout = setTimeout(() => {
setAnimateStarted(false);
setCount(props.count);
if (props.onAnimated) {
props.onAnimated();
}
setCount(customizeCount);
onAnimated();
});
}
return () => {
@ -81,7 +90,7 @@ const ScrollNumber: React.FC<ScrollNumberProps> = props => {
clearTimeout(timeout);
}
};
}, [animateStarted, count, props.count, props.onAnimated]);
}, [animateStarted, customizeCount, onAnimated]);
const getPositionByNum = (num: number, i: number) => {
const currentCount = Math.abs(Number(count));
@ -106,7 +115,7 @@ const ScrollNumber: React.FC<ScrollNumberProps> = props => {
return num;
};
const renderCurrentNumber = (prefixCls: string, num: number | string, i: number) => {
const renderCurrentNumber = (num: number | string, i: number) => {
if (typeof num === 'number') {
const position = getPositionByNum(num, i);
const removeTransition = animateStarted || getNumberArray(lastCount)[i] === undefined;
@ -133,65 +142,40 @@ const ScrollNumber: React.FC<ScrollNumberProps> = props => {
);
};
const renderNumberElement = (prefixCls: string) => {
const renderNumberElement = () => {
if (count && Number(count) % 1 === 0) {
return getNumberArray(count)
.map((num, i) => renderCurrentNumber(prefixCls, num, i))
.map((num, i) => renderCurrentNumber(num, i))
.reverse();
}
return count;
};
const renderScrollNumber = ({ getPrefixCls }: ConfigConsumerProps) => {
const {
prefixCls: customizePrefixCls,
className,
style,
title,
component = 'sup',
displayComponent,
} = props;
// fix https://fb.me/react-unknown-prop
const restProps = omit(props, [
'count',
'onAnimated',
'component',
'prefixCls',
'displayComponent',
]);
const prefixCls = getPrefixCls('scroll-number', customizePrefixCls);
const newProps = {
...restProps,
className: classNames(prefixCls, className),
title: title as string,
};
// allow specify the border
// mock border-color by box-shadow for compatible with old usage:
// <Badge count={4} style={{ backgroundColor: '#fff', color: '#999', borderColor: '#d9d9d9' }} />
if (style && style.borderColor) {
newProps.style = {
...style,
boxShadow: `0 0 0 1px ${style.borderColor} inset`,
};
}
if (displayComponent) {
return cloneElement(displayComponent, {
className: classNames(
`${prefixCls}-custom-component`,
displayComponent.props && displayComponent.props.className,
),
});
}
return React.createElement(component as any, newProps, renderNumberElement(prefixCls));
const newProps = {
...restProps,
style,
className: classNames(prefixCls, className),
title: title as string,
};
return <ConfigConsumer>{renderScrollNumber}</ConfigConsumer>;
};
ScrollNumber.defaultProps = {
count: null,
onAnimated() {},
// allow specify the border
// mock border-color by box-shadow for compatible with old usage:
// <Badge count={4} style={{ backgroundColor: '#fff', color: '#999', borderColor: '#d9d9d9' }} />
if (style && style.borderColor) {
newProps.style = {
...style,
boxShadow: `0 0 0 1px ${style.borderColor} inset`,
};
}
if (displayComponent) {
return cloneElement(displayComponent, {
className: classNames(
`${prefixCls}-custom-component`,
displayComponent.props && displayComponent.props.className,
),
});
}
return React.createElement(component as any, newProps, renderNumberElement());
};
export default ScrollNumber;

View File

@ -17,9 +17,6 @@ exports[`Badge badge should support float number 1`] = `
exports[`Badge badge should support float number 2`] = `
<Badge
count="3.5"
dot={false}
overflowCount={99}
showZero={false}
>
<span
className="ant-badge ant-badge-not-a-wrapper"
@ -51,7 +48,6 @@ exports[`Badge badge should support float number 2`] = `
count="3.5"
data-show={true}
key="scrollNumber"
onAnimated={[Function]}
prefixCls="ant-scroll-number"
title="3.5"
>
@ -938,9 +934,6 @@ exports[`Badge should be compatible with borderColor style 1`] = `
exports[`Badge should render when count is changed 1`] = `
<Badge
count={10}
dot={false}
overflowCount={99}
showZero={false}
>
<span
className="ant-badge ant-badge-not-a-wrapper"
@ -972,7 +965,6 @@ exports[`Badge should render when count is changed 1`] = `
count={10}
data-show={true}
key="scrollNumber"
onAnimated={[Function]}
prefixCls="ant-scroll-number"
title={10}
>
@ -1185,9 +1177,6 @@ exports[`Badge should render when count is changed 1`] = `
exports[`Badge should render when count is changed 2`] = `
<Badge
count={11}
dot={false}
overflowCount={99}
showZero={false}
>
<span
className="ant-badge ant-badge-not-a-wrapper"
@ -1219,7 +1208,6 @@ exports[`Badge should render when count is changed 2`] = `
count={11}
data-show={true}
key="scrollNumber"
onAnimated={[Function]}
prefixCls="ant-scroll-number"
title={11}
>
@ -1625,9 +1613,6 @@ exports[`Badge should render when count is changed 2`] = `
exports[`Badge should render when count is changed 3`] = `
<Badge
count={11}
dot={false}
overflowCount={99}
showZero={false}
>
<span
className="ant-badge ant-badge-not-a-wrapper"
@ -1659,7 +1644,6 @@ exports[`Badge should render when count is changed 3`] = `
count={11}
data-show={true}
key="scrollNumber"
onAnimated={[Function]}
prefixCls="ant-scroll-number"
title={11}
>
@ -2064,10 +2048,7 @@ exports[`Badge should render when count is changed 3`] = `
exports[`Badge should render when count is changed 4`] = `
<Badge
count={10}
dot={false}
overflowCount={99}
showZero={false}
count={111}
>
<span
className="ant-badge ant-badge-not-a-wrapper"
@ -2096,17 +2077,16 @@ exports[`Badge should render when count is changed 4`] = `
>
<ScrollNumber
className="ant-badge-count ant-badge-multiple-words"
count={10}
count="99+"
data-show={true}
key="scrollNumber"
onAnimated={[Function]}
prefixCls="ant-scroll-number"
title={10}
title={111}
>
<sup
className="ant-scroll-number ant-badge-count ant-badge-multiple-words"
data-show={true}
title={10}
title={111}
>
<span
className="ant-scroll-number-only"
@ -2503,11 +2483,59 @@ exports[`Badge should render when count is changed 4`] = `
`;
exports[`Badge should render when count is changed 5`] = `
<Badge
count={10}
>
<span
className="ant-badge ant-badge-not-a-wrapper"
>
<Animate
animation={Object {}}
component=""
componentProps={Object {}}
onAppear={[Function]}
onEnd={[Function]}
onEnter={[Function]}
onLeave={[Function]}
showProp="data-show"
transitionAppear={true}
transitionEnter={true}
transitionLeave={true}
transitionName=""
>
<AnimateChild
animation={Object {}}
key="scrollNumber"
transitionAppear={true}
transitionEnter={true}
transitionLeave={true}
transitionName=""
>
<ScrollNumber
className="ant-badge-count ant-badge-multiple-words"
count={10}
data-show={true}
key="scrollNumber"
prefixCls="ant-scroll-number"
title={10}
>
<sup
className="ant-scroll-number ant-badge-count ant-badge-multiple-words"
data-show={true}
title={10}
>
99+
</sup>
</ScrollNumber>
</AnimateChild>
</Animate>
</span>
</Badge>
`;
exports[`Badge should render when count is changed 6`] = `
<Badge
count={9}
dot={false}
overflowCount={99}
showZero={false}
>
<span
className="ant-badge ant-badge-not-a-wrapper"
@ -2539,7 +2567,6 @@ exports[`Badge should render when count is changed 5`] = `
count={9}
data-show={true}
key="scrollNumber"
onAnimated={[Function]}
prefixCls="ant-scroll-number"
title={9}
>

View File

@ -66,6 +66,9 @@ describe('Badge', () => {
wrapper.setProps({ count: 11 });
jest.runAllTimers();
expect(wrapper).toMatchSnapshot();
wrapper.setProps({ count: 111 });
jest.runAllTimers();
expect(wrapper).toMatchSnapshot();
wrapper.setProps({ count: 10 });
jest.runAllTimers();
expect(wrapper).toMatchSnapshot();

View File

@ -2,6 +2,7 @@
category: Components
type: Data Display
title: Badge
cover: https://gw.alipayobjects.com/zos/antfincdn/6%26GF9WHwvY/Badge.svg
---
Small numerical value or status descriptor for UI elements.

View File

@ -1,10 +1,9 @@
import * as React from 'react';
import Animate from 'rc-animate';
import omit from 'omit.js';
import classNames from 'classnames';
import ScrollNumber from './ScrollNumber';
import { PresetColorTypes, PresetColorType, PresetStatusColorType } from '../_util/colors';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
import { ConfigContext } from '../config-provider';
import { LiteralUnion } from '../_util/type';
import { cloneElement } from '../_util/reactNode';
@ -33,16 +32,33 @@ function isPresetColor(color?: string): boolean {
return (PresetColorTypes as any[]).indexOf(color) !== -1;
}
const Badge: React.FC<BadgeProps> = props => {
const Badge: React.FC<BadgeProps> = ({
prefixCls: customizePrefixCls,
scrollNumberPrefixCls: customizeScrollNumberPrefixCls,
children,
status,
text,
color,
count = null,
overflowCount = 99,
dot = false,
title,
offset,
style,
className,
showZero = false,
...restProps
}) => {
const { getPrefixCls, direction } = React.useContext(ConfigContext);
const prefixCls = getPrefixCls('badge', customizePrefixCls);
const getNumberedDisplayCount = () => {
const { count, overflowCount } = props;
const displayCount =
(count as number) > (overflowCount as number) ? `${overflowCount}+` : count;
return displayCount as string | number | null;
};
const hasStatus = (): boolean => {
const { status, color } = props;
return !!status || !!color;
};
@ -52,7 +68,6 @@ const Badge: React.FC<BadgeProps> = props => {
};
const isDot = () => {
const { dot } = props;
return (dot && !isZero()) || hasStatus();
};
@ -65,7 +80,6 @@ const Badge: React.FC<BadgeProps> = props => {
};
const getScrollNumberTitle = () => {
const { title, count } = props;
if (title) {
return title;
}
@ -73,7 +87,6 @@ const Badge: React.FC<BadgeProps> = props => {
};
const getStyleWithOffset = () => {
const { offset, style } = props;
return offset
? {
right: -parseInt(offset[0] as string, 10),
@ -83,30 +96,18 @@ const Badge: React.FC<BadgeProps> = props => {
: style;
};
const getBadgeClassName = (prefixCls: string, direction: string = 'ltr') => {
const { className, children } = props;
return classNames(className, prefixCls, {
[`${prefixCls}-status`]: hasStatus(),
[`${prefixCls}-not-a-wrapper`]: !children,
[`${prefixCls}-rtl`]: direction === 'rtl',
}) as string;
};
const isHidden = () => {
const { showZero } = props;
const displayCount = getDisplayCount();
const isEmpty = displayCount === null || displayCount === undefined || displayCount === '';
return (isEmpty || (isZero() && !showZero)) && !isDot();
};
const renderStatusText = (prefixCls: string) => {
const { text } = props;
const renderStatusText = () => {
const hidden = isHidden();
return hidden || !text ? null : <span className={`${prefixCls}-status-text`}>{text}</span>;
};
const renderDisplayComponent = () => {
const { count } = props;
const customNode = count as React.ReactElement<any>;
if (!customNode || typeof customNode !== 'object') {
return undefined;
@ -119,18 +120,17 @@ const Badge: React.FC<BadgeProps> = props => {
});
};
const renderBadgeNumber = (prefixCls: string, scrollNumberPrefixCls: string) => {
const { status, count, color } = props;
const renderBadgeNumber = () => {
const scrollNumberPrefixCls = getPrefixCls('scroll-number', customizeScrollNumberPrefixCls);
const displayCount = getDisplayCount();
const dot = isDot();
const bDot = isDot();
const hidden = isHidden();
const scrollNumberCls = classNames({
[`${prefixCls}-dot`]: dot,
[`${prefixCls}-count`]: !dot,
[`${prefixCls}-dot`]: bDot,
[`${prefixCls}-count`]: !bDot,
[`${prefixCls}-multiple-words`]:
!dot && count && count.toString && count.toString().length > 1,
!bDot && count && count.toString && count.toString().length > 1,
[`${prefixCls}-status-${status}`]: !!status,
[`${prefixCls}-status-${color}`]: isPresetColor(color),
});
@ -155,85 +155,50 @@ const Badge: React.FC<BadgeProps> = props => {
);
};
const renderBadge = ({ getPrefixCls, direction }: ConfigConsumerProps) => {
const {
prefixCls: customizePrefixCls,
scrollNumberPrefixCls: customizeScrollNumberPrefixCls,
children,
status,
text,
color,
...restProps
} = props;
const omitArr = [
'count',
'showZero',
'overflowCount',
'className',
'style',
'dot',
'offset',
'title',
];
const statusCls = classNames({
[`${prefixCls}-status-dot`]: hasStatus(),
[`${prefixCls}-status-${status}`]: !!status,
[`${prefixCls}-status-${color}`]: isPresetColor(color),
});
const statusStyle: React.CSSProperties = {};
if (color && !isPresetColor(color)) {
statusStyle.background = color;
}
const prefixCls = getPrefixCls('badge', customizePrefixCls);
const scrollNumberPrefixCls = getPrefixCls('scroll-number', customizeScrollNumberPrefixCls);
const scrollNumber = renderBadgeNumber(prefixCls, scrollNumberPrefixCls);
const statusText = renderStatusText(prefixCls);
const statusCls = classNames({
[`${prefixCls}-status-dot`]: hasStatus(),
[`${prefixCls}-status-${status}`]: !!status,
[`${prefixCls}-status-${color}`]: isPresetColor(color),
});
const statusStyle: React.CSSProperties = {};
if (color && !isPresetColor(color)) {
statusStyle.background = color;
}
// <Badge status="success" />
if (!children && hasStatus()) {
const styleWithOffset = getStyleWithOffset();
const statusTextColor = styleWithOffset && styleWithOffset.color;
return (
<span
{...omit(restProps, omitArr)}
className={getBadgeClassName(prefixCls, direction)}
style={styleWithOffset}
>
<span className={statusCls} style={statusStyle} />
<span style={{ color: statusTextColor }} className={`${prefixCls}-status-text`}>
{text}
</span>
</span>
);
}
const badgeClassName = classNames(className, prefixCls, {
[`${prefixCls}-status`]: hasStatus(),
[`${prefixCls}-not-a-wrapper`]: !children,
[`${prefixCls}-rtl`]: direction === 'rtl',
});
// <Badge status="success" />
if (!children && hasStatus()) {
const styleWithOffset = getStyleWithOffset();
const statusTextColor = styleWithOffset && styleWithOffset.color;
return (
<span {...omit(restProps, omitArr)} className={getBadgeClassName(prefixCls, direction)}>
{children}
<Animate
component=""
showProp="data-show"
transitionName={children ? `${prefixCls}-zoom` : ''}
transitionAppear
>
{scrollNumber}
</Animate>
{statusText}
<span {...restProps} className={badgeClassName} style={styleWithOffset}>
<span className={statusCls} style={statusStyle} />
<span style={{ color: statusTextColor }} className={`${prefixCls}-status-text`}>
{text}
</span>
</span>
);
};
}
return <ConfigConsumer>{renderBadge}</ConfigConsumer>;
};
Badge.defaultProps = {
count: null,
showZero: false,
dot: false,
overflowCount: 99,
return (
<span {...restProps} className={badgeClassName}>
{children}
<Animate
component=""
showProp="data-show"
transitionName={children ? `${prefixCls}-zoom` : ''}
transitionAppear
>
{renderBadgeNumber()}
</Animate>
{renderStatusText()}
</span>
);
};
export default Badge;

View File

@ -3,6 +3,7 @@ category: Components
subtitle: 徽标数
type: 数据展示
title: Badge
cover: https://gw.alipayobjects.com/zos/antfincdn/6%26GF9WHwvY/Badge.svg
---
图标右上角的圆形徽标数字。

View File

@ -2,6 +2,7 @@
category: Components
type: Navigation
title: Breadcrumb
cover: https://gw.alipayobjects.com/zos/alicdn/9Ltop8JwH/Breadcrumb.svg
---
A breadcrumb displays the current location within a hierarchy. It allows going back to states higher up in the hierarchy.

View File

@ -3,6 +3,7 @@ category: Components
subtitle: 面包屑
type: 导航
title: Breadcrumb
cover: https://gw.alipayobjects.com/zos/alicdn/9Ltop8JwH/Breadcrumb.svg
---
显示当前页面在系统层级结构中的位置,并能向上返回。

View File

@ -296,7 +296,7 @@ exports[`renders ./components/button/demo/ghost.md correctly 1`] = `
type="button"
>
<span>
link
Dashed
</span>
</button>
<button
@ -304,7 +304,7 @@ exports[`renders ./components/button/demo/ghost.md correctly 1`] = `
type="button"
>
<span>
Text Button
Text
</span>
</button>
<button
@ -312,7 +312,7 @@ exports[`renders ./components/button/demo/ghost.md correctly 1`] = `
type="button"
>
<span>
link
Link
</span>
</button>
</div>

View File

@ -23,13 +23,13 @@ ReactDOM.render(
</Button>
<Button ghost>Default</Button>
<Button type="dashed" ghost>
link
Dashed
</Button>
<Button type="text" ghost>
Text Button
Text
</Button>
<Button type="link" ghost>
link
Link
</Button>
</div>,
mountNode,

View File

@ -2,6 +2,7 @@
category: Components
type: General
title: Button
cover: https://gw.alipayobjects.com/zos/antfincdn/qZWIjVIkQ7/Button.svg
---
To trigger an operation.

View File

@ -3,6 +3,7 @@ category: Components
type: 通用
title: Button
subtitle: 按钮
cover: https://gw.alipayobjects.com/zos/antfincdn/qZWIjVIkQ7/Button.svg
---
按钮用于开始一个即时操作。

View File

@ -3,6 +3,7 @@ category: Components
type: Data Display
cols: 1
title: Calendar
cover: https://gw.alipayobjects.com/zos/antfincdn/dPQmLq08DI/Calendar.svg
---
Container for displaying data in calendar form.

View File

@ -4,6 +4,7 @@ type: 数据展示
subtitle: 日历
cols: 1
title: Calendar
cover: https://gw.alipayobjects.com/zos/antfincdn/dPQmLq08DI/Calendar.svg
---
按照日历形式展示数据的容器。

View File

@ -0,0 +1,3 @@
import ga_IE from '../../date-picker/locale/ga_IE';
export default ga_IE;

View File

@ -3,6 +3,7 @@ category: Components
type: Data Display
title: Card
cols: 1
cover: https://gw.alipayobjects.com/zos/antfincdn/NqXt8DJhky/Card.svg
---
Simple rectangular container.

View File

@ -4,6 +4,7 @@ type: 数据展示
title: Card
subtitle: 卡片
cols: 1
cover: https://gw.alipayobjects.com/zos/antfincdn/NqXt8DJhky/Card.svg
---
通用卡片容器。

View File

@ -2,6 +2,7 @@
category: Components
type: Data Display
title: Carousel
cover: https://gw.alipayobjects.com/zos/antfincdn/%24C9tmj978R/Carousel.svg
---
A carousel component. Scales with its container.

View File

@ -3,6 +3,7 @@ category: Components
type: 数据展示
title: Carousel
subtitle: 走马灯
cover: https://gw.alipayobjects.com/zos/antfincdn/%24C9tmj978R/Carousel.svg
---
旋转木马,一组轮播的区域。

View File

@ -2,6 +2,7 @@
category: Components
type: Data Entry
title: Cascader
cover: https://gw.alipayobjects.com/zos/antfincdn/cOHaAyTQ3u/Cascader.svg
---
Cascade selection box.

View File

@ -3,6 +3,7 @@ category: Components
type: 数据录入
title: Cascader
subtitle: 级联选择
cover: https://gw.alipayobjects.com/zos/antfincdn/cOHaAyTQ3u/Cascader.svg
---
级联选择框。

View File

@ -2,6 +2,7 @@
category: Components
type: Data Entry
title: Checkbox
cover: https://gw.alipayobjects.com/zos/alicdn/p7QZthygf/Checkbox.svg
---
Checkbox component.

View File

@ -3,6 +3,7 @@ category: Components
subtitle: 多选框
type: 数据录入
title: Checkbox
cover: https://gw.alipayobjects.com/zos/alicdn/p7QZthygf/Checkbox.svg
---
多选框。

View File

@ -3,6 +3,7 @@ category: Components
type: Data Display
title: Collapse
cols: 1
cover: https://gw.alipayobjects.com/zos/alicdn/IxH16B9RD/Collapse.svg
---
A content area which can be collapsed and expanded.

View File

@ -4,6 +4,7 @@ type: 数据展示
title: Collapse
subtitle: 折叠面板
cols: 1
cover: https://gw.alipayobjects.com/zos/alicdn/IxH16B9RD/Collapse.svg
---
可以折叠/展开的内容区域。

View File

@ -3,6 +3,7 @@ category: Components
type: Data Display
title: Comment
cols: 1
cover: https://gw.alipayobjects.com/zos/alicdn/uNYjrKkPv/Comment.svg
---
A comment displays user feedback and discussion to website content.

View File

@ -4,6 +4,7 @@ type: 数据展示
title: Comment
subtitle: 评论
cols: 1
cover: https://gw.alipayobjects.com/zos/alicdn/uNYjrKkPv/Comment.svg
---
对网站内容的反馈、评价和讨论。

View File

@ -3,6 +3,7 @@ category: Components
type: Other
cols: 1
title: ConfigProvider
cover: https://gw.alipayobjects.com/zos/alicdn/kegYxl1wj/ConfigProvider.svg
---
`ConfigProvider` provides a uniform configuration support for components.

View File

@ -4,6 +4,7 @@ subtitle: 全局化配置
cols: 1
type: 其他
title: ConfigProvider
cover: https://gw.alipayobjects.com/zos/alicdn/kegYxl1wj/ConfigProvider.svg
---
为组件提供统一的全局化配置。

View File

@ -2,6 +2,7 @@
category: Components
type: Data Entry
title: DatePicker
cover: https://gw.alipayobjects.com/zos/alicdn/Xr6CsbN_a/DatePicker.svg
---
To select or input a date.
@ -172,4 +173,16 @@ Added in `4.1.0`.
- [When set mode to DatePicker/RangePicker, cannot select year or month anymore?](/docs/react/faq#When-set-mode-to-DatePicker/RangePicker,-cannot-select-year-or-month-anymore?)
- [How to use DatePicker with customize date library like dayjs](/docs/react/replace-moment#DatePicker)
- [How to use DatePicker with customize date library like dayjs?](/docs/react/replace-moment#DatePicker)
- How to modify start day of week?
Please use correct [language](/docs/react/i18n) ([#5605](https://github.com/ant-design/ant-design/issues/5605)), or update moment `locale` config: https://codesandbox.io/s/moment-day-of-week-b24k5
```js
moment.locale('en', {
week: {
dow: 1,
},
});
```

View File

@ -3,6 +3,7 @@ category: Components
type: 数据录入
title: DatePicker
subtitle: 日期选择框
cover: https://gw.alipayobjects.com/zos/alicdn/Xr6CsbN_a/DatePicker.svg
---
输入或选择日期的控件。
@ -174,4 +175,17 @@ import 'moment/locale/zh-cn';
- [当我指定了 DatePicker/RangePicker 的 mode 属性后,点击后无法选择年份/月份?](/docs/react/faq#当我指定了-DatePicker/RangePicker-的-mode-属性后,点击后无法选择年份/月份?)
- [如何在 DatePicker 中使用自定义日期库(如 dayjs ](/docs/react/replace-moment#DatePicker)
- [如何在 DatePicker 中使用自定义日期库(如 dayjs ](/docs/react/replace-moment#DatePicker)
- 如何修改周的起始日?
请使用正确的[语言包](/docs/react/i18n)[#5605](https://github.com/ant-design/ant-design/issues/5605)),或者修改 moment 的 `locale` 配置https://codesandbox.io/s/moment-day-of-week-b24k5
```js
moment.locale('en', {
// 注意请修改你正在使用的 locale 语言,比如 zh-cn
week: {
dow: 1,
},
});
```

View File

@ -0,0 +1,27 @@
import CalendarLocale from 'rc-picker/lib/locale/ga_IE';
import TimePickerLocale from '../../time-picker/locale/ga_IE';
import { PickerLocale } from '../generatePicker';
// Merge into a locale object
const locale: PickerLocale = {
lang: {
placeholder: 'Roghnaigh dáta',
yearPlaceholder: 'Roghnaigh bliain',
quarterPlaceholder: 'Roghnaigh ráithe',
monthPlaceholder: 'Roghnaigh mí',
weekPlaceholder: 'Roghnaigh seachtain',
rangePlaceholder: ['Dáta tosaigh', 'Dáta deiridh'],
rangeYearPlaceholder: ['Tús na bliana', 'Deireadh na bliana'],
rangeMonthPlaceholder: ['Tosaigh mhí', 'Deireadh mhí'],
rangeWeekPlaceholder: ['Tosaigh an tseachtain', 'Deireadh na seachtaine'],
...CalendarLocale,
},
timePickerLocale: {
...TimePickerLocale,
},
};
// All settings at:
// https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json
export default locale;

View File

@ -3,6 +3,7 @@ category: Components
type: Data Display
title: Descriptions
cols: 1
cover: https://gw.alipayobjects.com/zos/alicdn/MjtG9_FOI/Descriptions.svg
---
Display multiple read-only fields in groups.

View File

@ -4,6 +4,7 @@ subtitle: 描述列表
type: 数据展示
title: Descriptions
cols: 1
cover: https://gw.alipayobjects.com/zos/alicdn/MjtG9_FOI/Descriptions.svg
---
成组展示多个只读字段。

View File

@ -2,6 +2,7 @@
category: Components
type: Layout
title: Divider
cover: https://gw.alipayobjects.com/zos/alicdn/5swjECahe/Divider.svg
---
A divider line separates different content.

View File

@ -3,6 +3,7 @@ category: Components
type: 布局
title: Divider
subtitle: 分割线
cover: https://gw.alipayobjects.com/zos/alicdn/5swjECahe/Divider.svg
---
区隔内容的分割线。

View File

@ -3,6 +3,7 @@ type: Feedback
category: Components
subtitle:
title: Drawer
cover: https://gw.alipayobjects.com/zos/alicdn/7z8NJQhFb/Drawer.svg
---
A panel which slides in from the edge of the screen.

View File

@ -3,6 +3,7 @@ type: 反馈
category: Components
subtitle: 抽屉
title: Drawer
cover: https://gw.alipayobjects.com/zos/alicdn/7z8NJQhFb/Drawer.svg
---
屏幕边缘滑出的浮层面板。

View File

@ -2,6 +2,7 @@
category: Components
type: Navigation
title: Dropdown
cover: https://gw.alipayobjects.com/zos/alicdn/TIIiKrsQT/Dropdown.svg
---
A dropdown list.

View File

@ -3,6 +3,7 @@ category: Components
subtitle: 下拉菜单
type: 导航
title: Dropdown
cover: https://gw.alipayobjects.com/zos/alicdn/TIIiKrsQT/Dropdown.svg
---
向下弹出的列表。

View File

@ -3,6 +3,7 @@ category: Components
type: Data Display
title: Empty
cols: 1
cover: https://gw.alipayobjects.com/zos/alicdn/HzvSywumz/Empty.svg
---
Empty state placeholder.

View File

@ -4,6 +4,7 @@ subtitle: 空状态
type: 数据展示
title: Empty
cols: 1
cover: https://gw.alipayobjects.com/zos/alicdn/HzvSywumz/Empty.svg
---
空状态时的展示占位图。

View File

@ -3,6 +3,7 @@ category: Components
type: Data Entry
cols: 1
title: Form
cover: https://gw.alipayobjects.com/zos/antfincdn/YeW5m96xHG/Form.svg
---
High performance Form component with data scope management. Including data collection, verification, and styles.

View File

@ -1,4 +1,4 @@
import { Rule } from 'rc-field-form/lib/interface';
import { Rule, RuleObject, RuleRender } from 'rc-field-form/lib/interface';
import InternalForm, { useForm, FormInstance, FormProps } from './Form';
import Item, { FormItemProps } from './FormItem';
import List from './FormList';
@ -30,6 +30,6 @@ Form.create = () => {
);
};
export { FormInstance, FormProps, FormItemProps, Rule };
export { FormInstance, FormProps, FormItemProps, Rule, RuleObject, RuleRender };
export default Form;

View File

@ -4,6 +4,7 @@ subtitle: 表单
type: 数据录入
cols: 1
title: Form
cover: https://gw.alipayobjects.com/zos/antfincdn/YeW5m96xHG/Form.svg
---
高性能表单控件,自带数据域管理。包含数据录入、校验以及对应样式。

View File

@ -3,6 +3,7 @@ category: Components
type: Layout
cols: 1
title: Grid
cover: https://gw.alipayobjects.com/zos/alicdn/5rWLU27so/Grid.svg
---
24 Grids System。

View File

@ -4,6 +4,7 @@ subtitle: 栅格
type: 布局
cols: 1
title: Grid
cover: https://gw.alipayobjects.com/zos/alicdn/5rWLU27so/Grid.svg
---
24 栅格系统。

View File

@ -3,6 +3,7 @@ category: Components
type: General
title: Icon
toc: false
cover: https://gw.alipayobjects.com/zos/alicdn/rrwbSt3FQ/Icon.svg
---
Semantic vector graphics. Before use icons, you need to install `@ant-design/icons` package:

View File

@ -4,6 +4,7 @@ subtitle: 图标
type: 通用
title: Icon
toc: false
cover: https://gw.alipayobjects.com/zos/alicdn/rrwbSt3FQ/Icon.svg
---
语义化的矢量图形。使用图标组件,你需要安装 `@ant-design/icons` 图标组件包:

View File

@ -2,6 +2,7 @@
category: Components
type: Data Entry
title: InputNumber
cover: https://gw.alipayobjects.com/zos/alicdn/SPEln9WgK/InputNumber.svg
---
Enter a number within certain range with the mouse or keyboard.

View File

@ -3,6 +3,7 @@ category: Components
subtitle: 数字输入框
type: 数据录入
title: InputNumber
cover: https://gw.alipayobjects.com/zos/alicdn/SPEln9WgK/InputNumber.svg
---
通过鼠标或键盘,输入范围内的数值。

View File

@ -2,6 +2,7 @@
category: Components
type: Data Entry
title: Input
cover: https://gw.alipayobjects.com/zos/alicdn/By8Gcczjz/Input.svg
---
A basic widget for getting the user input is a text field. Keyboard and mouse can be used for providing or changing data.

View File

@ -3,6 +3,7 @@ category: Components
subtitle: 输入框
type: 数据录入
title: Input
cover: https://gw.alipayobjects.com/zos/alicdn/By8Gcczjz/Input.svg
---
通过鼠标或键盘输入内容,是最基础的表单域的包装。

View File

@ -3,6 +3,7 @@ category: Components
type: Layout
cols: 1
title: Layout
cover: https://gw.alipayobjects.com/zos/alicdn/hzEndUVEx/Layout.svg
---
Handling the overall layout of a page.

View File

@ -4,6 +4,7 @@ subtitle: 布局
type: 布局
cols: 1
title: Layout
cover: https://gw.alipayobjects.com/zos/alicdn/hzEndUVEx/Layout.svg
---
协助进行页面级整体布局。

View File

@ -3,6 +3,7 @@ category: Components
type: Data Display
title: List
cols: 1
cover: https://gw.alipayobjects.com/zos/alicdn/5FrZKStG_/List.svg
---
Simple List.

View File

@ -4,6 +4,7 @@ type: 数据展示
title: List
subtitle: 列表
cols: 1
cover: https://gw.alipayobjects.com/zos/alicdn/5FrZKStG_/List.svg
---
通用列表。

View File

@ -32,6 +32,7 @@ import faIR from '../fa_IR';
import fiFI from '../fi_FI';
import frBE from '../fr_BE';
import frFR from '../fr_FR';
import gaIE from '../ga_IE';
import heIL from '../he_IL';
import hiIN from '../hi_IN';
import hrHR from '../hr_HR';
@ -86,6 +87,7 @@ const locales = [
fiFI,
frBE,
frFR,
gaIE,
heIL,
hiIN,
hrHR,

View File

@ -0,0 +1,3 @@
import locale from '../locale/ga_IE';
export default locale;

127
components/locale/ga_IE.tsx Normal file
View File

@ -0,0 +1,127 @@
/* eslint-disable no-template-curly-in-string */
import Pagination from 'rc-pagination/lib/locale/ga_IE';
import DatePicker from '../date-picker/locale/ga_IE';
import TimePicker from '../time-picker/locale/ga_IE';
import Calendar from '../calendar/locale/ga_IE';
import { Locale } from '../locale-provider';
const typeTemplate = '${label} is not a valid ${type}';
const localeValues: Locale = {
locale: 'ga',
Pagination,
DatePicker,
TimePicker,
Calendar,
global: {
placeholder: 'Please select',
},
Table: {
filterTitle: 'Filter menu',
filterConfirm: 'OK',
filterReset: 'Reset',
selectAll: 'Select current page',
selectInvert: 'Invert current page',
selectionAll: 'Select all data',
sortTitle: 'Sort',
expand: 'Expand row',
collapse: 'Collapse row',
triggerDesc: 'Click sort by descend',
triggerAsc: 'Click sort by ascend',
cancelSort: 'Click to cancel sort',
},
Modal: {
okText: 'OK',
cancelText: 'Cancel',
justOkText: 'OK',
},
Popconfirm: {
okText: 'OK',
cancelText: 'Cancel',
},
Transfer: {
titles: ['', ''],
searchPlaceholder: 'Search here',
itemUnit: 'item',
itemsUnit: 'items',
remove: 'Remove',
selectCurrent: 'Select current page',
removeCurrent: 'Remove current page',
selectAll: 'Select all data',
removeAll: 'Remove all data',
selectInvert: 'Invert current page',
},
Upload: {
uploading: 'Uploading...',
removeFile: 'Remove file',
uploadError: 'Upload error',
previewFile: 'Preview file',
downloadFile: 'Download file',
},
Empty: {
description: 'No Data',
},
Icon: {
icon: 'icon',
},
Text: {
edit: 'Edit',
copy: 'Copy',
copied: 'Copied',
expand: 'Expand',
},
PageHeader: {
back: 'Back',
},
Form: {
defaultValidateMessages: {
default: 'Field validation error ${label}',
required: 'Please enter ${label}',
enum: '${label} must be one of [${enum}]',
whitespace: '${label} cannot be a blank character',
date: {
format: '${label} date format is invalid',
parse: '${label} cannot be converted to a date',
invalid: '${label} is an invalid date',
},
types: {
string: typeTemplate,
method: typeTemplate,
array: typeTemplate,
object: typeTemplate,
number: typeTemplate,
date: typeTemplate,
boolean: typeTemplate,
integer: typeTemplate,
float: typeTemplate,
regexp: typeTemplate,
email: typeTemplate,
url: typeTemplate,
hex: typeTemplate,
},
string: {
len: '${label} must be ${len} characters',
min: '${label} at least ${min} characters',
max: '${label} up to ${max} characters',
range: '${label} must be between ${min}-${max} characters',
},
number: {
len: '${label} must be equal to ${len}',
min: '${label} minimum value is ${min}',
max: '${label} maximum value is ${max}',
range: '${label} must be between ${min}-${max}',
},
array: {
len: 'Must be ${len} ${label}',
min: 'At least ${min} ${label}',
max: 'At most ${max} ${label}',
range: 'The amount of ${label} must be between ${min}-${max}',
},
pattern: {
mismatch: '${label} does not match the pattern ${pattern}',
},
},
},
};
export default localeValues;

View File

@ -2,6 +2,7 @@
category: Components
type: Data Entry
title: Mentions
cover: https://gw.alipayobjects.com/zos/alicdn/0pF5j477V/Mentions.svg
---
Mention component.

View File

@ -3,6 +3,7 @@ category: Components
subtitle: 提及
type: 数据录入
title: Mentions
cover: https://gw.alipayobjects.com/zos/alicdn/0pF5j477V/Mentions.svg
---
提及组件。

View File

@ -3,6 +3,7 @@ category: Components
cols: 1
type: Navigation
title: Menu
cover: https://gw.alipayobjects.com/zos/alicdn/3XZcjGpvK/Menu.svg
---
A versatile menu for navigation.

View File

@ -4,6 +4,7 @@ cols: 1
type: 导航
title: Menu
subtitle: 导航菜单
cover: https://gw.alipayobjects.com/zos/alicdn/3XZcjGpvK/Menu.svg
---
为页面和功能提供导航的菜单列表。

View File

@ -3,6 +3,7 @@ category: Components
type: Feedback
noinstant: true
title: Message
cover: https://gw.alipayobjects.com/zos/alicdn/DDde1IT6g/Message.svg
---
Display global messages as feedback in response to user operations.

View File

@ -4,6 +4,7 @@ subtitle: 全局提示
type: 反馈
noinstant: true
title: Message
cover: https://gw.alipayobjects.com/zos/alicdn/DDde1IT6g/Message.svg
---
全局展示操作反馈信息。

View File

@ -2,6 +2,7 @@
type: Feedback
category: Components
title: Modal
cover: https://gw.alipayobjects.com/zos/alicdn/3StSdUlSH/Modal.svg
---
Modal dialogs.

View File

@ -3,6 +3,7 @@ type: 反馈
category: Components
subtitle: 对话框
title: Modal
cover: https://gw.alipayobjects.com/zos/alicdn/3StSdUlSH/Modal.svg
---
模态对话框。

View File

@ -3,6 +3,7 @@ category: Components
type: Feedback
noinstant: true
title: Notification
cover: https://gw.alipayobjects.com/zos/alicdn/KiuspIW60/Notification.svg
---
Display a notification message globally.

View File

@ -4,6 +4,7 @@ type: 反馈
noinstant: true
title: Notification
subtitle: 通知提醒框
cover: https://gw.alipayobjects.com/zos/alicdn/KiuspIW60/Notification.svg
---
全局展示通知提醒信息。

View File

@ -0,0 +1,7 @@
---
category: Components
title: Components Overview
type: Overview
---
`antd` provides plenty of UI components to enrich your web applications, and we will improve components expirerence consistently.

View File

@ -0,0 +1,7 @@
---
category: Components
title: 组件总览
type: 组件总览
---
`antd` 为 Web 应用提供了丰富的基础 UI 组件,我们还将持续探索企业级应用的最佳 UI 实践。

View File

@ -4,6 +4,7 @@ type: Navigation
title: PageHeader
cols: 1
subtitle:
cover: https://gw.alipayobjects.com/zos/alicdn/Uh-BJWMqm/PageHeader.svg
---
A header with common actions and design elements built in.

View File

@ -4,6 +4,7 @@ type: 导航
title: PageHeader
cols: 1
subtitle: 页头
cover: https://gw.alipayobjects.com/zos/alicdn/Uh-BJWMqm/PageHeader.svg
---
页头位于页容器中,页容器顶部,起到了内容概览和引导页级操作的作用。包括由面包屑、标题、页面内容简介、页面级操作等、页面级导航组成。

View File

@ -3,6 +3,7 @@ category: Components
type: Navigation
title: Pagination
cols: 1
cover: https://gw.alipayobjects.com/zos/alicdn/hRRde7p5u/Pagination.svg
---
A long list can be divided into several pages using `Pagination`, and only one page will be loaded at a time.

View File

@ -4,6 +4,7 @@ subtitle: 分页
type: 导航
title: Pagination
cols: 1
cover: https://gw.alipayobjects.com/zos/alicdn/hRRde7p5u/Pagination.svg
---
采用分页的形式分隔长列表,每次只加载一个页面。

View File

@ -2,6 +2,7 @@
category: Components
type: Feedback
title: Popconfirm
cover: https://gw.alipayobjects.com/zos/alicdn/8ln6VUFkX/Popconfirm.svg
---
A simple and compact confirmation dialog of an action.

View File

@ -3,6 +3,7 @@ category: Components
subtitle: 气泡确认框
type: 反馈
title: Popconfirm
cover: https://gw.alipayobjects.com/zos/alicdn/8ln6VUFkX/Popconfirm.svg
---
点击元素,弹出气泡式的确认框。

View File

@ -2,6 +2,7 @@
category: Components
type: Data Display
title: Popover
cover: https://gw.alipayobjects.com/zos/antfincdn/GkviFueLQwx/Popover.svg
---
The floating card popped by clicking or hovering.

View File

@ -3,6 +3,7 @@ category: Components
subtitle: 气泡卡片
type: 数据展示
title: Popover
cover: https://gw.alipayobjects.com/zos/antfincdn/GkviFueLQwx/Popover.svg
---
点击/鼠标移入元素,弹出气泡式的卡片浮层。

View File

@ -2,6 +2,7 @@
category: Components
type: Feedback
title: Progress
cover: https://gw.alipayobjects.com/zos/antfincdn/%24X8q%26OILIY/Progress.svg
---
Display the current progress of an operation flow.

Some files were not shown because too many files have changed in this diff Show More