Compare commits

...

115 Commits

Author SHA1 Message Date
竹雨 272ac40bba
📃 docs: 补充文档 (#41268) 2 years ago
qingmao 42d03877c1
site: replace version 4.0 address (#40799) 2 years ago
zombiej 08d1954ff7 chore: Clean up unused actions 4 years ago
偏右 58cc8d1038
Update Demo.jsx 4 years ago
Kai 1c5ad1469c
Fix: incorrect default value of `hoverable` in changelog v.3.x (#27483) 4 years ago
二货机器人 bc0f0b62ea
chore: resolutions fixed typescript version (#27407) 4 years ago
afc163 b5d3a90b96 docs: release 3.26.19 4 years ago
Van Nguyen 818470289f
fix: package.json import for webpack@5 compatibility (#27314) 4 years ago
Amumu 0a1ba7c6ca
fix: snap (#27342) 4 years ago
xrkffgg 34ba35eb80
docs: update gitee (#25699) 4 years ago
njzy e13bb39c1d
docs: fix the wrong way to import react-dnd-html5-backend (#25151) 4 years ago
afc163 bf4b72a76a fix snapshot 4 years ago
07akioni 9838fc5843
docs: changelog 3.26.18 (#24982) 5 years ago
Amumu b30ebb78b9
feat: add ga_IE locale (#24849) 5 years ago
zoomdong 37e9c6b111
fix: paramter type error (#24429) 5 years ago
Amumu 8e00e59f56
updater antd-tools (#24756) 5 years ago
Amumu 285068c533
snap (#24731) 5 years ago
偏右 8256b3cb89
🚀 release 3.26.17 (#24204) 5 years ago
Amumu 9504f5b418
fix: fix loading Button in Badge style (#23691) 5 years ago
偏右 88d3f34e57 fix: Upload.Dragger triggered by label when disabled (#24202) 5 years ago
Amumu 97f4bab57f
fix: tabs_animation_bug (#23151) (#24167) 5 years ago
Amumu fa899ff64f
Fix form input shaking (#23924) 5 years ago
afc163 30c702b34b fix snapshot 5 years ago
偏右 0b00640ab4
test: fix 3.x snapshot (#23852) 5 years ago
zombiej 44d344844c chore: Rollback of test 5 years ago
zombiej aa971b6459 chore: Clean up 5 years ago
zombiej 29b98ea63a test: Fix focus test 5 years ago
zombiej d3e6fd8090 test: Fix test case 5 years ago
zombiej 79821db32d chore: Update jest version 5 years ago
tangjinzhou 5eee566fff
fix: ant-table-thead to @{table-prefix-cls}-thead (#23771) 5 years ago
诸岳 90da05750c chore(test): Update snapshots 5 years ago
诸岳 e2b9e40d9d
docs: Add changelog of 3.26.16 (#23608) 5 years ago
偏右 226bce705a
Update README.md 5 years ago
偏右 df2425652c
test: fix ci error (#23382) 5 years ago
afc163 4751d109e3 🐛 Fix Carousel tabindex in non-active slide 5 years ago
xrkffgg 2c8107c8bd
site: Add 4.x url (#23130) 5 years ago
偏右 56870dd7b3
🐛 Fix Table filter menu have no height (#23272) 5 years ago
偏右 e94133a20b
docs: update 3.x codesandbox example (#23101) 5 years ago
zombiej 50f1605acc docs: Fix changelog lang of 3.26.14 5 years ago
zombiej 96f22840d9 chore: Lock v3 npm tag 5 years ago
zombiej 6f78142360 chore: Remove deploy & auto deploy script 5 years ago
信鑫-King b30832cda1
docs: 3.26.15 changelog (#22899) 5 years ago
Rustin c23ea0c5e6
Revert "fix: set codesandbox referrer to no-referrer (#22792)" (#22797) 5 years ago
偏右 0c1f181957 fix: 🐛 Affix state update on unmounted component (#22790) 5 years ago
Rustin 44d74415bc
fix: set codesandbox referrer to no-referrer (#22792) 5 years ago
偏右 1c302163af
🐛 fix Table column.filtered not working (#22597) 5 years ago
Kim, Harim 4d0ac007ed
fix: multiple select search input doesn't show normally on Safari (#22586) 5 years ago
二货机器人 282c792224
docs: 3.26.14 changelog (#22518) 5 years ago
Chiciuc Nicușor ba2ef53089
fix: Make events non-optional for Popconfirm (#22438) 5 years ago
偏右 0792ac8762
test: fix 3.x test case (#22447) 5 years ago
偏右 aabf60586d fix: Descriptions should be able to fit width (#22407) 5 years ago
偏右 f52003261f 🐛 Fix TextArea[autoSize] don't scroll bottom in Firefox (#22014) 5 years ago
afc163 b0146a20cb cherry pick #21703 5 years ago
zombiej 68b948b088 docs: Update demo link 5 years ago
偏右 bece43062b
docs: ❇️ release 3.26.13 (#21967) 5 years ago
偏右 2e8205b01b
fix(module:badge): fix toggling animation (#21887) 5 years ago
zhangj b81e3e9af0
fix: Date Picker disabled style (#21655) 5 years ago
偏右 045059f604 test: fix packtracker token (#21805) 5 years ago
偏右 a473770836 🔷 Fix Result status type to string & number (#21691) 5 years ago
Felipe Lima 92b7902f4b
fix: Grid rows overlapping when using vertical gutter (#21518) 5 years ago
zombiej 9ee1a903a3 docs: lock riddle & codepen antd version 5 years ago
afc163 5e7a31d71f docs: update demo links 5 years ago
偏右 27c9c086b6 🐛 Table filter menu should have max-height (#21602) 5 years ago
偏右 046f394c88
docs: fix wrong link 5 years ago
信鑫-King 2ae5efa29f
release: 3.26.12 (#21547) 5 years ago
Rick Zhou e85ec40c9a avoid reading innerText (#21217) 5 years ago
Amumu bb335bcc78
uniq (#21522) 5 years ago
偏右 26dd6f70af
💄 tweak Upload showDownloadIcon default value (#21496) 5 years ago
zhangj 91a5947ef2
docs: 📝 Added expandIconColumnIndex property description of Table. (#21495) 5 years ago
二货机器人 be19e4e65f
fix: Input with readOnly should not clearable (#21492) 5 years ago
二货机器人 ef7bb3763e
docs: 3.26.11 changelog (#21405) 5 years ago
二货机器人 ac740d74fb
fix: Revert patch of row fix (#21406) 5 years ago
zombiej e35663065c fix: ant-row with flex 5 years ago
chenshuai2144 4c52401fd1 Bump 3.26.9 5 years ago
陈帅 7c96796872
docs: add 3.26.10 changelog (#21393) 5 years ago
偏右 ac63d26f88
Revert "fix: Minor fix on ValidationRule to match AsyncValidator (#21250)" (#21391) 5 years ago
afc163 b22ef2280c fix Badge test in React 15 5 years ago
偏右 831f0fcb5e
chore: remove unused iconClassName from definition (#21378) 5 years ago
偏右 4db7cbcf43 🐛 Fix Affix throws Cannot read property getBoundingClientRect (#21350) 5 years ago
偏右 dd16a24426 🐛 fix Badge color not working when contains children (#21333) 5 years ago
偏右 f692e7ee34 🐛 fix Alert button extra padding in Firefox (#21325) 5 years ago
偏右 fd553c9ba0 🎬 improve dropdown demos in mobile (#21312) 5 years ago
偏右 1b23971fd6 💄 tweak steps 1px align (#21306) 5 years ago
二货机器人 04ef6a8bce fix: Clear fix missing width (#21310) 5 years ago
诸岳 703a4b1011 docs(changelog): Add missing version 5 years ago
诸岳 a1c733ad07 Bump 3.26.9 5 years ago
诸岳 9918140695 docs: Add the changelog of 3.26.9 (#21289) 5 years ago
Chiciuc Nicușor 87cbe0168f
Explicitly add children prop to Timeline. (#21265) 5 years ago
偏右 eea0b028c9 🐛 Typography editable should focus at the end (#21268) 5 years ago
偏右 88bed67368 🐛 Fix Steps style when size="small" and labelPlacement="vertical" (#21258) 5 years ago
Han f7e7ce9d4f
fix: Minor fix on ValidationRule to match AsyncValidator (#21250) 5 years ago
二货机器人 ae7666f8fa
fix badge (#21237) 5 years ago
Jirka-Lhotka 3fb7325a21
Fix wrong event type of AntTreeNodeMouseEvent (#21200) 5 years ago
偏右 59c29a400d
release 3.26.8 (#21187) 5 years ago
偏右 d3102bb2db
🐛 fix site menu affix bug (#21188) 5 years ago
afc163 e036e4c9a3 site: 📣 promote g2plot 5 years ago
Chiciuc Nicușor da3540bd59
Replace NativeButtonProps with ButtonProps for okButtonProps and cancelButtonProps. (#21165) 5 years ago
Teng YANG bba87d4125 update display names for layout components (#21124) 5 years ago
Teng YANG 6de8522894 fix: card actions font-size issue (#21106) 5 years ago
信鑫-King 674074ce93 fix: 3.x deploy site (#20682) 5 years ago
Amumu c68f4463d3 fix error docs (#20926) 5 years ago
偏右 a96a95ccb8
🐛 Fix List item flex layout (#20897) 5 years ago
偏右 b112378de3
🐛 Fix Tooltip title 0 is not shown (#20894) 5 years ago
Amumu db4bec92be version 3.23.0 (#20890) 5 years ago
信鑫-King b6fc0168db
chore: check commit (#20880) 5 years ago
信鑫-King 92fe411961
docs: 3.26.7 changelog (#20873) 5 years ago
zefeng ab29ecb377 fix: better approach to solve not show overflow content when in elastic (#20821) 5 years ago
afc163 23d5a856c0 🎬 improve Tag demo 5 years ago
偏右 6e4fa95d0f
🐛 fix Tree switcherIcon shown in leaf node (#20753) 5 years ago
afc163 2753ce91c9 🐛 tweak @zindex-badge for table fixed column 5 years ago
偏右 057f5b8526 🐛 Fix Cascader search bug when fieldNames existed (#20720) 5 years ago
Amumu d3eea22097 fix: correct the collapse-borderless class variable (#20718) (#20721) 5 years ago
骗你是小猫咪 da2f54a18a refactor: improve digital input in tooltip demo (#20702) (#20717) 5 years ago
afc163 e5dd231aaa site: 📣 promote yuque activity 5 years ago
偏右 c6eafe8380
🐛 fix Input.Group 1px bug in vertical layout form (#20685) 5 years ago
  1. 1
      .antd-tools.config.js
  2. 30
      .github/workflows/deploy-site.yml
  3. 19
      .github/workflows/lighthouse-ci.yml
  4. 14
      .github/workflows/rebase.yml
  5. 208
      .github/workflows/test.yml
  6. 124
      CHANGELOG.en-US.md
  7. 124
      CHANGELOG.zh-CN.md
  8. 2
      README.md
  9. 69
      azure-pipelines.yml
  10. 4
      components/affix/index.tsx
  11. 1
      components/alert/style/index.less
  12. 8
      components/auto-complete/__tests__/focus.test.js
  13. 60
      components/avatar/__tests__/__snapshots__/demo.test.js.snap
  14. 46
      components/badge/ScrollNumber.tsx
  15. 540
      components/badge/__tests__/__snapshots__/demo.test.js.snap
  16. 876
      components/badge/__tests__/__snapshots__/index.test.js.snap
  17. 19
      components/badge/__tests__/index.test.js
  18. 13
      components/badge/index.tsx
  19. 5
      components/badge/style/index.less
  20. 2
      components/button/button.tsx
  21. 3
      components/calendar/locale/ga_IE.tsx
  22. 2
      components/card/index.en-US.md
  23. 2
      components/card/index.zh-CN.md
  24. 2
      components/card/style/index.less
  25. 11
      components/carousel/style/index.less
  26. 47
      components/cascader/__tests__/__snapshots__/index.test.js.snap
  27. 46
      components/cascader/__tests__/index.test.js
  28. 12
      components/cascader/index.tsx
  29. 2
      components/collapse/style/index.less
  30. 273
      components/config-provider/__tests__/__snapshots__/components.test.js.snap
  31. 24
      components/date-picker/__tests__/focus.test.js
  32. 4
      components/date-picker/__tests__/showTime.test.js
  33. 2
      components/date-picker/index.en-US.md
  34. 2
      components/date-picker/index.zh-CN.md
  35. 19
      components/date-picker/locale/ga_IE.tsx
  36. 4
      components/date-picker/style/Picker.less
  37. 1
      components/descriptions/style/index.less
  38. 7
      components/dropdown/__tests__/__snapshots__/demo.test.js.snap
  39. 2
      components/dropdown/demo/basic.md
  40. 2
      components/dropdown/demo/event.md
  41. 2
      components/dropdown/demo/item.md
  42. 2
      components/dropdown/demo/menu-full.md
  43. 2
      components/dropdown/demo/overlay-visible.md
  44. 2
      components/dropdown/demo/sub-menu.md
  45. 2
      components/dropdown/demo/trigger.md
  46. 2
      components/form/FormItem.tsx
  47. 158
      components/form/__tests__/__snapshots__/index.test.js.snap
  48. 32
      components/form/__tests__/index.test.js
  49. 5
      components/form/__tests__/label.test.js
  50. 11
      components/form/style/index.less
  51. 4
      components/grid/style/index.less
  52. 16
      components/input/ClearableLabeledInput.tsx
  53. 18
      components/input/ResizableTextArea.tsx
  54. 4
      components/input/__tests__/Password.test.js
  55. 17
      components/input/__tests__/index.test.js
  56. 6
      components/input/demo/tooltip.md
  57. 9
      components/layout/layout.tsx
  58. 6
      components/list/Item.tsx
  59. 20
      components/list/__tests__/__snapshots__/demo.test.js.snap
  60. 1
      components/list/style/index.less
  61. 16267
      components/locale-provider/__tests__/__snapshots__/index.test.js.snap
  62. 2
      components/locale-provider/__tests__/index.test.js
  63. 3
      components/locale-provider/ga_IE.tsx
  64. 43
      components/locale/ga_IE.tsx
  65. 4
      components/modal/ActionButton.tsx
  66. 11
      components/modal/Modal.tsx
  67. 12
      components/modal/__tests__/__snapshots__/Modal.test.js.snap
  68. 21
      components/modal/index.en-US.md
  69. 21
      components/modal/index.zh-CN.md
  70. 4
      components/popconfirm/index.tsx
  71. 20
      components/progress/__tests__/__snapshots__/demo.test.js.snap
  72. 1
      components/progress/__tests__/__snapshots__/index.test.js.snap
  73. 23
      components/result/__tests__/type.test.tsx
  74. 4
      components/result/index.tsx
  75. 2
      components/select/index.en-US.md
  76. 2
      components/select/index.zh-CN.md
  77. 3
      components/select/style/index.less
  78. 2
      components/steps/style/label-placement.less
  79. 4
      components/style/themes/default.less
  80. 4
      components/table/__tests__/__snapshots__/demo.test.js.snap
  81. 2
      components/table/demo/drag-sorting.md
  82. 2
      components/table/filterDropdown.tsx
  83. 1
      components/table/index.en-US.md
  84. 1
      components/table/index.zh-CN.md
  85. 1
      components/table/interface.tsx
  86. 21
      components/table/style/index.less
  87. 2
      components/tabs/demo/custom-tab-bar-node.md
  88. 2
      components/tabs/style/index.less
  89. 6
      components/tag/__tests__/__snapshots__/demo.test.js.snap
  90. 2
      components/tag/demo/hot-tags.md
  91. 5
      components/time-picker/locale/ga_IE.tsx
  92. 1
      components/timeline/Timeline.tsx
  93. 1
      components/timeline/TimelineItem.tsx
  94. 10
      components/tooltip/__tests__/tooltip.test.js
  95. 14
      components/tooltip/index.tsx
  96. 2
      components/tree-select/__tests__/index.test.js
  97. 10
      components/tree/Tree.tsx
  98. 68
      components/tree/__tests__/__snapshots__/demo.test.js.snap
  99. 12
      components/tree/__tests__/index.test.js
  100. 13
      components/tree/__tests__/type.test.tsx

1
.antd-tools.config.js

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

30
.github/workflows/deploy-site.yml

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

19
.github/workflows/lighthouse-ci.yml

@ -1,19 +0,0 @@
name: Lighthouse
on: push
jobs:
lighthouse:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Audit URLs using Lighthouse
uses: treosh/lighthouse-ci-action@v2
with:
urls: |
https://ant.design
https://ant.design/docs/react/introduce-cn
https://ant.design/components/button-cn
- name: Save results
uses: actions/upload-artifact@v1
with:
name: lighthouse-results
path: '.lighthouseci' # This will save the Lighthouse results as .json files

14
.github/workflows/rebase.yml

@ -1,14 +0,0 @@
on:
issue_comment:
types: [created]
name: Automatic Rebase
jobs:
rebase:
name: Rebase
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Automatic Rebase
uses: cirrus-actions/rebase@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

208
.github/workflows/test.yml

@ -1,208 +0,0 @@
name: test
on: [push]
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: cache package-lock.json
uses: actions/cache@v1
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: create package-lock.json
run: npm i --package-lock-only
- name: hack for singe file
run: |
if [ ! -d "package-temp-dir" ]; then
mkdir package-temp-dir
fi
cp package-lock.json package-temp-dir
- name: cache node_modules
id: node_modules_cache_id
uses: actions/cache@v1
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: install
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
run: npm ci
compile:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v1
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v1
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: cache lib
uses: actions/cache@v1
with:
path: lib
key: lib-${{ github.sha }}
- name: cache es
uses: actions/cache@v1
with:
path: es
key: es-${{ github.sha }}
- name: compile
run: npm run compile
- name: check
run: node ./tests/dekko/lib.test.js
needs: setup
dist:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v1
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v1
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: dist
run: npm run dist
- name: check
run: node ./tests/dekko/dist.test.js
- name: test
run: npm test
env:
LIB_DIR: dist
needs: setup
lint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v1
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v1
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: lint
run: npm run lint
needs: setup
node:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v1
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v1
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: test
run: npm test
needs: setup
lib:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v1
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v1
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: restore cache from lib
uses: actions/cache@v1
with:
path: lib
key: lib-${{ github.sha }}
- name: test
run: npm test
env:
LIB_DIR: lib
needs: compile
es:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v1
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v1
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: restore cache from es
uses: actions/cache@v1
with:
path: es
key: es-${{ github.sha }}
- name: test
run: npm test
env:
LIB_DIR: es
needs: compile

124
CHANGELOG.en-US.md

@ -15,6 +15,128 @@ timeline: true
---
## 3.26.20
`2020-10-27`
- 🐞 Fix Typescript definition issue with related Typescript version.
## 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`
@ -2474,7 +2596,7 @@ Learn more in the [Ant Design 3.0 announcement post](https://medium.com/ant-desi
We provide a [migration tool](https://github.com/ant-design/antd-migration-helper) to help you find deprecated usages in your codebase.
- Card's `noHovering` has been renamed to `hoverable`, and its default value now is `true`.
- Card's `noHovering` has been renamed to `hoverable`, and its default value now is `false`.
- Added new Grid breakpoints. [#7230](https://github.com/ant-design/ant-design/pull/7230)
- Form `getFieldDecorator`'s `exclusive` option has been removed.
- Added `Form.createFormField`, and you must use it to wrap field data returned in `option.mapPropsToFields`:

124
CHANGELOG.zh-CN.md

@ -15,6 +15,128 @@ timeline: true
---
## 3.26.20
`2020-10-27`
- 🐞 修复 Typescript 版本导致的定义问题。
## 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`
@ -2477,7 +2599,7 @@ timeline: true
此版本有部分不兼容的改动,升级时确保修改相应的使用代码。另外由于人肉查找代码中的废弃用法过于低效,所以我们提供了 [antd-migration-helper](https://github.com/ant-design/antd-migration-helper) 用于扫描代码中的废弃用法。
- Card 的 `noHovering` 属性重命名为 `hoverable`,且默认值改为 `true`
- Card 的 `noHovering` 属性重命名为 `hoverable`,且默认值改为 `false`
- 调整了 Grid 的响应式断点值。详见 [#7230](https://github.com/ant-design/ant-design/pull/7230)
- Form `getFieldDecorator``exclusive` 参数被移除,此类场景应该由 Radio.Group、Checkbox.Group 之类的组件来完成。
- 新增 `Form.createFormField` 方法,`mapPropsToFields` 返回的字段都需要由该方法创建。

2
README.md

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

69
azure-pipelines.yml

@ -1,69 +0,0 @@
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
name: ant design
trigger:
batch: true
branches:
exclude:
- gh-pages
jobs:
- job: test_
pool:
vmImage: 'Ubuntu-16.04'
strategy:
matrix:
Lint:
TEST_TYPE: lint
dist-react@16:
REACT: 16
TEST_TYPE: test:dist
lib-react@16:
REACT: 16
TEST_TYPE: test:lib
es-react@16:
REACT: 16
TEST_TYPE: test:es
dom-react@16:
REACT: 16
TEST_TYPE: test:dom
node-react@16:
REACT: 16
TEST_TYPE: test:node
dist-react@15:
REACT: 15
TEST_TYPE: test:dist
lib-react@15:
REACT: 15
TEST_TYPE: test:lib
es-react@15:
REACT: 15
TEST_TYPE: test:es
dom-react@15:
REACT: 15
TEST_TYPE: test:dom
node-react@15:
REACT: 15
TEST_TYPE: test:node
steps:
- checkout: self
fetchDepth: 1
clean: false
- task: NodeTool@0
inputs:
versionSpec: '10.x'
- script: npm install
displayName: install
- script: scripts/install-react.sh
displayName: install-react
- script: scripts/travis-script.sh
displayName: test
- task: PublishBuildArtifacts@1
# 主分支,并且运行成功
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
pathtoPublish: './package-lock.json'
artifactName: lock

4
components/affix/index.tsx

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

1
components/alert/style/index.less

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

8
components/auto-complete/__tests__/focus.test.js

@ -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');

60
components/avatar/__tests__/__snapshots__/demo.test.js.snap

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

46
components/badge/ScrollNumber.tsx

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

540
components/badge/__tests__/__snapshots__/demo.test.js.snap

File diff suppressed because it is too large

876
components/badge/__tests__/__snapshots__/index.test.js.snap

File diff suppressed because it is too large

19
components/badge/__tests__/index.test.js

@ -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();
})
});

13
components/badge/index.tsx

@ -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"
/>
);

5
components/badge/style/index.less

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

2
components/button/button.tsx

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

3
components/calendar/locale/ga_IE.tsx

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

2
components/card/index.en-US.md

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

2
components/card/index.zh-CN.md

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

2
components/card/style/index.less

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

11
components/carousel/style/index.less

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

47
components/cascader/__tests__/__snapshots__/index.test.js.snap

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

46
components/cascader/__tests__/index.test.js

@ -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');

12
components/cascader/index.tsx

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

2
components/collapse/style/index.less

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

273
components/config-provider/__tests__/__snapshots__/components.test.js.snap

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

24
components/date-picker/__tests__/focus.test.js

@ -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();
});
});

4
components/date-picker/__tests__/showTime.test.js

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

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

@ -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/)\[]) | - | |

2
components/date-picker/index.zh-CN.md

@ -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/)\[]) | - | |

19
components/date-picker/locale/ga_IE.tsx

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

4
components/date-picker/style/Picker.less

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

1
components/descriptions/style/index.less

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

7
components/dropdown/__tests__/__snapshots__/demo.test.js.snap

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

2
components/dropdown/demo/basic.md

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

2
components/dropdown/demo/event.md

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

2
components/dropdown/demo/item.md

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

2
components/dropdown/demo/menu-full.md

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

2
components/dropdown/demo/overlay-visible.md

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

2
components/dropdown/demo/sub-menu.md

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

2
components/dropdown/demo/trigger.md

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

2
components/form/FormItem.tsx

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

158
components/form/__tests__/__snapshots__/index.test.js.snap

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

32
components/form/__tests__/index.test.js

@ -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
});
});
});

5
components/form/__tests__/label.test.js

@ -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', () => {

11
components/form/style/index.less

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

4
components/grid/style/index.less

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

16
components/input/ClearableLabeledInput.tsx

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

18
components/input/ResizableTextArea.tsx

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

4
components/input/__tests__/Password.test.js

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

17
components/input/__tests__/index.test.js

@ -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', () => {

6
components/input/demo/tooltip.md

@ -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();
}

9
components/layout/layout.tsx

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

6
components/list/Item.tsx

@ -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) => {

20
components/list/__tests__/__snapshots__/demo.test.js.snap

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

1
components/list/style/index.less

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

16267
components/locale-provider/__tests__/__snapshots__/index.test.js.snap

File diff suppressed because it is too large

2
components/locale-provider/__tests__/index.test.js

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

3
components/locale-provider/ga_IE.tsx

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

43
components/locale/ga_IE.tsx

@ -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í',
},
};

4
components/modal/ActionButton.tsx

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

11
components/modal/Modal.tsx

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

12
components/modal/__tests__/__snapshots__/Modal.test.js.snap

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

21
components/modal/index.en-US.md

@ -110,3 +110,24 @@ browserHistory.listen(() => {
Modal.destroyAll();
});
```
## FAQ
### Why I can not access context, redux, ConfigProvider `locale/prefixCls` in Modal.xxx?
antd will dynamic create React instance by `ReactDOM.render` when call Modal methods. Whose context is different with origin code located context.
You can try the following ways to solve the problem
set [@ant-prefix](https://github.com/ant-design/ant-design/blob/2c6c789e3a9356f96c47aea0083f5a15538315cf/components/style/themes/default.less#L7):`'ant-prefix': 'antd3'`
```js
import { Modal } from 'antd';
// use
Modal.confirm({
title: 'hello world',
// must use the '-modal' suffix
prefixCls: 'antd3-modal',
});
```

21
components/modal/index.zh-CN.md

@ -113,3 +113,24 @@ browserHistory.listen(() => {
Modal.destroyAll();
});
```
## FAQ
### 为什么 Modal 方法不能获取 context、redux、的内容和 ConfigProvider `locale/prefixCls` 配置?
直接调用 Modal 方法,antd 会通过 `ReactDOM.render` 动态创建新的 React 实体。其 context 与当前代码所在 context 并不相同,因而无法获取 context 信息。
你可以用以下的方法解决这个问题
设置 [@ant-prefix](https://github.com/ant-design/ant-design/blob/2c6c789e3a9356f96c47aea0083f5a15538315cf/components/style/themes/default.less#L7):`'ant-prefix': 'antd3'`
```js
import { Modal } from 'antd';
// 使用
Modal.confirm({
title: 'hello world',
// 必须带上 '-modal' 后缀
prefixCls: 'antd3-modal',
});
```

4
components/popconfirm/index.tsx

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

20
components/progress/__tests__/__snapshots__/demo.test.js.snap

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

1
components/progress/__tests__/__snapshots__/index.test.js.snap

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

23
components/result/__tests__/type.test.tsx

@ -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();
});
});

4
components/result/index.tsx

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

2
components/select/index.en-US.md

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

2
components/select/index.zh-CN.md

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

3
components/select/style/index.less

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

2
components/steps/style/label-placement.less

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

4
components/style/themes/default.less

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

4
components/table/__tests__/__snapshots__/demo.test.js.snap

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

2
components/table/demo/drag-sorting.md

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

2
components/table/filterDropdown.tsx

@ -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(),
});

1
components/table/index.en-US.md

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

1
components/table/index.zh-CN.md

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

1
components/table/interface.tsx

@ -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>[];

21
components/table/style/index.less

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

2
components/tabs/demo/custom-tab-bar-node.md

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

2
components/tabs/style/index.less

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

6
components/tag/__tests__/__snapshots__/demo.test.js.snap

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

2
components/tag/demo/hot-tags.md

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

5
components/time-picker/locale/ga_IE.tsx

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

1
components/timeline/Timeline.tsx

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

1
components/timeline/TimelineItem.tsx

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

10
components/tooltip/__tests__/tooltip.test.js

@ -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');
});
});

14
components/tooltip/index.tsx

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

2
components/tree-select/__tests__/index.test.js

@ -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', () => {

10
components/tree/Tree.tsx

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

68
components/tree/__tests__/__snapshots__/demo.test.js.snap

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

12
components/tree/__tests__/index.test.js

@ -30,4 +30,16 @@ describe('Tree', () => {
);
expect(wrapper.render()).toMatchSnapshot();
});
it('switcherIcon in Tree should not render at leaf nodes', () => {
const wrapper = mount(
<Tree switcherIcon={<i className="switcherIcon" />} defaultExpandAll>
<TreeNode icon="icon">
<TreeNode id="node1" title="node1" icon="icon" key="0-0-2" />
<TreeNode id="node2" title="node2" key="0-0-3" />
</TreeNode>
</Tree>,
);
expect(wrapper.find('.switcherIcon').length).toBe(1);
});
});

13
components/tree/__tests__/type.test.tsx

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

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

Loading…
Cancel
Save