Compare commits

..

73 Commits

Author SHA1 Message Date
07akioni
9838fc5843 docs: changelog 3.26.18 (#24982)
* docs: changelog 3.26.18

* chore: typo

* docs: reorder 3.26.18 changlog

* docs: version 3.26.18

* docs: Update CHANGELOG.zh-CN.md

Co-authored-by: 偏右 <afc163@gmail.com>

* docs: Update CHANGELOG.zh-CN.md

Co-authored-by: 偏右 <afc163@gmail.com>

* docs: add contributors in 3.26.18 changelog

Co-authored-by: 偏右 <afc163@gmail.com>
2020-06-14 22:44:09 +08:00
Amumu
b30ebb78b9 feat: add ga_IE locale (#24849)
* add ga_IE locale

* add test case
2020-06-09 13:49:38 +08:00
zoomdong
37e9c6b111 fix: paramter type error (#24429)
* fix: paramter type error

* feat: adjust

* feat: add type.test.tsx
2020-06-05 17:41:25 +08:00
Amumu
8e00e59f56 updater antd-tools (#24756) 2020-06-05 17:01:23 +08:00
Amumu
285068c533 snap (#24731) 2020-06-04 19:31:14 +08:00
偏右
8256b3cb89 🚀 release 3.26.17 (#24204) 2020-05-16 17:05:38 +08:00
Amumu
9504f5b418 fix: fix loading Button in Badge style (#23691)
* fix loading button in badage style

* order name

* snap

* rever demo change

* update

* update

* update

* snap

* snap
2020-05-16 15:24:13 +08:00
偏右
88d3f34e57 fix: Upload.Dragger triggered by label when disabled (#24202)
* refactor Dragger.tsx

* 🐛 Avoid disabled Upload.Dragger being triggered by label

close #24197
2020-05-16 14:28:33 +08:00
Amumu
97f4bab57f fix: tabs_animation_bug (#23151) (#24167)
* fix: tabs_animation_bug

* fix: fix lint error

Co-authored-by: 侯先诚 <houxiancheng@houxianchengdeMacBook-Pro.local>

Co-authored-by: HouXiancheng <505421473@qq.com>
Co-authored-by: 侯先诚 <houxiancheng@houxianchengdeMacBook-Pro.local>
2020-05-15 10:44:35 +08:00
Amumu
fa899ff64f Fix form input shaking (#23924) 2020-05-07 11:31:24 +08:00
afc163
30c702b34b fix snapshot 2020-05-06 18:46:48 +08:00
偏右
0b00640ab4 test: fix 3.x snapshot (#23852)
*  fix progress and date-picker snapshot

* [CodeFactor] Apply fixes

[ci skip] [skip ci]

Co-authored-by: codefactor-io <support@codefactor.io>
2020-05-04 16:06:49 +08:00
zombiej
44d344844c chore: Rollback of test 2020-05-01 00:59:12 +08:00
zombiej
aa971b6459 chore: Clean up 2020-05-01 00:58:53 +08:00
zombiej
29b98ea63a test: Fix focus test 2020-05-01 00:38:22 +08:00
zombiej
d3e6fd8090 test: Fix test case 2020-05-01 00:29:45 +08:00
zombiej
79821db32d chore: Update jest version 2020-04-30 23:46:23 +08:00
tangjinzhou
5eee566fff fix: ant-table-thead to @{table-prefix-cls}-thead (#23771) 2020-04-30 11:02:51 +08:00
诸岳
90da05750c chore(test): Update snapshots 2020-04-26 15:06:08 +08:00
诸岳
e2b9e40d9d docs: Add changelog of 3.26.16 (#23608) 2020-04-26 14:25:00 +08:00
偏右
226bce705a Update README.md 2020-04-19 18:38:08 +08:00
偏右
df2425652c test: fix ci error (#23382) 2020-04-19 18:29:33 +08:00
afc163
4751d109e3 🐛 Fix Carousel tabindex in non-active slide
close #23294
2020-04-19 01:35:03 +08:00
xrkffgg
2c8107c8bd site: Add 4.x url (#23130)
* docs: add 4.x url in 3.x page

* add s
2020-04-18 13:18:02 +08:00
偏右
56870dd7b3 🐛 Fix Table filter menu have no height (#23272)
when less version is 2.x

close ant-design/ant-design#23166
2020-04-15 10:50:40 +08:00
偏右
e94133a20b docs: update 3.x codesandbox example (#23101)
* Update getting-started.en-US.md

* Update getting-started.zh-CN.md
2020-04-09 22:56:02 +08:00
zombiej
50f1605acc docs: Fix changelog lang of 3.26.14 2020-04-04 13:38:08 +08:00
zombiej
96f22840d9 chore: Lock v3 npm tag 2020-04-04 13:36:50 +08:00
zombiej
6f78142360 chore: Remove deploy & auto deploy script 2020-04-04 11:08:07 +08:00
信鑫-King
b30832cda1 docs: 3.26.15 changelog (#22899)
* docs: 3.26.15 changelog

* fix: newline

* fix: changelog

* docs: changelog

* docs: changelog
2020-04-03 23:43:39 +08:00
Rustin
c23ea0c5e6 Revert "fix: set codesandbox referrer to no-referrer (#22792)" (#22797)
This reverts commit 44d74415
2020-04-01 11:12:11 +08:00
偏右
0c1f181957 fix: 🐛 Affix state update on unmounted component (#22790)
close #22683
2020-03-31 22:01:00 +08:00
Rustin
44d74415bc fix: set codesandbox referrer to no-referrer (#22792) 2020-03-31 21:24:36 +08:00
偏右
1c302163af 🐛 fix Table column.filtered not working (#22597)
close #22590
2020-03-25 17:45:32 +08:00
Kim, Harim
4d0ac007ed fix: multiple select search input doesn't show normally on Safari (#22586)
* Fix input padding in multple select #21950

* move padding style
2020-03-25 16:33:54 +08:00
二货机器人
282c792224 docs: 3.26.14 changelog (#22518)
* docs: 3.26.14 changelog

* bump ts version
2020-03-23 17:38:04 +08:00
Chiciuc Nicușor
ba2ef53089 fix: Make events non-optional for Popconfirm (#22438) 2020-03-20 21:42:09 +08:00
偏右
0792ac8762 test: fix 3.x test case (#22447)
*  fix snapshot

* fix test case broken by react-component/calendar#640

* 🔒 lock @typescript-eslint/parser version
2020-03-20 19:32:59 +08:00
偏右
aabf60586d fix: Descriptions should be able to fit width (#22407)
close #22350
2020-03-19 18:41:25 +08:00
偏右
f52003261f 🐛 Fix TextArea[autoSize] don't scroll bottom in Firefox (#22014)
close #21870
2020-03-09 16:09:06 +08:00
afc163
b0146a20cb cherry pick #21703
close https://github.com/ant-design/ant-design/issues/21870#issuecomment-596072738
2020-03-09 16:04:01 +08:00
zombiej
68b948b088 docs: Update demo link 2020-03-07 23:10:41 +08:00
偏右
bece43062b docs: ❇️ release 3.26.13 (#21967) 2020-03-07 15:40:30 +08:00
偏右
2e8205b01b fix(module:badge): fix toggling animation (#21887)
close #21674

chore: remove log

fix: timer leak

fix: willUnmount

test: cov
2020-03-05 13:29:58 +08:00
zhangj
b81e3e9af0 fix: Date Picker disabled style (#21655)
* fix https://github.com/ant-design/ant-design/issues/21644

* 修复样式前缀,应该采用getPrefixCls来进行获取

* fix: 不应该直接使用input的样式

* 修复代码风格

* 修复空格问题,并且采用less变量

* 添加cursor样式,补充禁用的时候指针样式丢失

* 添加less样式,修复鼠标指针的问题。

* 修复空格问题
2020-03-03 15:01:05 +08:00
偏右
045059f604 test: fix packtracker token (#21805) 2020-03-03 15:00:33 +08:00
偏右
a473770836 🔷 Fix Result status type to string & number (#21691)
close #21592
2020-03-02 14:49:14 +08:00
Felipe Lima
92b7902f4b fix: Grid rows overlapping when using vertical gutter (#21518)
The clearfix was not enough when having columns of different heights because we have negative margin-top and margin-bottom on the grid rows when using vertical gutter. Instead of setting `clear: both` just for the `::after` pseudo-element, we should also set it for the `::before` one when we are dealing with an ant-row that was immediately preceded by another ant-row.
2020-02-28 18:06:47 +08:00
zombiej
9ee1a903a3 docs: lock riddle & codepen antd version 2020-02-27 16:22:43 +08:00
afc163
5e7a31d71f docs: update demo links 2020-02-26 16:47:44 +08:00
偏右
27c9c086b6 🐛 Table filter menu should have max-height (#21602)
close #19542
2020-02-26 14:55:22 +08:00
偏右
046f394c88 docs: fix wrong link 2020-02-26 14:38:40 +08:00
信鑫-King
2ae5efa29f release: 3.26.12 (#21547)
* release: 3.26.12

* docs: changelog

* docs: changelog
2020-02-24 13:01:34 +08:00
Rick Zhou
e85ec40c9a avoid reading innerText (#21217)
this resolves https://github.com/ant-design/ant-design/issues/21160
2020-02-24 12:09:30 +08:00
Amumu
bb335bcc78 uniq (#21522) 2020-02-22 14:16:44 +08:00
偏右
26dd6f70af 💄 tweak Upload showDownloadIcon default value (#21496)
it should be false
2020-02-21 12:55:14 +08:00
zhangj
91a5947ef2 docs: 📝 Added expandIconColumnIndex property description of Table. (#21495)
* 添加Table表格的expandIconColumnIndex属性说明。

* Update components/table/index.en-US.md

Co-Authored-By: 偏右 <afc163@gmail.com>

* Update components/table/index.zh-CN.md

Co-Authored-By: 偏右 <afc163@gmail.com>

Co-authored-by: 偏右 <afc163@gmail.com>
2020-02-20 22:43:31 +08:00
二货机器人
be19e4e65f fix: Input with readOnly should not clearable (#21492) 2020-02-20 19:32:55 +08:00
二货机器人
ef7bb3763e docs: 3.26.11 changelog (#21405)
* update changelog

* update changelog

* update

* update link
2020-02-17 12:13:09 +08:00
二货机器人
ac740d74fb fix: Revert patch of row fix (#21406) 2020-02-17 12:03:04 +08:00
zombiej
e35663065c fix: ant-row with flex 2020-02-17 11:37:23 +08:00
chenshuai2144
4c52401fd1 Bump 3.26.9 2020-02-17 08:37:40 +08:00
陈帅
7c96796872 docs: add 3.26.10 changelog (#21393)
* doc: add 3.26.10 changelog

* docs: add 21306 21310 changelog

* docs: add 21356 changelog

* docs: Revert extra line breaks

* doc: fix typo

* doc: fix typo

* doc: fix typo
2020-02-17 01:22:10 +08:00
偏右
ac63d26f88 Revert "fix: Minor fix on ValidationRule to match AsyncValidator (#21250)" (#21391)
This reverts commit f7e7ce9d4f.
2020-02-15 23:35:18 +08:00
afc163
b22ef2280c fix Badge test in React 15 2020-02-14 12:31:23 +08:00
偏右
831f0fcb5e chore: remove unused iconClassName from definition (#21378)
close #21367
2020-02-14 12:29:37 +08:00
偏右
4db7cbcf43 🐛 Fix Affix throws Cannot read property getBoundingClientRect (#21350)
close #21348
2020-02-12 13:05:11 +08:00
偏右
dd16a24426 🐛 fix Badge color not working when contains children (#21333)
close #21331
2020-02-11 12:57:00 +08:00
偏右
f692e7ee34 🐛 fix Alert button extra padding in Firefox (#21325)
close #21324
2020-02-10 19:52:48 +08:00
偏右
fd553c9ba0 🎬 improve dropdown demos in mobile (#21312)
close #21267
2020-02-10 13:10:45 +08:00
偏右
1b23971fd6 💄 tweak steps 1px align (#21306)
https://github.com/ant-design/ant-design/issues/21257#issuecomment-583865088
2020-02-10 13:08:00 +08:00
二货机器人
04ef6a8bce fix: Clear fix missing width (#21310) 2020-02-10 11:55:30 +08:00
诸岳
703a4b1011 docs(changelog): Add missing version 2020-02-08 22:27:54 +08:00
90 changed files with 12559 additions and 7192 deletions

View File

@@ -67,4 +67,5 @@ module.exports = {
dist: {
finalize: finalizeDist,
},
tag: 'previous',
};

View File

@@ -1,30 +0,0 @@
name: Deploy website
on:
release:
types: [published]
branches:
- 3.x-stable
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: install
run: npm install
- name: build
run: npm run predeploy
- name: deploy
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
# PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./_site
with:
emptyCommits: false

View File

@@ -15,6 +15,84 @@ timeline: true
---
## 3.26.18
`2020-06-14`
- 🐞 Fix Tree `AntTreeNodeProps.children` type. [#24429](https://github.com/ant-design/ant-design/pull/24429) [@fireairforce](https://github.com/fireairforce)
- 🇮🇪 Add Irish(ga_IE) locale. [#24849](https://github.com/ant-design/ant-design/pull/24849) [@AbhijeetGaware](https://github.com/AbhijeetGaware)
## 3.26.17
`2020-05-16`
- 🐞 Avoid disabled Upload.Dragger being triggered by clicking Form `label`. [#24202](https://github.com/ant-design/ant-design/pull/24202)
- 🐞 Fix Tabs cannot be displayed in Safair. [#23151](https://github.com/ant-design/ant-design/pull/23151)
- 🐞 Fix Form.Item control icon shaking when `hasFeedback` is not set. [#23924](https://github.com/ant-design/ant-design/pull/23924)
- 🐞 Fix `loading` Button using Badge style. [#23691](https://github.com/ant-design/ant-design/pull/23691)
## 3.26.16
`2020-04-26`
- 🐞 Fix Carousel tabbed Radio/Checkbox to non-active slide. [#23380](https://github.com/ant-design/ant-design/pull/23380)
- 🐞 Fix Table filter menu no height when less version is `2.x`. [#23272](https://github.com/ant-design/ant-design/pull/23272)
## 3.26.15
`2020-04-03`
- 🐞 Fix Affix throws `React warning of state update on unmounted component`. [#22790](https://github.com/ant-design/ant-design/pull/22790)
- 🐞 Fix Table `column.filtered` not working. [#22597](https://github.com/ant-design/ant-design/pull/22597)
- 🐞 Fix Select Input style with `multiple` mode in Safari. [#22586](https://github.com/ant-design/ant-design/pull/22586) [@iicdii](https://github.com/iicdii)
## 3.26.14
`2020-03-23`
- 🐞 Fix Descriptions cannot fit to small container width. [#22407](https://github.com/ant-design/ant-design/pull/22407)
- 🐞 Fix TextArea `autoSize` don't scroll bottom in Firefox. [#22014](https://github.com/ant-design/ant-design/pull/22014)
- 🐞 Fix TextArea style get warning in `react@16.13`. [#21703](https://github.com/ant-design/ant-design/pull/21703)
- Typescript
- Adjust Popconfirm `onConfirm` `onCancel` event definition. [#22438](https://github.com/ant-design/ant-design/pull/22438) [@nicu-chiciuc](https://github.com/nicu-chiciuc)
## 3.26.13
`2020-03-07`
- 🐞 Fix Result `status` cannot assigned to `string` or `number` type. [#21691](https://github.com/ant-design/ant-design/pull/21691)
- 🐞 Fix Badge animation when switch between 10 and 11. [#21887](https://github.com/ant-design/ant-design/pull/21887) [@wendellhu95](https://github.com/wendellhu95)
- 🐞 Fix DatePicker disabled icon cursor style. [#21655](https://github.com/ant-design/ant-design/pull/21655) [@jhoneybee](https://github.com/jhoneybee)
- 🐞 Fix Grid multiple Rows `margin` overlapping. [#21518](https://github.com/ant-design/ant-design/pull/21518) [@felipeptcho](https://github.com/felipeptcho)
- 🐞 Fix Table filter menu max height with many items. [#21602](https://github.com/ant-design/ant-design/pull/21602)
## 3.26.12
`2020-02-24`
- 🐞 Fix Input with `readOnly` still clearable by `allowClear`. [#21492](https://github.com/ant-design/ant-design/pull/21492)
- 🐞 Fix Upload won't showing download icon defaultly. [#21496](https://github.com/ant-design/ant-design/pull/21496)
- ⚡️ Improve Button render performance. [#21217](https://github.com/ant-design/ant-design/pull/21217)
## 3.26.11
`2020-02-17`
- 🐞 Rollback misc `clearfix` style to breaks flex layout (mainly affect Row, Form, Layout style). [#21406](https://github.com/ant-design/ant-design/pull/21406)
## 3.26.10
`2020-02-16`
- 🐞 Fix Input.Group inside `<Form layout="vertical" >` 1px bug. [#20685](https://github.com/ant-design/ant-design/pull/20685)
- 🐞 Fix Badge `color` not working when contains children. [#21333](https://github.com/ant-design/ant-design/pull/21333)
- 🐞 Fix Alert close button extra `padding`. [#21325](https://github.com/ant-design/ant-design/pull/21325)
- 🐞 Fix Affix throws `Cannot read property getBoundingClientRect in mobile device`. [#21350](https://github.com/ant-design/ant-design/pull/21350)
- 💄 Tweak Steps 1px align issue. [#21306](https://github.com/ant-design/ant-design/pull/21306)
- 💄 Fix Row component affect next element style issue. [#21310](https://github.com/ant-design/ant-design/pull/21310)
- Typescript
- 🔷 Revert [#21250](https://github.com/ant-design/ant-design/pull/21250) Type Definition Update.[#21356](https://github.com/ant-design/ant-design/pull/21356)
## 3.26.9
`2020-02-08`
@@ -2625,7 +2703,7 @@ We provide a [migration tool](https://github.com/ant-design/antd-migration-helpe
- 🙅 Deprecated `onRowClick`, `onRowDoubleClick`, `onRowContextMenu`, `onRowMouseEnter`, `onRowMouseLeave`, please use `onRow` instead.
```javascript
<Table
onRow={record => ({
onRow={(record) => ({
onClick: () => {},
onDoubleClick: () => {},
onContextMenu: () => {},

View File

@@ -15,6 +15,86 @@ timeline: true
---
## 3.26.18
`2020-06-14`
- 🐞 修正了 Tree `AntTreeNodeProps.children` 的类型。[#24429](https://github.com/ant-design/ant-design/pull/24429) [@fireairforce](https://github.com/fireairforce)
- 🇮🇪 添加爱尔兰语国际化支持。[#24849](https://github.com/ant-design/ant-design/pull/24849) [@AbhijeetGaware](https://github.com/AbhijeetGaware)
## 3.26.17
`2020-05-16`
- 🐞 修复 Upload.Dragger 禁用时依然会被 Form `label` 触发的问题。[#24202](https://github.com/ant-design/ant-design/pull/24202)
- 🐞 修复 Tabs 开启动画时 Safair 下无法显示的问题。[#23151](https://github.com/ant-design/ant-design/pull/23151)
- 🐞 修复 Form.Item 不设置 `hasFeedback` 时校验图标闪动问题。[#23924](https://github.com/ant-design/ant-design/pull/23924)
- 🐞 修复 `loading` Button 使用 Badge 时的样式问题。[#23691](https://github.com/ant-design/ant-design/pull/23691)
## 3.26.16
`2020-04-26`
- 🐞 修复 Carousel 键盘切换到非活跃 slide 上的 Radio/Checkbox 的问题。[#23380](https://github.com/ant-design/ant-design/pull/23380)
- 🐞 修复 Table 筛选菜单在 less 版本为 `2.x` 时不显示的问题。[#23272](https://github.com/ant-design/ant-design/pull/23272)
## 3.26.15
`2020-04-03`
- 🐞 修复 Affix 抛出 `React state update on unmounted component` 警告的问题。[#22790](https://github.com/ant-design/ant-design/pull/22790)
- 🐞 修复 Table `column.filtered` 失效的问题。[#22597](https://github.com/ant-design/ant-design/pull/22597)
- 🐞 修复 Select `multiple` 模式下Input 在 Safari 浏览器的样式问题。[#22586](https://github.com/ant-design/ant-design/pull/22586) [@iicdii](https://github.com/iicdii)
## 3.26.14
`2020-03-23`
- 🐞 修复 Descriptions 在小尺寸下无法自适应的问题。[#22407](https://github.com/ant-design/ant-design/pull/22407)
- 🐞 修复 TextArea `autoSize` 时在 Firefox 下不会自动滚动到底的问题。[#22014](https://github.com/ant-design/ant-design/pull/22014)
- 🐞 修复 TextArea 样式在 `react@16.13` 下会报警告的问题。[#21703](https://github.com/ant-design/ant-design/pull/21703)
- Typescript
- 调整 Popconfirm `onConfirm` `onCancel` 事件类型定义。[#22438](https://github.com/ant-design/ant-design/pull/22438) [@nicu-chiciuc](https://github.com/nicu-chiciuc)
## 3.26.13
`2020-03-07`
- 🐞 修复 Result `status` 属性不能赋值 `string` 或者 `number` 类型的问题。[#21691](https://github.com/ant-design/ant-design/pull/21691)
- 🐞 修复 Badge 数字在 10 和 11 切换时的动画错误。[#21887](https://github.com/ant-design/ant-design/pull/21887) [@wendellhu95](https://github.com/wendellhu95)
- 🐞 修复 DatePicker 日历图标在禁用时的手型。[#21655](https://github.com/ant-design/ant-design/pull/21655) [@jhoneybee](https://github.com/jhoneybee)
- 🐞 修复 Grid 多个 Row 之间的边距叠加问题。[#21518](https://github.com/ant-design/ant-design/pull/21518) [@felipeptcho](https://github.com/felipeptcho)
- 🐞 修复 Table 筛选菜单高度溢出屏幕的问题。[#21602](https://github.com/ant-design/ant-design/pull/21602)
## 3.26.12
`2020-02-24`
- 🐞 修复 Input 在设置 `readOnly``allowClear` 仍然可以清除的问题。[#21492](https://github.com/ant-design/ant-design/pull/21492)
- 🐞 修复 Upload 列表默认情况下不展现下载按钮。[#21496](https://github.com/ant-design/ant-design/pull/21496)
- ⚡️ 提升 Button 渲染性能。[#21217](https://github.com/ant-design/ant-design/pull/21217)
## 3.26.11
`2020-02-17`
- 🐞 回滚原子样式 `clearfix` 以修复破坏 flex 布局的问题(主要影响 Row、Form、Layout 等布局问题)。[#21406](https://github.com/ant-design/ant-design/pull/21406)
## 3.26.10
`2020-02-16`
- 🐞 修复 `<Form layout="vertical" >` 内 Input.Group 偏上一像素的问题。[#20685](https://github.com/ant-design/ant-design/pull/20685)
- 🐞 修复 Badge 包裹模式下 `color` 属性失效的问题。[#21333](https://github.com/ant-design/ant-design/pull/21333)
- 🐞 修复 Alert 关闭按钮额外的 `padding`。[#21325](https://github.com/ant-design/ant-design/pull/21325)
- 🐞 修复 Affix 在移动设备下抛错 `Cannot read property getBoundingClientRect` 的问题。[#21350](https://github.com/ant-design/ant-design/pull/21350)
- 💄 微调 Steps 文本 1px 使其居中对齐。[#21306](https://github.com/ant-design/ant-design/pull/21306)
- 💄 修复 Row 组件影响下一个元素样式问题。[#21310](https://github.com/ant-design/ant-design/pull/21310)
- Typescript
- 🔷 回滚 [#21250](https://github.com/ant-design/ant-design/pull/21250) 的类型定义更新。[#21356](https://github.com/ant-design/ant-design/pull/21356)
## 3.26.9
`2020-02-08`
- 🐞 修复 Badge 在 Typography 下数字错位的问题。[#21237](https://github.com/ant-design/ant-design/pull/21237)
@@ -2639,7 +2719,7 @@ timeline: true
- 🙅 废弃以下属性 `onRowClick``onRowDoubleClick`、`onRowContextMenu`、`onRowMouseEnter`、`onRowMouseLeave`,请使用 `onRow` 代替。
```javascript
<Table
onRow={record => ({
onRow={(record) => ({
onClick: () => {},
onDoubleClick: () => {},
onContextMenu: () => {},

View File

@@ -10,7 +10,7 @@
An enterprise-class UI design language and React UI library.
[![CircleCI branch](https://img.shields.io/circleci/project/github/ant-design/ant-design/master.svg?style=flat-square)](https://circleci.com/gh/ant-design/ant-design) ![CI Status](https://github.com/ant-design/ant-design/workflows/test/badge.svg) [![Codecov](https://img.shields.io/codecov/c/github/ant-design/ant-design/master.svg?style=flat-square)](https://codecov.io/gh/ant-design/ant-design/branch/master) [![](https://flat.badgen.net/npm/v/antd?icon=npm)](https://www.npmjs.com/package/antd) [![](https://badgen.net/npm/v/antd/next)](https://www.npmjs.com/package/antd) [![NPM downloads](http://img.shields.io/npm/dm/antd.svg?style=flat-square)](http://npmjs.com/antd)
[![CircleCI branch](https://img.shields.io/circleci/project/github/ant-design/ant-design/master.svg?style=flat-square)](https://circleci.com/gh/ant-design/ant-design) ![CI Status](https://github.com/ant-design/ant-design/workflows/test/badge.svg) [![Codecov](https://img.shields.io/codecov/c/github/ant-design/ant-design/master.svg?style=flat-square)](https://codecov.io/gh/ant-design/ant-design/branch/master) [![](https://flat.badgen.net/npm/v/antd?icon=npm)](https://www.npmjs.com/package/antd) [![NPM downloads](http://img.shields.io/npm/dm/antd.svg?style=flat-square)](http://npmjs.com/antd)
[![Dependencies](https://img.shields.io/david/ant-design/ant-design.svg?style=flat-square)](https://david-dm.org/ant-design/ant-design) [![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design.svg?style=flat-square)](https://david-dm.org/ant-design/ant-design?type=dev) [![Total alerts](https://flat.badgen.net/lgtm/alerts/g/ant-design/ant-design)](https://lgtm.com/projects/g/ant-design/ant-design/alerts/) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fant-design%2Fant-design.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fant-design%2Fant-design?ref=badge_shield) [![Issues need help](https://flat.badgen.net/github/label-issues/ant-design/ant-design/help%20wanted/open)](https://github.com/ant-design/ant-design/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22)

View File

@@ -116,6 +116,8 @@ class Affix extends React.Component<AffixProps, AffixState> {
clearTimeout(this.timeout);
removeObserveTarget(this);
(this.updatePosition as any).cancel();
// https://github.com/ant-design/ant-design/issues/22683
(this.lazyUpdatePosition as any).cancel();
}
getOffsetTop = () => {
@@ -239,7 +241,7 @@ class Affix extends React.Component<AffixProps, AffixState> {
const offsetBottom = this.getOffsetBottom();
const targetNode = target();
if (targetNode) {
if (targetNode && this.placeholderNode) {
const targetRect = getTargetRect(targetNode);
const placeholderReact = getTargetRect(this.placeholderNode);
const fixedTop = getFixedTop(placeholderReact, targetRect, offsetTop);

View File

@@ -72,6 +72,7 @@
position: absolute;
top: 8px;
right: 16px;
padding: 0;
overflow: hidden;
font-size: @font-size-sm;
line-height: 22px;

View File

@@ -35,6 +35,7 @@ describe('AutoComplete children could be focus', () => {
.focus();
jest.runAllTimers();
expect(handleFocus).toHaveBeenCalled();
wrapper.unmount();
});
it('blur() and onBlur', () => {
@@ -51,6 +52,7 @@ describe('AutoComplete children could be focus', () => {
.blur();
jest.runAllTimers();
expect(handleBlur).toHaveBeenCalled();
wrapper.unmount();
});
it('child.ref should work', () => {
@@ -67,7 +69,11 @@ describe('AutoComplete children could be focus', () => {
let inputRef;
mount(
<AutoComplete dataSource={[]}>
<input ref={node => { inputRef = node; }} />
<input
ref={node => {
inputRef = node;
}}
/>
</AutoComplete>,
);
expect(typeof inputRef.focus).toBe('function');

View File

@@ -71,6 +71,8 @@ class ScrollNumber extends React.Component<ScrollNumberProps, ScrollNumberState>
lastCount?: string | number | null;
private timeout?: number;
constructor(props: ScrollNumberProps) {
super(props);
this.state = {
@@ -83,17 +85,26 @@ class ScrollNumber extends React.Component<ScrollNumberProps, ScrollNumberState>
this.lastCount = prevState.count;
const { animateStarted } = this.state;
if (animateStarted) {
// eslint-disable-next-line react/no-did-update-set-state
this.setState(
(__, props) => ({
animateStarted: false,
count: props.count,
}),
this.onAnimated,
);
this.clearTimeout();
// Let browser has time to reset the scroller before actually
// performing the transition.
this.timeout = setTimeout(() => {
// eslint-disable-next-line react/no-did-update-set-state
this.setState(
(__, props) => ({
animateStarted: false,
count: props.count,
}),
this.onAnimated,
);
});
}
}
componentWillUnmount() {
this.clearTimeout();
}
getPositionByNum(num: number, i: number) {
const { count } = this.state;
const currentCount = Math.abs(Number(count));
@@ -210,6 +221,13 @@ class ScrollNumber extends React.Component<ScrollNumberProps, ScrollNumberState>
render() {
return <ConfigConsumer>{this.renderScrollNumber}</ConfigConsumer>;
}
private clearTimeout(): void {
if (this.timeout) {
clearTimeout(this.timeout);
this.timeout = undefined;
}
}
}
polyfill(ScrollNumber);

View File

@@ -69,6 +69,42 @@ exports[`Badge badge should support float number 2`] = `
</Badge>
`;
exports[`Badge render Badge status/color when contains children 1`] = `
<div>
<span
class="ant-badge ant-badge-status"
>
<a />
<sup
class="ant-scroll-number ant-badge-dot ant-badge-status-success"
data-show="true"
title="5"
/>
</span>
<span
class="ant-badge ant-badge-status"
>
<a />
<sup
class="ant-scroll-number ant-badge-dot ant-badge-status-blue"
data-show="true"
title="5"
/>
</span>
<span
class="ant-badge ant-badge-status"
>
<a />
<sup
class="ant-scroll-number ant-badge-dot"
data-show="true"
style="background:#08c"
title="5"
/>
</span>
</div>
`;
exports[`Badge render correct with negative number 1`] = `
<div>
<span

View File

@@ -25,6 +25,7 @@ describe('Badge', () => {
expect(wrapper).toMatchSnapshot();
wrapper = mount(<Badge count="3.5" />);
expect(wrapper).toMatchSnapshot();
expect(() => wrapper.unmount()).not.toThrow();
});
it('badge dot not showing count == 0', () => {
@@ -111,4 +112,22 @@ describe('Badge', () => {
);
expect(wrapper).toMatchSnapshot();
});
// https://github.com/ant-design/ant-design/issues/21331
it('render Badge status/color when contains children', () => {
const wrapper = render(
<div>
<Badge count={5} status="success">
<a />
</Badge>
<Badge count={5} color="blue">
<a />
</Badge>
<Badge count={5} color="#08c">
<a />
</Badge>
</div>,
);
expect(wrapper).toMatchSnapshot();
})
});

View File

@@ -136,7 +136,7 @@ export default class Badge extends React.Component<BadgeProps, any> {
}
renderBadgeNumber(prefixCls: string, scrollNumberPrefixCls: string) {
const { status, count } = this.props;
const { status, count, color } = this.props;
const displayCount = this.getDispayCount();
const isDot = this.isDot();
@@ -147,9 +147,16 @@ export default class Badge extends React.Component<BadgeProps, any> {
[`${prefixCls}-count`]: !isDot,
[`${prefixCls}-multiple-words`]:
!isDot && count && count.toString && count.toString().length > 1,
[`${prefixCls}-status-${status}`]: this.hasStatus(),
[`${prefixCls}-status-${status}`]: !!status,
[`${prefixCls}-status-${color}`]: isPresetColor(color),
});
let statusStyle: React.CSSProperties | undefined = this.getStyleWithOffset();
if (color && !isPresetColor(color)) {
statusStyle = statusStyle || {};
statusStyle.background = color;
}
return hidden ? null : (
<ScrollNumber
prefixCls={scrollNumberPrefixCls}
@@ -158,7 +165,7 @@ export default class Badge extends React.Component<BadgeProps, any> {
count={displayCount}
displayComponent={this.renderDispayComponent()} // <Badge status="success" count={<Icon type="xxx" />}></Badge>
title={this.getScrollNumberTitle()}
style={this.getStyleWithOffset()}
style={statusStyle}
key="scrollNumber"
/>
);

View File

@@ -13,7 +13,6 @@
line-height: 1;
&-count {
z-index: @zindex-badge;
min-width: @badge-height;
height: @badge-height;
padding: 0 6px;
@@ -37,7 +36,6 @@
}
&-dot {
z-index: @zindex-badge;
width: @badge-dot-size;
height: @badge-dot-size;
background: @highlight-color;
@@ -51,6 +49,7 @@
position: absolute;
top: 0;
right: 0;
z-index: @zindex-badge;
transform: translate(50%, -50%);
transform-origin: 100% 0%;
}

View File

@@ -194,7 +194,7 @@ class Button extends React.Component<ButtonProps, ButtonState> {
if (!this.buttonNode) {
return;
}
const buttonText = this.buttonNode.textContent || this.buttonNode.innerText;
const buttonText = this.buttonNode.textContent;
if (this.isNeedInserted() && isTwoCNChar(buttonText)) {
if (!this.state.hasTwoCNChar) {
this.setState({

View File

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

View File

@@ -31,8 +31,19 @@
.slick-slide {
pointer-events: none;
// https://github.com/ant-design/ant-design/issues/23294
input.@{ant-prefix}-radio-input,
input.@{ant-prefix}-checkbox-input {
visibility: hidden;
}
&.slick-active {
pointer-events: auto;
input.@{ant-prefix}-radio-input,
input.@{ant-prefix}-checkbox-input {
visibility: visible;
}
}
}
}

View File

@@ -8171,7 +8171,7 @@ exports[`ConfigProvider components Modal configProvider 1`] = `
>
<div
aria-hidden="true"
style="width:0;height:0;overflow:hidden"
style="width:0;height:0;overflow:hidden;outline:none"
tabindex="0"
/>
<div
@@ -8236,7 +8236,7 @@ exports[`ConfigProvider components Modal configProvider 1`] = `
</div>
<div
aria-hidden="true"
style="width:0;height:0;overflow:hidden"
style="width:0;height:0;overflow:hidden;outline:none"
tabindex="0"
/>
</div>
@@ -8265,7 +8265,7 @@ exports[`ConfigProvider components Modal normal 1`] = `
>
<div
aria-hidden="true"
style="width:0;height:0;overflow:hidden"
style="width:0;height:0;overflow:hidden;outline:none"
tabindex="0"
/>
<div
@@ -8330,7 +8330,7 @@ exports[`ConfigProvider components Modal normal 1`] = `
</div>
<div
aria-hidden="true"
style="width:0;height:0;overflow:hidden"
style="width:0;height:0;overflow:hidden;outline:none"
tabindex="0"
/>
</div>
@@ -8359,7 +8359,7 @@ exports[`ConfigProvider components Modal prefixCls 1`] = `
>
<div
aria-hidden="true"
style="width:0;height:0;overflow:hidden"
style="width:0;height:0;overflow:hidden;outline:none"
tabindex="0"
/>
<div
@@ -8424,7 +8424,7 @@ exports[`ConfigProvider components Modal prefixCls 1`] = `
</div>
<div
aria-hidden="true"
style="width:0;height:0;overflow:hidden"
style="width:0;height:0;overflow:hidden;outline:none"
tabindex="0"
/>
</div>
@@ -17396,7 +17396,7 @@ exports[`ConfigProvider components Upload configProvider 1`] = `
</svg>
</i>
<span
class="config-upload-list-item-name config-upload-list-item-name-icon-count-2"
class="config-upload-list-item-name config-upload-list-item-name-icon-count-1"
title="xxx.png"
>
xxx.png
@@ -17404,31 +17404,6 @@ exports[`ConfigProvider components Upload configProvider 1`] = `
<span
class="config-upload-list-item-card-actions "
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
<a
title="Remove file"
>
@@ -17505,7 +17480,7 @@ exports[`ConfigProvider components Upload normal 1`] = `
</svg>
</i>
<span
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
title="xxx.png"
>
xxx.png
@@ -17513,31 +17488,6 @@ exports[`ConfigProvider components Upload normal 1`] = `
<span
class="ant-upload-list-item-card-actions "
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
<a
title="Remove file"
>
@@ -17614,7 +17564,7 @@ exports[`ConfigProvider components Upload prefixCls 1`] = `
</svg>
</i>
<span
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
title="xxx.png"
>
xxx.png
@@ -17622,31 +17572,6 @@ exports[`ConfigProvider components Upload prefixCls 1`] = `
<span
class="ant-upload-list-item-card-actions "
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
<a
title="Remove file"
>

View File

@@ -18,22 +18,24 @@ describe('DatePicker', () => {
});
it('should focus trigger input after select date in DatePicker', () => {
const wrapper = mount(<DatePicker />);
const wrapper = mount(<DatePicker />, { attachTo: document.body });
openPanel(wrapper);
selectDate(wrapper, moment('2016-11-23'));
expect(wrapper.find('.ant-calendar-picker-input').getDOMNode()).toBe(document.activeElement);
wrapper.unmount();
});
it('should focus trigger input after select date in RangePicker', () => {
const wrapper = mount(<RangePicker />);
const wrapper = mount(<RangePicker />, { attachTo: document.body });
openPanel(wrapper);
selectDate(wrapper, moment('2016-11-23'), 0);
selectDate(wrapper, moment('2016-11-28'), 1);
expect(wrapper.find('.ant-calendar-picker').getDOMNode()).toBe(document.activeElement);
wrapper.unmount();
});
it('should focus trigger input after select date in MonthPicker', () => {
const wrapper = mount(<MonthPicker />);
const wrapper = mount(<MonthPicker />, { attachTo: document.body });
openPanel(wrapper);
wrapper
.find('.ant-calendar-month-panel-month')
@@ -44,46 +46,52 @@ describe('DatePicker', () => {
.at(6)
.hasClass('ant-calendar-month-panel-selected-cell');
expect(wrapper.find('.ant-calendar-picker-input').getDOMNode()).toBe(document.activeElement);
wrapper.unmount();
});
it('should focus trigger input after select date in WeekPicker', () => {
const wrapper = mount(<WeekPicker />);
const wrapper = mount(<WeekPicker />, { attachTo: document.body });
openPanel(wrapper);
selectDate(wrapper, moment('2016-11-23'));
expect(wrapper.find('.ant-calendar-picker-input').getDOMNode()).toBe(document.activeElement);
wrapper.unmount();
});
it('should not auto focus trigger input when open prop is true in DatePicker', () => {
const wrapper = mount(<DatePicker open />);
const wrapper = mount(<DatePicker open />, { attachTo: document.body });
const wrapperInput = mount(<Input />);
wrapperInput.instance().select();
expect(wrapper.find('.ant-calendar-picker-input').getDOMNode()).not.toBe(
document.activeElement,
);
wrapper.unmount();
});
it('should not auto focus trigger input when open prop is true in RangePicker', () => {
const wrapper = mount(<RangePicker open />);
const wrapper = mount(<RangePicker open />, { attachTo: document.body });
const wrapperInput = mount(<Input />);
wrapperInput.instance().select();
expect(wrapper.find('.ant-calendar-picker').getDOMNode()).not.toBe(document.activeElement);
wrapper.unmount();
});
it('should not auto focus trigger input when open prop is true in WeekPicker', () => {
const wrapper = mount(<WeekPicker open />);
const wrapper = mount(<WeekPicker open />, { attachTo: document.body });
const wrapperInput = mount(<Input />);
wrapperInput.instance().select();
expect(wrapper.find('.ant-calendar-picker-input').getDOMNode()).not.toBe(
document.activeElement,
);
wrapper.unmount();
});
it('should not auto focus trigger input when open prop is true in MonthPicker', () => {
const wrapper = mount(<MonthPicker open />);
const wrapper = mount(<MonthPicker open />, { attachTo: document.body });
const wrapperInput = mount(<Input />);
wrapperInput.instance().select();
expect(wrapper.find('.ant-calendar-picker-input').getDOMNode()).not.toBe(
document.activeElement,
);
wrapper.unmount();
});
});

View File

@@ -75,7 +75,9 @@ describe('DatePicker with showTime', () => {
});
it('should have correct className when use12Hours is true', () => {
const wrapper = mount(<DatePicker showTime={{ use12Hours: true }} open />);
const wrapper = mount(
<DatePicker defaultValue={moment()} showTime={{ use12Hours: true }} open />,
);
const calendarWrapper = mount(
wrapper
.find('Trigger')

View File

@@ -0,0 +1,19 @@
import CalendarLocale from 'rc-calendar/lib/locale/ga_IE';
import TimePickerLocale from '../../time-picker/locale/ga_IE';
// Merge into a locale object
const locale = {
lang: {
placeholder: 'Select date',
rangePlaceholder: ['Start date', 'End date'],
...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

@@ -102,6 +102,10 @@
line-height: 1;
}
.@{ant-prefix}-input-disabled + &-icon {
cursor: not-allowed;
}
&-small &-clear,
&-small &-icon {
right: @control-padding-horizontal-sm;

View File

@@ -41,7 +41,6 @@
font-weight: normal;
font-size: @font-size-base;
line-height: @line-height-base;
white-space: nowrap;
&::after {
position: relative;

View File

@@ -3,7 +3,6 @@
exports[`renders ./components/dropdown/demo/basic.md correctly 1`] = `
<a
class="ant-dropdown-link ant-dropdown-trigger"
href="#"
>
Hover me
<i
@@ -184,7 +183,6 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
exports[`renders ./components/dropdown/demo/event.md correctly 1`] = `
<a
class="ant-dropdown-link ant-dropdown-trigger"
href="#"
>
Hover me, Click menu item
<i
@@ -212,7 +210,6 @@ exports[`renders ./components/dropdown/demo/event.md correctly 1`] = `
exports[`renders ./components/dropdown/demo/item.md correctly 1`] = `
<a
class="ant-dropdown-link ant-dropdown-trigger"
href="#"
>
Hover me
<i
@@ -240,7 +237,6 @@ exports[`renders ./components/dropdown/demo/item.md correctly 1`] = `
exports[`renders ./components/dropdown/demo/menu-full.md correctly 1`] = `
<a
class="ant-dropdown-link ant-dropdown-trigger"
href="#"
>
Hover to check menu style
<i
@@ -268,7 +264,6 @@ exports[`renders ./components/dropdown/demo/menu-full.md correctly 1`] = `
exports[`renders ./components/dropdown/demo/overlay-visible.md correctly 1`] = `
<a
class="ant-dropdown-link ant-dropdown-trigger"
href="#"
>
Hover me
<i
@@ -350,7 +345,6 @@ exports[`renders ./components/dropdown/demo/placement.md correctly 1`] = `
exports[`renders ./components/dropdown/demo/sub-menu.md correctly 1`] = `
<a
class="ant-dropdown-link ant-dropdown-trigger"
href="#"
>
Cascading menu
<i
@@ -378,7 +372,6 @@ exports[`renders ./components/dropdown/demo/sub-menu.md correctly 1`] = `
exports[`renders ./components/dropdown/demo/trigger.md correctly 1`] = `
<a
class="ant-dropdown-link ant-dropdown-trigger"
href="#"
>
Click me
<i

View File

@@ -38,7 +38,7 @@ const menu = (
ReactDOM.render(
<Dropdown overlay={menu}>
<a className="ant-dropdown-link" href="#">
<a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
Hover me <Icon type="down" />
</a>
</Dropdown>,

View File

@@ -30,7 +30,7 @@ const menu = (
ReactDOM.render(
<Dropdown overlay={menu}>
<a className="ant-dropdown-link" href="#">
<a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
Hover me, Click menu item <Icon type="down" />
</a>
</Dropdown>,

View File

@@ -37,7 +37,7 @@ const menu = (
ReactDOM.render(
<Dropdown overlay={menu}>
<a className="ant-dropdown-link" href="#">
<a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
Hover me <Icon type="down" />
</a>
</Dropdown>,

View File

@@ -82,7 +82,7 @@ const menu = (
ReactDOM.render(
<Dropdown overlay={menu}>
<a className="ant-dropdown-link" href="#">
<a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
Hover to check menu style <Icon type="down" />
</a>
</Dropdown>,

View File

@@ -45,7 +45,7 @@ class OverlayVisible extends React.Component {
onVisibleChange={this.handleVisibleChange}
visible={this.state.visible}
>
<a className="ant-dropdown-link" href="#">
<a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
Hover me <Icon type="down" />
</a>
</Dropdown>

View File

@@ -35,7 +35,7 @@ const menu = (
ReactDOM.render(
<Dropdown overlay={menu}>
<a className="ant-dropdown-link" href="#">
<a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
Cascading menu <Icon type="down" />
</a>
</Dropdown>,

View File

@@ -31,7 +31,7 @@ const menu = (
ReactDOM.render(
<Dropdown overlay={menu} trigger={['click']}>
<a className="ant-dropdown-link" href="#">
<a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
Click me <Icon type="down" />
</a>
</Dropdown>,

View File

@@ -29,7 +29,7 @@ export interface FormCreateOption<T> {
}
const FormLayouts = tuple('horizontal', 'inline', 'vertical');
export type FormLayout = typeof FormLayouts[number];
export type FormLayout = (typeof FormLayouts)[number];
export interface FormProps extends React.FormHTMLAttributes<HTMLFormElement> {
layout?: FormLayout;
@@ -51,28 +51,11 @@ export interface FormProps extends React.FormHTMLAttributes<HTMLFormElement> {
labelAlign?: FormLabelAlign;
}
export type ValidationRuleType =
| 'string'
| 'number'
| 'boolean'
| 'method'
| 'regexp'
| 'integer'
| 'float'
| 'array'
| 'object'
| 'enum'
| 'date'
| 'url'
| 'hex'
| 'email'
| 'any';
export type ValidationRule = {
/** validation error message */
message?: React.ReactNode;
/** built-in validation type, available options: https://github.com/yiminghe/async-validator#type */
type?: ValidationRuleType;
type?: string;
/** indicates whether field is required */
required?: boolean;
/** treat required fields that only contain whitespace as errors */
@@ -84,7 +67,7 @@ export type ValidationRule = {
/** validate the max length of a field */
max?: number;
/** validate the value from a list of possible values */
enum?: (string | number | boolean)[];
enum?: string | string[];
/** validate from a regular expression */
pattern?: RegExp;
/** transform a value before validation */

View File

@@ -257,7 +257,7 @@ export default class FormItem extends React.Component<FormItemProps, any> {
let classes = `${prefixCls}-item-control`;
if (validateStatus) {
classes = classNames(`${prefixCls}-item-control`, {
'has-feedback': props.hasFeedback || validateStatus === 'validating',
'has-feedback': validateStatus && props.hasFeedback,
'has-success': validateStatus === 'success',
'has-warning': validateStatus === 'warning',
'has-error': validateStatus === 'error',

View File

@@ -26,3 +26,161 @@ exports[`Form Form.Item should support data-*、aria-* and custom attribute 1`]
</div>
</form>
`;
exports[`Form FormItem FormItem: generate snapshot when validates fields 1`] = `
<form
class="ant-form ant-form-horizontal"
>
<div
class="ant-row ant-form-item"
>
<div
class="ant-col ant-form-item-control-wrapper"
>
<div
class="ant-form-item-control"
>
<span
class="ant-form-item-children"
>
<span
class="ant-input-affix-wrapper"
>
<input
class="ant-input"
data-__field="[object Object]"
data-__meta="[object Object]"
id="test"
type="text"
value=""
/>
<span
class="ant-input-suffix"
/>
</span>
</span>
</div>
</div>
</div>
</form>
`;
exports[`Form FormItem FormItem: generate snapshot when validates fields 2`] = `
<form
class="ant-form ant-form-horizontal"
>
<div
class="ant-row ant-form-item"
>
<div
class="ant-col ant-form-item-control-wrapper"
>
<div
class="ant-form-item-control is-validating"
>
<span
class="ant-form-item-children"
>
<span
class="ant-input-affix-wrapper"
>
<input
class="ant-input"
data-__field="[object Object]"
data-__meta="[object Object]"
id="test"
type="text"
value="test"
/>
<span
class="ant-input-suffix"
>
<i
aria-label="icon: close-circle"
class="anticon anticon-close-circle ant-input-clear-icon"
role="button"
tabindex="-1"
>
<svg
aria-hidden="true"
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 0 1-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"
/>
</svg>
</i>
</span>
</span>
</span>
</div>
</div>
</div>
</form>
`;
exports[`Form FormItem FormItem: generate snapshot when validates fields 3`] = `
<form
class="ant-form ant-form-horizontal"
>
<div
class="ant-row ant-form-item"
>
<div
class="ant-col ant-form-item-control-wrapper"
>
<div
class="ant-form-item-control has-success"
>
<span
class="ant-form-item-children"
>
<span
class="ant-input-affix-wrapper"
>
<input
class="ant-input"
data-__field="[object Object]"
data-__meta="[object Object]"
id="test"
type="text"
value="test"
/>
<span
class="ant-input-suffix"
>
<i
aria-label="icon: close-circle"
class="anticon anticon-close-circle ant-input-clear-icon"
role="button"
tabindex="-1"
>
<svg
aria-hidden="true"
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 0 1-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"
/>
</svg>
</i>
</span>
</span>
</span>
</div>
</div>
</div>
</form>
`;

View File

@@ -2,6 +2,7 @@
import React from 'react';
import { mount, render } from 'enzyme';
import Form from '..';
import Input from '../../input';
import mountTest from '../../../tests/shared/mountTest';
import './type.test';
@@ -58,4 +59,35 @@ describe('Form', () => {
expect(form).toBeInstanceOf(TestForm);
});
});
describe('FormItem', () => {
it('FormItem: generate snapshot when validates fields', async done => {
let wrapper;
const TestForm = props => (
<Form>
<Form.Item>
{props.form.getFieldDecorator('test', {
rules: [
{
validator: (rule, value, callback) => {
setTimeout(() => {
callback();
expect(wrapper.render()).toMatchSnapshot(); // after validate
done();
}, 100);
},
},
],
})(<Input allowClear />)}
</Form.Item>
</Form>
);
const Wrapped = Form.create()(TestForm);
wrapper = mount(<Wrapped />);
expect(wrapper.render()).toMatchSnapshot(); // before validate
wrapper.find('.ant-input').simulate('change', { target: { value: 'test' } });
await new Promise(resolve => setTimeout(resolve, 0));
expect(wrapper.render()).toMatchSnapshot(); // validating
});
});
});

View File

@@ -176,6 +176,7 @@ describe('Form', () => {
<Form1 />
<Form2 />
</div>,
{ attachTo: document.body },
);
wrapper
.find('Form label')
@@ -197,6 +198,7 @@ describe('Form', () => {
.at(1)
.getDOMNode(),
).toBe(document.activeElement);
wrapper.unmount();
});
// https://github.com/ant-design/ant-design/issues/7693
@@ -208,7 +210,7 @@ describe('Form', () => {
</Form.Item>
</Form>
));
const wrapper = mount(<Form1 />);
const wrapper = mount(<Form1 />, { attachTo: document.body });
expect(() => {
wrapper
.find('Form label')
@@ -221,6 +223,7 @@ describe('Form', () => {
.at(0)
.getDOMNode(),
).toBe(document.activeElement);
wrapper.unmount();
});
it('should `labelAlign` work in FormItem', () => {

View File

@@ -210,7 +210,7 @@ Note: if Form.Item has multiple children that had been decorated by `getFieldDec
| Property | Description | Type | Default Value | Version |
| --- | --- | --- | --- | --- |
| enum | validate a value from a list of possible values | string[] | - | |
| enum | validate a value from a list of possible values | string | - | |
| len | validate an exact length of a field | number | - | |
| max | validate a max length of a field | number | - | |
| message | validation error message | string\|ReactNode | - | |

View File

@@ -212,7 +212,7 @@ validateFields(['field1', 'field2'], options, (errors, values) => {
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| enum | 枚举类型 | string[] | - | |
| enum | 枚举类型 | string | - | |
| len | 字段长度 | number | - | |
| max | 最大长度 | number | - | |
| message | 校验文案 | string\|ReactNode | - | |

View File

@@ -10,6 +10,10 @@
box-sizing: border-box;
}
.@{ant-prefix}-row + .@{ant-prefix}-row::before {
clear: both;
}
.@{ant-prefix}-row-flex {
display: flex;
flex-flow: row wrap;

View File

@@ -16,7 +16,7 @@ export function hasPrefixSuffix(props: InputProps | ClearableInputProps) {
*/
interface BasicProps {
prefixCls: string;
inputType: (typeof ClearableInputType)[number];
inputType: typeof ClearableInputType[number];
value?: any;
defaultValue?: any;
allowClear?: boolean;
@@ -25,13 +25,14 @@ interface BasicProps {
className?: string;
style?: object;
disabled?: boolean;
readOnly?: boolean;
}
/**
* This props only for input.
*/
interface ClearableInputProps extends BasicProps {
size?: (typeof InputSizes)[number];
size?: typeof InputSizes[number];
suffix?: React.ReactNode;
prefix?: React.ReactNode;
addonBefore?: React.ReactNode;
@@ -40,8 +41,15 @@ interface ClearableInputProps extends BasicProps {
class ClearableLabeledInput extends React.Component<ClearableInputProps> {
renderClearIcon(prefixCls: string) {
const { allowClear, value, disabled, inputType, handleReset } = this.props;
if (!allowClear || disabled || value === undefined || value === null || value === '') {
const { allowClear, value, disabled, readOnly, inputType, handleReset } = this.props;
if (
!allowClear ||
disabled ||
readOnly ||
value === undefined ||
value === null ||
value === ''
) {
return null;
}
const className =

View File

@@ -65,6 +65,7 @@ class ResizableTextArea extends React.Component<TextAreaProps, TextAreaState> {
raf.cancel(this.resizeFrameId);
this.resizeFrameId = raf(() => {
this.setState({ resizing: false });
this.fixFirefoxAutoScroll();
});
});
};
@@ -74,6 +75,21 @@ class ResizableTextArea extends React.Component<TextAreaProps, TextAreaState> {
raf.cancel(this.resizeFrameId);
}
// https://github.com/ant-design/ant-design/issues/21870
fixFirefoxAutoScroll() {
try {
if (document.activeElement === this.textArea) {
const currentStart = this.textArea.selectionStart;
const currentEnd = this.textArea.selectionEnd;
this.textArea.setSelectionRange(currentStart, currentEnd);
}
} catch (e) {
// Fix error in Chrome:
// Failed to read the 'selectionStart' property from 'HTMLInputElement'
// http://stackoverflow.com/q/21177489/3040605
}
}
renderTextArea = () => {
const { prefixCls, autoSize, autosize, className, disabled } = this.props;
const { textareaStyles, resizing } = this.state;
@@ -101,7 +117,7 @@ class ResizableTextArea extends React.Component<TextAreaProps, TextAreaState> {
const style = {
...this.props.style,
...textareaStyles,
...(resizing ? { overflow: 'hidden' } : null),
...(resizing ? { overflowX: 'hidden', overflowY: 'hidden' } : null),
};
return (
<ResizeObserver onResize={this.resizeOnNextFrame} disabled={!(autoSize || autosize)}>

View File

@@ -49,7 +49,9 @@ describe('Input.Password', () => {
});
it('should keep focus state', () => {
const wrapper = mount(<Input.Password defaultValue="111" autoFocus />);
const wrapper = mount(<Input.Password defaultValue="111" autoFocus />, {
attachTo: document.body,
});
expect(document.activeElement).toBe(
wrapper
.find('input')

View File

@@ -47,7 +47,7 @@ describe('Input', () => {
expect(errorSpy).not.toHaveBeenCalled();
});
it('trigger warning', () => {
const wrapper = mount(<Input />);
const wrapper = mount(<Input />, { attachTo: document.body });
wrapper
.find('input')
.instance()
@@ -58,6 +58,7 @@ describe('Input', () => {
expect(errorSpy).toHaveBeenCalledWith(
'Warning: [antd: Input] When Input is focused, dynamic add or remove prefix / suffix will make it lose focus caused by dom structure change. Read more: https://ant.design/components/input/#FAQ',
);
wrapper.unmount();
});
});
});
@@ -299,7 +300,7 @@ describe('Input allowClear', () => {
});
it('should focus input after clear', () => {
const wrapper = mount(<Input allowClear defaultValue="111" />);
const wrapper = mount(<Input allowClear defaultValue="111" />, { attachTo: document.body });
wrapper
.find('.ant-input-clear-icon')
.at(0)
@@ -310,11 +311,14 @@ describe('Input allowClear', () => {
.at(0)
.getDOMNode(),
);
wrapper.unmount();
});
it('should not support allowClear when it is disabled', () => {
const wrapper = mount(<Input allowClear defaultValue="111" disabled />);
expect(wrapper.find('.ant-input-clear-icon').length).toBe(0);
['disabled', 'readOnly'].forEach(prop => {
it(`should not support allowClear when it is ${prop}`, () => {
const wrapper = mount(<Input allowClear defaultValue="111" {...{ [prop]: true }} />);
expect(wrapper.find('.ant-input-clear-icon').length).toBe(0);
});
});
});
@@ -397,7 +401,7 @@ describe('TextArea allowClear', () => {
});
it('should focus textarea after clear', () => {
const wrapper = mount(<TextArea allowClear defaultValue="111" />);
const wrapper = mount(<TextArea allowClear defaultValue="111" />, { attachTo: document.body });
wrapper
.find('.ant-input-textarea-clear-icon')
.at(0)
@@ -408,6 +412,7 @@ describe('TextArea allowClear', () => {
.at(0)
.getDOMNode(),
);
wrapper.unmount();
});
it('should not support allowClear when it is disabled', () => {

View File

@@ -17,6 +17,7 @@ import {
Select,
Transfer,
} from '../..';
import gaIE from '../ga_IE';
import arEG from '../ar_EG';
import bgBG from '../bg_BG';
import caES from '../ca_ES';
@@ -70,6 +71,7 @@ import zhCN from '../zh_CN';
import zhTW from '../zh_TW';
const locales = [
gaIE,
arEG,
bgBG,
caES,

View File

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

View File

@@ -0,0 +1,43 @@
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';
export default {
locale: 'ga_IE',
Pagination,
DatePicker,
TimePicker,
Calendar,
Table: {
filterTitle: 'Scagaire roghchlár',
filterConfirm: 'Ceart go leor',
filterReset: 'Athshocraigh',
selectAll: 'Roghnaigh an leathanach reatha',
selectInvert: 'Inbhéartaigh an leathanach reatha',
},
Modal: {
okText: 'Ceart go leor',
cancelText: 'Cealaigh',
justOkText: 'Ceart go leor',
},
Popconfirm: {
okText: 'Ceart go leor',
cancelText: 'Cealaigh',
},
Transfer: {
searchPlaceholder: 'Cuardaigh anseo',
itemUnit: 'mír',
itemsUnit: 'míreanna',
},
Upload: {
uploading: 'Uaslódáil ...',
removeFile: 'Bain comhad',
uploadError: 'Earráid uaslódáil',
previewFile: 'Comhad réamhamhairc',
downloadFile: 'Íoslódáil an comhad',
},
Empty: {
description: 'Gan aon sonraí',
},
};

View File

@@ -94,7 +94,6 @@ export interface ModalFuncProps {
cancelButtonProps?: ButtonProps;
centered?: boolean;
width?: string | number;
iconClassName?: string;
okText?: React.ReactNode;
okType?: ButtonType;
cancelText?: React.ReactNode;

View File

@@ -22,7 +22,7 @@ exports[`Modal render correctly 1`] = `
>
<div
aria-hidden="true"
style="width: 0px; height: 0px; overflow: hidden;"
style="width: 0px; height: 0px; overflow: hidden; outline: none;"
tabindex="0"
/>
<div
@@ -87,7 +87,7 @@ exports[`Modal render correctly 1`] = `
</div>
<div
aria-hidden="true"
style="width: 0px; height: 0px; overflow: hidden;"
style="width: 0px; height: 0px; overflow: hidden; outline: none;"
tabindex="0"
/>
</div>
@@ -120,7 +120,7 @@ exports[`Modal render without footer 1`] = `
>
<div
aria-hidden="true"
style="width: 0px; height: 0px; overflow: hidden;"
style="width: 0px; height: 0px; overflow: hidden; outline: none;"
tabindex="0"
/>
<div
@@ -163,7 +163,7 @@ exports[`Modal render without footer 1`] = `
</div>
<div
aria-hidden="true"
style="width: 0px; height: 0px; overflow: hidden;"
style="width: 0px; height: 0px; overflow: hidden; outline: none;"
tabindex="0"
/>
</div>
@@ -193,7 +193,7 @@ exports[`Modal support closeIcon 1`] = `
>
<div
aria-hidden="true"
style="width: 0px; height: 0px; overflow: hidden;"
style="width: 0px; height: 0px; overflow: hidden; outline: none;"
tabindex="0"
/>
<div
@@ -240,7 +240,7 @@ exports[`Modal support closeIcon 1`] = `
</div>
<div
aria-hidden="true"
style="width: 0px; height: 0px; overflow: hidden;"
style="width: 0px; height: 0px; overflow: hidden; outline: none;"
tabindex="0"
/>
</div>

View File

@@ -11,8 +11,8 @@ import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
export interface PopconfirmProps extends AbstractTooltipProps {
title: React.ReactNode;
disabled?: boolean;
onConfirm?: (e?: React.MouseEvent<HTMLElement>) => void;
onCancel?: (e?: React.MouseEvent<HTMLElement>) => void;
onConfirm?: (event: React.MouseEvent<HTMLElement>) => void;
onCancel?: (event: React.MouseEvent<HTMLElement>) => void;
okText?: React.ReactNode;
okType?: ButtonType;
cancelText?: React.ReactNode;

View File

@@ -30,6 +30,7 @@ exports[`renders ./components/progress/demo/circle.md correctly 1`] = `
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
opacity="1"
stroke=""
stroke-linecap="round"
stroke-width="6"
@@ -72,6 +73,7 @@ exports[`renders ./components/progress/demo/circle.md correctly 1`] = `
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
opacity="1"
stroke=""
stroke-linecap="round"
stroke-width="6"
@@ -131,6 +133,7 @@ exports[`renders ./components/progress/demo/circle.md correctly 1`] = `
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
opacity="1"
stroke=""
stroke-linecap="round"
stroke-width="6"
@@ -195,9 +198,10 @@ exports[`renders ./components/progress/demo/circle-dynamic.md correctly 1`] = `
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
opacity="0"
stroke=""
stroke-linecap="round"
stroke-width="0"
stroke-width="6"
style="stroke:#108ee9;stroke-dasharray:0px 295.3097094374406px;stroke-dashoffset:-0px;transition:stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"
/>
</svg>
@@ -297,6 +301,7 @@ exports[`renders ./components/progress/demo/circle-mini.md correctly 1`] = `
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
opacity="1"
stroke=""
stroke-linecap="round"
stroke-width="6"
@@ -339,6 +344,7 @@ exports[`renders ./components/progress/demo/circle-mini.md correctly 1`] = `
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
opacity="1"
stroke=""
stroke-linecap="round"
stroke-width="6"
@@ -398,6 +404,7 @@ exports[`renders ./components/progress/demo/circle-mini.md correctly 1`] = `
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
opacity="1"
stroke=""
stroke-linecap="round"
stroke-width="6"
@@ -461,6 +468,7 @@ exports[`renders ./components/progress/demo/dashboard.md correctly 1`] = `
a 47,47 0 1 1 0,-94
a 47,47 0 1 1 0,94"
fill-opacity="0"
opacity="1"
stroke=""
stroke-linecap="round"
stroke-width="6"
@@ -591,6 +599,7 @@ exports[`renders ./components/progress/demo/format.md correctly 1`] = `
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
opacity="1"
stroke=""
stroke-linecap="round"
stroke-width="6"
@@ -633,6 +642,7 @@ exports[`renders ./components/progress/demo/format.md correctly 1`] = `
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
opacity="1"
stroke=""
stroke-linecap="round"
stroke-width="6"
@@ -746,6 +756,7 @@ exports[`renders ./components/progress/demo/gradient-line.md correctly 1`] = `
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
opacity="1"
stroke="url(#ant-progress-gradient-10)"
stroke-linecap="round"
stroke-width="6"
@@ -806,6 +817,7 @@ exports[`renders ./components/progress/demo/gradient-line.md correctly 1`] = `
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
opacity="1"
stroke="url(#ant-progress-gradient-11)"
stroke-linecap="round"
stroke-width="6"
@@ -1184,6 +1196,7 @@ exports[`renders ./components/progress/demo/linecap.md correctly 1`] = `
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
opacity="1"
stroke=""
stroke-linecap="square"
stroke-width="6"
@@ -1226,6 +1239,7 @@ exports[`renders ./components/progress/demo/linecap.md correctly 1`] = `
a 47,47 0 1 1 0,-94
a 47,47 0 1 1 0,94"
fill-opacity="0"
opacity="1"
stroke=""
stroke-linecap="square"
stroke-width="6"
@@ -1301,6 +1315,7 @@ exports[`renders ./components/progress/demo/segment.md correctly 1`] = `
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
opacity="1"
stroke=""
stroke-linecap="round"
stroke-width="6"
@@ -1312,6 +1327,7 @@ exports[`renders ./components/progress/demo/segment.md correctly 1`] = `
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
opacity="1"
stroke=""
stroke-linecap="round"
stroke-width="6"
@@ -1354,6 +1370,7 @@ exports[`renders ./components/progress/demo/segment.md correctly 1`] = `
a 47,47 0 1 1 0,-94
a 47,47 0 1 1 0,94"
fill-opacity="0"
opacity="1"
stroke=""
stroke-linecap="round"
stroke-width="6"
@@ -1365,6 +1382,7 @@ exports[`renders ./components/progress/demo/segment.md correctly 1`] = `
a 47,47 0 1 1 0,-94
a 47,47 0 1 1 0,94"
fill-opacity="0"
opacity="1"
stroke=""
stroke-linecap="round"
stroke-width="6"

View File

@@ -233,6 +233,7 @@ exports[`Progress render strokeColor 1`] = `
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
opacity="1"
stroke=""
stroke-linecap="round"
stroke-width="6"

View File

@@ -0,0 +1,23 @@
import * as React from 'react';
import Result from '..';
describe('Result.typescript', () => {
it('status', () => {
const result = (
<>
<Result
status="404"
title="404"
subTitle="Sorry, the page you visited does not exist."
/>
<Result
status={404}
title="404"
subTitle="Sorry, the page you visited does not exist."
/>
</>
);
expect(result).toBeTruthy();
});
});

View File

@@ -19,7 +19,7 @@ export const ExceptionMap = {
'403': unauthorized,
};
export type ExceptionStatusType = keyof typeof ExceptionMap;
export type ExceptionStatusType = 403 | 404 | 500 | '403' | '404' | '500';
export type ResultStatusType = ExceptionStatusType | keyof typeof IconMap;
export interface ResultProps {
@@ -46,7 +46,7 @@ const ExceptionStatus = Object.keys(ExceptionMap);
const renderIcon = (prefixCls: string, { status, icon }: ResultProps) => {
const className = classnames(`${prefixCls}-icon`);
if (ExceptionStatus.includes(status as ResultStatusType)) {
if (ExceptionStatus.includes(`${status}`)) {
const SVGComponent = ExceptionMap[status as ExceptionStatusType];
return (
<div className={`${className} ${prefixCls}-image`}>

View File

@@ -98,4 +98,4 @@ Select component to select value from options.
### The dropdown is closed when click `dropdownRender` area?
See the [dropdownRender example](/components/select/#components-select-demo-custom-dropdown-menu).
See the instruction in [dropdownRender example](#components-select-demo-custom-dropdown-menu).

View File

@@ -101,4 +101,4 @@ title: Select
### 点击 `dropdownRender` 里的内容浮层关闭怎么办?
看下 [dropdownRender 例子](/components/select-cn/#components-select-demo-custom-dropdown-menu) 里的说明。
看下 [dropdownRender 例子](#components-select-demo-custom-dropdown-menu) 里的说明。

View File

@@ -310,6 +310,7 @@
.@{select-prefix-cls}-search__field {
width: 0.75em;
max-width: 100%;
padding: 1px;
}
}
@@ -469,7 +470,7 @@
&-menu {
max-height: 250px;
margin-bottom: 0;
padding: @select-dropdown-edge-child-vertical-padding 0; //Change
padding: @select-dropdown-edge-child-vertical-padding 0; //Change
padding-left: 0; // Override default ul/ol
overflow: auto;
list-style: none;

View File

@@ -31,7 +31,7 @@
&.@{steps-prefix-cls}-small:not(.@{steps-prefix-cls}-dot) {
.@{steps-prefix-cls}-item {
&-icon {
margin-left: 47px;
margin-left: 46px;
}
}
}

View File

@@ -265,8 +265,8 @@
@layout-trigger-color-light: @text-color;
// z-index list, order by `z-index`
@zindex-badge: auto;
@zindex-table-fixed: auto;
@zindex-badge: 1;
@zindex-table-fixed: 1;
@zindex-affix: 10;
@zindex-back-top: 10;
@zindex-picker-panel: 10;

View File

@@ -11868,7 +11868,6 @@ exports[`renders ./components/table/demo/resizable-column.md correctly 1`] = `
</span>
<span
class="react-resizable-handle react-resizable-handle-se"
style="touch-action:none"
/>
</th>
<th
@@ -11890,7 +11889,6 @@ exports[`renders ./components/table/demo/resizable-column.md correctly 1`] = `
</span>
<span
class="react-resizable-handle react-resizable-handle-se"
style="touch-action:none"
/>
</th>
<th
@@ -11912,7 +11910,6 @@ exports[`renders ./components/table/demo/resizable-column.md correctly 1`] = `
</span>
<span
class="react-resizable-handle react-resizable-handle-se"
style="touch-action:none"
/>
</th>
<th
@@ -11934,7 +11931,6 @@ exports[`renders ./components/table/demo/resizable-column.md correctly 1`] = `
</span>
<span
class="react-resizable-handle react-resizable-handle-se"
style="touch-action:none"
/>
</th>
<th

View File

@@ -206,7 +206,7 @@ class FilterMenu<T> extends React.Component<FilterMenuProps<T>, FilterMenuState<
}
const dropdownIconClass = classNames({
[`${prefixCls}-selected`]: filtered,
[`${prefixCls}-selected`]: 'filtered' in column ? column.filtered : filtered,
[`${prefixCls}-open`]: this.getDropdownVisible(),
});

View File

@@ -71,6 +71,7 @@ const columns = [
| expandedRowRender | Expanded container render for each row | Function(record, index, indent, expanded):ReactNode | - | |
| expandIcon | Customize row expand Icon. Ref [example](http://react-component.github.io/table/examples/expandIcon.html) | Function(props):ReactNode | - | 3.11.3 |
| expandRowByClick | Whether to expand row by clicking anywhere in the whole row | boolean | `false` | 3.0.1 |
| expandIconColumnIndex | The index of `expandIcon` which column will be inserted when `expandIconAsCell` is false | 0 | |
| footer | Table footer renderer | Function(currentPageData) | | |
| indentSize | Indent size in pixels of tree data | number | 15 | |
| loading | Loading status of table | boolean\|[object](https://ant.design/components/spin-cn/#API) ([more](https://github.com/ant-design/ant-design/issues/4544#issuecomment-271533135)) | `false` | |

View File

@@ -76,6 +76,7 @@ const columns = [
| expandedRowRender | 额外的展开行 | Function(record, index, indent, expanded):ReactNode | - | |
| expandIcon | 自定义展开图标,参考[示例](http://react-component.github.io/table/examples/expandIcon.html) | Function(props):ReactNode | - | 3.11.3 |
| expandRowByClick | 通过点击行来展开子行 | boolean | `false` | 3.0.1 |
| expandIconColumnIndex | 展开的图标显示在哪一列,如果没有 `rowSelection`,默认显示在第一列,否则显示在选择框后面 | `number` | |
| footer | 表格尾部 | Function(currentPageData) | | |
| indentSize | 展示树形数据时,每层缩进的宽度,以 px 为单位 | number | 15 | |
| loading | 页面是否加载中 | boolean\|[object](https://ant.design/components/spin-cn/#API) ([更多](https://github.com/ant-design/ant-design/issues/4544#issuecomment-271533135)) | false | |

View File

@@ -56,6 +56,7 @@ export interface ColumnProps<T> {
fixed?: boolean | typeof ColumnFixedPlacements[number];
filterIcon?: React.ReactNode | ((filtered: boolean) => React.ReactNode);
filteredValue?: any[] | null;
filtered?: boolean;
defaultFilteredValue?: any[];
sortOrder?: SortOrder | boolean;
children?: ColumnProps<T>[];

View File

@@ -75,7 +75,7 @@
}
}
.@{table-prefix-cls}-filter-selected.@{iconfont-css-prefix}-filter {
.@{table-prefix-cls}-filter-selected.@{iconfont-css-prefix} {
color: @primary-color;
}
@@ -445,16 +445,14 @@
box-shadow: @box-shadow-base;
.@{ant-prefix}-dropdown-menu {
// https://github.com/ant-design/ant-design/issues/4916
// https://github.com/ant-design/ant-design/issues/19542
max-height: ~'calc(100vh - 130px)';
overflow-x: hidden;
border: 0;
border-radius: @border-radius-base @border-radius-base 0 0;
box-shadow: none;
// https://github.com/ant-design/ant-design/issues/4916
&-without-submenu {
max-height: 400px;
overflow-x: hidden;
}
&-item > label + span {
padding-right: 0;
}
@@ -724,7 +722,7 @@
table {
border-radius: @table-border-radius-base 0 0 0;
}
.ant-table-thead > tr > th:last-child {
.@{table-prefix-cls}-thead > tr > th:last-child {
border-top-right-radius: 0;
}
}
@@ -742,7 +740,7 @@
color: transparent;
pointer-events: none;
}
.ant-table-thead > tr > th:first-child {
.@{table-prefix-cls}-thead > tr > th:first-child {
border-top-left-radius: 0;
}
}

View File

@@ -255,10 +255,10 @@
.@{tab-prefix-cls}-top-content,
.@{tab-prefix-cls}-bottom-content {
width: 100%;
> .@{tab-prefix-cls}-tabpane {
flex-shrink: 0;
width: 100%;
-webkit-backface-visibility: hidden;
opacity: 1;
transition: opacity 0.45s;
}

View File

@@ -0,0 +1,5 @@
const locale = {
placeholder: 'Roghnaigh am',
};
export default locale;

View File

@@ -1,11 +1,9 @@
import React from 'react';
import { mount } from 'enzyme';
import TreeSelect, { TreeNode } from '..';
import focusTest from '../../../tests/shared/focusTest';
import mountTest from '../../../tests/shared/mountTest';
describe('TreeSelect', () => {
focusTest(TreeSelect);
mountTest(TreeSelect);
describe('showSearch', () => {

View File

@@ -41,7 +41,7 @@ export interface AntTreeNodeProps {
selected?: boolean;
selectable?: boolean;
icon?: ((treeNode: AntdTreeNodeAttribute) => React.ReactNode) | React.ReactNode;
children?: React.ReactNode;
children?: React.ReactElement[];
[customProp: string]: any;
}

View File

@@ -0,0 +1,13 @@
/* eslint-disable */
import * as React from 'react';
import { AntTreeNodeProps } from '../Tree';
describe('Tree TypeScript Test', async () => {
it('AntTreeNodeProps', () => {
const tree: AntTreeNodeProps = {
children: [React.createElement('h1')],
};
expect(tree).toBeTruthy();
});
});

View File

@@ -92,4 +92,4 @@ Before `3.4.0`: The number of treeNodes can be very large, but when `checkable=t
### How to hide file icon when use showLine?
File icon realize by using switcherIcon. You can overwrite the style to hide it: https://codesandbox.io/s/883vo47xp8
File icon realize by using switcherIcon. You can overwrite the style to hide it: https://codesandbox.io/s/long-moon-go9e2

View File

@@ -93,4 +93,4 @@ subtitle: 树形控件
### 在 showLine 时,如何隐藏子节点图标?
文件图标通过 switcherIcon 来实现如果不需要你可以覆盖对应的样式https://codesandbox.io/s/883vo47xp8
文件图标通过 switcherIcon 来实现如果不需要你可以覆盖对应的样式https://codesandbox.io/s/long-moon-go9e2

View File

@@ -49,8 +49,8 @@ class Editable extends React.Component<EditableProps, EditableState> {
if (this.textarea && this.textarea.resizableTextArea) {
const { textArea } = this.textarea.resizableTextArea;
textArea.focus();
const { length } = textArea.value;
textArea.setSelectionRange(length, length);
const { length } = textArea.value;
textArea.setSelectionRange(length, length);
}
}

View File

@@ -9,7 +9,7 @@ export type DraggerProps = UploadProps & { height?: number };
// eslint-disable-next-line react/prefer-stateless-function
export default class Dragger extends React.Component<DraggerProps, any> {
render() {
const { props } = this;
return <Upload {...props} type="drag" style={{ ...props.style, height: props.height }} />;
const { style, height, ...restProps } = this.props;
return <Upload {...restProps} type="drag" style={{ ...style, height }} />;
}
}

View File

@@ -163,7 +163,7 @@ class Upload extends React.Component<UploadProps, UploadState> {
const { onRemove } = this.props;
const { fileList } = this.state;
Promise.resolve(typeof onRemove === 'function' ? onRemove(file) : onRemove).then(ret => {
Promise.resolve(typeof onRemove === 'function' ? onRemove(file) : onRemove).then((ret) => {
// Prevent removing file
if (ret === false) {
return;
@@ -301,6 +301,14 @@ class Upload extends React.Component<UploadProps, UploadState> {
delete rcUploadProps.className;
delete rcUploadProps.style;
// Remove id to avoid open by label when trigger is hidden
// !children: https://github.com/ant-design/ant-design/issues/14298
// disabled: https://github.com/ant-design/ant-design/issues/16478
// https://github.com/ant-design/ant-design/issues/24197
if (!children || disabled) {
delete rcUploadProps.id;
}
const uploadList = showUploadList ? (
<LocaleReceiver componentName="Upload" defaultLocale={defaultLocale.Upload}>
{this.renderUploadList}
@@ -312,7 +320,7 @@ class Upload extends React.Component<UploadProps, UploadState> {
prefixCls,
{
[`${prefixCls}-drag`]: true,
[`${prefixCls}-drag-uploading`]: fileList.some(file => file.status === 'uploading'),
[`${prefixCls}-drag-uploading`]: fileList.some((file) => file.status === 'uploading'),
[`${prefixCls}-drag-hover`]: dragState === 'dragover',
[`${prefixCls}-disabled`]: disabled,
},
@@ -342,13 +350,6 @@ class Upload extends React.Component<UploadProps, UploadState> {
[`${prefixCls}-disabled`]: disabled,
});
// Remove id to avoid open by label when trigger is hidden
// https://github.com/ant-design/ant-design/issues/14298
// https://github.com/ant-design/ant-design/issues/16478
if (!children || disabled) {
delete rcUploadProps.id;
}
const uploadButton = (
<div className={uploadButtonCls} style={children ? undefined : { display: 'none' }}>
<RcUpload {...rcUploadProps} ref={this.saveUpload} />

View File

@@ -16,7 +16,7 @@ export default class UploadList extends React.Component<UploadListProps, any> {
showInfo: false,
},
showRemoveIcon: true,
showDownloadIcon: true,
showDownloadIcon: false,
showPreviewIcon: true,
previewFile: previewImage,
};

View File

@@ -64,7 +64,7 @@ exports[`renders ./components/upload/demo/defaultFileList.md correctly 1`] = `
</svg>
</i>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
href="http://www.baidu.com/xxx.png"
rel="noopener noreferrer"
target="_blank"
@@ -75,31 +75,6 @@ exports[`renders ./components/upload/demo/defaultFileList.md correctly 1`] = `
<span
class="ant-upload-list-item-card-actions "
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
<a
title="Remove file"
>
@@ -162,7 +137,7 @@ exports[`renders ./components/upload/demo/defaultFileList.md correctly 1`] = `
</svg>
</i>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
href="http://www.baidu.com/yyy.png"
rel="noopener noreferrer"
target="_blank"
@@ -173,31 +148,6 @@ exports[`renders ./components/upload/demo/defaultFileList.md correctly 1`] = `
<span
class="ant-upload-list-item-card-actions "
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
<a
title="Remove file"
>
@@ -369,7 +319,7 @@ exports[`renders ./components/upload/demo/fileList.md correctly 1`] = `
</svg>
</i>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
href="http://www.baidu.com/xxx.png"
rel="noopener noreferrer"
target="_blank"
@@ -380,31 +330,6 @@ exports[`renders ./components/upload/demo/fileList.md correctly 1`] = `
<span
class="ant-upload-list-item-card-actions "
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
<a
title="Remove file"
>
@@ -474,7 +399,7 @@ exports[`renders ./components/upload/demo/picture-card.md correctly 1`] = `
/>
</a>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
rel="noopener noreferrer"
target="_blank"
@@ -513,27 +438,6 @@ exports[`renders ./components/upload/demo/picture-card.md correctly 1`] = `
</svg>
</i>
</a>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
<i
aria-label="icon: delete"
class="anticon anticon-delete"
@@ -583,7 +487,7 @@ exports[`renders ./components/upload/demo/picture-card.md correctly 1`] = `
/>
</a>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
rel="noopener noreferrer"
target="_blank"
@@ -622,27 +526,6 @@ exports[`renders ./components/upload/demo/picture-card.md correctly 1`] = `
</svg>
</i>
</a>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
<i
aria-label="icon: delete"
class="anticon anticon-delete"
@@ -692,7 +575,7 @@ exports[`renders ./components/upload/demo/picture-card.md correctly 1`] = `
/>
</a>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
rel="noopener noreferrer"
target="_blank"
@@ -731,27 +614,6 @@ exports[`renders ./components/upload/demo/picture-card.md correctly 1`] = `
</svg>
</i>
</a>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
<i
aria-label="icon: delete"
class="anticon anticon-delete"
@@ -801,7 +663,7 @@ exports[`renders ./components/upload/demo/picture-card.md correctly 1`] = `
/>
</a>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
rel="noopener noreferrer"
target="_blank"
@@ -840,27 +702,6 @@ exports[`renders ./components/upload/demo/picture-card.md correctly 1`] = `
</svg>
</i>
</a>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
<i
aria-label="icon: delete"
class="anticon anticon-delete"
@@ -1036,7 +877,7 @@ exports[`renders ./components/upload/demo/picture-style.md correctly 1`] = `
/>
</a>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
rel="noopener noreferrer"
target="_blank"
@@ -1047,31 +888,6 @@ exports[`renders ./components/upload/demo/picture-style.md correctly 1`] = `
<span
class="ant-upload-list-item-card-actions picture"
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
<a
title="Remove file"
>
@@ -1225,7 +1041,7 @@ exports[`renders ./components/upload/demo/picture-style.md correctly 1`] = `
/>
</a>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
rel="noopener noreferrer"
target="_blank"
@@ -1236,31 +1052,6 @@ exports[`renders ./components/upload/demo/picture-style.md correctly 1`] = `
<span
class="ant-upload-list-item-card-actions picture"
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
<a
title="Remove file"
>

View File

@@ -280,7 +280,7 @@ exports[`Upload List should be uploading when upload a file 2`] = `
</svg>
</i>
<span
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
title="foo.png"
>
foo.png
@@ -288,31 +288,6 @@ exports[`Upload List should be uploading when upload a file 2`] = `
<span
class="ant-upload-list-item-card-actions "
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
<a
title="Remove file"
>
@@ -440,7 +415,7 @@ exports[`Upload List should non-image format file preview 1`] = `
</i>
</a>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
href="https://cdn.xxx.com/aaa.zip"
rel="noopener noreferrer"
target="_blank"
@@ -451,31 +426,6 @@ exports[`Upload List should non-image format file preview 1`] = `
<span
class="ant-upload-list-item-card-actions picture"
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
<a
title="Remove file"
>
@@ -531,7 +481,7 @@ exports[`Upload List should non-image format file preview 1`] = `
/>
</a>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
href="https://cdn.xxx.com/aaa"
rel="noopener noreferrer"
target="_blank"
@@ -542,31 +492,6 @@ exports[`Upload List should non-image format file preview 1`] = `
<span
class="ant-upload-list-item-card-actions picture"
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
<a
title="Remove file"
>
@@ -641,7 +566,7 @@ exports[`Upload List should non-image format file preview 1`] = `
</i>
</a>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
href="https://cdn.xxx.com/aaa.xx"
rel="noopener noreferrer"
target="_blank"
@@ -652,31 +577,6 @@ exports[`Upload List should non-image format file preview 1`] = `
<span
class="ant-upload-list-item-card-actions picture"
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
<a
title="Remove file"
>
@@ -751,7 +651,7 @@ exports[`Upload List should non-image format file preview 1`] = `
</i>
</a>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
href="https://cdn.xxx.com/aaa.png/xx.xx"
rel="noopener noreferrer"
target="_blank"
@@ -762,31 +662,6 @@ exports[`Upload List should non-image format file preview 1`] = `
<span
class="ant-upload-list-item-card-actions picture"
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
<a
title="Remove file"
>
@@ -842,7 +717,7 @@ exports[`Upload List should non-image format file preview 1`] = `
/>
</a>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
href="https://cdn.xxx.com/xx.xx/aaa.png"
rel="noopener noreferrer"
target="_blank"
@@ -853,31 +728,6 @@ exports[`Upload List should non-image format file preview 1`] = `
<span
class="ant-upload-list-item-card-actions picture"
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
<a
title="Remove file"
>
@@ -933,7 +783,7 @@ exports[`Upload List should non-image format file preview 1`] = `
/>
</a>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
href="https://cdn.xxx.com/xx.xx/aaa.png"
rel="noopener noreferrer"
target="_blank"
@@ -944,31 +794,6 @@ exports[`Upload List should non-image format file preview 1`] = `
<span
class="ant-upload-list-item-card-actions picture"
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
<a
title="Remove file"
>
@@ -1024,7 +849,7 @@ exports[`Upload List should non-image format file preview 1`] = `
/>
</a>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
href="https://cdn.xxx.com/xx.xx/aaa.png?query=123"
rel="noopener noreferrer"
target="_blank"
@@ -1035,31 +860,6 @@ exports[`Upload List should non-image format file preview 1`] = `
<span
class="ant-upload-list-item-card-actions picture"
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
<a
title="Remove file"
>
@@ -1115,7 +915,7 @@ exports[`Upload List should non-image format file preview 1`] = `
/>
</a>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
href="https://cdn.xxx.com/xx.xx/aaa.png#anchor"
rel="noopener noreferrer"
target="_blank"
@@ -1126,31 +926,6 @@ exports[`Upload List should non-image format file preview 1`] = `
<span
class="ant-upload-list-item-card-actions picture"
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
<a
title="Remove file"
>
@@ -1206,7 +981,7 @@ exports[`Upload List should non-image format file preview 1`] = `
/>
</a>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
href="https://cdn.xxx.com/xx.xx/aaa.png?query=some.query.with.dot"
rel="noopener noreferrer"
target="_blank"
@@ -1217,31 +992,6 @@ exports[`Upload List should non-image format file preview 1`] = `
<span
class="ant-upload-list-item-card-actions picture"
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
<a
title="Remove file"
>
@@ -1297,7 +1047,7 @@ exports[`Upload List should non-image format file preview 1`] = `
/>
</a>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-2"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
href="https://publish-pic-cpu.baidu.com/1296beb3-50d9-4276-885f-52645cbb378e.jpeg@w_228%2ch_152"
rel="noopener noreferrer"
target="_blank"
@@ -1308,31 +1058,6 @@ exports[`Upload List should non-image format file preview 1`] = `
<span
class="ant-upload-list-item-card-actions picture"
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
<a
title="Remove file"
>
@@ -1462,7 +1187,7 @@ exports[`Upload List should support showRemoveIcon and showPreviewIcon 1`] = `
/>
</a>
<a
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-1"
class="ant-upload-list-item-name ant-upload-list-item-name-icon-count-0"
href="https://cdn.xxx.com/aaa"
rel="noopener noreferrer"
target="_blank"
@@ -1472,33 +1197,7 @@ exports[`Upload List should support showRemoveIcon and showPreviewIcon 1`] = `
</a>
<span
class="ant-upload-list-item-card-actions picture"
>
<a
title="Download file"
>
<i
aria-label="icon: download"
class="anticon anticon-download"
tabindex="-1"
title="Download file"
>
<svg
aria-hidden="true"
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
/>
</svg>
</i>
</a>
</span>
/>
</span>
</div>
</div>

View File

@@ -34,11 +34,11 @@ describe('Upload', () => {
expect(ref).toBeDefined();
});
it('return promise in beforeUpload', done => {
it('return promise in beforeUpload', (done) => {
const data = jest.fn();
const props = {
action: 'http://upload.com',
beforeUpload: () => new Promise(resolve => setTimeout(() => resolve('success'), 100)),
beforeUpload: () => new Promise((resolve) => setTimeout(() => resolve('success'), 100)),
data,
onChange: ({ file }) => {
if (file.status !== 'uploading') {
@@ -61,11 +61,11 @@ describe('Upload', () => {
});
});
it('should update progress in IE', done => {
it('should update progress in IE', (done) => {
const originSetInterval = window.setInterval;
process.env.TEST_IE = true;
Object.defineProperty(window, 'setInterval', {
value: fn => fn(),
value: (fn) => fn(),
});
const props = {
action: 'http://upload.com',
@@ -92,7 +92,7 @@ describe('Upload', () => {
});
});
it('beforeUpload can be falsy', done => {
it('beforeUpload can be falsy', (done) => {
const props = {
action: 'http://upload.com',
beforeUpload: false,
@@ -116,12 +116,12 @@ describe('Upload', () => {
});
});
it('upload promise return file in beforeUpload', done => {
it('upload promise return file in beforeUpload', (done) => {
const data = jest.fn();
const props = {
action: 'http://upload.com',
beforeUpload: file =>
new Promise(resolve =>
beforeUpload: (file) =>
new Promise((resolve) =>
setTimeout(() => {
const result = file;
result.name = 'test.png';
@@ -151,7 +151,7 @@ describe('Upload', () => {
});
});
it('should not stop upload when return value of beforeUpload is false', done => {
it('should not stop upload when return value of beforeUpload is false', (done) => {
const fileList = [
{
uid: 'bar',
@@ -169,7 +169,7 @@ describe('Upload', () => {
data,
onChange: ({ file, fileList: updatedFileList }) => {
expect(file instanceof File).toBe(true);
expect(updatedFileList.map(f => f.name)).toEqual(['bar.png', 'foo.png']);
expect(updatedFileList.map((f) => f.name)).toEqual(['bar.png', 'foo.png']);
expect(data).not.toHaveBeenCalled();
done();
},
@@ -188,7 +188,7 @@ describe('Upload', () => {
});
});
it('should increase percent automatically when call autoUpdateProgress in IE', done => {
it('should increase percent automatically when call autoUpdateProgress in IE', (done) => {
let uploadInstance;
let lastPercent = -1;
const props = {
@@ -223,7 +223,7 @@ describe('Upload', () => {
uploadInstance = wrapper.instance();
});
it('should not stop upload when return value of beforeUpload is not false', done => {
it('should not stop upload when return value of beforeUpload is not false', (done) => {
const data = jest.fn();
const props = {
action: 'http://upload.com',
@@ -293,7 +293,7 @@ describe('Upload', () => {
});
// https://github.com/ant-design/ant-design/issues/16478
it('should not have id if upload is disabled, avoid being triggered by label', () => {
it('should not have id if Upload is disabled, avoid being triggered by label', () => {
// eslint-disable-next-line
class Demo extends React.Component {
render() {
@@ -323,6 +323,37 @@ describe('Upload', () => {
expect(wrapper.find('input#upload').length).toBe(0);
});
// https://github.com/ant-design/ant-design/issues/24197
it('should not have id if Upload.Dragger is disabled, avoid being triggered by label', () => {
// eslint-disable-next-line
class Demo extends React.Component {
render() {
const {
form: { getFieldDecorator },
disabled,
} = this.props;
return (
<Form>
<Form.Item label="Upload">
{getFieldDecorator('upload', {
valuePropName: 'fileList',
})(
<Upload.Dragger disabled={disabled}>
<div>upload</div>
</Upload.Dragger>,
)}
</Form.Item>
</Form>
);
}
}
const WrappedDemo = Form.create()(Demo);
const wrapper = mount(<WrappedDemo />);
expect(wrapper.find('input#upload').length).toBe(1);
wrapper.setProps({ disabled: true });
expect(wrapper.find('input#upload').length).toBe(0);
});
it('should be controlled by fileList', () => {
const fileList = [
{
@@ -348,7 +379,7 @@ describe('Upload', () => {
it('should be able to copy file instance', () => {
const file = new File([], 'aaa.zip');
const copiedFile = fileToObject(file);
['uid', 'lastModified', 'lastModifiedDate', 'name', 'size', 'type'].forEach(key => {
['uid', 'lastModified', 'lastModifiedDate', 'name', 'size', 'type'].forEach((key) => {
expect(key in copiedFile).toBe(true);
});
});
@@ -455,7 +486,7 @@ describe('Upload', () => {
expect(linkNode.props().rel).toBe('noopener');
});
it('should not stop remove when return value of onRemove is false', done => {
it('should not stop remove when return value of onRemove is false', (done) => {
const mockRemove = jest.fn(() => false);
const props = {
onRemove: mockRemove,
@@ -484,13 +515,13 @@ describe('Upload', () => {
});
// https://github.com/ant-design/ant-design/issues/18902
it('should not abort uploading until return value of onRemove is resolved as true', done => {
it('should not abort uploading until return value of onRemove is resolved as true', (done) => {
let wrapper;
const props = {
onRemove: () =>
new Promise(
resolve =>
(resolve) =>
setTimeout(() => {
wrapper.update();
expect(props.fileList).toHaveLength(1);
@@ -519,10 +550,13 @@ describe('Upload', () => {
wrapper.find('div.ant-upload-list-item i.anticon-delete').simulate('click');
});
it('should not stop download when return use onDownload', done => {
it('should not stop download when return use onDownload', (done) => {
const mockRemove = jest.fn(() => false);
const props = {
onRemove: mockRemove,
showUploadList: {
showDownloadIcon: true,
},
fileList: [
{
uid: '-1',

View File

@@ -205,7 +205,7 @@ describe('Upload List', () => {
it('In the case of listType=picture, the error status does not show the download.', () => {
const file = { status: 'error', uid: 'file' };
const wrapper = mount(
<Upload listType="picture" fileList={[file]}>
<Upload listType="picture" fileList={[file]} showUploadList={{ showDownloadIcon: true }}>
<button type="button">upload</button>
</Upload>,
);
@@ -215,7 +215,7 @@ describe('Upload List', () => {
it('In the case of listType=picture-card, the error status does not show the download.', () => {
const file = { status: 'error', uid: 'file' };
const wrapper = mount(
<Upload listType="picture-card" fileList={[file]}>
<Upload listType="picture-card" fileList={[file]} showUploadList={{ showDownloadIcon: true }}>
<button type="button">upload</button>
</Upload>,
);
@@ -225,7 +225,7 @@ describe('Upload List', () => {
it('In the case of listType=text, the error status does not show the download.', () => {
const file = { status: 'error', uid: 'file' };
const wrapper = mount(
<Upload listType="text" fileList={[file]}>
<Upload listType="text" fileList={[file]} showUploadList={{ showDownloadIcon: true }}>
<button type="button">upload</button>
</Upload>,
);
@@ -292,6 +292,9 @@ describe('Upload List', () => {
},
]}
onDownload={handleDownload}
showUploadList={{
showDownloadIcon: true,
}}
>
<button type="button">upload</button>
</Upload>,
@@ -302,7 +305,7 @@ describe('Upload List', () => {
.simulate('click');
});
it('should support no onDownload', async () => {
it('should support no onDownload', async () => {
const wrapper = mount(
<Upload
listType="picture-card"
@@ -314,6 +317,9 @@ describe('Upload List', () => {
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
},
]}
showUploadList={{
showDownloadIcon: true,
}}
>
<button type="button">upload</button>
</Upload>,
@@ -541,7 +547,13 @@ describe('Upload List', () => {
it('return when prop onDownload not exists', () => {
const file = new File([''], 'test.txt', { type: 'text/plain' });
const items = [{ uid: 'upload-list-item', url: '' }];
const wrapper = mount(<UploadList items={items} locale={{ downloadFile: '' }} />).instance();
const wrapper = mount(
<UploadList
items={items}
locale={{ downloadFile: '' }}
showUploadList={{ showDownloadIcon: true }}
/>,
).instance();
expect(wrapper.handleDownload(file)).toBe(undefined);
});
@@ -563,6 +575,7 @@ describe('Upload List', () => {
items={items}
onDownload={() => {}}
locale={{ downloadFile: '' }}
showUploadList={{ showDownloadIcon: true }}
/>,
).instance();
return wrapper.props.onDownload(file);
@@ -576,16 +589,18 @@ describe('Upload List', () => {
expect(wrapper.find('.ant-upload-list-item-thumbnail').length).toBe(2);
});
it('extname should work correctly when url exists', () => {
it('extname should work correctly when url exists', (done) => {
const items = [{ status: 'done', uid: 'upload-list-item', url: '/example' }];
const wrapper = mount(
<UploadList
listType="picture"
onDownload={file => {
expect(file.url).toBe('/example');
done();
}}
items={items}
locale={{ downloadFile: '' }}
showDownloadIcon
/>,
);
wrapper.find('div.ant-upload-list-item i.anticon-download').simulate('click');

View File

@@ -178,7 +178,7 @@
opacity: 1;
}
.anticon {
padding-right: 5px;
padding-right: 6px;
color: rgba(0, 0, 0, 0.45);
}
}
@@ -239,7 +239,6 @@
&-error &-card-actions {
.anticon {
padding-right: 5px;
color: @error-color;
}
opacity: 1;

View File

@@ -16,7 +16,7 @@ If you try in local environment, Please refer to [Install and Initialization](ht
Here is a simple codesandbox example to show the usage of Ant Design React.
<iframe
src="https://codesandbox.io/embed/antd-reproduction-template-6e93z?autoresize=1&fontsize=14&hidenavigation=1&theme=dark"
src="https://codesandbox.io/embed/antd-reproduction-template-08g8k?autoresize=1&fontsize=14&hidenavigation=1&theme=dark"
style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;"
title="antd reproduction template"
allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb"

View File

@@ -14,7 +14,7 @@ Ant Design React 致力于提供给程序员**愉悦**的开发体验。
这是一个最简单的 Ant Design 组件的在线 codesandbox 演示。
<iframe
src="https://codesandbox.io/embed/antd-reproduction-template-6e93z?autoresize=1&fontsize=14&hidenavigation=1&theme=dark"
src="https://codesandbox.io/embed/antd-reproduction-template-08g8k?autoresize=1&fontsize=14&hidenavigation=1&theme=dark"
style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;"
title="antd reproduction template"
allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb"

View File

@@ -1,6 +1,6 @@
{
"name": "antd",
"version": "3.26.9",
"version": "3.26.18",
"description": "An enterprise-class UI design language and React components implementation",
"keywords": [
"ant",
@@ -47,9 +47,7 @@
"bundlesize": "bundlesize",
"check-commit": "node ./scripts/check-commit.js",
"compile": "antd-tools run compile",
"predeploy": "antd-tools run clean && npm run site && cp netlify.toml CNAME _site && cp -r .circleci/ _site && npm run site:test",
"deploy": "bisheng gh-pages --push-only",
"deploy:china-mirror": "git checkout gh-pages && git pull origin gh-pages && git push git@gitee.com:ant-design/ant-design.git gh-pages",
"deploy": "echo '!!! v3 is in maintaining which means no need to deploy site !!!'",
"dist": "antd-tools run dist",
"lint": "npm run lint:tsc && npm run lint:script && npm run lint:demo && npm run lint:style && npm run lint:deps",
"lint-fix": "npm run lint-fix:script && npm run lint-fix:demo && npm run lint-fix:style",
@@ -147,8 +145,7 @@
},
"devDependencies": {
"@ant-design/colors": "^3.2.2",
"@ant-design/tools": "^8.0.4",
"@packtracker/webpack-plugin": "^2.0.1",
"@ant-design/tools": "^9.0.1",
"@qixian.cs/github-contributors-list": "^1.0.3",
"@sentry/browser": "^5.4.0",
"@stackblitz/sdk": "^1.3.0",
@@ -163,7 +160,7 @@
"@types/shallowequal": "^1.1.1",
"@types/warning": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^2.0.0",
"@typescript-eslint/parser": "^2.10.0",
"@typescript-eslint/parser": "~2.23.0",
"antd-theme-generator": "^1.1.6",
"babel-eslint": "^10.0.1",
"babel-plugin-add-react-displayname": "^0.0.5",
@@ -187,7 +184,7 @@
"eslint-config-airbnb": "^18.0.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-import": "~2.19.1",
"eslint-plugin-import": "~2.20.1",
"eslint-plugin-jest": "^23.0.2",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-markdown": "^1.0.0",
@@ -200,7 +197,7 @@
"husky": "^3.0.2",
"immutability-helper": "^3.0.0",
"intersection-observer": "^0.7.0",
"jest": "^24.8.0",
"jest": "^25.5.0",
"jsdom": "^15.1.1",
"jsonml.js": "^0.1.0",
"logrocket": "^1.0.0",
@@ -244,7 +241,7 @@
"stylelint-config-standard": "^19.0.0",
"stylelint-declaration-block-no-ignored-properties": "^2.1.0",
"stylelint-order": "^4.0.0",
"typescript": "~3.7.2",
"typescript": "~3.8.3",
"xhr-mock": "^2.4.1",
"xhr2": "^0.2.0",
"yaml-front-matter": "^4.0.0"

View File

@@ -66,12 +66,15 @@ module.exports = {
废弃: 7,
},
docVersions: {
'0.9.x': 'http://09x.ant.design',
'0.10.x': 'http://010x.ant.design',
'0.11.x': 'http://011x.ant.design',
'0.12.x': 'http://012x.ant.design',
'1.x': 'http://1x.ant.design',
'2.x': 'http://2x.ant.design',
'1.x': 'http://1x.ant.design',
'0.12.x': 'http://012x.ant.design',
'0.11.x': 'http://011x.ant.design',
'0.10.x': 'http://010x.ant.design',
'0.9.x': 'http://09x.ant.design',
},
docNewVersions: {
'4.x': 'https://ant.design',
},
},
filePathMapper(filePath) {

View File

@@ -1,9 +1,10 @@
import React from 'react';
import uniq from 'lodash/uniq';
import { generate } from '@ant-design/colors';
import ColorBlock from './ColorBlock';
export default function ColorPatterns({ color }) {
return generate(color).map((colorString, i) => (
return uniq(generate(color)).map((colorString, i) => (
<ColorBlock color={colorString} index={i + 1} key={colorString} />
));
}

View File

@@ -159,12 +159,12 @@ class Demo extends React.Component {
.replace(/([a-zA-Z]*)\s+as\s+([a-zA-Z]*)/, '$1:$2'),
css: prefillStyle,
editors: '001',
css_external: 'https://unpkg.com/antd/dist/antd.css',
css_external: 'https://unpkg.com/antd@3.x/dist/antd.css',
js_external: [
'react@16.x/umd/react.development.js',
'react-dom@16.x/umd/react-dom.development.js',
'moment/min/moment-with-locales.js',
'antd/dist/antd-with-locales.js',
'antd@3.x/dist/antd-with-locales.js',
'react-router-dom/umd/react-router-dom.min.js',
'react-router@3.x/umd/ReactRouter.min.js',
]
@@ -174,8 +174,8 @@ class Demo extends React.Component {
};
const riddlePrefillConfig = {
title: `${localizedTitle} - Ant Design Demo`,
js: sourceCode,
css: prefillStyle,
js: sourceCode.replace("'antd';", "'antd@3.x';"),
css: prefillStyle.replace(" 'antd/", " 'antd@3.x/"),
};
const dependencies = sourceCode.split('\n').reduce(
(acc, line) => {
@@ -188,7 +188,7 @@ class Demo extends React.Component {
}
return acc;
},
{ react: 'latest', 'react-dom': 'latest', antd: 'latest' },
{ react: 'latest', 'react-dom': 'latest', antd: '3.x' },
);
const indexJsContent = `
import React from 'react';

View File

@@ -90,6 +90,7 @@ const Banner = ({ isMobile }) => {
key="promote"
className="banner-promote"
style={{
display: 'none',
width: isZhCN ? 412 : 522,
}}
>

View File

@@ -108,8 +108,16 @@ class Header extends React.Component {
const { menuVisible } = this.state;
const { isMobile } = this.context;
const menuMode = isMobile ? 'inline' : 'horizontal';
const { location, themeConfig, intl: { locale } } = this.props;
const docVersions = { ...themeConfig.docVersions, [antdVersion]: antdVersion };
const {
location,
themeConfig,
intl: { locale },
} = this.props;
const docVersions = {
...themeConfig.docNewVersions,
[antdVersion]: antdVersion,
...themeConfig.docVersions,
};
const versionOptions = Object.keys(docVersions).map(version => (
<Option value={docVersions[version]} key={version}>
{version}

View File

@@ -28,6 +28,7 @@ export default function focusTest(Component) {
wrapper.instance().focus();
jest.runAllTimers();
expect(handleFocus).toHaveBeenCalled();
wrapper.unmount();
});
it('blur() and onBlur', () => {
@@ -38,13 +39,15 @@ export default function focusTest(Component) {
wrapper.instance().blur();
jest.runAllTimers();
expect(handleBlur).toHaveBeenCalled();
wrapper.unmount();
});
it('autoFocus', () => {
const handleFocus = jest.fn();
mount(<Component autoFocus onFocus={handleFocus} />, { attachTo: container });
const wrapper = mount(<Component autoFocus onFocus={handleFocus} />, { attachTo: container });
jest.runAllTimers();
expect(handleFocus).toHaveBeenCalled();
wrapper.unmount();
});
});
}

View File

@@ -1,7 +1,6 @@
/* eslint no-param-reassign: 0 */
// This config is for building dist files
const getWebpackConfig = require('@ant-design/tools/lib/getWebpackConfig');
const PacktrackerPlugin = require('@packtracker/webpack-plugin');
const { webpack } = getWebpackConfig;
@@ -36,18 +35,6 @@ if (process.env.RUN_ENV === 'PRODUCTION') {
ignoreMomentLocale(config);
externalMoment(config);
addLocales(config);
// skip codesandbox ci
if (!process.env.CSB_REPO) {
// https://docs.packtracker.io/uploading-your-webpack-stats/webpack-plugin
config.plugins.push(
new PacktrackerPlugin({
project_token: '8adbb892-ee4a-4d6f-93bb-a03219fb6778',
upload: process.env.CI === 'true',
fail_build: true,
exclude_assets: name => !['antd.min.js', 'antd.min.css'].includes(name),
}),
);
}
});
}