Compare commits

..

123 Commits

Author SHA1 Message Date
afc163
b5d3a90b96 docs: release 3.26.19 2020-10-25 16:26:20 +08:00
Van Nguyen
818470289f fix: package.json import for webpack@5 compatibility (#27314) 2020-10-25 03:46:04 +08:00
Amumu
0a1ba7c6ca fix: snap (#27342) 2020-10-24 14:06:08 +08:00
xrkffgg
34ba35eb80 docs: update gitee (#25699) 2020-07-20 14:26:33 +08:00
njzy
e13bb39c1d docs: fix the wrong way to import react-dnd-html5-backend (#25151)
* Fix the wrong way to import react-dnd-html5-backend

* chore: update react-dnd

* Update custom-tab-bar-node.md
2020-06-23 17:25:47 +08:00
afc163
bf4b72a76a fix snapshot 2020-06-23 16:35:15 +08:00
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
诸岳
a1c733ad07 Bump 3.26.9 2020-02-08 21:27:25 +08:00
诸岳
9918140695 docs: Add the changelog of 3.26.9 (#21289) 2020-02-08 21:25:53 +08:00
Chiciuc Nicușor
87cbe0168f Explicitly add children prop to Timeline. (#21265) 2020-02-08 19:16:09 +08:00
偏右
eea0b028c9 🐛 Typography editable should focus at the end (#21268)
close #21261
2020-02-07 13:15:53 +08:00
偏右
88bed67368 🐛 Fix Steps style when size="small" and labelPlacement="vertical" (#21258)
close #21257
2020-02-06 17:28:47 +08:00
Han
f7e7ce9d4f fix: Minor fix on ValidationRule to match AsyncValidator (#21250)
* Minor fix on ValidationRule to match AsyncValidator

* update doc
2020-02-06 10:44:49 +08:00
二货机器人
ae7666f8fa fix badge (#21237) 2020-02-05 14:23:21 +08:00
Jirka-Lhotka
3fb7325a21 Fix wrong event type of AntTreeNodeMouseEvent (#21200) 2020-02-03 20:31:27 +08:00
偏右
59c29a400d release 3.26.8 (#21187) 2020-02-03 12:45:28 +08:00
偏右
d3102bb2db 🐛 fix site menu affix bug (#21188)
close #21128
2020-02-03 12:35:04 +08:00
afc163
e036e4c9a3 site: 📣 promote g2plot 2020-02-03 11:38:44 +08:00
Chiciuc Nicușor
da3540bd59 Replace NativeButtonProps with ButtonProps for okButtonProps and cancelButtonProps. (#21165) 2020-01-31 22:09:49 +08:00
Teng YANG
bba87d4125 update display names for layout components (#21124)
(cherry picked from commit 286e0e97f8)
2020-01-28 15:26:55 +08:00
Teng YANG
6de8522894 fix: card actions font-size issue (#21106)
Fix card component action font-size not controlled by theme variable.
2020-01-26 11:40:06 +08:00
信鑫-King
674074ce93 fix: 3.x deploy site (#20682) 2020-01-17 12:31:56 +08:00
Amumu
c68f4463d3 fix error docs (#20926) 2020-01-16 15:58:24 +08:00
偏右
a96a95ccb8 🐛 Fix List item flex layout (#20897)
close #20648
2020-01-15 10:35:45 +08:00
偏右
b112378de3 🐛 Fix Tooltip title 0 is not shown (#20894)
close #20891
2020-01-14 17:55:40 +08:00
Amumu
db4bec92be version 3.23.0 (#20890) 2020-01-14 15:50:16 +08:00
信鑫-King
b6fc0168db chore: check commit (#20880) 2020-01-14 09:41:57 +08:00
信鑫-King
92fe411961 docs: 3.26.7 changelog (#20873)
* upd: version

* 📝 changelog

* 📝 docs
2020-01-14 07:40:32 +08:00
zefeng
ab29ecb377 fix: better approach to solve not show overflow content when in elastic (#20821) 2020-01-13 20:43:03 +08:00
afc163
23d5a856c0 🎬 improve Tag demo 2020-01-08 15:09:24 +08:00
偏右
6e4fa95d0f 🐛 fix Tree switcherIcon shown in leaf node (#20753)
close #20511
2020-01-08 13:17:49 +08:00
afc163
2753ce91c9 🐛 tweak @zindex-badge for table fixed column
close #20750
close #13930
2020-01-08 11:43:10 +08:00
偏右
057f5b8526 🐛 Fix Cascader search bug when fieldNames existed (#20720)
and label/value have same field name

close #20619
2020-01-08 10:38:36 +08:00
Amumu
d3eea22097 fix: correct the collapse-borderless class variable (#20718) (#20721)
Co-authored-by: Kuitos <kuitos.lau@gmail.com>
2020-01-07 15:39:42 +08:00
骗你是小猫咪
da2f54a18a refactor: improve digital input in tooltip demo (#20702) (#20717)
* refactor: improve digital input in tooltip demo

* fix lint
2020-01-07 12:02:21 +08:00
afc163
e5dd231aaa site: 📣 promote yuque activity 2020-01-06 18:03:04 +08:00
偏右
c6eafe8380 🐛 fix Input.Group 1px bug in vertical layout form (#20685)
close #20616
2020-01-06 14:26:11 +08:00
Googleplex
0520b844d5 docs: Update year in change log (#20670)
* Update year in CHANGELOG.zh-CN.md

Update year in change log of 3.26.6 from 2019 to 2020

* Update year in CHANGELOG.en-US.md

Update year in change log of 3.26.6 from 2019 to 2020
2020-01-05 19:09:51 +08:00
zombiej
8dd91ca648 docs: Update home for antd next link 2020-01-03 21:56:38 +08:00
二货机器人
44c9bcafc9 docs: 3.26.6 changelog (#20647)
* 3.26.6 changelog

* add v3 notify
2020-01-03 17:30:45 +08:00
vagusX
4df1cd3db2 docs: update Modal docs (#20612)
* doc: update Modal docs

* doc: update modal en-US doc
2020-01-02 23:22:54 +08:00
二货机器人
2f7c895675 Revert "Update colors.en-US.md (#20606)" (#20607)
This reverts commit c513296849.
2020-01-02 18:18:39 +08:00
myeunhyuk
c513296849 Update colors.en-US.md (#20606) 2020-01-02 18:17:52 +08:00
jiang
2416f733bf fix: url 404 (#20589)
* fix url 404

* update url
2020-01-02 14:16:05 +08:00
偏右
d102c2bf7a 🆙 upgrade stylelint-order (#20585) 2020-01-02 12:11:26 +08:00
偏右
2adf8ced24 fix: 💄 Remove Input.Password value attribute from dom (#20544)
* 💄 Remove Input.Password value attribute in dom

close #20541
close #7761
close #19959
close #20536
close #12672
close #10952

*  fix test coverage

* 🐛 fix defaultValue create `value` attribute in Input.Password
2019-12-31 14:41:09 +08:00
Yaindrop
528f1df5d6 Fix image misplacing (#20552)
Switched the images of "The keyword of the user query is only displayed in three categories, Topics, Questions and Articles." and "The number of categories the keyword of the user query belongs to is uncertain."
2019-12-31 10:56:28 +08:00
DiamondYuan
4297f33e85 fix: use Object.prototype.toString to check object (#20546)
close #20528
2019-12-30 22:14:17 +08:00
偏右
8ea9356399 💄 Improve Step type="navigation" UI in small screen (#20545)
close #19877
2019-12-30 20:13:24 +08:00
二货机器人
bcb71b8b78 chore: dev mode always show debug default (#20535) 2019-12-30 16:31:30 +08:00
liyuanqiu
121437b666 Remove inconsistant style (#20533)
Remove "line-height: unset;" from ".@{radio-group-prefix-cls}".
It causes inconsistance with Checkbox.Group.
See: https://codesandbox.io/s/antd-radio-line-height-8kt7u
2019-12-30 16:01:29 +08:00
135 changed files with 14016 additions and 8309 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:
- master
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,131 @@ timeline: true
---
## 3.26.19
`2020-10-25`
- 🐞 Fix webpack 5 compatibility issue. [#27314](https://github.com/ant-design/ant-design/pull/27314) [@vnguyen94](https://github.com/vnguyen94)
## 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`
- 🐞 Fix Badge that count is not align when wrapped by Typography. [#21237](https://github.com/ant-design/ant-design/pull/21237)
- 🐞 Fix Steps that icon is not align when `size="small"` and `labelPlacement="vertical"`. [#21258](https://github.com/ant-design/ant-design/pull/21258)
- 🐞 Fix Typography not focus at the end of textarea when `editable` is true. [#21268](https://github.com/ant-design/ant-design/pull/21268)
- TypeScript
- 💄 Improve type definition of validation rule's type for Form. [#21250](https://github.com/ant-design/ant-design/pull/21250) [@hansololai](https://github.com/hansololai)
- 🐞 Fix type definition of `event` for Tree. [#21200](https://github.com/ant-design/ant-design/pull/21200) [@Jirka-Lhotka](https://github.com/Jirka-Lhotka)
## 3.26.8
`2020-02-03`
- 🐞 Fix Tooltip hidden when `title` is `0`. [#20894](https://github.com/ant-design/ant-design/pull/20894)
- 🐞 Fix List `actions` inconsistent position. [#20897](https://github.com/ant-design/ant-design/pull/20897)
- 🐞 Fix Card `font-size` of `actions` not in less theme variables. [#21106](https://github.com/ant-design/ant-design/pull/21106)
- 🐞 Fix Layout components `displayName`. [#21124](https://github.com/ant-design/ant-design/pull/21124)
- 🐞 Fix Modal.confirm `okButtonProps` and `cancelButtonProps` interface. [#21165](https://github.com/ant-design/ant-design/pull/21165)
## 3.26.7
`2020-01-13`
- 💄 Optimize Table fixed columns blank problem in some case. [#20821](https://github.com/ant-design/ant-design/pull/20821) [@AshoneA](https://github.com/AshoneA)
- 🐞 Fix Tree `switcherIcon` shown in leaf node problem. [#20753](https://github.com/ant-design/ant-design/pull/20753)
- 🐞 Fix Badge `z-index` higher than Table fixed columns. [#20751](https://github.com/ant-design/ant-design/pull/20751)
- 🐞 Fix Cascader search bug when `fieldNames` is existed and label/value share same name. [#20720](https://github.com/ant-design/ant-design/pull/20720)
- 🐞 Fix Collapse background color with wrong less variable. [#20718](https://github.com/ant-design/ant-design/pull/20718) [@kuitos](https://github.com/kuitos)
- 🐞 Fix Input.Group inside `<Form layout="vertical" >` 1px bug. [#20685](https://github.com/ant-design/ant-design/pull/20685)
## 3.26.6
`2020-01-03`
- 📢 v3 branch changes from `master` to `3.x-stable` and v4 merge into `master`.
- 💄 Improve Steps `type="navigation"` UI in small screen. [#20545](https://github.com/ant-design/ant-design/pull/20545)
- 🐞 Fix `message.xxx` pass `null` will failed. [#20546](https://github.com/ant-design/ant-design/pull/20546)
- 🐞 Remove Input.Password `value` attribute from dom. [#20544](https://github.com/ant-design/ant-design/pull/20544)
## 3.26.5
`2019-12-29`
@@ -2584,7 +2709,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,131 @@ timeline: true
---
## 3.26.19
`2020-10-25`
- 🐞 修复 webpack 5 兼容问题。[#27314](https://github.com/ant-design/ant-design/pull/27314) [@vnguyen94](https://github.com/vnguyen94)
## 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)
- 🐞 修复 Steps 在 `size="small"``labelPlacement="vertical"` 时图标没有对齐的问题。[#21258](https://github.com/ant-design/ant-design/pull/21258)
- 🐞 修复 Typography 在可编辑状态时光标没有在输入框末位的问题。[#21268](https://github.com/ant-design/ant-design/pull/21268)
- TypeScript
- 💄 完善 Form 中校验规则类型的类型定义。[#21250](https://github.com/ant-design/ant-design/pull/21250) [@hansololai](https://github.com/hansololai)
- 🐞 修复 Tree 中事件类型定义不正确的问题。[#21200](https://github.com/ant-design/ant-design/pull/21200) [@Jirka-Lhotka](https://github.com/Jirka-Lhotka)
## 3.26.8
`2020-02-03`
- 🐞 修复 Tooltip `title``0` 时没有显示的问题。[#20894](https://github.com/ant-design/ant-design/pull/20894)
- 🐞 修复 List `actions` 位置不在右边的问题。[#20897](https://github.com/ant-design/ant-design/pull/20897)
- 🐞 修复 Card `actions` 字体大小不受 less 变量影响的问题。[#21106](https://github.com/ant-design/ant-design/pull/21106)
- 🐞 修正 Layout 各组件的 `displayName`。[#21124](https://github.com/ant-design/ant-design/pull/21124)
- 🐞 优化 Modal.confirm 的 `okButtonProps``cancelButtonProps` 的 TypeScript 类型。[#21165](https://github.com/ant-design/ant-design/pull/21165)
## 3.26.7
`2020-01-13`
- 💄 优化 Table 固定列在某些情况下出现空白间隔的问题。[#20821](https://github.com/ant-design/ant-design/pull/20821) [@AshoneA](https://github.com/AshoneA)
- 🐞 修复 Tree `switcherIcon` 在叶子节点上展示的问题。[#20753](https://github.com/ant-design/ant-design/pull/20753)
- 🐞 修复 Badge 在 Table 固定列中穿透的问题。[#20751](https://github.com/ant-design/ant-design/pull/20751)
- 🐞 修复 Cascader `fieldNames` 中 label 和 value 共用一个值时搜索功能失效的问题。[#20720](https://github.com/ant-design/ant-design/pull/20720)
- 🐞 修复 Collapse 背景使用错误的 less 变量。[#20718](https://github.com/ant-design/ant-design/pull/20718) [@kuitos](https://github.com/kuitos)
- 🐞 修复 `<Form layout="vertical" >` 内 Input.Group 偏上一像素的问题。[#20685](https://github.com/ant-design/ant-design/pull/20685)
## 3.26.6
`2020-01-03`
- 📢 v3 分支由 `master` 进入 `3.x-stable`v4 合入 `master`
- 💄 优化 Steps `type="navigation"` 在小屏幕下的样式。[#20545](https://github.com/ant-design/ant-design/pull/20545)
- 🐞 修复 `message.xxx` 传入 `null` 会报错的问题。[#20546](https://github.com/ant-design/ant-design/pull/20546)
- 🐞 优化 Input.Password 在 dom 中明文显示 `value` 属性的问题。[#20544](https://github.com/ant-design/ant-design/pull/20544)
## 3.26.5
`2019-12-29`
@@ -2600,7 +2725,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

@@ -41,152 +41,152 @@ exports[`renders ./components/avatar/demo/badge.md correctly 1`] = `
style="transition:none;-ms-transform:translateY(-1100%);-webkit-transform:translateY(-1100%);transform:translateY(-1100%)"
>
<p
class=""
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
5
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
9
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class="current"
class="ant-scroll-number-only-unit current"
>
1
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
5
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
9
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
5
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
9
</p>

View File

@@ -17,12 +17,16 @@ function getNumberArray(num: string | number | undefined | null) {
: [];
}
function renderNumberList(position: number) {
function renderNumberList(position: number, className: string) {
const childrenToReturn: React.ReactElement<any>[] = [];
for (let i = 0; i < 30; i++) {
const currentClassName = position === i ? 'current' : '';
childrenToReturn.push(
<p key={i.toString()} className={currentClassName}>
<p
key={i.toString()}
className={classNames(className, {
current: position === i,
})}
>
{i % 10}
</p>,
);
@@ -67,6 +71,8 @@ class ScrollNumber extends React.Component<ScrollNumberProps, ScrollNumberState>
lastCount?: string | number | null;
private timeout?: number;
constructor(props: ScrollNumberProps) {
super(props);
this.state = {
@@ -79,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));
@@ -138,7 +153,7 @@ class ScrollNumber extends React.Component<ScrollNumberProps, ScrollNumberState>
},
key: i,
},
renderNumberList(position),
renderNumberList(position, `${prefixCls}-only-unit`),
);
}
@@ -206,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);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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%;
}
@@ -159,7 +158,7 @@
display: inline-block;
height: @badge-height;
transition: all 0.3s @ease-in-out;
> p {
> p.@{number-prefix-cls}-only-unit {
height: @badge-height;
margin: 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

@@ -32,7 +32,7 @@ A card can be used to display content related to a single subject. The content c
| hoverable | Lift up when hovering card | boolean | false | |
| loading | Shows a loading indicator while the contents of the card are being fetched | boolean | false | |
| tabList | List of TabPane's head. | Array&lt;{key: string, tab: ReactNode}> | - | |
| tabBarExtraContent | Extra content in tab bar | React.ReactNode | - | |
| tabBarExtraContent | Extra content in tab bar | React.ReactNode | - | 3.23.0 |
| size | Size of card | `default` \| `small` | `default` | 3.12.0 |
| title | Card title | string\|ReactNode | - | |
| type | Card style type, can be set to `inner` or not set | string | - | |

View File

@@ -33,7 +33,7 @@ cols: 1
| hoverable | 鼠标移过时可浮起 | boolean | false | |
| loading | 当卡片内容还在加载中时,可以用 loading 展示一个占位 | boolean | false | |
| tabList | 页签标题列表 | Array&lt;{key: string, tab: ReactNode}> | - | |
| tabBarExtraContent | tab bar 上额外的元素 | React.ReactNode | 无 | |
| tabBarExtraContent | tab bar 上额外的元素 | React.ReactNode | 无 | 3.23.0 |
| size | card 的尺寸 | `default` \| `small` | `default` | 3.12.0 |
| title | 卡片标题 | string\|ReactNode | - | |
| type | 卡片类型,可设置为 `inner` 或 不设置 | string | - | |

View File

@@ -144,7 +144,7 @@
position: relative;
display: block;
min-width: 32px;
font-size: 14px;
font-size: @font-size-base;
line-height: 22px;
cursor: pointer;

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

@@ -839,6 +839,7 @@ exports[`Cascader should highlight keyword and filter when search in Cascader 1`
Object {
"__IS_FILTERED_OPTION": true,
"disabled": false,
"isEmptyNode": true,
"label": Array [
"Jiangsu",
Array [
@@ -891,6 +892,7 @@ exports[`Cascader should highlight keyword and filter when search in Cascader 1`
Object {
"__IS_FILTERED_OPTION": true,
"disabled": false,
"isEmptyNode": true,
"label": Array [
"Zhejiang",
Array [
@@ -1025,6 +1027,49 @@ exports[`Cascader should highlight keyword and filter when search in Cascader 1`
</Popup>
`;
exports[`Cascader should highlight keyword and filter when search in Cascader with same field name of label and value 1`] = `
<div>
<div
class="ant-cascader-menus ant-cascader-menus-placement-bottomLeft slide-up-appear"
style="left: -999px; top: -995px;"
>
<div>
<ul
class="ant-cascader-menu"
style="width: 0px;"
>
<li
class="ant-cascader-menu-item"
role="menuitem"
title=""
>
Zhejiang / Hang
<span
class="ant-cascader-menu-item-keyword"
>
z
</span>
hou / West Lake
</li>
<li
class="ant-cascader-menu-item ant-cascader-menu-item-disabled"
role="menuitem"
title=""
>
Zhejiang / Hang
<span
class="ant-cascader-menu-item-keyword"
>
z
</span>
hou / Xia Sha
</li>
</ul>
</div>
</div>
</div>
`;
exports[`Cascader should render not found content 1`] = `
<Popup
action={
@@ -1242,6 +1287,7 @@ exports[`Cascader should render not found content 1`] = `
Array [
Object {
"disabled": true,
"isEmptyNode": true,
"label": <Context.Consumer>
[Function]
</Context.Consumer>,
@@ -1569,6 +1615,7 @@ exports[`Cascader should show not found content when options.length is 0 1`] = `
Array [
Object {
"disabled": true,
"isEmptyNode": true,
"label": <Context.Consumer>
[Function]
</Context.Consumer>,

View File

@@ -205,6 +205,52 @@ describe('Cascader', () => {
expect(popupWrapper).toMatchSnapshot();
});
it('should highlight keyword and filter when search in Cascader with same field name of label and value', () => {
const customOptions = [
{
name: 'Zhejiang',
value: 'Zhejiang',
children: [
{
name: 'Hangzhou',
value: 'Hangzhou',
children: [
{
name: 'West Lake',
value: 'West Lake',
},
{
name: 'Xia Sha',
value: 'Xia Sha',
disabled: true,
},
],
},
],
},
];
function customFilter(inputValue, path) {
return path.some(option => option.name.toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
}
const wrapper = mount(
<Cascader
options={customOptions}
fieldNames={{ label: 'name', value: 'name' }}
showSearch={{ filter: customFilter }}
/>,
);
wrapper.find('input').simulate('click');
wrapper.find('input').simulate('change', { target: { value: 'z' } });
expect(wrapper.state('inputValue')).toBe('z');
const popupWrapper = mount(
wrapper
.find('Trigger')
.instance()
.getComponent(),
);
expect(popupWrapper.render()).toMatchSnapshot();
});
it('should render not found content', () => {
const wrapper = mount(<Cascader options={options} showSearch={{ filter }} />);
wrapper.find('input').simulate('click');

View File

@@ -397,17 +397,19 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
return {
__IS_FILTERED_OPTION: true,
path,
[names.label]: render(inputValue, path, prefixCls, names),
[names.value]: path.map((o: CascaderOptionType) => o[names.value]),
[names.label]: render(inputValue, path, prefixCls, names),
disabled: path.some((o: CascaderOptionType) => !!o.disabled),
isEmptyNode: true,
} as CascaderOptionType;
});
}
return [
{
[names.label]: notFoundContent || renderEmpty('Cascader'),
[names.value]: 'ANT_CASCADER_NOT_FOUND',
[names.label]: notFoundContent || renderEmpty('Cascader'),
disabled: true,
isEmptyNode: true,
},
];
}
@@ -503,9 +505,10 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
} else {
options = [
{
[names.label]: notFoundContent || renderEmpty('Cascader'),
[names.value]: 'ANT_CASCADER_NOT_FOUND',
[names.label]: notFoundContent || renderEmpty('Cascader'),
disabled: true,
isEmptyNode: true,
},
];
}
@@ -517,8 +520,7 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
}
const dropdownMenuColumnStyle: { width?: number; height?: string } = {};
const isNotFound =
(options || []).length === 1 && options[0][names.value] === 'ANT_CASCADER_NOT_FOUND';
const isNotFound = (options || []).length === 1 && options[0].isEmptyNode;
if (isNotFound) {
dropdownMenuColumnStyle.height = 'auto'; // Height of one row.
}

View File

@@ -102,7 +102,7 @@
}
&-borderless {
background-color: @component-background;
background-color: @collapse-header-bg;
border: 0;
}

View File

@@ -445,152 +445,152 @@ exports[`ConfigProvider components Badge configProvider 1`] = `
style="transition:none;-ms-transform:translateY(-1500%);-webkit-transform:translateY(-1500%);transform:translateY(-1500%)"
>
<p
class=""
class="config-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
4
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
5
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
9
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
4
</p>
<p
class="current"
class="config-scroll-number-only-unit current"
>
5
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
9
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
4
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
5
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="config-scroll-number-only-unit"
>
9
</p>
@@ -625,152 +625,152 @@ exports[`ConfigProvider components Badge normal 1`] = `
style="transition:none;-ms-transform:translateY(-1500%);-webkit-transform:translateY(-1500%);transform:translateY(-1500%)"
>
<p
class=""
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
5
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
9
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class="current"
class="ant-scroll-number-only-unit current"
>
5
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
9
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
5
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="ant-scroll-number-only-unit"
>
9
</p>
@@ -805,152 +805,152 @@ exports[`ConfigProvider components Badge prefixCls 1`] = `
style="transition:none;-ms-transform:translateY(-1500%);-webkit-transform:translateY(-1500%);transform:translateY(-1500%)"
>
<p
class=""
class="prefix-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
4
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
5
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
9
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
4
</p>
<p
class="current"
class="prefix-scroll-number-only-unit current"
>
5
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
9
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
0
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
1
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
2
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
3
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
4
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
5
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
6
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
7
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
8
</p>
<p
class=""
class="prefix-scroll-number-only-unit"
>
9
</p>
@@ -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

@@ -127,7 +127,7 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker, WeekPicke
| showTime | to provide an additional time selection | object\|boolean | [TimePicker Options](/components/time-picker/#API) | |
| showTime.defaultValue | to set default time of selected date, [demo](#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)\[] | \[moment(), moment()] | |
| value | to set date | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - | |
| onCalendarChange | a callback function, can be executed when the start time or the end time of the range is changing | function(dates: \[moment, moment], dateStrings: \[string, string]) | - | 3.10.9 |
| onCalendarChange | a callback function, can be executed when the start time or the end time of the range is changing | function(dates: \[moment, moment]) | - | 3.0.0 |
| onChange | a callback function, can be executed when the selected time is changing | function(dates: \[moment, moment], dateStrings: \[string, string]) | - | |
| onOk | callback when click ok button | function(dates: [moment](http://momentjs.com/)\[]) | - | |

View File

@@ -129,7 +129,7 @@ moment.locale('zh-cn');
| showTime | 增加时间选择功能 | Object\|boolean | [TimePicker Options](/components/time-picker/#API) | |
| showTime.defaultValue | 设置用户选择日期时默认的时分秒,[例子](#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)\[] | \[moment(), moment()] | |
| value | 日期 | [moment](http://momentjs.com/)\[] | 无 | |
| onCalendarChange | 待选日期发生变化的回调 | function(dates: \[moment, moment\], dateStrings: \[string, string\]) | 无 | |
| onCalendarChange | 待选日期发生变化的回调 | function(dates: \[moment, moment\]) | 无 | 3.0.0 |
| onChange | 日期范围发生变化的回调 | function(dates: \[moment, moment\], dateStrings: \[string, string\]) | 无 | |
| onOk | 点击确定按钮的回调 | function(dates: [moment](http://momentjs.com/)\[]) | - | |

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

@@ -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

@@ -262,11 +262,18 @@ form {
// fix input with addon position. https://github.com/ant-design/ant-design/issues/8243
:not(.@{ant-prefix}-input-group-wrapper) > .@{ant-prefix}-input-group,
.@{ant-prefix}-input-group-wrapper {
position: relative;
top: -1px;
display: inline-block;
vertical-align: middle;
}
// https://github.com/ant-design/ant-design/issues/20616
&:not(.@{form-prefix-cls}-vertical) {
:not(.@{ant-prefix}-input-group-wrapper) > .@{ant-prefix}-input-group,
.@{ant-prefix}-input-group-wrapper {
position: relative;
top: -1px;
}
}
}
// Form layout

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

@@ -17,7 +17,7 @@ export const InputSizes = tuple('small', 'default', 'large');
export interface InputProps
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> {
prefixCls?: string;
size?: (typeof InputSizes)[number];
size?: typeof InputSizes[number];
onPressEnter?: React.KeyboardEventHandler<HTMLInputElement>;
addonBefore?: React.ReactNode;
addonAfter?: React.ReactNode;
@@ -61,7 +61,7 @@ export function resolveOnChange(
export function getInputClassName(
prefixCls: string,
size?: (typeof InputSizes)[number],
size?: typeof InputSizes[number],
disabled?: boolean,
) {
return classNames(prefixCls, {
@@ -114,6 +114,8 @@ class Input extends React.Component<InputProps, InputState> {
clearableInput: ClearableLabeledInput;
removePasswordTimeout: number;
constructor(props: InputProps) {
super(props);
const value = typeof props.value === 'undefined' ? props.defaultValue : props.value;
@@ -131,6 +133,10 @@ class Input extends React.Component<InputProps, InputState> {
return null;
}
componentDidMount() {
this.clearPasswordValueAttribute();
}
// Since polyfill `getSnapshotBeforeUpdate` need work with `componentDidUpdate`.
// We keep an empty function here.
componentDidUpdate() {}
@@ -146,6 +152,12 @@ class Input extends React.Component<InputProps, InputState> {
return null;
}
componentWillUnmount() {
if (this.removePasswordTimeout) {
clearTimeout(this.removePasswordTimeout);
}
}
focus() {
this.input.focus();
}
@@ -209,8 +221,21 @@ class Input extends React.Component<InputProps, InputState> {
);
};
clearPasswordValueAttribute = () => {
// https://github.com/ant-design/ant-design/issues/20541
this.removePasswordTimeout = setTimeout(() => {
if (
this.input &&
this.input.getAttribute('type') === 'password' &&
this.input.hasAttribute('value')
) {
this.input.removeAttribute('value');
}
});
};
handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
this.setValue(e.target.value);
this.setValue(e.target.value, this.clearPasswordValueAttribute);
resolveOnChange(this.input, e, this.props.onChange);
};

View File

@@ -33,7 +33,7 @@ export default class Password extends React.Component<PasswordProps, PasswordSta
visible: false,
};
onChange = () => {
onVisibleChange = () => {
const { disabled } = this.props;
if (disabled) {
return;
@@ -46,7 +46,7 @@ export default class Password extends React.Component<PasswordProps, PasswordSta
const { prefixCls, action } = this.props;
const iconTrigger = ActionMap[action!] || '';
const iconProps = {
[iconTrigger]: this.onChange,
[iconTrigger]: this.onVisibleChange,
className: `${prefixCls}-icon`,
type: this.state.visible ? 'eye' : 'eye-invisible',
key: 'passwordIcon',

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

@@ -4,6 +4,7 @@ import { mount } from 'enzyme';
import Input from '..';
import focusTest from '../../../tests/shared/focusTest';
import mountTest from '../../../tests/shared/mountTest';
import { sleep } from '../../../tests/utils';
describe('Input.Password', () => {
focusTest(Input.Password);
@@ -48,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')
@@ -70,4 +73,46 @@ describe('Input.Password', () => {
.getDOMNode(),
);
});
// https://github.com/ant-design/ant-design/issues/20541
it('should not show value attribute in input element', async () => {
const wrapper = mount(<Input.Password />);
wrapper
.find('input')
.at('0')
.simulate('change', { target: { value: 'value' } });
await sleep();
expect(
wrapper
.find('input')
.at('0')
.getDOMNode()
.getAttribute('value'),
).toBeFalsy();
});
// https://github.com/ant-design/ant-design/issues/20541
it('could be unmount without errors', () => {
expect(() => {
const wrapper = mount(<Input.Password />);
wrapper
.find('input')
.at('0')
.simulate('change', { target: { value: 'value' } });
wrapper.unmount();
}).not.toThrow();
});
// https://github.com/ant-design/ant-design/pull/20544#issuecomment-569861679
it('should not contain value attribute in input element with defautValue', async () => {
const wrapper = mount(<Input.Password defaultValue="value" />);
await sleep();
expect(
wrapper
.find('input')
.at('0')
.getDOMNode()
.getAttribute('value'),
).toBeFalsy();
});
});

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

@@ -35,7 +35,7 @@ function formatNumber(value) {
class NumericInput extends React.Component {
onChange = e => {
const { value } = e.target;
const reg = /^-?(0|[1-9][0-9]*)(\.[0-9]*)?$/;
const reg = /^-?[0-9]*(\.[0-9]*)?$/;
if ((!isNaN(value) && reg.test(value)) || value === '' || value === '-') {
this.props.onChange(value);
}
@@ -44,9 +44,11 @@ class NumericInput extends React.Component {
// '.' at the end or only '-' in the input box.
onBlur = () => {
const { value, onBlur, onChange } = this.props;
let valueTemp = value;
if (value.charAt(value.length - 1) === '.' || value === '-') {
onChange(value.slice(0, -1));
valueTemp = value.slice(0, -1);
}
onChange(valueTemp.replace(/0*(\d+)/, '$1'));
if (onBlur) {
onBlur();
}

View File

@@ -7,6 +7,7 @@ import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
export interface GeneratorProps {
suffixCls: string;
tagName: 'header' | 'footer' | 'main' | 'section';
displayName: string;
}
export interface BasicProps extends React.HTMLAttributes<HTMLDivElement> {
prefixCls?: string;
@@ -30,9 +31,11 @@ interface BasicPropsWithTagName extends BasicProps {
tagName: 'header' | 'footer' | 'main' | 'section';
}
function generator({ suffixCls, tagName }: GeneratorProps) {
function generator({ suffixCls, tagName, displayName }: GeneratorProps) {
return (BasicComponent: any) => {
return class Adapter extends React.Component<BasicProps, any> {
static displayName: string = displayName;
static Header: any;
static Footer: any;
@@ -108,21 +111,25 @@ const Layout: React.ComponentClass<BasicProps> & {
} = generator({
suffixCls: 'layout',
tagName: 'section',
displayName: 'Layout',
})(BasicLayout);
const Header = generator({
suffixCls: 'layout-header',
tagName: 'header',
displayName: 'Header',
})(Basic);
const Footer = generator({
suffixCls: 'layout-footer',
tagName: 'footer',
displayName: 'Footer',
})(Basic);
const Content = generator({
suffixCls: 'layout-content',
tagName: 'main',
displayName: 'Content',
})(Basic);
Layout.Header = Header;

View File

@@ -72,7 +72,7 @@ export default class Item extends React.Component<ListItemProps, any> {
context: any;
isItemContainsTextNode() {
isItemContainsTextNodeAndNotSingular() {
const { children } = this.props;
let result;
React.Children.forEach(children, (element: React.ReactElement<any>) => {
@@ -80,7 +80,7 @@ export default class Item extends React.Component<ListItemProps, any> {
result = true;
}
});
return result;
return result && React.Children.count(children) > 1;
}
isFlexMode() {
@@ -89,7 +89,7 @@ export default class Item extends React.Component<ListItemProps, any> {
if (itemLayout === 'vertical') {
return !!extra;
}
return !this.isItemContainsTextNode();
return !this.isItemContainsTextNodeAndNotSingular();
}
renderItem = ({ getPrefixCls }: ConfigConsumerProps) => {

View File

@@ -763,27 +763,27 @@ exports[`renders ./components/list/demo/simple.md correctly 1`] = `
class="ant-list-items"
>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Racing car sprays burning fuel into crowd.
</li>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Japanese princess to wed commoner.
</li>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Australian walks 100km after outback crash.
</li>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Man charged over missing wedding girl.
</li>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Los Angeles battles huge wildfires.
</li>
@@ -823,27 +823,27 @@ exports[`renders ./components/list/demo/simple.md correctly 1`] = `
class="ant-list-items"
>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Racing car sprays burning fuel into crowd.
</li>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Japanese princess to wed commoner.
</li>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Australian walks 100km after outback crash.
</li>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Man charged over missing wedding girl.
</li>
<li
class="ant-list-item ant-list-item-no-flex"
class="ant-list-item"
>
Los Angeles battles huge wildfires.
</li>

View File

@@ -52,6 +52,7 @@
&-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: @list-item-padding;
&-content {

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

@@ -189,4 +189,8 @@ describe('message', () => {
jest.advanceTimersByTime(1500);
expect(document.querySelectorAll('.ant-message-notice').length).toBe(0);
});
it('should not throw error when pass null', () => {
message.error(null);
});
});

View File

@@ -114,7 +114,10 @@ type JointContent = ConfigContent | ArgsProps;
export type ConfigOnClose = () => void;
function isArgsProps(content: JointContent): content is ArgsProps {
return typeof content === 'object' && !!(content as ArgsProps).content;
return (
Object.prototype.toString.call(content) === '[object Object]' &&
!!(content as ArgsProps).content
);
}
export interface ConfigOptions {

View File

@@ -1,14 +1,14 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import Button from '../button';
import { ButtonType, NativeButtonProps } from '../button/button';
import { ButtonType, ButtonProps } from '../button/button';
export interface ActionButtonProps {
type?: ButtonType;
actionFn?: (...args: any[]) => any | PromiseLike<any>;
closeModal: Function;
autoFocus?: boolean;
buttonProps?: NativeButtonProps;
buttonProps?: ButtonProps;
}
export interface ActionButtonState {

View File

@@ -6,7 +6,7 @@ import addEventListener from 'rc-util/lib/Dom/addEventListener';
import { getConfirmLocale } from './locale';
import Icon from '../icon';
import Button from '../button';
import { ButtonType, NativeButtonProps } from '../button/button';
import { ButtonType, ButtonProps } from '../button/button';
import LocaleReceiver from '../locale-provider/LocaleReceiver';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
@@ -60,8 +60,8 @@ export interface ModalProps {
maskClosable?: boolean;
/** 强制渲染 Modal */
forceRender?: boolean;
okButtonProps?: NativeButtonProps;
cancelButtonProps?: NativeButtonProps;
okButtonProps?: ButtonProps;
cancelButtonProps?: ButtonProps;
destroyOnClose?: boolean;
style?: React.CSSProperties;
wrapClassName?: string;
@@ -90,11 +90,10 @@ export interface ModalFuncProps {
// TODO: find out exact types
onOk?: (...args: any[]) => any;
onCancel?: (...args: any[]) => any;
okButtonProps?: NativeButtonProps;
cancelButtonProps?: NativeButtonProps;
okButtonProps?: ButtonProps;
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

@@ -64,7 +64,7 @@ The items listed above are all functions, expecting a settings object as paramet
| centered | Centered Modal | Boolean | `false` | 3.8.0 |
| className | className of container | string | - | 3.1.1 |
| content | Content | string\|ReactNode | - | |
| icon | custom icon (`Added in 3.12.0`) | string\|ReactNode | `<Icon type="question-circle">` | 3.12.0 |
| icon | custom icon (`Added in 3.12.0`) | string\|ReactNode | `<Icon type="question-circle" />` | 3.12.0 |
| iconType | Icon `type` of the Icon component (deprecated after `3.12.0`) | string | `question-circle` | |
| keyboard | Whether support press esc to close | Boolean | true | 3.4.2 |
| mask | Whether show mask or not. | Boolean | true | 3.13.0 |

View File

@@ -68,7 +68,7 @@ title: Modal
| centered | 垂直居中展示 Modal | Boolean | `false` | 3.8.2 |
| className | 容器类名 | string | - | 3.1.1 |
| content | 内容 | string\|ReactNode | 无 | |
| icon | 自定义图标3.12.0 新增) | string\|ReactNode | `<Icon type="question-circle">` | 3.12.0 |
| icon | 自定义图标3.12.0 新增) | string\|ReactNode | `<Icon type="question-circle" />` | 3.12.0 |
| iconType | 图标类型3.12.0 后废弃,请使用 `icon` | string | `question-circle` | |
| mask | 是否展示遮罩 | Boolean | true | 3.13.0 |
| maskClosable | 点击蒙层是否允许关闭 | Boolean | `false` | |

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

@@ -11,7 +11,6 @@
.reset-component;
display: inline-block;
line-height: unset;
}
// 一般状态

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: 40px;
margin-left: 46px;
}
}
}

View File

@@ -89,3 +89,36 @@
width: 100%;
}
}
@media (max-width: @screen-xs) {
.@{steps-prefix-cls}-navigation {
> .@{steps-prefix-cls}-item {
margin-right: 0 !important;
&::before {
display: none;
}
&.@{steps-prefix-cls}-item-active::before {
top: 0;
right: 0;
left: unset;
display: block;
width: 3px;
height: calc(100% - 24px);
}
&::after {
position: relative;
top: -2px;
left: 50%;
display: block;
width: 8px;
height: 8px;
margin-bottom: 8px;
text-align: center;
transform: rotate(135deg);
}
> .@{steps-prefix-cls}-item-container > .@{steps-prefix-cls}-item-tail {
visibility: hidden;
}
}
}
}

View File

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

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

@@ -16,7 +16,7 @@ By using custom components, we can integrate table with react-dnd to implement d
```jsx
import { Table } from 'antd';
import { DndProvider, DragSource, DropTarget } from 'react-dnd';
import HTML5Backend from 'react-dnd-html5-backend';
import { HTML5Backend } from 'react-dnd-html5-backend';
import update from 'immutability-helper';
let dragingIndex = -1;

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;
}
@@ -623,7 +621,10 @@
// https://github.com/ant-design/ant-design/issues/14545
// https://github.com/ant-design/ant-design/issues/19491
.@{table-prefix-cls}-fixed-columns-in-body:not([colspan]) {
visibility: hidden;
color: transparent;
& > * {
visibility: hidden;
}
}
}
}
@@ -721,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;
}
}
@@ -739,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

@@ -16,7 +16,7 @@ Use `react-dnd` to make tabs draggable.
```jsx
import { Tabs } from 'antd';
import { DndProvider, DragSource, DropTarget } from 'react-dnd';
import HTML5Backend from 'react-dnd-html5-backend';
import { HTML5Backend } from 'react-dnd-html5-backend';
const { TabPane } = Tabs;

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

@@ -442,11 +442,11 @@ exports[`renders ./components/tag/demo/controlled.md correctly 1`] = `
exports[`renders ./components/tag/demo/hot-tags.md correctly 1`] = `
<div>
<h6
style="margin-right:8px;display:inline"
<span
style="margin-right:8px"
>
Categories:
</h6>
</span>
<span
class="ant-tag ant-tag-checkable"
>

View File

@@ -36,7 +36,7 @@ class HotTags extends React.Component {
const { selectedTags } = this.state;
return (
<div>
<h6 style={{ marginRight: 8, display: 'inline' }}>Categories:</h6>
<span style={{ marginRight: 8 }}>Categories:</span>
{tagsFromServer.map(tag => (
<CheckableTag
key={tag}

View File

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

View File

@@ -13,6 +13,7 @@ export interface TimelineProps {
style?: React.CSSProperties;
reverse?: boolean;
mode?: 'left' | 'alternate' | 'right';
children?: React.ReactNode;
}
export default class Timeline extends React.Component<TimelineProps, any> {

View File

@@ -11,6 +11,7 @@ export interface TimeLineItemProps {
pending?: boolean;
position?: string;
style?: React.CSSProperties;
children?: React.ReactNode;
}
const TimelineItem: React.SFC<TimeLineItemProps> = props => (

View File

@@ -241,4 +241,14 @@ describe('Tooltip', () => {
expect(onVisibleChange).toHaveBeenCalledWith(false);
expect(wrapper.instance().tooltip.props.visible).toBe(false);
});
// https://github.com/ant-design/ant-design/issues/20891
it('should display zero', async () => {
const wrapper = mount(
<Tooltip title={0} visible>
<div />
</Tooltip>,
);
expect(wrapper.find('.ant-tooltip-inner').getDOMNode().innerHTML).toBe('0');
});
});

View File

@@ -226,7 +226,15 @@ class Tooltip extends React.Component<TooltipProps, any> {
isNoTitle() {
const { title, overlay } = this.props;
return !title && !overlay; // overlay for old version compatibility
return !title && !overlay && title !== 0; // overlay for old version compatibility
}
getOverlay() {
const { title, overlay } = this.props;
if (title === 0) {
return title;
}
return overlay || title || '';
}
renderTooltip = ({
@@ -236,8 +244,6 @@ class Tooltip extends React.Component<TooltipProps, any> {
const { props, state } = this;
const {
prefixCls: customizePrefixCls,
title,
overlay,
openClassName,
getPopupContainer,
getTooltipContainer,
@@ -266,7 +272,7 @@ class Tooltip extends React.Component<TooltipProps, any> {
getTooltipContainer={getPopupContainer || getTooltipContainer || getContextPopupContainer}
ref={this.saveTooltip}
builtinPlacements={this.getPlacements()}
overlay={overlay || title || ''}
overlay={this.getOverlay()}
visible={visible}
onVisibleChange={this.onVisibleChange}
onPopupAlign={this.onPopupAlign}

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;
}
@@ -70,7 +70,7 @@ export interface AntTreeNodeExpandedEvent extends AntTreeNodeBaseEvent {
export interface AntTreeNodeMouseEvent {
node: AntTreeNode;
event: React.MouseEvent<HTMLElement>;
event: React.DragEvent<HTMLElement>;
}
export interface AntTreeNodeDragEnterEvent extends AntTreeNodeMouseEvent {
@@ -194,15 +194,15 @@ export default class Tree extends React.Component<TreeProps, any> {
if (loading) {
return <Icon type="loading" className={`${prefixCls}-switcher-loading-icon`} />;
}
if (isLeaf) {
return showLine ? <Icon type="file" className={`${prefixCls}-switcher-line-icon`} /> : null;
}
const switcherCls = `${prefixCls}-switcher-icon`;
if (switcherIcon) {
return React.cloneElement(switcherIcon, {
className: classNames(switcherIcon.props.className || '', switcherCls),
});
}
if (isLeaf) {
return showLine ? <Icon type="file" className={`${prefixCls}-switcher-line-icon`} /> : null;
}
return showLine ? (
<Icon
type={expanded ? 'minus-square' : 'plus-square'}

View File

@@ -725,27 +725,7 @@ exports[`renders ./components/tree/demo/customized-icon.md correctly 1`] = `
>
<span
class="ant-tree-switcher ant-tree-switcher-noop"
>
<i
aria-label="icon: down"
class="anticon anticon-down ant-tree-switcher-icon"
>
<svg
aria-hidden="true"
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
/>
</svg>
</i>
</span>
/>
<span
class="ant-tree-node-content-wrapper ant-tree-node-content-wrapper-normal ant-tree-node-selected"
title="leaf"
@@ -786,27 +766,7 @@ exports[`renders ./components/tree/demo/customized-icon.md correctly 1`] = `
>
<span
class="ant-tree-switcher ant-tree-switcher-noop"
>
<i
aria-label="icon: down"
class="anticon anticon-down ant-tree-switcher-icon"
>
<svg
aria-hidden="true"
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
/>
</svg>
</i>
</span>
/>
<span
class="ant-tree-node-content-wrapper ant-tree-node-content-wrapper-normal"
title="leaf"
@@ -2249,13 +2209,13 @@ exports[`renders ./components/tree/demo/switcher-icon.md correctly 1`] = `
class="ant-tree-switcher ant-tree-switcher-noop"
>
<i
aria-label="icon: down"
class="anticon anticon-down ant-tree-switcher-icon"
aria-label="icon: file"
class="anticon anticon-file ant-tree-switcher-line-icon"
>
<svg
aria-hidden="true"
class=""
data-icon="down"
data-icon="file"
fill="currentColor"
focusable="false"
height="1em"
@@ -2263,7 +2223,7 @@ exports[`renders ./components/tree/demo/switcher-icon.md correctly 1`] = `
width="1em"
>
<path
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
d="M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z"
/>
</svg>
</i>
@@ -2287,13 +2247,13 @@ exports[`renders ./components/tree/demo/switcher-icon.md correctly 1`] = `
class="ant-tree-switcher ant-tree-switcher-noop"
>
<i
aria-label="icon: down"
class="anticon anticon-down ant-tree-switcher-icon"
aria-label="icon: file"
class="anticon anticon-file ant-tree-switcher-line-icon"
>
<svg
aria-hidden="true"
class=""
data-icon="down"
data-icon="file"
fill="currentColor"
focusable="false"
height="1em"
@@ -2301,7 +2261,7 @@ exports[`renders ./components/tree/demo/switcher-icon.md correctly 1`] = `
width="1em"
>
<path
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
d="M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z"
/>
</svg>
</i>
@@ -2325,13 +2285,13 @@ exports[`renders ./components/tree/demo/switcher-icon.md correctly 1`] = `
class="ant-tree-switcher ant-tree-switcher-noop"
>
<i
aria-label="icon: down"
class="anticon anticon-down ant-tree-switcher-icon"
aria-label="icon: file"
class="anticon anticon-file ant-tree-switcher-line-icon"
>
<svg
aria-hidden="true"
class=""
data-icon="down"
data-icon="file"
fill="currentColor"
focusable="false"
height="1em"
@@ -2339,7 +2299,7 @@ exports[`renders ./components/tree/demo/switcher-icon.md correctly 1`] = `
width="1em"
>
<path
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
d="M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z"
/>
</svg>
</i>

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