Compare commits

..

213 Commits
4.5.2 ... 4.6.2

Author SHA1 Message Date
ZHANGYU
09dd53915e docs: update modal doc (#26492)
* docs: update modal doc

* docs: sort modal props
2020-08-31 14:18:50 +08:00
信鑫-King
fb8be1e249 release: 4.6.2 changelog (#26490)
* docs: changelog

* chore: version

* chore: changelog

* docs: changelog
2020-08-31 11:44:12 +08:00
xrkffgg
5f6470d8f3 style: optimize col rtl style (#26482) 2020-08-29 22:06:07 +08:00
二货机器人
88ae028321 fix: Upload controlled issue (#26481)
* fix upload sync

* add test case

* rm only

* update snapshot

* fix test case
2020-08-29 21:28:44 +08:00
Moein Alizadeh
6b90477b53 fix: rlt style of columns (#26479)
* Fix rlt issue for columns

This fix should exist in rtl styles.

* Update rtl.less
2020-08-29 19:33:28 +08:00
xrkffgg
bf72f5538a docs: update api naming 2020-08-29 15:25:09 +08:00
Kaan KÜÇÜK
7e223c1edc Update index.en-US.md (#26476)
Type for Checkbox.Group Options is not valid on docs.
2020-08-29 12:11:22 +08:00
Rainy
221a38db91 fix: no shadow in the style of the Select focus. (#26465)
Fix #26255 style error.
2020-08-28 23:08:33 +08:00
xrkffgg
ae650485a0 docs: optimize site menu sort (#26471) 2020-08-28 22:55:16 +08:00
xrkffgg
2005546d22 test: update snap (#26467) 2020-08-28 21:43:44 +08:00
zhangchen
c47bfb0c91 fix: Table topPaginationNode display logic should same with bottomPaginationNode (#26143)
* fix: Tree bottomPaginationNode display logic should same with bottomPaginationNode

* update: test
2020-08-28 15:48:19 +08:00
二货机器人
77cbf724cf fix: TimePicker.RangePicker props (#26446) 2020-08-28 11:46:35 +08:00
二货机器人
d561d73614 fix: Space should support fragement (#26444) 2020-08-28 11:29:37 +08:00
baidumap
3507a01798 fix: 修复disabledTime参数文档 (#26439)
* fix: 修复disabledTime参数文档

* fix: 英文版dates -> date

Co-authored-by: jingruoyu <jingruoyu@xiaomi.com>
2020-08-27 21:15:52 +08:00
Arvin Xu
948ba88629 docs: update image cover (#26431)
* docs: update image cover

* docs: update image cover
2020-08-27 17:02:02 +08:00
ZHANGYU
dd547aabfd docs: fix Tree prop autoExpandParent default value (#26426) 2020-08-27 11:45:10 +08:00
二货机器人
a6180008c5 Revert "fix: ref lost in Radio.Group (#25328)" (#26418)
This reverts commit 0a8641fc02.
2020-08-26 21:36:21 +08:00
Ben Callaway
852fad9e3b fix: Add missing properties to ShowUploadListInterface (#26406) 2020-08-26 18:43:34 +08:00
xrkffgg
008dc3e7f5 docs: update select demo and site (#26417) 2020-08-26 17:50:14 +08:00
偏右
c53e8ac4c9 test: add test cases to increase coverage (#26410) 2020-08-26 16:42:47 +08:00
偏右
e11da52bf7 fix: 🐛 Table Expand Icon size issue (#26409)
* - https://github.com/ant-design/ant-design/issues/24719
Expand Icon

* - https://github.com/ant-design/ant-design/issues/24719
Expand Icon

Co-authored-by: Gary Wei <wgz@tip-lab.com>
2020-08-26 13:43:48 +08:00
zhangchen
453eafe68d fix: Badge not work when props.color is empty (#26375)
* fix: Badge not work when props.color is empty

* update: test
2020-08-26 11:27:07 +08:00
xishanxu
507fdc44ae docs: fix typo in demo (#26391)
* Update extra.md

* Update extra.md
2020-08-26 11:09:14 +08:00
xrkffgg
73f4b9bcd7 docs: complete expandedRowClassName (#26397) 2020-08-25 22:54:29 +08:00
偏右
7274a2ef4a fix: colorPalette is not defined when use theme (#26395)
close #26290
2020-08-25 22:54:04 +08:00
Bosseskompis
19606b375c docs: Add expandedRowClassName to Table.expandable (#26392)
* Add expandedRowClassName to Table.expandable docs

* Use alphabetical order
2020-08-25 20:26:04 +08:00
二货机器人
875e190ac7 fix: Space preserve empty dom when children is null (#26389)
* fix: Space additional dom render

* test case
2020-08-25 16:43:52 +08:00
偏右
fb839f096c fix: Tree draggable transition style (#26387)
close #26383
2020-08-25 15:55:10 +08:00
偏右
e25f03206c docs: 📝 fix typo 2020-08-25 13:55:44 +08:00
afc163
92ab198198 docs: improve changelog 2020-08-25 13:32:19 +08:00
zombiej
04d7a81ff7 docs: Update Form FAQ 2020-08-25 11:27:01 +08:00
afc163
902f5617db docs: improve changelog 2020-08-25 10:51:58 +08:00
偏右
24a86df257 style: 💄 fix Upload picture-card button style (#26367)
* style: fix Upload picture-card button style

close https://github.com/ant-design/ant-design/issues/26317
close #23339

* style: tweak Upload list animation

close #22386

* fix snapshot change

* docs: update Upload demos

* add test case

* update form demo

* fix test case
2020-08-24 16:33:24 +08:00
偏右
fbef76e943 test: add more test cases (#26362) 2020-08-24 11:50:53 +08:00
信鑫-King
9b6db94fdf chore: esbuild target (#26357)
* chore: esbuild target

* Update bisheng.config.js

* fix lint

Co-authored-by: 二货机器人 <smith3816@gmail.com>
2020-08-24 11:46:21 +08:00
二货机器人
54b6bab2bf docs: 4.6.1 changelog (#26356) 2020-08-24 10:48:35 +08:00
偏右
d5eda4f87e test: add more test cases (#26350)
* test: add more test to Layout

* test: add more test to DatePicker

* refactor: remove unused code in Menu
2020-08-24 10:09:57 +08:00
Kermit Xuan
d8215589de fix(upload): props type declaration (#26347)
* fix(upload): props  type declaration

* fix lint

* chore: add type test case
2020-08-23 22:46:55 +08:00
二货机器人
71bdb0ab33 docs: 4.6.0 changelog (#26342)
* docs: 4.6.0 changelog

* Update CHANGELOG.zh-CN.md

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

* update changelog

* add mssing fix

Co-authored-by: 偏右 <afc163@gmail.com>
2020-08-23 09:08:09 +08:00
二货机器人
117da493e6 Merge pull request #26341 from ant-design/feature
chore: Master merge feature
2020-08-22 23:14:55 +08:00
二货机器人
949f1f46e6 Merge pull request #26339 from ant-design/feature-merge-master
chore: Feature merge master
2020-08-22 22:50:50 +08:00
zombiej
40473cfa19 chore: Fix LocaleReceiver ts define 2020-08-22 22:31:20 +08:00
zombiej
5a3bceea28 merge origin master 2020-08-22 22:09:07 +08:00
骗你是小猫咪
e3ee4e87aa feat: 🎉 Image component (#26296)
* feat: 🎉 Image component

* fix color

* fix style naming and sort api doc order

* remove onPreviewClose doc

* use animation-duration var

* use box and modal-mask mixins

* use box and modal-mask mixins

* improve style

* improve fallback demo src

* add cover

* improve demo

* update demo snapshots

* upgrade rc-image, naming Random -> Reload

* extract modal mask common style, and improve demo

* update snapshots

* fix less var conflict

* upgrade rc-image, adjust maxSize with dark.min.css, improve placeholder demo desc
2020-08-22 22:02:20 +08:00
afc163
2f7feca7ca docs: 📝 update changelog 2020-08-22 18:31:57 +08:00
偏右
07a38653ee refactor: simplify Transfer dom structure (#26334)
* refactor: simplify Transfer dom structure

* fix eslint
2020-08-22 17:55:09 +08:00
偏右
152cf6f6f5 fix: Transfer filterOption not trigger by spaces (#26335)
close #26208
2020-08-22 17:54:57 +08:00
llwslc
06b7a7aed9 fix: Set site h tag style in dark mode (#26332)
* add site h tag color

* #000 -> @black

* empty demo h3 -> h4
2020-08-22 15:24:44 +08:00
afc163
f4f5b633ff docs: 📖 update Ant Design Blazor implementation 2020-08-22 01:37:54 +08:00
偏右
d839cb1af9 fix: Progress steps support trailColor (#26323)
* fix: Progress steps support trailColor

close #26316

* add test case

* add test case
2020-08-22 01:29:48 +08:00
Kermit Xuan
63816fa6ba 🐛 fix(textarea): should display defaultValue when value is undefined (#26327)
close #26308
2020-08-21 22:14:28 +08:00
二货机器人
131b6e0264 test: Update Lithuanian doc & test (#26321)
* chore: Update lithuanian lang

* reorder

* Update docs/react/i18n.en-US.md

Co-authored-by: Amumu <yoyo837@hotmail.com>

Co-authored-by: Amumu <yoyo837@hotmail.com>
2020-08-21 22:11:44 +08:00
Diego Barreiro
f1a09fe25d feat: Galician Locale (#26015)
* feat: Create gl_ES

* Bump dependencies

rc-pagination
rc-picker

* Add test case

* Add documentation

Co-authored-by: Amumu <yoyo837@hotmail.com>

* Update test snapshots

* fix snapshot

Co-authored-by: Amumu <yoyo837@hotmail.com>
Co-authored-by: 二货机器人 <smith3816@gmail.com>
2020-08-21 18:26:36 +08:00
linye
c79ba580f1 docs: Update MorePage.tsx (#26322) 2020-08-21 18:06:48 +08:00
Maksim Slotvinskij
16962bbff1 lithuanian language (#26312)
Co-authored-by: 二货机器人 <smith3816@gmail.com>
2020-08-21 17:07:48 +08:00
偏右
d6488ca6d1 refactor: 🆙 upgrade TypeScript to 4.0 (#26318)
https://devblogs.microsoft.com/typescript/announcing-typescript-4-0/
2020-08-21 15:04:00 +08:00
二货机器人
60771a0f61 feat: Support requiredMarkType (#26309)
* feat: support requreidMarkType

* docs: Update doc desc

* fix lint

* use requiredMark instead

* not change className

* fix ts

* update test case

* rtl style

* fix rtl

Co-authored-by: xrkffgg <xrkffgg@vip.qq.com>
2020-08-21 12:58:14 +08:00
zombiej
55c1dd02c2 chore: Merge master 2020-08-20 17:31:03 +08:00
偏右
9a84eb57ac fix: Progress type=circle success.percent (#26307)
* refactor: Circle code

* fix: Progress circle success.percent

close #26299
2020-08-20 17:15:40 +08:00
二货机器人
bd2d50c114 chore: Update snapshot (#26306) 2020-08-20 16:45:10 +08:00
偏右
9be6493f08 Update research-form.zh-CN.md 2020-08-20 15:47:41 +08:00
偏右
0111039575 Update research-form.zh-CN.md 2020-08-20 15:42:45 +08:00
偏右
92114f540b refactor: progress getSuccessPercent (#26302) 2020-08-20 15:27:16 +08:00
yui
ab59023971 fix: typescript build in windows error from-item initialValue (#26292) 2020-08-20 14:42:09 +08:00
Victor
e6e149b1c4 docs: fix mdx typo for code highlight (#26300) 2020-08-20 08:56:08 +08:00
afc163
af91a9b230 docs: 📖 update replace-moment docs 2020-08-19 19:00:45 +08:00
二货机器人
72863626c9 chore: Update rc-virtual-list deps (#26282)
* chore: Update rc-virtual-list deps

* bump

* clean comment
2020-08-19 17:30:23 +08:00
偏右
a3864532e1 chore: 🆙 upgrade rc-virtual-list (#26278)
* chore: 🆙 upgrade rc-virtual-list

* update snapshot

Co-authored-by: zombiej <smith3816@gmail.com>
2020-08-19 13:49:22 +08:00
afc163
29ef3f74dd docs: 📝 update ConfigProvider API 2020-08-19 11:24:43 +08:00
flyerH
2c6c789e3a fix: Cascader options not open after press ESC and then search (#26271)
* fix: Cascader options not open after press ESC

* add test

* modify

* Apply suggestions from code review

Co-authored-by: 偏右 <afc163@gmail.com>
2020-08-19 10:43:54 +08:00
Kermit Xuan
f98e3eee25 refactor: optimize code stle (#26270) 2020-08-19 09:50:04 +08:00
07akioni
1f04757ece docs: v3 -> v4 deprecate Button.Group (#26260)
* docs: v3 -> v4 deprecate Button.Group

* docs: update
2020-08-19 09:48:51 +08:00
偏右
a4585c13d0 Merge pull request #26267 from ant-design/master
chore: merge master into feature
2020-08-18 18:51:49 +08:00
xrkffgg
1ecca69bb3 docs: perfect website (#26265) 2020-08-18 17:53:21 +08:00
zombiej
aec0f4517c test: Fix resize related test case 2020-08-18 16:46:05 +08:00
偏右
abf95437f1 fix: Typography copyable tooltips (#26259)
* fix: Typography copyable tooltips cannot accept empty string

https://github.com/ant-design/ant-design/pull/25953#issuecomment-674480396

* fix snapshot change
2020-08-18 16:14:14 +08:00
afc163
adf990f8fb revert: rc-virtual-list in devDeps 2020-08-18 16:00:58 +08:00
Kermit Xuan
ee50fe7952 refactor(upload): rewrite with hooks (#26196)
* refactor(upload): rewrite with hooks

* refactor: optimize code style;
chore(dragger): add forwardRef;

* fix: lint

* fix: trigger ci

* fix: lint

* chore: add test case
2020-08-18 15:44:31 +08:00
afc163
517d2eeccb 🆙 upgrade rc-virtual-list in devDeps 2020-08-18 15:31:33 +08:00
xrkffgg
95aef4aafe fix: Select focused disabled style (#26255) 2020-08-18 15:13:03 +08:00
偏右
e17e82f549 Merge pull request #26243 from ant-design/master
chore: merge master into feature
2020-08-17 22:23:07 +08:00
偏右
86f6b5f0bc docs: improve code demo box style (#26242)
* docs: improve code demo box style

* chore: update lighthouse.yml

* use node 14
2020-08-17 19:32:03 +08:00
偏右
30c198c077 chore: 🆙 upgrade lodash
close #26240
2020-08-17 17:45:53 +08:00
偏右
46f63751a4 chore: 🆙 upgrade lodash
close #26240
2020-08-17 17:45:33 +08:00
Albert Mañosa
65ba33e1ab fix: Pagination font family (#26230)
* fix: Change @pagination-font-family value

* fix: Add explicit font-family to item-ellipsis
2020-08-17 10:31:20 +08:00
afc163
93c1614bcf docs: 🎬 add InputNumber demo of using Intl.Numberformat
close #26223
close #19645
2020-08-16 19:32:48 +08:00
骗你是小猫咪
6d02b51ae1 fix: Space children remount. close #26177 (#26219)
* fix: Space children remount. close #26177

* update snapshots
2020-08-15 16:29:47 +08:00
07akioni
5537ab66e0 docs: v3 -> v4 Tree & TreeSelect migration guide (#26214)
* docs: v3 -> v4 tree & treeselect label & title adjustment

* docs: update links

* chore

* chore

* fix: misplace docs

* chore
2020-08-15 16:28:58 +08:00
xrkffgg
dc306a20f9 style: optimize cascader clear animation (#26186)
* style: optimize cascader clear animation

* fix test

* style: optimize cascader clear animation

* fix test

* add clearTimeout

* add test

* add clearTimeout
2020-08-14 17:53:34 +08:00
xrkffgg
1c63268e6a style: optimize tree line rtl style (#26205) 2020-08-14 15:41:52 +08:00
xrkffgg
49d02a0b58 style: optimize dropdown rtl style (#26206) 2020-08-14 15:41:22 +08:00
xrkffgg
c6763b35e4 style: fix rtl.less missing variable (#26201) 2020-08-14 13:35:30 +08:00
二货机器人
5cc9742eec chore: Update snapshot 2020-08-14 04:04:58 +00:00
xrkffgg
cbdd2f5703 docs: perfect website (#26198) 2020-08-14 10:58:58 +08:00
xrkffgg
e8c43d4d6c style: improve select style (#26181) 2020-08-13 13:33:38 +08:00
zhangchen
7df2c4053a fix: Select with multiple type has no room for icons (#26168)
* fix: Select with multiple type has no room for icons

* update: rtl style
2020-08-13 10:16:34 +08:00
llwslc
ff7aca19cc feat: add Typography.Text type success (#26145)
* baseType & style

* update demo

* update snap

* update document

* remove type primary
2020-08-13 10:13:32 +08:00
xrkffgg
61e01e7c60 chore: merge master into feature 2020-08-13 09:06:53 +08:00
Ivor Wanders
d4ea5d2e3b docs: Fix spelling of copywrite (#26174) 2020-08-13 01:15:17 +08:00
afc163
043901468a chore: add CssMinimizerPlugin 2020-08-12 20:49:34 +08:00
afc163
9c91b62625 docs: correct design doc expressing 2020-08-12 19:57:43 +08:00
zoomdong
39f1126315 feat: Form.List add() support index param (#26081)
* feat: Form.List add() support index param

* update test case

* update
2020-08-12 19:13:44 +08:00
偏右
2b71085e68 docs: 🌐 translate more design documents (#26125)
* docs: 🌐 translate more design documents

* translate docs/spec/copywriting.en-US.md

* translate docs/spec/data-format.en-US.md

* translate docs/spec/detail-page.en-US.md

* fix remark link

* update link

* translate docs/spec/visualization-page.en-US.md

* update docs

* update docs
2020-08-12 17:37:31 +08:00
诸岳
d092cc36f9 Merge pull request #26163 from ant-design/release-4.5.4
docs: Add changelog of 4.5.4
2020-08-12 16:05:28 +08:00
诸岳
0a2736b027 docs: Add changelog of 4.5.4 2020-08-12 15:34:14 +08:00
xrkffgg
0c1504cc8d style: optimize DatePicker footer rtl style (#26158) 2020-08-12 15:06:04 +08:00
偏右
7d500703d7 feat: 💄 Add @badge-color (#26159) 2020-08-12 15:04:46 +08:00
xrkffgg
2e463e76b8 fix: add export handleStyle/trackStyle (#26160) 2020-08-12 15:02:58 +08:00
偏右
b8f05d3ae7 feat: 💄 Add @badge-color (#26159) 2020-08-12 15:01:45 +08:00
xrkffgg
af16da1ccd fix: DatePicer range start and end show in rtl (#26157) 2020-08-12 14:25:46 +08:00
xrkffgg
a4e7e184c2 fix: input search rtl style (#26156) 2020-08-12 14:00:06 +08:00
偏右
d9d5cbcac3 style: optimize DatePicker range show in rtl (#26149)
* style: optimize DatePicker range show in rtl

* change place
2020-08-12 13:09:05 +08:00
偏右
5a013478ef fix: 🐛 Form.Item hidden not working in less (#26152)
close #26141
2020-08-12 13:08:50 +08:00
xrkffgg
50a0678f35 fix: addonBefore Input rtl style (#26153) 2020-08-12 13:08:43 +08:00
偏右
077ea950d4 demo: fix Table filter dropdown select behavior
close #26144
2020-08-12 11:44:40 +08:00
xrkffgg
7f130a89ec change place 2020-08-12 11:02:23 +08:00
xrkffgg
40b9d8c57a style: optimize DatePicker range show in rtl 2020-08-12 10:45:16 +08:00
偏右
9f94744d1f fix: Dropdown overflow string issue (#26135)
close #26134
2020-08-11 17:43:54 +08:00
07akioni
cec7744b2c refactor: Alert use CSSMotion (#26115)
* refactor: Alert use CSSMotion

* chore

* test: remove afterClose case
2020-08-11 17:04:42 +08:00
QoVoQ
f65013994f fix: #26126 use mergedData instead of pageData to decide if render bottom pagination (#26133)
Co-authored-by: Zhongxian Liang <zhongxian.liang@shopee.com>
2020-08-11 16:18:34 +08:00
二货机器人
1119c3da38 fix: Fix DirectoryTree miss ref.scrollTo function (#26129)
* fix: DirTree support ref

* add test case
2020-08-11 14:22:16 +08:00
偏右
3ad0b47d92 🆙 upgrade react-virtualized 2020-08-11 13:55:22 +08:00
afc163
d0b9f6ed80 docs: 💄 fix resource image 2020-08-11 11:23:39 +08:00
偏右
8580655519 chore: 🛠 improve changelog editor (#26119)
https://github.com/ant-design/antd-changelog-editor/pull/42
2020-08-10 19:03:26 +08:00
afc163
c18737698b docs: 📝 fix edit button color again 2020-08-10 16:34:11 +08:00
afc163
2d9448c1b6 docs: 📝 fix edit button color 2020-08-10 16:23:55 +08:00
James Yeung
802cc51c4c docs(PageHeader): fix default value for onBack (#25664) 2020-08-10 14:54:49 +08:00
偏右
ae843df718 Merge pull request #26112 from ant-design/master
chore: merge master into feature
2020-08-10 14:53:46 +08:00
Daryl Roberts
cdb8a5bcd7 style: add @badge-count-background (#26043) 2020-08-10 11:16:00 +08:00
zhangchen
4da2260342 feat: show line in Tree first level (#25991)
* feat: tree line in first level

* update: Tree showLine demo
2020-08-10 10:48:11 +08:00
偏右
487d3e46c0 docs: improve typography API table (#26102)
* docs: improve typography API table

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

Co-authored-by: xrkffgg <xrkffgg@gmail.com>

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

Co-authored-by: xrkffgg <xrkffgg@gmail.com>

* docs: update doc

* docs: update

Co-authored-by: xrkffgg <xrkffgg@gmail.com>
Co-authored-by: xrkffgg <xrkffgg@vip.qq.com>
2020-08-10 10:44:16 +08:00
xrkffgg
d0c4e4b3cf chore: merge master into feature 2020-08-10 10:08:46 +08:00
xrkffgg
e1f990e61a chore: fix merge conflict 2020-08-10 09:43:21 +08:00
07akioni
504d51477a docs: Form add debug true on dep-debug (#26103) 2020-08-10 09:41:45 +08:00
陈帅
1a10df03a7 docs: add 4.5.3 changelog (#26099)
* docs: add 4.5.3 changelog

* Update CHANGELOG.en-US.md

Co-authored-by: xrkffgg <xrkffgg@gmail.com>

* fix review warning

* Update CHANGELOG.zh-CN.md

Co-authored-by: He Linming <hlm52pk@163.com>

Co-authored-by: xrkffgg <xrkffgg@gmail.com>
Co-authored-by: He Linming <hlm52pk@163.com>
2020-08-09 22:51:01 +08:00
linye
5a34f5b414 docs: Update site link (#26088)
* Update RecommendPage.tsx

* Update RecommendPage.tsx

* fix lint

Co-authored-by: 二货机器人 <smith3816@gmail.com>
2020-08-09 20:57:54 +08:00
07akioni
f964abc7f4 fix: Steps progress circle size & rtl style when use progress (#26075)
* fix: Steps progress circle size

* test: update snapshot

* fix: rtl
2020-08-09 20:28:08 +08:00
xrkffgg
d5ca5880ef fix: Avatar.Group key lost (#26098)
* fix: avatargroup key lost

* Update components/avatar/group.tsx
2020-08-09 18:54:53 +08:00
llwslc
15b30e6761 feat: customize Typography.Paragraph copyable and editable (#25953)
* Merge branch 'feature' of github.com:ant-design/ant-design into antd

# Conflicts:
#	components/typography/__tests__/__snapshots__/demo.test.js.snap
#	components/typography/demo/interactive.md

* add icons & tooltips test

* remove Array<React.ReactNode> definition

* clean up useless code

* refactoring

* React.ReactNode already contains string

* 1. keep aria-label attribute
2. customize edit icon & tooltip

* rebase feature

* update snapshots

* update abi document

* update demo & document

* copyable icon & tooltip document

* version document
2020-08-09 12:56:35 +08:00
Mohelm97
e7e83fb357 fix: Arabic locale (#26094)
All Arabic strings in this file flipped the order of the words in the sentence, for example if 
${label} = كلمة السر
The old message will be
كلمة السر يرجى إدخال
But the correct message is
يرجى إدخال كلمة السر
2020-08-08 17:36:18 +08:00
xiao11lang
be7c8d1cc8 docs: update button component doc (#26095)
Co-authored-by: caohang <caohang@caohangdeMacBook-Pro.local>
2020-08-08 17:35:26 +08:00
07akioni
548c6e86a3 chore: ❤️ improve components overview page experience (#26082)
* fix: comp overview display glitch

* chore

* chore
2020-08-07 19:11:01 +08:00
骗你是小猫咪
bd02b83da4 feat: Table new sticky prop (#25939)
* feat: Table new sticky prop

* add example

* update snapshots

* fix typo

* fix example and improve less

* rename to @zindex-table-fixed-column

* fix compile error

* fix header z-index

* upgrade rc-table and add active style

* improve less var

* upgrade rc-table and remove hover style

Co-authored-by: 二货机器人 <smith3816@gmail.com>
2020-08-07 17:53:23 +08:00
afc163
fa9316f78c docs: info about Upload file.status 2020-08-07 17:31:18 +08:00
偏右
d02290c922 Update index.zh-CN.md 2020-08-07 17:25:23 +08:00
afc163
7502d84d15 docs: fix demo typo 2020-08-07 17:14:55 +08:00
afc163
5447db9239 docs: 🎬 add Upload demo about beforeUpload usage 2020-08-07 17:08:47 +08:00
xrkffgg
f0568efdf3 docs: perfect website (#26079)
* docs: perfect website

* fix []
2020-08-07 15:50:53 +08:00
07akioni
6d5ccd854f style: Cascader selector down arrow doesn't rotate (#26078)
* fix: Cascader selector down arrow always down

* chore: remove useless style
2020-08-07 14:53:48 +08:00
zefeng
73ce401ae8 fix: 修复紧凑模式下表单项 margin 计算错误 (#26069)
close #25989
2020-08-07 13:45:35 +08:00
xrkffgg
d1d23ac4ae fix: horizontal menu in dark & dark (#26062) 2020-08-07 11:14:27 +08:00
xrkffgg
1ade6da9cd fix: inputnumber handler background in dark (#26072) 2020-08-07 09:57:52 +08:00
jesse
7121760f52 feat: Tabs add slot to support extra position (#25138)
* Update package.json

* update API

* update Demo

* update test

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

Co-authored-by: xrkffgg <xrkffgg@vip.qq.com>

* Update components/tabs/demo/extra.md

Co-authored-by: xrkffgg <xrkffgg@vip.qq.com>

* update index.en-US

Co-authored-by: xrkffgg <xrkffgg@vip.qq.com>
2020-08-07 09:53:45 +08:00
afc163
53ef8bed92 docs: 🎬 Improve DatePicker demo 2020-08-06 15:10:52 +08:00
陈帅
f928baf52a fix: Optimize the display of elements of the block type. (#25903)
* add flex style

* add new demo

* update snapshot

* Merge branch feature into fix-descriptions

* update snapshot

* update snapshot
2020-08-06 14:32:13 +08:00
lihqi
b92a9a5678 feat: message destroy the specified key (#26052)
close #25236
close #26054
2020-08-06 13:34:18 +08:00
偏右
a9f14ea48f refactor: 🌎 new kmr_IQ to replace ku_IQ (#26030)
* feat: 🌎 new kmr_IQ to replace ku_IQ

close #25778
close #25790

* fix locale provider Legacy usage

* Update docs/react/i18n.en-US.md

Co-authored-by: Amumu <yoyo837@hotmail.com>

* Update i18n.zh-CN.md

Co-authored-by: Amumu <yoyo837@hotmail.com>
2020-08-06 10:40:58 +08:00
Kermit Xuan
85e28791cb chore: replace rc-animate/lib/CSSMotion with rc-motion (#26049) 2020-08-05 23:05:25 +08:00
偏右
112e0e2a4c Merge pull request #26050 from ant-design/master-to-merge-feature
chore: merge master into feature
2020-08-05 22:50:51 +08:00
afc163
d3700fbe2e resolve merge conflict 2020-08-05 22:30:47 +08:00
偏右
9a67f3571d fix: Table crash when dataSource contains number (#26042)
close #26039
2020-08-05 22:29:38 +08:00
Mateusz Wierzbicki
35a9d94c92 docs: Added UI kit for Adobe XD to Resources page (#26047) 2020-08-05 22:09:26 +08:00
二货机器人
c6244382a7 chore: Replace rc-animation/lib/CSSMotion to rc-motion (#26044)
* chore: bump version

* chore: update rest version

* clean up rc-trigger ts define

* clean up motion define
2020-08-05 21:23:15 +08:00
afc163
1d0f600918 📝 update PR template 2020-08-05 18:30:53 +08:00
Thanaen
e3946416a3 fix: fr_FR Table.cancelSort spelling error (#26034)
Co-authored-by: Clément Costedoat <ccostedoat@isdecisions.com>
2020-08-05 17:05:53 +08:00
xrkffgg
a6f787ed47 fix: menu position in dark rtl (#26032) 2020-08-05 16:50:17 +08:00
偏右
32ccb525ad Merge pull request #26026 from ant-design/master-2
chore: merge master into feature
2020-08-05 15:23:14 +08:00
afc163
4dbf74afae fix typography snapshot 2020-08-05 15:00:35 +08:00
afc163
2f95bf6cf0 Merge branch 'master' into master-2 2020-08-05 14:51:07 +08:00
xrkffgg
aacdc2ebe1 docs: perfect site (#26025) 2020-08-05 14:50:52 +08:00
afc163
45cbbd6034 merge feature into master-to-merge-feature 2020-08-05 14:49:10 +08:00
xrkffgg
c72be7bdda docs: update grid demo (#26022) 2020-08-05 11:28:57 +08:00
二货机器人
c345580ea2 fix: hidden should higher than noStyle (#26020) 2020-08-05 10:08:57 +08:00
Emily Xiong
683750c396 docs: add en translation for buttons page (#25997)
* spec: add en translation for buttons page

* fix typo
2020-08-05 09:06:17 +08:00
Li Ming
b29a9b4291 docs: fix typo in resposive.md (#26019) 2020-08-05 08:55:53 +08:00
zombiej
5131c24b79 chore: update snapshot 2020-08-04 23:07:49 +08:00
偏右
a0c5460d73 style: optimize pagination simple disabled (#26008)
* style: optimize pagination simple disabled

* update snap
2020-08-04 20:00:45 +08:00
xrkffgg
7acb6d1cdc fix: transfer pagination disabled (#26009) 2020-08-04 20:00:21 +08:00
xrkffgg
93d8d66171 style: add @btn-line-height (#26014) 2020-08-04 19:56:10 +08:00
偏右
a2e4b22f54 fix: Cascader text overflow in Firefox (#26011)
close #25969
2020-08-04 19:53:38 +08:00
xrkffgg
b0536c2a43 docs: update table demo action (#26010) 2020-08-04 17:49:31 +08:00
xrkffgg
b9ce4a869f update snap 2020-08-04 16:13:27 +08:00
xrkffgg
81e21c18dc style: optimize pagination simple disabled 2020-08-04 16:10:27 +08:00
偏右
a33dc19ec8 chore: 🛠 quit pub script when throw error (#26006)
* eslint

* chore: quit pub script when throw error

close #25965

https://stackoverflow.com/a/2871034

* revert
2020-08-04 15:35:03 +08:00
xrkffgg
5461934f54 fix: transfer disabled header dropdown cursor (#26005) 2020-08-04 15:00:42 +08:00
xrkffgg
87555eb5a9 style: optimize select multiple disabled style (#25980)
* style: optimize select multiple disabled style

* add var

* add dark
2020-08-04 11:56:18 +08:00
xrkffgg
de1941fa5b fix: select disabled icon cursor style (#26002) 2020-08-04 11:48:13 +08:00
偏右
8d7cbbdb0f fix: Table empty filters throw warning (#26001)
close #25979
2020-08-04 11:43:11 +08:00
xrkffgg
2626d5eb90 style: hidden handler when inputnumber readonly (#25998) 2020-08-04 10:42:08 +08:00
偏右
c4418d089c fix: fix breadcrumb separator (#25984)
* fix: fix breadcrumb separator

* add test snapshot

* code lint
2020-08-03 23:21:54 +08:00
Ivan Yakovlev
2a05d5a93f fix: remove typo (#25954) (#25990)
Co-authored-by: Ivan.Yakovlev <ivan.yakovlev@pochtavip.com>
2020-08-03 23:21:29 +08:00
flyerH
11bb2fff88 code lint 2020-08-03 21:53:13 +08:00
flyerH
3950dce5e3 add test snapshot 2020-08-03 21:34:29 +08:00
flyerH
e6dd15f01f fix: fix breadcrumb separator 2020-08-03 20:13:42 +08:00
偏右
038ce0e1b1 Revert "test: 📦 compressed-size.yml (#25986)" (#25987)
This reverts commit ebd693ab64.
2020-08-03 18:37:32 +08:00
偏右
ebd693ab64 test: 📦 compressed-size.yml (#25986) 2020-08-03 18:33:00 +08:00
偏右
8c7f7b4295 site: fix toc active menu (#25978) 2020-08-03 16:27:56 +08:00
xrkffgg
1efbc089ac style: adjust mentions readonly cursor (#25977) 2020-08-03 16:14:46 +08:00
xrkffgg
c5a7f031e4 docs: format api (#25973) 2020-08-03 15:01:16 +08:00
xrkffgg
ea49b01f0e fix: cascader disabled border color (#25970) 2020-08-03 14:36:16 +08:00
偏右
bc76e84619 docs: fix site problem (#25968)
close #23332
2020-08-03 14:35:11 +08:00
偏右
eadd475314 Update index.zh-CN.md 2020-08-03 13:56:58 +08:00
二货机器人
9fdad14dc0 fix: useModal missing prefix (#25967)
* fix: useModal hooks missing style

* add test case
2020-08-03 11:41:08 +08:00
afc163
915d94b1dc fix eslint 2020-08-02 23:48:36 +08:00
二货机器人
98050358f1 feat: Form support generic type (#25937)
* feat: Form support generic

* test: add test case of compile

* clean up
2020-07-31 16:53:39 +08:00
xrkffgg
35c44d038e style: add @text-color in dark (#25923) 2020-07-31 15:00:48 +08:00
07akioni
30d7231d08 feat: Select onClear (#25907)
* feat: Select onClear

* chore
2020-07-30 17:38:53 +08:00
偏右
cc7ad06a43 Merge pull request #25889 from ant-design/master
chore: merge master into feature
2020-07-29 21:32:11 +08:00
偏右
bf0cd1073b style: increase @text-color contrast (#25630)
* style: increase @text-color contrast

* update UI image snapshot
2020-07-29 17:52:47 +08:00
xrkffgg
672066ccae feat: add Typography.Title level 5 (#25861)
* feat: add Typography.Title level 5

* fix test
2020-07-28 20:39:43 +08:00
CornerSkyless
ab9c477638 feat: Add maxLength and autoSize in Typography editable config (#25373)
* feat: Add maxLength and autoSize in Typography editable config

* doc: add version column of maxLength and autoSize

* doc: add demo of maxLength and autoSize

* doc: simplify version column of autoSize and maxLength

* doc: fix version column of autoSize and maxLength

* snapshot: add snapshot

* snapshot: add snapshot

* doc: add version column of maxLength and autoSize

* doc: simplify version column of autoSize and maxLength

* snapshot: add snapshot

* update version column

* feat: Add maxLength and autoSize in Typography editable config

* doc: add version column of maxLength and autoSize

* doc: simplify version column of autoSize and maxLength

* doc: fix version column of autoSize and maxLength

* snapshot: add snapshot

* snapshot: add snapshot

* doc: add version column of maxLength and autoSize

* doc: simplify version column of autoSize and maxLength

* snapshot: add snapshot

* update version column

* add snapshot
2020-07-28 17:48:37 +08:00
moonrailgun
74d13f48b1 feat: Add size props for Badge (#25851)
* feat: add badge size

* test: add doc and testcase for badge size

* doc: update demo doc of Badge

* doc: update demo doc of Badge

* test: fix test case

* docs: add badge new props size addition version

* style: modify size of small badge
2020-07-28 15:27:50 +08:00
偏右
3b6b410850 Merge pull request #25847 from ant-design/master
chore: merge master into feature
2020-07-28 11:40:30 +08:00
372 changed files with 35797 additions and 13403 deletions

View File

@@ -26,4 +26,5 @@ dist
coverage
**/*.d.ts
# Scripts
scripts/previewEditor/**/*
scripts/previewEditor/**/*
jest-stare

View File

@@ -18,6 +18,8 @@ Please makes sure that these form are filled before submitting your pull request
- [ ] TypeScript definition update
- [ ] Bundle size optimization
- [ ] Performance optimization
- [ ] Enhancement feature
- [ ] Internationalization
- [ ] Refactoring
- [ ] Code style optimization
- [ ] Test Case

View File

@@ -14,11 +14,13 @@
- [ ] 日常 bug 修复
- [ ] 站点、文档改进
- [ ] 演示代码改进
- [ ] 组件样式改进
- [ ] 组件样式/交互改进
- [ ] TypeScript 定义更新
- [ ] 包体积优化
- [ ] 性能优化
- [ ] 重构
- [ ] 功能增强
- [ ] 国际化改进
- [ ] 代码风格优化
- [ ] 测试用例
- [ ] 分支合并

View File

@@ -5,7 +5,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2-beta
with:
node-version: '14'
- run: npm install && npm install -g @lhci/cli@0.4.x
- run: npm run site
- run: lhci autorun --upload.target=temporary-public-storage

View File

@@ -15,6 +15,141 @@ timeline: true
---
## 4.6.2
`2020-08-31`
- Upload
- 🐞 Fix Upload list status issue when in control mode. [#26481](https://github.com/ant-design/ant-design/pull/26481)
- 💄 Fix Upload `picture-card` style unexpected margin in Form.Item. [#26367](https://github.com/ant-design/ant-design/pull/26367)
- 💄 Fix Select focus shadow style. [#26465](https://github.com/ant-design/ant-design/pull/26465) [@Rainy](https://github.com/Rainy)
- Table
- 🐞 Fix Table Pagination not hide with empty data when show on top position. [#26143](https://github.com/ant-design/ant-design/pull/26143) [@zhangchen915](https://github.com/zhangchen915)
- 💄 Fix Table expand icon size issue when `@font-size-base` is `12px`. [#26409](https://github.com/ant-design/ant-design/pull/26409)
- Space
- 🐞 Fix Space not support React.Fragment issue. [#26444](https://github.com/ant-design/ant-design/pull/26444)
- 🐞 Fix Space preserve empty dom node when `children` contains empty node. [#26389](https://github.com/ant-design/ant-design/pull/26389)
- 🐞 Fix Badge not work when `status` or `color` is empty. [#26375](https://github.com/ant-design/ant-design/pull/26375) [@zhangchen915](https://github.com/zhangchen915)
- 💄 Fix Tree draggable transition style. [#26387](https://github.com/ant-design/ant-design/pull/26387)
- 🐞 Fix `colorPalette is not defined` when customize theme in some situation. [#26395](https://github.com/ant-design/ant-design/pull/26395)
- TypeScript
- 🐞 Fix TimePicker.RangePicker typescript need `picker` issue. [#26446](https://github.com/ant-design/ant-design/pull/26446)
- 🐞 Upload extended `showUploadList` of Upload with `removeIcon` and `downloadIcon` properties. [#26406](https://github.com/ant-design/ant-design/pull/26406) [@bencallaway](https://github.com/bencallaway)
- RTL
- 🐞 Fix the rtl style of Col. [#26479](https://github.com/ant-design/ant-design/pull/26479) [#26482](https://github.com/ant-design/ant-design/pull/26482) [@TrueMoein](https://github.com/TrueMoein)
## 4.6.1
`2020-08-24`
- TypeScript
- 🐞 Fix Upload type declaration missing `children`. [#26347](https://github.com/ant-design/ant-design/pull/26347)
## 4.6.0
`2020-08-23`
- 💄 Darker `@text-color` for WCAG 2.0 on contrast ratio. [#25630](https://github.com/ant-design/ant-design/pull/25630)
- 🔥 New Image component. [#26296](https://github.com/ant-design/ant-design/pull/26296)
- 🔥 Table support `sticky` prop to sticky header and scroll bar. [#25939](https://github.com/ant-design/ant-design/pull/25939)
- Form
- 🆕 Form support style of required mark with `requiredMark` and deprecate `hideRequiredMark` prop. [#26309](https://github.com/ant-design/ant-design/pull/26309)
- 🆕 Form.List support the second `index` param in `add`. [#26081](https://github.com/ant-design/ant-design/pull/26081)
- 🆕 VirtualList support no blink jump and fix Select blank dropdown issue. [#26306](https://github.com/ant-design/ant-design/pull/26306)
- Typography
- 🆕 Support Typography.Text `success` type. [#26145](https://github.com/ant-design/ant-design/pull/26145) [@llwslc](https://github.com/llwslc)
- 🆕 Typography `copyable` support hide tooltip and `editable` support config icon and tooltip. [#25953](https://github.com/ant-design/ant-design/pull/25953) [@llwslc](https://github.com/llwslc)
- 🆕 Add Typography.Title level 5. [#25861](https://github.com/ant-design/ant-design/pull/25861)
- 🆕 Typography add `maxLength` & `autoSize` with `editable` config [#25373](https://github.com/ant-design/ant-design/pull/25373) [@CornerSkyless](https://github.com/CornerSkyless)
- 🐞 Fix Transfer `filterOption` not trigger when search spaces. [#26335](https://github.com/ant-design/ant-design/pull/26335)
- Progress
- 🐞 Fix Progress `steps` don't support `trailColor`. [#26323](https://github.com/ant-design/ant-design/pull/26323)
- 🐞 Fix Progress `success.percent` not working when `type="circle"`. [#26307](https://github.com/ant-design/ant-design/pull/26307)
- 🐞 Fix Textarea don't display `defaultValue` when `value` is `undefined`. [#26327](https://github.com/ant-design/ant-design/pull/26327)
- Cascader
- 🐞 Fix Cascader options not open with search after ESC pressing. [#26271](https://github.com/ant-design/ant-design/pull/26271) [@flyerH](https://github.com/flyerH)
- 💄 Optimize Cascader clear animation. [#26186](https://github.com/ant-design/ant-design/pull/26186)
- 🗑 Remove deprecated `Button.Group` and please use Space component instead. [#26260](https://github.com/ant-design/ant-design/pull/26260)
- Select
- 🆕 Select support `onClear` prop. [#25907](https://github.com/ant-design/ant-design/pull/25907)
- 🐞 Fix Select `mode="tags"` showing duplicated items when search. [#25907](https://github.com/ant-design/ant-design/pull/25907)
- 🐞 Fixed the style exception that was disabled when Select focused. [#26255](https://github.com/ant-design/ant-design/pull/26255)
- 🐞 Fix Select icon overlap with selections when `showArrow` enabled. [#26168](https://github.com/ant-design/ant-design/pull/26168) [@zhangchen915](https://github.com/zhangchen915)
- DatePicker
- 🐞 Fix panel not correct when `picker` changed. [#26093](https://github.com/ant-design/ant-design/issues/26093)
- 🐞 Fix RangePicker do not close panel when click clear icon. [#26188](https://github.com/ant-design/ant-design/issues/26188)
- 🐞 Fix Pagination font family style. [#26230](https://github.com/ant-design/ant-design/pull/26230) [@albertms10](https://github.com/albertms10)
- 🐞 Fix Space children remount in some case. [#26219](https://github.com/ant-design/ant-design/pull/26219)
- Badge
- 💄 Add `@badge-color` less variable. [#26159](https://github.com/ant-design/ant-design/pull/26159)
- 🆕 Badge support `size` prop. [#25851](https://github.com/ant-design/ant-design/pull/25851) [@moonrailgun](https://github.com/moonrailgun)
- 🆕 Tabs `tabBarExtraSlot` support extra position. [#25138](https://github.com/ant-design/ant-design/pull/25138) [@jesse3mh9a](https://github.com/jesse3mh9a)
- 💄 Optimize the display effect of Descriptions when there is more content. [#25903](https://github.com/ant-design/ant-design/pull/25903)
- 🆕 message could be detroied by `message.desctroy(key)`. [#26052](https://github.com/ant-design/ant-design/pull/26052) [@lihqi](https://github.com/lihqi)
- 💄 Adjust InputNumber handler bar to be hidden when `readOnly`. [#25998](https://github.com/ant-design/ant-design/pull/25998)
- Locale
- 🌐 Add Galician locale support. [#26015](https://github.com/ant-design/ant-design/pull/26015) [@barreeeiroo](https://github.com/barreeeiroo)
- 🇱🇹 Add Lithuanian locale support. [#26312](https://github.com/ant-design/ant-design/pull/26312) [@mslotvinskij](https://github.com/mslotvinskij)
- 🌐 Use `kmr_IQ` to replace `ku_IQ`. [#26030](https://github.com/ant-design/ant-design/pull/26030)
- RTL
- 💄 Optimize the connection line style in Tree RTL mode. [#26205](https://github.com/ant-design/ant-design/pull/26205)
- 💄 Optimize Dropdown RTL writing to avoid dark mode style overlays. [#26206](https://github.com/ant-design/ant-design/pull/26206)
- TypeScript
- 🤖 Fix Form.Item `initialValue` missing definition. [#26292](https://github.com/ant-design/ant-design/pull/26292) [@miaoyuxinbaby](https://github.com/miaoyuxinbaby)
- 🤖 Form support generic type. [#25937](https://github.com/ant-design/ant-design/pull/25937)
## 4.5.4
`2020-08-12`
- 🐞 Fix Form.Item `hidden` not working in less. [#26152](https://github.com/ant-design/ant-design/pull/26152)
- 🐞 Fix Dropdown render issue when `overlay` is string. [#26135](https://github.com/ant-design/ant-design/pull/26135)
- 🐞 Fix Table pagination disappear when last record in last page is deleted. [#26133](https://github.com/ant-design/ant-design/pull/26133) [@QoVoQ](https://github.com/QoVoQ)
- Tree
- 🐞 Fix Tree.DirectoryTree can not use `scrollTo` with ref. [#26129](https://github.com/ant-design/ant-design/pull/26129)
- 🐞 Fix Tree lost line between top level nodes when enable `showLine`. [#25991](https://github.com/ant-design/ant-design/pull/25991) [@zhangchen915](https://github.com/zhangchen915)
- 💄 Add `@badge-color` less variable. [#26159](https://github.com/ant-design/ant-design/pull/26159)
- RTL
- 🐞 Fixed Input.Search border style in RTL mode. [#26156](https://github.com/ant-design/ant-design/pull/26156)
- 🐞 Fix the style of Input when `addonBefore` in RTL mode. [#26153](https://github.com/ant-design/ant-design/pull/26153)
- 🐞 Fix multiple style issues for DatePicker in RTL mode. [#26149](https://github.com/ant-design/ant-design/pull/26149) [#26157](https://github.com/ant-design/ant-design/pull/26157) [#26158](https://github.com/ant-design/ant-design/pull/26158)
- TypeScript
- 🐞 Fix Slider `handleStyle` and `trackStyle` TypeScript definitions. [#26160](https://github.com/ant-design/ant-design/pull/26160)
## 4.5.3
`2020-08-08`
- Menu
- 🐞 Fix horizontal Menu dark `theme` style under dark theme. [#26062](https://github.com/ant-design/ant-design/pull/26062)
- 🐞 Fix the position of the horizontal Menu in dark theme and RTL mode. [#26032](https://github.com/ant-design/ant-design/pull/26032)
- Table
- 🐞 Fix Table crash when `dataSource` contains number. [#26042](https://github.com/ant-design/ant-design/pull/26042)
- 🐞 Fix Table empty filters throw warning. [#26001](https://github.com/ant-design/ant-design/pull/26001)
- Form
- 🐞 Fix Form.Item `hidden` not work with `noStyle`. [#26020](https://github.com/ant-design/ant-design/pull/26020)
- 💄 Fix Form.Item margin is uncorrect in compact mode. [#26069](https://github.com/ant-design/ant-design/pull/26069)
- Transfer
- 🐞 Fix the mouse style of the head dropDown when Transfer is `disabled`. [#26005](https://github.com/ant-design/ant-design/pull/26005)
- 🐞 Fix the problem that Pagination is not `disabled` when Transfer is `disabled`. [#26009](https://github.com/ant-design/ant-design/pull/26009)
- Cascader
- 💄 Cascader selector down arrow doesn't rotate. [#26078](https://github.com/ant-design/ant-design/pull/26078) [@07akioni](https://github.com/07akioni)
- 🐞 Fix Cascader text overflow bug in Firefox. [#26011](https://github.com/ant-design/ant-design/pull/26011)
- 🐞 Fix the problem that the color of mouse hover border is abnormal when Cascader is `disabled`. [#25970](https://github.com/ant-design/ant-design/pull/25970)
- Select
- 💄 Optimize the `disabled` style of Select multiple mode. [#25980](https://github.com/ant-design/ant-design/pull/25980)
- 🐞 Fix the mouse style of custom icon when Select is `disabled`. [#26002](https://github.com/ant-design/ant-design/pull/26002)
- 🐞 Fix Breadcrumb.Item lost separator after wrapping in component. [#25984](https://github.com/ant-design/ant-design/pull/25984) [@flyerH](https://github.com/flyerH)
- 🐞 Fix InputNumber dark theme handler background color. [#26072](https://github.com/ant-design/ant-design/pull/26072)
- 🐞 Fix the missing `key` of Avatar.Group. [#26098](https://github.com/ant-design/ant-design/pull/26098)
- 💄 Adjusts Mentions `readOnly` mouse style to native style. [#25977](https://github.com/ant-design/ant-design/pull/25977)
- 💄 Add `@btn-line-height`. [#26014](https://github.com/ant-design/ant-design/pull/26014)
- 💄 Optimize Pagination style when `simple` type and `disabled`. [#26008](https://github.com/ant-design/ant-design/pull/26008)
- 🐞 Fix Modal `useModal` missing style issue. [#25967](https://github.com/ant-design/ant-design/pull/25967)
- 🐞 Fix Steps RTL style when use `progress`. [#26075](https://github.com/ant-design/ant-design/pull/26075)
- 🌐 Improve Arabic locale. [#26094](https://github.com/ant-design/ant-design/pull/26094) [@Mohelm97](https://github.com/Mohelm97)
- 🌐 Improve fr_FR localization. [#26034](https://github.com/ant-design/ant-design/pull/26034) [@Thanaen](https://github.com/Thanaen)
## 4.5.2
`2020-08-02`

View File

@@ -15,6 +15,141 @@ timeline: true
---
## 4.6.2
`2020-08-31`
- Upload
- 🐞 修复 Upload 在受控模式下同步更新导致的状态错误问题。[#26481](https://github.com/ant-design/ant-design/pull/26481)
- 💄 修复 Upload 图片样式在 Form.Item 中有异常 margin 的问题。[#26367](https://github.com/ant-design/ant-design/pull/26367)
- 💄 修复 Select focus 状态样式无阴影。[#26465](https://github.com/ant-design/ant-design/pull/26465) [@Rainy](https://github.com/Rainy)
- Table
- 🐞 修复 Table Pagination 展示于上侧且没有数据时不消失的问题。[#26143](https://github.com/ant-design/ant-design/pull/26143) [@zhangchen915](https://github.com/zhangchen915)
- 💄 修复 Table 展开图标在 `@font-size-base``12px` 时样式错位的问题。[#26409](https://github.com/ant-design/ant-design/pull/26409)
- Space
- 🐞 修复 Space 不支持 React.Fragment 的问题。[#26444](https://github.com/ant-design/ant-design/pull/26444)
- 🐞 修复 Space 在 `children` 中包含空节点时会出现空 dom 的问题。[#26389](https://github.com/ant-design/ant-design/pull/26389)
- 🐞 修复 Badge 在 `status``color` 为空时不展示。[#26375](https://github.com/ant-design/ant-design/pull/26375) [@zhangchen915](https://github.com/zhangchen915)
- 💄 修复 Tree `draggable` 切换时样式 transition 变化的问题。[#26387](https://github.com/ant-design/ant-design/pull/26387)
- 🐞 修复使用主题有时会报 `colorPalette is not defined` 的问题。[#26395](https://github.com/ant-design/ant-design/pull/26395)
- TypeScript
- 🐞 修复 TimePicker.RangePicker 定义需要 `picker` 的问题。[#26446](https://github.com/ant-design/ant-design/pull/26446)
- 🐞 Upload 组件 `showUploadList` 类型添加 `removeIcon``downloadIcon` 属性声明。[#26406](https://github.com/ant-design/ant-design/pull/26406) [@bencallaway](https://github.com/bencallaway)
- RTL
- 🐞 修复 Col RTL 样式。[#26479](https://github.com/ant-design/ant-design/pull/26479) [#26482](https://github.com/ant-design/ant-design/pull/26482) [@TrueMoein](https://github.com/TrueMoein)
## 4.6.1
`2020-08-24`
- TypeScript
- 🐞 修复 Upload 类型声明丢失 `children` 的问题。[#26347](https://github.com/ant-design/ant-design/pull/26347)
## 4.6.0
`2020-08-23`
- 💄 加深默认文本 `@text-color` 以满足 WCAG 2.0 对比度的规范。[#25630](https://github.com/ant-design/ant-design/pull/25630)
- 🔥 新增图片组件 Image。[#26296](https://github.com/ant-design/ant-design/pull/26296)
- 🔥 Table 新增 `sticky` 属性以支持固定表头和滚动条。[#25939](https://github.com/ant-design/ant-design/pull/25939)
- Form
- 🆕 Form 添加 `requiredMark` 属性以支持设置必选样式,废弃原 `hideRequiredMark`。[#26309](https://github.com/ant-design/ant-design/pull/26309)
- 🆕 Form.List 中的 `add` 方法支持第二个 `index` 参数。[#26081](https://github.com/ant-design/ant-design/pull/26081)
- 🆕 虚拟滚动支持无闪动滚动,修复 Select/TreeSelect 滚动时列表空白的问题。[#26306](https://github.com/ant-design/ant-design/pull/26306)
- Typography
- 🆕 新增 Typography.Text `success` 类型。[#26145](https://github.com/ant-design/ant-design/pull/26145) [@llwslc](https://github.com/llwslc)
- 🆕 Typography `copyable` 支持隐藏提示,`editable` 支持设置图标与提示。[#25953](https://github.com/ant-design/ant-design/pull/25953) [@llwslc](https://github.com/llwslc)
- 🆕 新增 Typography.Title 5 级标题。[#25861](https://github.com/ant-design/ant-design/pull/25861)
- 🆕 Typography 的 `editable` 配置中增加了 `maxLength``autoSize` 属性。[#25373](https://github.com/ant-design/ant-design/pull/25373) [@CornerSkyless](https://github.com/CornerSkyless)
- 🐞 修复 Transfer 搜索空格时 `filterOption` 没有触发的问题。[#26335](https://github.com/ant-design/ant-design/pull/26335)
- Progress
- 🐞 修复 Progress `steps` 属性对于 `trailColor` 不生效的问题。[#26323](https://github.com/ant-design/ant-design/pull/26323)
- 🐞 修复 Progress 当 `type="circle"``success.percent` 不生效的问题。[#26307](https://github.com/ant-design/ant-design/pull/26307)
- 🐞 修复 Textarea 当 `value``undefined` 时未显示 `defaultValue` 问题。[#26327](https://github.com/ant-design/ant-design/pull/26327)
- Cascader
- 🐞 修复 Cascader 在按下 ESC 键,然后通过输入进行搜索时 `options` 不展开的问题。[#26271](https://github.com/ant-design/ant-design/pull/26271) [@flyerH](https://github.com/flyerH)
- 💄 优化 Cascader 清除动画效果。[#26186](https://github.com/ant-design/ant-design/pull/26186)
- 🗑 移除遗留的 Button.Group 支持,请使用 Space 代替。[#26260](https://github.com/ant-design/ant-design/pull/26260)
- Select
- 🆕 Select 支持 `onClear` 属性。[#25907](https://github.com/ant-design/ant-design/pull/25907)
- 🐞 修复 Select `mode="tags"` 搜索显示两条重复条目的问题。[#25907](https://github.com/ant-design/ant-design/pull/25907)
- 🐞 修复 Select 聚焦时被禁用的样式异常问题。[#26255](https://github.com/ant-design/ant-design/pull/26255)
- 🐞 修复多选模式的 Select 在 `showArrow` 时图标重叠问题。[#26168](https://github.com/ant-design/ant-design/pull/26168) [@zhangchen915](https://github.com/zhangchen915)
- DatePicker
- 🐞 修复 `picker` 属性改变时渲染面板不会改变的问题。[#26093](https://github.com/ant-design/ant-design/issues/26093)
- 🐞 修复 RangePicker 点击清除按钮面板不会关闭的问题。[#26188](https://github.com/ant-design/ant-design/issues/26188)
- 🐞 修复 Pagination 字体相关样式问题。[#26230](https://github.com/ant-design/ant-design/pull/26230) [@albertms10](https://github.com/albertms10)
- 🐞 修复 Space `children` 有时会重新渲染的问题。[#26219](https://github.com/ant-design/ant-design/pull/26219)
- Badge
- 💄 新增 `@badge-color` less 变量。[#26159](https://github.com/ant-design/ant-design/pull/26159)
- 🆕 Badge 新增 `size` 属性用于设置大小。[#25851](https://github.com/ant-design/ant-design/pull/25851) [@moonrailgun](https://github.com/moonrailgun)
- 🆕 Tabs 可自定义`tabBarExtraContent` 的渲染位置。[#25138](https://github.com/ant-design/ant-design/pull/25138) [@jesse3mh9a](https://github.com/jesse3mh9a)
- 💄 优化 Descriptions 在内容比较多时的显示效果。[#25903](https://github.com/ant-design/ant-design/pull/25903)
- 🆕 message 支持通过 `message.desctroy(key)` 销毁。[#26052](https://github.com/ant-design/ant-design/pull/26052) [@lihqi](https://github.com/lihqi)
- 💄 调整 InputNumber 操作栏在 `readOnly` 时为隐藏。[#25998](https://github.com/ant-design/ant-design/pull/25998)
- 国际化
- 🌐 添加加利西亚语支持。[#26015](https://github.com/ant-design/ant-design/pull/26015) [@barreeeiroo](https://github.com/barreeeiroo)
- 🇱🇹 添加立陶宛语支持。[#26312](https://github.com/ant-design/ant-design/pull/26312) [@mslotvinskij](https://github.com/mslotvinskij)
- 🌐 新增 `kmr_IQ` 语言包用以代替 ku_IQ。[#26030](https://github.com/ant-design/ant-design/pull/26030)
- RTL
- 💄 优化 Tree RTL 模式下连接线的样式。[#26205](https://github.com/ant-design/ant-design/pull/26205)
- 💄 优化 Dropdown RTL 写法避免暗黑模式样式覆盖。[#26206](https://github.com/ant-design/ant-design/pull/26206)
- TypeScript
- 🤖 修复 Form.Item `initialValue` 定义丢失问题。[#26292](https://github.com/ant-design/ant-design/pull/26292) [@miaoyuxinbaby](https://github.com/miaoyuxinbaby)
- 🤖 Form 支持泛型。[#25937](https://github.com/ant-design/ant-design/pull/25937)
## 4.5.4
`2020-08-12`
- 🐞 修复 Form.Item 在 `hidden` 时引用 less 样式时失效的问题。[#26152](https://github.com/ant-design/ant-design/pull/26152)
- 🐞 修复 Dropdown `overlay` 为 string 时渲染错误的问题。[#26135](https://github.com/ant-design/ant-design/pull/26135)
- 🐞 修复 Table 删除最后一页的最后一条记录时分页消失的问题。[#26133](https://github.com/ant-design/ant-design/pull/26133) [@QoVoQ](https://github.com/QoVoQ)
- Tree
- 🐞 修复 Tree.DirectoryTree 不能通过 `ref` 调用 `scrollTo` 的问题。[#26129](https://github.com/ant-design/ant-design/pull/26129)
- 🐞 修复 Tree 开启 `showLine` 时顶级节点间缺少连接线的问题。[#25991](https://github.com/ant-design/ant-design/pull/25991) [@zhangchen915](https://github.com/zhangchen915)
- 💄 新增 `@badge-color` less 变量。[#26159](https://github.com/ant-design/ant-design/pull/26159)
- RTL
- 🐞 修复 Input.Search 在 RTL 模式下的边框样式。[#26156](https://github.com/ant-design/ant-design/pull/26156)
- 🐞 修复 Input 在 RTL 模式下 `addonBefore` 的样式问题。[#26153](https://github.com/ant-design/ant-design/pull/26153)
- 🐞 修复 DatePicker 在 RTL 模式下的多个样式问题。[#26149](https://github.com/ant-design/ant-design/pull/26149) [#26157](https://github.com/ant-design/ant-design/pull/26157) [#26158](https://github.com/ant-design/ant-design/pull/26158)
- TypeScript
- 🐞 修复 Slider `handleStyle``trackStyle` 属性的类型定义。[#26160](https://github.com/ant-design/ant-design/pull/26160)
## 4.5.3
`2020-08-08`
- Menu
- 🐞 修复水平 Menu 黑暗 `theme` 在暗黑主题下的样式。[#26062](https://github.com/ant-design/ant-design/pull/26062)
- 🐞 修复水平方向 Menu 在暗黑主题 RTL 模式下的位置。[#26032](https://github.com/ant-design/ant-design/pull/26032)
- Table
- 🐞 修复 Table `dataSource` 中含有非法数值时会报错的问题。[#26042](https://github.com/ant-design/ant-design/pull/26042)
- 🐞 修复 Table 空筛选项在控制台抛出 warning 的问题。[#26001](https://github.com/ant-design/ant-design/pull/26001)
- Form
- 🐞 修复 Form.Item `hidden` 不能和 `noStyle` 一同使用的问题。[#26020](https://github.com/ant-design/ant-design/pull/26020)
- 💄 修复 Form 紧凑模式下表单项 margin 计算错误。[#26069](https://github.com/ant-design/ant-design/pull/26069)
- Transfer
- 🐞 修复 Transfer 禁用时分页未禁用的问题。[#26009](https://github.com/ant-design/ant-design/pull/26009)
- 🐞 修复 Transfer 禁用时头部下拉按钮的鼠标样式。[#26005](https://github.com/ant-design/ant-design/pull/26005)
- Cascader
- 🐞 修复 Cascader 在 Firefox 下文本和箭头重叠的问题。[#26011](https://github.com/ant-design/ant-design/pull/26011)
- 💄 Cascader 的选择器箭头不再旋转。[#26078](https://github.com/ant-design/ant-design/pull/26078) [@07akioni](https://github.com/07akioni)
- 🐞 修复 Cascader 禁用时鼠标悬浮边框颜色异常的问题。[#25970](https://github.com/ant-design/ant-design/pull/25970)
- Select
- 💄 优化 Select 多选模式 `disabled` 样式。[#25980](https://github.com/ant-design/ant-design/pull/25980)
- 🐞 修复 Select 禁用时自定义图标的鼠标样式。[#26002](https://github.com/ant-design/ant-design/pull/26002)
- 🐞 修复 Breadcrumb.Item 封装后丢失分隔符的问题。[#25984](https://github.com/ant-design/ant-design/pull/25984) [@flyerH](https://github.com/flyerH)
- 🐞 修复 Avatar.Group key 缺失的问题。[#26098](https://github.com/ant-design/ant-design/pull/26098)
- 💄 调整 Mentions `readOnly` 鼠标样式为原生样式。[#25977](https://github.com/ant-design/ant-design/pull/25977)
- 💄 新增 `@btn-line-height` 变量。[#26014](https://github.com/ant-design/ant-design/pull/26014)
- 💄 优化 Pagination 简洁分页禁用样式。[#26008](https://github.com/ant-design/ant-design/pull/26008)
- 🐞 修复 Modal `useModal` 丢失样式的问题。[#25967](https://github.com/ant-design/ant-design/pull/25967)
- 🐞 修复 InputNumber 暗黑主题下操作栏背景色。[#26072](https://github.com/ant-design/ant-design/pull/26072)
- 🐞 修复 Steps 使用 `progress` 时的 RTL 样式问题。[#26075](https://github.com/ant-design/ant-design/pull/26075)
- 🌐 改进阿拉伯语 Arabic 的国际化。[#26094](https://github.com/ant-design/ant-design/pull/26094) [@Mohelm97](https://github.com/Mohelm97)
- 🌐 改进法语 fr_FR 国际化。[#26034](https://github.com/ant-design/ant-design/pull/26034) [@Thanaen](https://github.com/Thanaen)
## 4.5.2
`2020-08-02`
@@ -160,11 +295,10 @@ timeline: true
- Table
- 🆕 Table 添加 `rowSelection.dirty` 以支持异步数据下保留 `key`。[#24718](https://github.com/ant-design/ant-design/pull/24718)
- 🆕 Table `onChange` 添加 `action` 参数用于标示操作类型。[#24697](https://github.com/ant-design/ant-design/pull/24697)
- 🐞 Table 支持 `rowSelection.checkStrictly` 来完全受控节点。[#24931](https://github.com/ant-design/ant-design/pull/24931)
- 🐞 Table 支持 `rowSelection.checkStrictly`,现在父子节点选择状态可以关联了。[#24931](https://github.com/ant-design/ant-design/pull/24931)
- 🐞 修复 Table `onSelectAll``changeRows` 参数不正确的问题。[#24931](https://github.com/ant-design/ant-design/pull/24931)
- 🐞 修复 Table 树形数据叶节点行的展开按钮仍能被点击的问题。[#24931](https://github.com/ant-design/ant-design/pull/24931)
- 🐞 修复 Table 展开图标隐藏时仍然有鼠标手型的问题。[#25170](https://github.com/ant-design/ant-design/pull/25170)
- 🐞 修复 Table 展开图标隐藏时仍然有鼠标手型的问题。[#25170](https://github.com/ant-design/ant-design/pull/25170)
- TimePicker
- 🐞 修复 TimePicker 面板 12 AM 显示为 0 AM 的问题。[#25174](https://github.com/ant-design/ant-design/pull/25174)
- 🐞 修复 TimePicker 在 use12Hours 时没有用 0 23 来禁用小时的问题。[#25174](https://github.com/ant-design/ant-design/pull/25174)

View File

@@ -23,7 +23,7 @@ stages:
- task: NodeTool@0
displayName: 'Install Node.js'
inputs:
versionSpec: '12.13.1'
versionSpec: '14.7.0'
- script: npm install
displayName: 'Install modules'
- script: |
@@ -53,7 +53,7 @@ stages:
- task: NodeTool@0
displayName: 'Install Node.js'
inputs:
versionSpec: '12.13.1'
versionSpec: '14.7.0'
- script: npm install
displayName: 'Install modules'
- script: |
@@ -71,7 +71,7 @@ stages:
- task: NodeTool@0
displayName: 'Install Node.js'
inputs:
versionSpec: '12.16.3'
versionSpec: '14.7.0'
- script: npm install
displayName: 'Install modules'
- script: |
@@ -98,7 +98,7 @@ stages:
- task: NodeTool@0
displayName: 'Install Node.js'
inputs:
versionSpec: '12.13.1'
versionSpec: '14.7.0'
- script: npm install
displayName: 'Install modules'
- task: DownloadPipelineArtifact@2

View File

@@ -29,6 +29,7 @@ Array [
"Form",
"Grid",
"Input",
"Image",
"InputNumber",
"Layout",
"List",

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
export default function useForceUpdate() {
const [, forceUpdate] = React.useReducer(x => x + 1, 0);
return forceUpdate;
}

View File

@@ -0,0 +1,18 @@
import * as React from 'react';
import useForceUpdate from './useForceUpdate';
type UseSyncStateProps<T> = [() => T, (newValue: T) => void];
export default function useSyncState<T>(initialValue: T): UseSyncStateProps<T> {
const ref = React.useRef<T>(initialValue);
const forceUpdate = useForceUpdate();
return [
() => ref.current,
(newValue: T) => {
ref.current = newValue;
// re-render
forceUpdate();
},
];
}

View File

@@ -1,36 +1,14 @@
import * as React from 'react';
type MotionFunc = (element: HTMLElement) => React.CSSProperties;
type MotionEndFunc = (element: HTMLElement, event: TransitionEvent) => boolean;
interface Motion {
visible?: boolean;
motionName?: string; // It also support object, but we only use string here.
motionAppear?: boolean;
motionEnter?: boolean;
motionLeave?: boolean;
motionLeaveImmediately?: boolean; // Trigger leave motion immediately
motionDeadline?: number;
removeOnLeave?: boolean;
leavedClassName?: string;
onAppearStart?: MotionFunc;
onAppearActive?: MotionFunc;
onAppearEnd?: MotionEndFunc;
onEnterStart?: MotionFunc;
onEnterActive?: MotionFunc;
onEnterEnd?: MotionEndFunc;
onLeaveStart?: MotionFunc;
onLeaveActive?: MotionFunc;
onLeaveEnd?: MotionEndFunc;
}
import { CSSMotionProps } from 'rc-motion';
import { MotionEventHandler, MotionEndEventHandler } from 'rc-motion/lib/CSSMotion';
// ================== Collapse Motion ==================
const getCollapsedHeight: MotionFunc = () => ({ height: 0, opacity: 0 });
const getRealHeight: MotionFunc = node => ({ height: node.scrollHeight, opacity: 1 });
const getCurrentHeight: MotionFunc = node => ({ height: node.offsetHeight });
const skipOpacityTransition: MotionEndFunc = (_, event) => event.propertyName === 'height';
const getCollapsedHeight: MotionEventHandler = () => ({ height: 0, opacity: 0 });
const getRealHeight: MotionEventHandler = node => ({ height: node.scrollHeight, opacity: 1 });
const getCurrentHeight: MotionEventHandler = node => ({ height: node.offsetHeight });
const skipOpacityTransition: MotionEndEventHandler = (_, event) =>
(event as TransitionEvent).propertyName === 'height';
const collapseMotion: Motion = {
const collapseMotion: CSSMotionProps = {
motionName: 'ant-motion-collapse',
onAppearStart: getCollapsedHeight,
onEnterStart: getCollapsedHeight,

View File

@@ -13,6 +13,7 @@ class AffixMounter extends React.Component<{
offsetBottom?: number;
offsetTop?: number;
onTestUpdatePosition?(): void;
onChange?: () => void;
}> {
private container: HTMLDivElement;
@@ -131,13 +132,15 @@ describe('Affix Render', () => {
it('updatePosition when offsetTop changed', async () => {
document.body.innerHTML = '<div id="mounter" />';
const onChange = jest.fn();
affixMounterWrapper = mount(<AffixMounter offsetTop={0} />, {
affixMounterWrapper = mount(<AffixMounter offsetTop={0} onChange={onChange} />, {
attachTo: document.getElementById('mounter'),
});
await sleep(20);
await movePlaceholder(-100);
expect(onChange).toHaveBeenLastCalledWith(true);
expect(affixMounterWrapper.instance().affix.state.affixStyle?.top).toBe(0);
affixMounterWrapper.setProps({
offsetTop: 10,

View File

@@ -2,7 +2,7 @@
order: 99
title:
zh-CN: 调整浏览器大小,观察 Affix 容器是否发生变化。跟随变化为正常。#17678
en-US:
en-US: debug
debug: true
---

View File

@@ -19,8 +19,8 @@ Please note that Affix should not cover other content on the page, especially wh
| --- | --- | --- | --- |
| offsetBottom | Offset from the bottom of the viewport (in pixels) | number | - |
| offsetTop | Offset from the top of the viewport (in pixels) | number | 0 |
| onChange | Callback for when Affix state is changed | function(affixed) | - |
| target | Specifies the scrollable area DOM node | () => HTMLElement | () => window |
| onChange | Callback for when Affix state is changed | Function(affixed) | - |
**Note:** Children of `Affix` must not have the property `position: absolute`, but you can set `position: absolute` on `Affix` itself:

View File

@@ -20,8 +20,8 @@ cover: https://gw.alipayobjects.com/zos/alicdn/tX6-md4H6/Affix.svg
| --- | --- | --- | --- |
| offsetBottom | 距离窗口底部达到指定偏移量后触发 | number | - |
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | number | - |
| onChange | 固定状态改变时触发的回调函数 | function(affixed) | - |
| target | 设置 `Affix` 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 | () => HTMLElement | () => window |
| onChange | 固定状态改变时触发的回调函数 | Function(affixed) | - |
**注意:**`Affix` 内的元素不要使用绝对定位,如需要绝对定位的效果,可以直接设置 `Affix` 为绝对定位:

View File

@@ -21,20 +21,17 @@ describe('Alert', () => {
it('could be closed', () => {
const onClose = jest.fn();
const afterClose = jest.fn();
const wrapper = mount(
<Alert
message="Warning Text Warning Text Warning TextW arning Text Warning Text Warning TextWarning Text"
type="warning"
closable
onClose={onClose}
afterClose={afterClose}
/>,
);
wrapper.find('.ant-alert-close-icon').simulate('click');
expect(onClose).toHaveBeenCalled();
jest.runAllTimers();
expect(afterClose).toHaveBeenCalled();
expect(onClose).toHaveBeenCalled();
});
describe('data and aria props', () => {

View File

@@ -8,7 +8,7 @@ import CheckCircleFilled from '@ant-design/icons/CheckCircleFilled';
import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled';
import InfoCircleFilled from '@ant-design/icons/InfoCircleFilled';
import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled';
import Animate from 'rc-animate';
import CSSMotion from 'rc-motion';
import classNames from 'classnames';
import { ConfigContext } from '../config-provider';
@@ -75,12 +75,12 @@ const Alert: AlertInterface = ({
onMouseEnter,
onMouseLeave,
onClick,
afterClose,
showIcon,
closable,
closeText,
...props
}) => {
const [closing, setClosing] = React.useState(false);
const [closed, setClosed] = React.useState(false);
const ref = React.useRef<HTMLElement>();
@@ -88,14 +88,8 @@ const Alert: AlertInterface = ({
const prefixCls = getPrefixCls('alert', customizePrefixCls);
const handleClose = (e: React.MouseEvent<HTMLButtonElement>) => {
setClosing(true);
props.onClose?.(e);
};
const animationEnd = () => {
setClosing(false);
setClosed(true);
props.afterClose?.();
props.onClose?.(e);
};
const getType = () => {
@@ -149,7 +143,6 @@ const Alert: AlertInterface = ({
prefixCls,
`${prefixCls}-${type}`,
{
[`${prefixCls}-closing`]: closing,
[`${prefixCls}-with-description`]: !!description,
[`${prefixCls}-no-icon`]: !isShowIcon,
[`${prefixCls}-banner`]: !!banner,
@@ -161,30 +154,36 @@ const Alert: AlertInterface = ({
const dataOrAriaProps = getDataOrAriaProps(props);
return closed ? null : (
<Animate
component=""
showProp="data-show"
transitionName={`${prefixCls}-slide-up`}
onEnd={animationEnd}
return (
<CSSMotion
visible={!closed}
motionName={`${prefixCls}-motion`}
motionAppear={false}
motionEnter={false}
onLeaveStart={node => ({
maxHeight: node.offsetHeight,
})}
onLeaveEnd={afterClose}
>
<div
ref={ref}
data-show={!closing}
className={alertCls}
style={style}
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
onClick={onClick}
role="alert"
{...dataOrAriaProps}
>
{isShowIcon ? renderIconNode() : null}
<span className={`${prefixCls}-message`}>{message}</span>
<span className={`${prefixCls}-description`}>{description}</span>
{renderCloseIcon()}
</div>
</Animate>
{({ className: motionClassName, style: motionStyle }) => (
<div
ref={ref}
data-show={!closed}
className={classNames(alertCls, motionClassName)}
style={{ ...style, ...motionStyle }}
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
onClick={onClick}
role="alert"
{...dataOrAriaProps}
>
{isShowIcon ? renderIconNode() : null}
<span className={`${prefixCls}-message`}>{message}</span>
<span className={`${prefixCls}-description`}>{description}</span>
{renderCloseIcon()}
</div>
)}
</CSSMotion>
);
};

View File

@@ -7,7 +7,6 @@
.reset-component;
position: relative;
max-height: 1000vh;
padding: 8px 15px 8px 37px;
word-wrap: break-word;
border-radius: @border-radius-base;
@@ -146,18 +145,20 @@
display: block;
}
&&-closing {
max-height: 0;
margin: 0;
padding-top: 0;
padding-bottom: 0;
transform-origin: 50% 0;
transition: all 0.3s @ease-in-out-circ;
&&-motion-leave {
overflow: hidden;
opacity: 1;
transition: max-height 0.3s @ease-in-out-circ, opacity 0.3s @ease-in-out-circ,
padding-top 0.3s @ease-in-out-circ, padding-bottom 0.3s @ease-in-out-circ,
margin-bottom 0.3s @ease-in-out-circ;
}
&-slide-up-leave {
animation: antAlertSlideUpOut 0.3s @ease-in-out-circ;
animation-fill-mode: both;
&&-motion-leave-active {
max-height: 0;
margin-bottom: 0 !important;
padding-top: 0;
padding-bottom: 0;
opacity: 0;
}
&-banner {
@@ -167,30 +168,4 @@
}
}
@keyframes antAlertSlideUpIn {
0% {
transform: scaleY(0);
transform-origin: 0% 0%;
opacity: 0;
}
100% {
transform: scaleY(1);
transform-origin: 0% 0%;
opacity: 1;
}
}
@keyframes antAlertSlideUpOut {
0% {
transform: scaleY(1);
transform-origin: 0% 0%;
opacity: 1;
}
100% {
transform: scaleY(0);
transform-origin: 0% 0%;
opacity: 0;
}
}
@import './rtl';

View File

@@ -30,7 +30,7 @@ exports[`AutoComplete legacy dataSource should accept react element option 1`] =
<div>
<div
class="ant-select-dropdown"
style="opacity:0"
style="opacity:0;pointer-events:none"
>
<div>
<div
@@ -48,29 +48,34 @@ exports[`AutoComplete legacy dataSource should accept react element option 1`] =
</div>
</div>
<div
class=""
style="height:256px"
class="rc-virtual-list"
style="position:relative"
>
<div>
<div
class=""
style="display:flex;flex-direction:column"
>
<div
class="rc-virtual-list-holder"
style="max-height:256px;overflow-y:auto;overflow-anchor:none"
>
<div>
<div
aria-selected="false"
class="ant-select-item ant-select-item-option ant-select-item-option-active"
class="rc-virtual-list-holder-inner"
style="display:flex;flex-direction:column"
>
<div
class="ant-select-item-option-content"
aria-selected="false"
class="ant-select-item ant-select-item-option ant-select-item-option-active"
>
ReactNode
<div
class="ant-select-item-option-content"
>
ReactNode
</div>
<span
aria-hidden="true"
class="ant-select-item-option-state"
style="user-select:none;-webkit-user-select:none"
unselectable="on"
/>
</div>
<span
aria-hidden="true"
class="ant-select-item-option-state"
style="user-select:none;-webkit-user-select:none"
unselectable="on"
/>
</div>
</div>
</div>

View File

@@ -24,7 +24,7 @@ When there is a need for autocomplete functionality.
| defaultActiveFirstOption | Whether active first option by default | boolean | true | |
| defaultValue | Initial selected option | string | - | |
| disabled | Whether disabled select | boolean | false | |
| filterOption | If true, filter options by input, if function, filter options against it. The function will receive two arguments, `inputValue` and `option`, if the function returns `true`, the option will be included in the filtered set; Otherwise, it will be excluded | boolean \| function(inputValue, option) | true | |
| filterOption | If true, filter options by input, if function, filter options against it. The function will receive two arguments, `inputValue` and `option`, if the function returns true, the option will be included in the filtered set; Otherwise, it will be excluded | boolean \| function(inputValue, option) | true | |
| placeholder | The placeholder of input | string | - | |
| value | Selected option | string | - | |
| onBlur | Called when leaving the component | function() | - | |

View File

@@ -25,7 +25,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/qtJm4yt45/AutoComplete.svg
| defaultActiveFirstOption | 是否默认高亮第一个选项 | boolean | true | |
| defaultValue | 指定默认选中的条目 | string | - | |
| disabled | 是否禁用 | boolean | false | |
| filterOption | 是否根据输入项进行筛选。当其为一个函数时,会接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 `true`,反之则返回 `false` | boolean \| function(inputValue, option) | true | |
| filterOption | 是否根据输入项进行筛选。当其为一个函数时,会接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 true反之则返回 false | boolean \| function(inputValue, option) | true | |
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](https://codesandbox.io/s/4j168r7jw0) | function(triggerNode) | () => document.body | |
| placeholder | 输入框提示 | string | - | |
| value | 指定当前选中的条目 | string | - | |

View File

@@ -163,10 +163,7 @@ describe('Avatar Render', () => {
const div = global.document.createElement('div');
global.document.body.appendChild(div);
const wrapper = mount(
<Avatar
shape="circle"
src="http://error.url"
>
<Avatar shape="circle" src="http://error.url">
A
</Avatar>,
{ attachTo: div },

View File

@@ -19,16 +19,10 @@ import { Avatar } from 'antd';
ReactDOM.render(
<>
<Avatar
shape="circle"
src="http://abc.com/not-exist.jpg"
>
<Avatar shape="circle" src="http://abc.com/not-exist.jpg">
A
</Avatar>
<Avatar
shape="circle"
src="http://abc.com/not-exist.jpg"
>
<Avatar shape="circle" src="http://abc.com/not-exist.jpg">
ABC
</Avatar>
</>,

View File

@@ -1,6 +1,7 @@
import * as React from 'react';
import classNames from 'classnames';
import toArray from 'rc-util/lib/Children/toArray';
import { cloneElement } from '../_util/reactNode';
import { ConfigContext } from '../config-provider';
import Avatar from './avatar';
import Popover from '../popover';
@@ -28,13 +29,19 @@ const Group: React.FC<GroupProps> = props => {
);
const { children, maxPopoverPlacement = 'top' } = props;
const childrenWithProps = toArray(children);
const childrenWithProps = toArray(children).map((child, index) => {
return cloneElement(child, {
key: `avatar-key-${index}`,
});
});
const numOfChildren = childrenWithProps.length;
if (maxCount && maxCount < numOfChildren) {
const childrenShow = childrenWithProps.slice(0, maxCount);
const childrenHidden = childrenWithProps.slice(maxCount, numOfChildren);
childrenShow.push(
<Popover
key="avatar-popover-key"
content={childrenHidden}
trigger="hover"
placement={maxPopoverPlacement}

View File

@@ -2211,6 +2211,349 @@ exports[`renders ./components/badge/demo/ribbon-debug.md correctly 1`] = `
</div>
`;
exports[`renders ./components/badge/demo/size.md correctly 1`] = `
Array [
<span
class="ant-badge"
>
<a
class="head-example"
href="#"
/>
<sup
class="ant-scroll-number ant-badge-count"
data-show="true"
title="5"
>
<span
class="ant-scroll-number-only"
style="transition:none;-ms-transform:translateY(-1500%);-webkit-transform:translateY(-1500%);transform:translateY(-1500%)"
>
<p
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class="ant-scroll-number-only-unit"
>
5
</p>
<p
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class="ant-scroll-number-only-unit"
>
9
</p>
<p
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class="ant-scroll-number-only-unit current"
>
5
</p>
<p
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class="ant-scroll-number-only-unit"
>
9
</p>
<p
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class="ant-scroll-number-only-unit"
>
5
</p>
<p
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class="ant-scroll-number-only-unit"
>
9
</p>
</span>
</sup>
</span>,
<span
class="ant-badge"
>
<a
class="head-example"
href="#"
/>
<sup
class="ant-scroll-number ant-badge-count ant-badge-count-sm"
data-show="true"
title="5"
>
<span
class="ant-scroll-number-only"
style="transition:none;-ms-transform:translateY(-1500%);-webkit-transform:translateY(-1500%);transform:translateY(-1500%)"
>
<p
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class="ant-scroll-number-only-unit"
>
5
</p>
<p
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class="ant-scroll-number-only-unit"
>
9
</p>
<p
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class="ant-scroll-number-only-unit current"
>
5
</p>
<p
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class="ant-scroll-number-only-unit"
>
9
</p>
<p
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class="ant-scroll-number-only-unit"
>
5
</p>
<p
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class="ant-scroll-number-only-unit"
>
9
</p>
</span>
</sup>
</span>,
]
`;
exports[`renders ./components/badge/demo/status.md correctly 1`] = `
<div>
<span

View File

@@ -65,6 +65,343 @@ exports[`Badge badge should support float number 2`] = `
</Badge>
`;
exports[`Badge render Badge size when contains children 1`] = `
Array [
<span
class="ant-badge"
>
<a />
<sup
class="ant-scroll-number ant-badge-count"
data-show="true"
title="5"
>
<span
class="ant-scroll-number-only"
style="transition:none;-ms-transform:translateY(-1500%);-webkit-transform:translateY(-1500%);transform:translateY(-1500%)"
>
<p
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class="ant-scroll-number-only-unit"
>
5
</p>
<p
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class="ant-scroll-number-only-unit"
>
9
</p>
<p
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class="ant-scroll-number-only-unit current"
>
5
</p>
<p
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class="ant-scroll-number-only-unit"
>
9
</p>
<p
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class="ant-scroll-number-only-unit"
>
5
</p>
<p
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class="ant-scroll-number-only-unit"
>
9
</p>
</span>
</sup>
</span>,
<span
class="ant-badge"
>
<a />
<sup
class="ant-scroll-number ant-badge-count ant-badge-count-sm"
data-show="true"
title="5"
>
<span
class="ant-scroll-number-only"
style="transition:none;-ms-transform:translateY(-1500%);-webkit-transform:translateY(-1500%);transform:translateY(-1500%)"
>
<p
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class="ant-scroll-number-only-unit"
>
5
</p>
<p
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class="ant-scroll-number-only-unit"
>
9
</p>
<p
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class="ant-scroll-number-only-unit current"
>
5
</p>
<p
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class="ant-scroll-number-only-unit"
>
9
</p>
<p
class="ant-scroll-number-only-unit"
>
0
</p>
<p
class="ant-scroll-number-only-unit"
>
1
</p>
<p
class="ant-scroll-number-only-unit"
>
2
</p>
<p
class="ant-scroll-number-only-unit"
>
3
</p>
<p
class="ant-scroll-number-only-unit"
>
4
</p>
<p
class="ant-scroll-number-only-unit"
>
5
</p>
<p
class="ant-scroll-number-only-unit"
>
6
</p>
<p
class="ant-scroll-number-only-unit"
>
7
</p>
<p
class="ant-scroll-number-only-unit"
>
8
</p>
<p
class="ant-scroll-number-only-unit"
>
9
</p>
</span>
</sup>
</span>,
]
`;
exports[`Badge render Badge status/color when contains children 1`] = `
Array [
<span

View File

@@ -140,6 +140,31 @@ describe('Badge', () => {
);
expect(wrapper).toMatchSnapshot();
});
it('Badge should work when status/color is empty string', () => {
const wrapper = mount(
<>
<Badge color="" text="text" />
<Badge status="" text="text" />
</>,
);
expect(wrapper.find('.ant-badge')).toHaveLength(2);
});
it('render Badge size when contains children', () => {
const wrapper = render(
<>
<Badge size="default" count={5}>
<a />
</Badge>
<Badge size="small" count={5}>
<a />
</Badge>
</>,
);
expect(wrapper).toMatchSnapshot();
});
});
describe('Ribbon', () => {

View File

@@ -0,0 +1,30 @@
---
order: 9
title:
zh-CN: 大小
en-US: Size
---
## zh-CN
可以设置有数字徽标的大小。
## en-US
Set size of numeral Badge.
```jsx
import { Badge } from 'antd';
ReactDOM.render(
<>
<Badge size="default" count={5}>
<a href="#" className="head-example" />
</Badge>
<Badge size="small" count={5}>
<a href="#" className="head-example" />
</Badge>
</>,
mountNode,
);
```

View File

@@ -24,6 +24,7 @@ Badge normally appears in proximity to notifications or user avatars with eye-ca
| overflowCount | Max count to show | number | 99 | |
| showZero | Whether to show badge when `count` is zero | boolean | false | |
| status | Set Badge as a status dot | `success` \| `processing` \| `default` \| `error` \| `warning` | - | |
| size | If `count` is set, `size` sets the size of badge | `default` \| `small` | - | 4.6.0 |
| text | If `status` is set, `text` sets the display text of the status `dot` | ReactNode | - | |
| title | Text to show when hovering over the badge | string | - | |

View File

@@ -30,6 +30,7 @@ export interface BadgeProps {
status?: PresetStatusColorType;
color?: LiteralUnion<PresetColorType, string>;
text?: React.ReactNode;
size?: 'default' | 'small';
offset?: [number | string, number | string];
title?: string;
}
@@ -44,6 +45,7 @@ const Badge: CompoundedComponent = ({
count = null,
overflowCount = 99,
dot = false,
size = 'default',
title,
offset,
style,
@@ -60,9 +62,7 @@ const Badge: CompoundedComponent = ({
return displayCount as string | number | null;
};
const hasStatus = (): boolean => {
return !!status || !!color;
};
const hasStatus = (): boolean => (status !== null && status !== undefined) || (color !== null && color !== undefined);
const isZero = () => {
const numberedDisplayCount = getNumberedDisplayCount();
@@ -140,6 +140,7 @@ const Badge: CompoundedComponent = ({
const scrollNumberCls = classNames({
[`${prefixCls}-dot`]: bDot,
[`${prefixCls}-count`]: !bDot,
[`${prefixCls}-count-sm`]: size === 'small',
[`${prefixCls}-multiple-words`]:
!bDot && count && count.toString && count.toString().length > 1,
[`${prefixCls}-status-${status}`]: !!status,

View File

@@ -25,6 +25,7 @@ cover: https://gw.alipayobjects.com/zos/antfincdn/6%26GF9WHwvY/Badge.svg
| overflowCount | 展示封顶的数字值 | number | 99 | |
| showZero | 当数值为 0 时,是否展示 Badge | boolean | false | |
| status | 设置 Badge 为状态点 | `success` \| `processing` \| `default` \| `error` \| `warning` | - | |
| size | 在设置了 `count` 的前提下有效,设置小圆点的大小 | `default` \| `small` | - | 4.6.0 |
| text | 在设置了 `status` 的前提下有效,设置状态点的文本 | ReactNode | - | |
| title | 设置鼠标放在状态点上时显示的文字 | string | - | |

View File

@@ -23,7 +23,7 @@
line-height: @badge-height;
white-space: nowrap;
text-align: center;
background: @highlight-color;
background: @badge-color;
border-radius: @badge-height / 2;
box-shadow: 0 0 0 1px @shadow-color-inverse;
a,
@@ -32,6 +32,15 @@
}
}
&-count-sm {
min-width: @badge-height-sm;
height: @badge-height-sm;
padding: 0;
font-size: @badge-font-size-sm;
line-height: @badge-height-sm;
border-radius: @badge-height-sm / 2;
}
&-multiple-words {
padding: 0 8px;
}

View File

@@ -17,7 +17,7 @@ interface BreadcrumbItemInterface extends React.FC<BreadcrumbItemProps> {
}
const BreadcrumbItem: BreadcrumbItemInterface = ({
prefixCls: customizePrefixCls,
separator,
separator = '/',
children,
overlay,
dropdownProps,

View File

@@ -138,4 +138,23 @@ describe('Breadcrumb', () => {
);
expect(wrapper).toMatchSnapshot();
});
// https://github.com/ant-design/ant-design/issues/25975
it('should support Breadcrumb.Item default separator', () => {
const MockComponent = () => {
return (
<span>
<Breadcrumb.Item>Mock Node</Breadcrumb.Item>
</span>
);
};
const wrapper = render(
<Breadcrumb>
<Breadcrumb.Item>Location</Breadcrumb.Item>
<MockComponent />
<Breadcrumb.Item>Application Center</Breadcrumb.Item>
</Breadcrumb>,
);
expect(wrapper).toMatchSnapshot();
});
});

View File

@@ -185,6 +185,51 @@ exports[`Breadcrumb should render a menu 1`] = `
</div>
`;
exports[`Breadcrumb should support Breadcrumb.Item default separator 1`] = `
<div
class="ant-breadcrumb"
>
<span>
<span
class="ant-breadcrumb-link"
>
Location
</span>
<span
class="ant-breadcrumb-separator"
>
/
</span>
</span>
<span>
<span>
<span
class="ant-breadcrumb-link"
>
Mock Node
</span>
<span
class="ant-breadcrumb-separator"
>
/
</span>
</span>
</span>
<span>
<span
class="ant-breadcrumb-link"
>
Application Center
</span>
<span
class="ant-breadcrumb-separator"
>
/
</span>
</span>
</div>
`;
exports[`Breadcrumb should support React.Fragment and falsy children 1`] = `
<div
class="ant-breadcrumb"

View File

@@ -11,7 +11,7 @@ title:
## en-US
The simplest use
The simplest use.
```jsx
import { Breadcrumb } from 'antd';

View File

@@ -11,7 +11,7 @@ title:
## en-US
The separator can be customized by setting the separator property: `Breadcrumb.Separator`
The separator can be customized by setting the separator property: `Breadcrumb.Separator`.
```jsx
import { Breadcrumb } from 'antd';

View File

@@ -11,7 +11,7 @@ title:
## en-US
The separator can be customized by setting the separator property: separator=">"
The separator can be customized by setting the separator property: `separator=">"`.
```jsx
import { Breadcrumb } from 'antd';

View File

@@ -28,10 +28,10 @@ A breadcrumb displays the current location within a hierarchy. It allows going b
| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
| href | Target of hyperlink | string | - | |
| overlay | The dropdown menu | [Menu](/components/menu) \| () => Menu | - | |
| onClick | Set the handler to handle `click` event | (e:MouseEvent)=>void | - | |
| dropdownProps | The dropdown props | [Dropdown](/components/dropdown) | - | |
| href | Target of hyperlink | string | - | |
| onClick | Set the handler to handle click event | (e:MouseEvent) => void | - | |
| overlay | The dropdown menu | [Menu](/components/menu) \| () => Menu | - | |
### Breadcrumb.Separator

View File

@@ -29,10 +29,10 @@ cover: https://gw.alipayobjects.com/zos/alicdn/9Ltop8JwH/Breadcrumb.svg
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| href | 链接的目的地 | string | - | |
| overlay | 下拉菜单的内容 | [Menu](/components/menu) \| () => Menu | - | |
| onClick | 单击事件 | (e:MouseEvent)=>void | - | |
| dropdownProps | 弹出下拉菜单的自定义配置 | [Dropdown](/components/dropdown) | - | |
| href | 链接的目的地 | string | - | |
| onClick | 单击事件 | (e:MouseEvent) => void | - | |
| overlay | 下拉菜单的内容 | [Menu](/components/menu) \| () => Menu | - | |
### Breadcrumb.Separator

View File

@@ -1,6 +1,6 @@
import * as React from 'react';
import classNames from 'classnames';
import CSSMotion from 'rc-animate/lib/CSSMotion';
import CSSMotion from 'rc-motion';
import LoadingOutlined from '@ant-design/icons/LoadingOutlined';
export interface LoadingIconProps {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@@ -28,31 +28,31 @@ And 4 other properties additionally.
## API
To get a customized button, just set `type`/`shape`/`size`/`loading`/`disabled`.
Different button styles can be generated by setting Button properties. The recommended order is: `type` -> `shape` -> `size` -> `loading` -> `disabled`.
| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
| block | Option to fit button width to its parent width | boolean | false | |
| danger | Set the danger status of button | boolean | false | |
| disabled | Disabled state of button | boolean | false | |
| ghost | Make background transparent and invert text and border colors | boolean | false | |
| href | Redirect url of link button | string | - | |
| htmlType | Set the original html `type` of `button`, see: [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) | string | `button` | |
| icon | Set the icon component of button | ReactNode | - | |
| loading | Set the loading status of button | boolean \| { delay: number } | false | |
| onClick | Set the handler to handle `click` event | (event) => void | - | |
| shape | Can be set to `circle`, `round` or omitted | string | - | |
| size | Set the size of button | `large` \| `middle` \| `small` | - | |
| target | Same as target attribute of a, works when href is specified | string | - | |
| type | Can be set to `primary` `ghost` `dashed` `danger` `link` `text` `default` | string | `default` | |
| onClick | Set the handler to handle `click` event | (event) => void | - | |
| block | Option to fit button width to its parent width | boolean | false | |
| danger | Set the danger status of button | boolean | false | |
It accepts all props which native buttons support.
## FAQ
### How to remove space between 2 chinese characters
### How to remove space between 2 chinese characters?
Following the Ant Design specification, we will add one space between if Button contains two Chinese characters only. If you don't need that, you can use [ConfigProvider](/components/config-provider/#API) to set `autoInsertSpaceInButton` as `false`.
Following the Ant Design specification, we will add one space between if Button (exclude Text button and Link button) contains two Chinese characters only. If you don't need that, you can use [ConfigProvider](/components/config-provider/#API) to set `autoInsertSpaceInButton` as `false`.
<img src="https://gw.alipayobjects.com/zos/antfincdn/MY%26THAPZrW/38f06cb9-293a-4b42-b183-9f443e79ffea.png" style="box-shadow: none; margin: 0; width: 100px" alt="Button with two Chinese characters" />

View File

@@ -35,19 +35,19 @@ cover: https://gw.alipayobjects.com/zos/alicdn/fNUKzY1sk/Button.svg
| 属性 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| block | 将按钮宽度调整为其父宽度的选项 | boolean | false | |
| danger | 设置危险按钮 | boolean | false | |
| disabled | 按钮失效状态 | boolean | false | |
| ghost | 幽灵属性,使按钮背景透明 | boolean | false | |
| href | 点击跳转的地址,指定此属性 button 的行为和 a 链接一致 | string | - | |
| htmlType | 设置 `button` 原生的 `type` 值,可选值请参考 [HTML 标准](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) | string | `button` | |
| icon | 设置按钮的图标组件 | ReactNode | - | |
| loading | 设置按钮载入状态 | boolean \| { delay: number } | false | |
| onClick | 点击按钮时的回调 | (event) => void | - | |
| shape | 设置按钮形状,可选值为 `circle``round` 或者不设 | string | - | |
| size | 设置按钮大小 | `large` \| `middle` \| `small` | - | |
| target | 相当于 a 链接的 target 属性href 存在时生效 | string | - | |
| type | 设置按钮类型 | `primary` \| `ghost` \| `dashed` \| `danger` \| `link` \| `text` \| `default` | `default` | |
| onClick | 点击按钮时的回调 | (event) => void | - | |
| block | 将按钮宽度调整为其父宽度的选项 | boolean | false | |
| danger | 设置危险按钮 | boolean | false | |
支持原生 button 的其他所有属性。
@@ -55,7 +55,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/fNUKzY1sk/Button.svg
### 如何移除两个汉字之间的空格?
根据 Ant Design 设计规范要求,我们会在按钮内只有两个汉字时自动添加空格,如果你不需要这个特性,可以设置 [ConfigProvider](/components/config-provider/#API) 的 `autoInsertSpaceInButton``false`
根据 Ant Design 设计规范要求,我们会在按钮内(文本按钮和链接按钮除外)只有两个汉字时自动添加空格,如果你不需要这个特性,可以设置 [ConfigProvider](/components/config-provider/#API) 的 `autoInsertSpaceInButton``false`
<img src="https://gw.alipayobjects.com/zos/antfincdn/MY%26THAPZrW/38f06cb9-293a-4b42-b183-9f443e79ffea.png" style="box-shadow: none; margin: 0; width: 100px" alt="移除两个汉字之间的空格" />

View File

@@ -19,7 +19,7 @@
// Fixing https://github.com/ant-design/ant-design/issues/13214
// It is a render problem of chrome, which is only happened in the codesandbox demo
// 0.001px solution works and I don't why
line-height: @line-height-base;
line-height: @btn-line-height;
.btn;
.btn-default;

View File

@@ -29,11 +29,13 @@ describe('Calendar', () => {
it('Calendar should be selectable', () => {
const onSelect = jest.fn();
const wrapper = mount(<Calendar onSelect={onSelect} />);
const onChange = jest.fn();
const wrapper = mount(<Calendar onSelect={onSelect} onChange={onChange} />);
wrapper.find('.ant-picker-cell').at(0).simulate('click');
expect(onSelect).toHaveBeenCalledWith(expect.anything());
const value = onSelect.mock.calls[0][0];
expect(Moment.isMoment(value)).toBe(true);
expect(onChange).toHaveBeenCalled();
});
it('only Valid range should be selectable', () => {

View File

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

View File

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

View File

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

View File

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

View File

@@ -4,7 +4,7 @@ exports[`Cascader can be selected 1`] = `
<div>
<div
class="ant-cascader-menus"
style="opacity:0"
style="opacity:0;pointer-events:none"
>
<div>
<ul
@@ -117,7 +117,7 @@ exports[`Cascader can be selected 2`] = `
<div>
<div
class="ant-cascader-menus"
style="opacity:0"
style="opacity:0;pointer-events:none"
>
<div>
<ul
@@ -364,7 +364,7 @@ exports[`Cascader can be selected in RTL direction 1`] = `
<div>
<div
class="ant-cascader-menus ant-cascader-menu-rtl"
style="opacity:0"
style="opacity:0;pointer-events:none"
>
<div>
<ul
@@ -477,7 +477,7 @@ exports[`Cascader can be selected in RTL direction 2`] = `
<div>
<div
class="ant-cascader-menus ant-cascader-menu-rtl"
style="opacity:0"
style="opacity:0;pointer-events:none"
>
<div>
<ul
@@ -601,7 +601,7 @@ exports[`Cascader have a notFoundContent that fit trigger input width 1`] = `
<div>
<div
class="ant-cascader-menus"
style="opacity: 0;"
style="opacity: 0; pointer-events: none;"
>
<div>
<ul
@@ -679,7 +679,7 @@ exports[`Cascader popup correctly when panel is open 1`] = `
<div>
<div
class="ant-cascader-menus"
style="opacity:0"
style="opacity:0;pointer-events:none"
>
<div>
<ul
@@ -757,7 +757,7 @@ exports[`Cascader popup correctly with defaultValue 1`] = `
<div>
<div
class="ant-cascader-menus"
style="opacity:0"
style="opacity:0;pointer-events:none"
>
<div>
<ul
@@ -881,7 +881,7 @@ exports[`Cascader popup correctly with defaultValue RTL 1`] = `
<div>
<div
class="ant-cascader-menus ant-cascader-menu-rtl"
style="opacity:0"
style="opacity:0;pointer-events:none"
>
<div>
<ul
@@ -1074,6 +1074,7 @@ exports[`Cascader should highlight keyword and filter when search in Cascader 1`
>
<div>
<ForwardRef
leavedClassName="ant-cascader-menus-hidden"
motionAppear={false}
motionEnter={false}
motionLeave={false}
@@ -1088,6 +1089,7 @@ exports[`Cascader should highlight keyword and filter when search in Cascader 1`
>
<CSSMotion
internalRef={null}
leavedClassName="ant-cascader-menus-hidden"
motionAppear={false}
motionEnter={false}
motionLeave={false}
@@ -1125,17 +1127,16 @@ exports[`Cascader should highlight keyword and filter when search in Cascader 1`
>
<PopupInner
className="ant-cascader-menus"
hiddenClassName="ant-cascader-menus-hidden"
onMouseDown={[Function]}
onTouchStart={[Function]}
prefixCls="ant-cascader-menus"
style={
Object {
"opacity": 0,
"pointerEvents": "none",
"zIndex": undefined,
}
}
visible={true}
>
<div
className="ant-cascader-menus"
@@ -1144,6 +1145,7 @@ exports[`Cascader should highlight keyword and filter when search in Cascader 1`
style={
Object {
"opacity": 0,
"pointerEvents": "none",
"zIndex": undefined,
}
}
@@ -1442,7 +1444,7 @@ exports[`Cascader should highlight keyword and filter when search in Cascader wi
<div>
<div
class="ant-cascader-menus"
style="opacity: 0;"
style="opacity: 0; pointer-events: none;"
>
<div>
<ul
@@ -1514,6 +1516,7 @@ exports[`Cascader should render not found content 1`] = `
>
<div>
<ForwardRef
leavedClassName="ant-cascader-menus-hidden"
motionAppear={false}
motionEnter={false}
motionLeave={false}
@@ -1528,6 +1531,7 @@ exports[`Cascader should render not found content 1`] = `
>
<CSSMotion
internalRef={null}
leavedClassName="ant-cascader-menus-hidden"
motionAppear={false}
motionEnter={false}
motionLeave={false}
@@ -1565,17 +1569,16 @@ exports[`Cascader should render not found content 1`] = `
>
<PopupInner
className="ant-cascader-menus ant-cascader-menu-empty"
hiddenClassName="ant-cascader-menus-hidden"
onMouseDown={[Function]}
onTouchStart={[Function]}
prefixCls="ant-cascader-menus"
style={
Object {
"opacity": 0,
"pointerEvents": "none",
"zIndex": undefined,
}
}
visible={true}
>
<div
className="ant-cascader-menus ant-cascader-menu-empty"
@@ -1584,6 +1587,7 @@ exports[`Cascader should render not found content 1`] = `
style={
Object {
"opacity": 0,
"pointerEvents": "none",
"zIndex": undefined,
}
}
@@ -1835,6 +1839,7 @@ exports[`Cascader should show not found content when options.length is 0 1`] = `
>
<div>
<ForwardRef
leavedClassName="ant-cascader-menus-hidden"
motionAppear={false}
motionEnter={false}
motionLeave={false}
@@ -1849,6 +1854,7 @@ exports[`Cascader should show not found content when options.length is 0 1`] = `
>
<CSSMotion
internalRef={null}
leavedClassName="ant-cascader-menus-hidden"
motionAppear={false}
motionEnter={false}
motionLeave={false}
@@ -1886,17 +1892,16 @@ exports[`Cascader should show not found content when options.length is 0 1`] = `
>
<PopupInner
className="ant-cascader-menus ant-cascader-menu-empty"
hiddenClassName="ant-cascader-menus-hidden"
onMouseDown={[Function]}
onTouchStart={[Function]}
prefixCls="ant-cascader-menus"
style={
Object {
"opacity": 0,
"pointerEvents": "none",
"zIndex": undefined,
}
}
visible={true}
>
<div
className="ant-cascader-menus ant-cascader-menu-empty"
@@ -1905,6 +1910,7 @@ exports[`Cascader should show not found content when options.length is 0 1`] = `
style={
Object {
"opacity": 0,
"pointerEvents": "none",
"zIndex": undefined,
}
}

View File

@@ -6,6 +6,7 @@ import ConfigProvider from '../../config-provider';
import focusTest from '../../../tests/shared/focusTest';
import mountTest from '../../../tests/shared/mountTest';
import rtlTest from '../../../tests/shared/rtlTest';
import { sleep } from '../../../tests/utils';
const options = [
{
@@ -186,11 +187,18 @@ describe('Cascader', () => {
expect(popupWrapper).toMatchSnapshot();
});
it('should support to clear selection', () => {
it('should support to clear selection', async () => {
const wrapper = mount(<Cascader options={options} defaultValue={['zhejiang', 'hangzhou']} />);
const willUnmount = jest.spyOn(wrapper.instance(), 'componentWillUnmount');
const clearTimeoutSpy = jest.spyOn(global, 'clearTimeout');
expect(wrapper.find('.ant-cascader-picker-label').text()).toBe('Zhejiang / Hangzhou');
wrapper.find('.ant-cascader-picker-clear').at(0).simulate('click');
await sleep(300);
expect(wrapper.find('.ant-cascader-picker-label').text()).toBe('');
wrapper.unmount();
expect(willUnmount).toHaveBeenCalled();
expect(clearTimeoutSpy).toHaveBeenCalled();
clearTimeoutSpy.mockRestore();
});
it('should close popup when clear selection', () => {
@@ -508,4 +516,12 @@ describe('Cascader', () => {
.simulate('click');
expect(onChange).toHaveBeenCalledWith(['zhejiang', 'hangzhou', 'xihu'], expect.anything());
});
it('options should open after press esc and then search', () => {
const wrapper = mount(<Cascader options={options} showSearch />);
wrapper.find('input').simulate('change', { target: { value: 'jin' } });
wrapper.find('input').simulate('keydown', { keyCode: KeyCode.ESC });
wrapper.find('input').simulate('change', { target: { value: 'jin' } });
expect(wrapper.state('popupVisible')).toBe(true);
});
});

View File

@@ -109,7 +109,7 @@ export interface CascaderProps {
/** use this after antd@3.7.0 */
fieldNames?: FieldNamesType;
suffixIcon?: React.ReactNode;
dropdownRender?: (menus: React.ReactNode) => React.ReactNode
dropdownRender?: (menus: React.ReactNode) => React.ReactNode;
}
export interface CascaderState {
@@ -255,6 +255,8 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
cachedOptions: CascaderOptionType[] = [];
clearSelectionTimeout: any;
private input: Input;
constructor(props: CascaderProps) {
@@ -269,6 +271,12 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
};
}
componentWillUnmount() {
if (this.clearSelectionTimeout) {
clearTimeout(this.clearSelectionTimeout);
}
}
setValue = (value: CascaderValueType, selectedOptions: CascaderOptionType[] = []) => {
if (!('value' in this.props)) {
this.setState({ value });
@@ -345,7 +353,11 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
};
handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const { popupVisible } = this.state;
const inputValue = e.target.value;
if (!popupVisible) {
this.handlePopupVisibleChange(true);
}
this.setState({ inputValue });
};
@@ -354,8 +366,10 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
e.preventDefault();
e.stopPropagation();
if (!inputValue) {
this.setValue([]);
this.handlePopupVisibleChange(false);
this.clearSelectionTimeout = setTimeout(() => {
this.setValue([]);
}, 200);
} else {
this.setState({ inputValue: '' });
}

View File

@@ -110,16 +110,14 @@
color: @disabled-color;
font-size: 12px;
line-height: 12px;
transition: transform 0.2s;
&&-expand {
transform: rotate(180deg);
}
}
}
// https://github.com/ant-design/ant-design/pull/12407#issuecomment-424657810
&-picker-label:hover + &-input {
.hover;
&:not(.@{cascader-prefix-cls}-picker-disabled &) {
.hover;
}
}
&-picker-small &-picker-clear,
@@ -190,8 +188,10 @@
}
&-menu-item {
padding: @cascader-dropdown-vertical-padding @control-padding-horizontal;
overflow: hidden;
line-height: @cascader-dropdown-line-height;
white-space: nowrap;
text-overflow: ellipsis;
cursor: pointer;
transition: all 0.3s;
&:hover {

View File

@@ -34,7 +34,7 @@ Checkbox component.
| defaultValue | Default selected value | string\[] | \[] | |
| disabled | If disable all checkboxes | boolean | false | |
| name | The `name` property of all `input[type="checkbox"]` children | string | - | |
| options | Specifies options | string\[] | \[] | |
| options | Specifies options | string\[] \| Option\[] | \[] | |
| value | Used for setting the currently selected value | string\[] | \[] | |
| onChange | The callback function that is triggered when the state changes | function(checkedValue) | - | |

View File

@@ -11,7 +11,7 @@ export interface ConfigConsumerProps {
getTargetContainer?: () => HTMLElement;
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
rootPrefixCls?: string;
getPrefixCls: (suffixCls: string, customizePrefixCls?: string) => string;
getPrefixCls: (suffixCls?: string, customizePrefixCls?: string) => string;
renderEmpty: RenderEmptyHandler;
csp?: CSPConfig;
autoInsertSpaceInButton?: boolean;
@@ -32,7 +32,7 @@ export interface ConfigConsumerProps {
export const ConfigContext = React.createContext<ConfigConsumerProps>({
// We provide a default function for Context without provider
getPrefixCls: (suffixCls: string, customizePrefixCls?: string) => {
getPrefixCls: (suffixCls?: string, customizePrefixCls?: string) => {
if (customizePrefixCls) return customizePrefixCls;
return suffixCls ? `ant-${suffixCls}` : 'ant';

View File

@@ -17,8 +17,8 @@ import { ConfigProvider } from 'antd';
// ...
return (
<ConfigProvider {...yourConfig}>
export default () => (
<ConfigProvider direction="rtl">
<App />
</ConfigProvider>
);
@@ -47,7 +47,7 @@ Some components use dynamic style to support wave effect. You can config `csp` p
| getPopupContainer | To set the container of the popup element. The default is to create a `div` element in `body` | function(triggerNode) | () => document.body | |
| getTargetContainer | Config Affix, Anchor scroll target container | () => HTMLElement | () => window | 4.2.0 |
| locale | Language package setting, you can find the packages in [antd/es/locale](http://unpkg.com/antd/es/locale/) | object | - |
| prefixCls | Set prefix class. Note: This will discard default styles from `antd` | string | `ant` | |
| prefixCls | Set prefix className (cooperated with [@ant-prefix](https://github.com/ant-design/ant-design/blob/2c6c789e3a9356f96c47aea0083f5a15538315cf/components/style/themes/default.less#L7)) | string | `ant` | |
| pageHeader | Unify the ghost of PageHeader, ref [PageHeader](/components/page-header) | { ghost: boolean } | true | |
| direction | Set direction of layout. See [demo](#components-config-provider-demo-direction) | `ltr` \| `rtl` | `ltr` | |
| space | Set Space `size`, ref [Space](/components/space) | { size: `small` \| `middle` \| `large` \| `number` } | - | 4.1.0 |

View File

@@ -18,8 +18,8 @@ import { ConfigProvider } from 'antd';
// ...
return (
<ConfigProvider {...yourConfig}>
export default () => (
<ConfigProvider direction="rtl">
<App />
</ConfigProvider>
);
@@ -48,7 +48,7 @@ return (
| getPopupContainer | 弹出框Select, Tooltip, Menu 等等)渲染父节点,默认渲染到 body 上。 | function(triggerNode) | () => document.body | |
| getTargetContainer | 配置 Affix、Anchor 滚动监听容器。 | () => HTMLElement | () => window | 4.2.0 |
| locale | 语言包配置,语言包可到 [antd/es/locale](http://unpkg.com/antd/es/locale/) 目录下寻找 | object | - | |
| prefixCls | 设置统一样式前缀。`注意:这将不会应用由 antd 提供的默认样式` | string | `ant` | |
| prefixCls | 设置统一样式前缀。`注意:需要配合 less 变量 [@ant-prefix](https://github.com/ant-design/ant-design/blob/2c6c789e3a9356f96c47aea0083f5a15538315cf/components/style/themes/default.less#L7) 使用` | string | `ant` | |
| pageHeader | 统一设置 PageHeader 的 ghost参考 [PageHeader](/components/page-header) | { ghost: boolean } | true | |
| direction | 设置文本展示方向。 [示例](#components-config-provider-demo-direction) | `ltr` \| `rtl` | `ltr` | |
| space | 设置 Space 的 `size`,参考 [Space](/components/space) | { size: `small` \| `middle` \| `large` \| `number` } | - | 4.1.0 |

View File

@@ -78,4 +78,106 @@ describe('DatePicker', () => {
const wrapper = mount(<DatePicker placeholder={undefined} />);
expect(wrapper.find('input').props().placeholder).toEqual('Select date');
});
it('showTime={{ showHour: true, showMinute: true }}', () => {
const wrapper = mount(
<DatePicker
defaultValue={moment()}
showTime={{ showHour: true, showMinute: true }}
format="YYYY-MM-DD"
open
/>,
);
expect(wrapper.find('.ant-picker-time-panel-column').length).toBe(2);
expect(
wrapper.find('.ant-picker-time-panel-column').at(0).find('.ant-picker-time-panel-cell')
.length,
).toBe(24);
expect(
wrapper.find('.ant-picker-time-panel-column').at(1).find('.ant-picker-time-panel-cell')
.length,
).toBe(60);
});
it('showTime={{ showHour: true, showSecond: true }}', () => {
const wrapper = mount(
<DatePicker
defaultValue={moment()}
showTime={{ showHour: true, showSecond: true }}
format="YYYY-MM-DD"
open
/>,
);
expect(wrapper.find('.ant-picker-time-panel-column').length).toBe(2);
expect(
wrapper.find('.ant-picker-time-panel-column').at(0).find('.ant-picker-time-panel-cell')
.length,
).toBe(24);
expect(
wrapper.find('.ant-picker-time-panel-column').at(1).find('.ant-picker-time-panel-cell')
.length,
).toBe(60);
});
it('showTime={{ showMinute: true, showSecond: true }}', () => {
const wrapper = mount(
<DatePicker
defaultValue={moment()}
showTime={{ showMinute: true, showSecond: true }}
format="YYYY-MM-DD"
open
/>,
);
expect(wrapper.find('.ant-picker-time-panel-column').length).toBe(2);
expect(
wrapper.find('.ant-picker-time-panel-column').at(0).find('.ant-picker-time-panel-cell')
.length,
).toBe(60);
expect(
wrapper.find('.ant-picker-time-panel-column').at(1).find('.ant-picker-time-panel-cell')
.length,
).toBe(60);
});
it('12 hours', () => {
const wrapper = mount(
<DatePicker defaultValue={moment()} showTime format="YYYY-MM-DD HH:mm:ss A" open />,
);
expect(wrapper.find('.ant-picker-time-panel-column').length).toBe(4);
expect(
wrapper.find('.ant-picker-time-panel-column').at(0).find('.ant-picker-time-panel-cell')
.length,
).toBe(12);
expect(
wrapper.find('.ant-picker-time-panel-column').at(1).find('.ant-picker-time-panel-cell')
.length,
).toBe(60);
expect(
wrapper.find('.ant-picker-time-panel-column').at(2).find('.ant-picker-time-panel-cell')
.length,
).toBe(60);
expect(
wrapper.find('.ant-picker-time-panel-column').at(3).find('.ant-picker-time-panel-cell')
.length,
).toBe(2);
});
it('24 hours', () => {
const wrapper = mount(
<DatePicker defaultValue={moment()} showTime format="YYYY-MM-DD HH:mm:ss" open />,
);
expect(wrapper.find('.ant-picker-time-panel-column').length).toBe(3);
expect(
wrapper.find('.ant-picker-time-panel-column').at(0).find('.ant-picker-time-panel-cell')
.length,
).toBe(24);
expect(
wrapper.find('.ant-picker-time-panel-column').at(1).find('.ant-picker-time-panel-cell')
.length,
).toBe(60);
expect(
wrapper.find('.ant-picker-time-panel-column').at(2).find('.ant-picker-time-panel-cell')
.length,
).toBe(60);
});
});

View File

@@ -45,7 +45,7 @@ Array [
<div>
<div
class="ant-picker-dropdown"
style="opacity: 0;"
style="opacity: 0; pointer-events: none;"
>
<div
class="ant-picker-panel-container"
@@ -669,7 +669,7 @@ Array [
<div>
<div
class="ant-picker-dropdown"
style="opacity: 0;"
style="opacity: 0; pointer-events: none;"
>
<div
class="ant-picker-panel-container"

View File

@@ -150,7 +150,7 @@ Array [
<div>
<div
class="ant-picker-dropdown ant-picker-dropdown-range"
style="opacity:0"
style="opacity:0;pointer-events:none"
>
<div
class="ant-picker-range-wrapper ant-picker-date-range-wrapper"

View File

@@ -6,7 +6,7 @@ exports[`renders ./components/date-picker/demo/basic.md correctly 1`] = `
>
<div
class="ant-space-item"
style="margin-bottom:12px"
style="margin-bottom:8px"
>
<div
class="ant-picker"
@@ -51,120 +51,180 @@ exports[`renders ./components/date-picker/demo/basic.md correctly 1`] = `
</div>
<div
class="ant-space-item"
style="margin-bottom:8px"
>
<div
class="ant-space ant-space-horizontal ant-space-align-center"
class="ant-picker"
>
<div
class="ant-space-item"
style="margin-right:8px"
class="ant-picker-input"
>
<div
class="ant-select ant-select-single ant-select-show-arrow"
<input
autocomplete="off"
placeholder="Select week"
readonly=""
size="12"
title=""
value=""
/>
<span
class="ant-picker-suffix"
>
<div
class="ant-select-selector"
>
<span
class="ant-select-selection-search"
>
<input
aria-activedescendant="undefined_list_0"
aria-autocomplete="list"
aria-controls="undefined_list"
aria-haspopup="listbox"
aria-owns="undefined_list"
autocomplete="off"
class="ant-select-selection-search-input"
readonly=""
role="combobox"
style="opacity:0"
unselectable="on"
value=""
/>
</span>
<span
class="ant-select-selection-item"
title="Time"
>
Time
</span>
</div>
<span
aria-hidden="true"
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none"
unselectable="on"
aria-label="calendar"
class="anticon anticon-calendar"
role="img"
>
<span
aria-label="down"
class="anticon anticon-down ant-select-suffix"
role="img"
<svg
aria-hidden="true"
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<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>
</span>
<path
d="M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z"
/>
</svg>
</span>
</div>
</span>
</div>
</div>
</div>
<div
class="ant-space-item"
style="margin-bottom:8px"
>
<div
class="ant-picker"
>
<div
class="ant-space-item"
class="ant-picker-input"
>
<div
class="ant-picker"
<input
autocomplete="off"
placeholder="Select month"
readonly=""
size="12"
title=""
value=""
/>
<span
class="ant-picker-suffix"
>
<div
class="ant-picker-input"
<span
aria-label="calendar"
class="anticon anticon-calendar"
role="img"
>
<input
autocomplete="off"
placeholder="Select time"
readonly=""
size="10"
title=""
value=""
/>
<span
class="ant-picker-suffix"
<svg
aria-hidden="true"
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<span
aria-label="clock-circle"
class="anticon anticon-clock-circle"
role="img"
>
<svg
aria-hidden="true"
class=""
data-icon="clock-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 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"
/>
<path
d="M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"
/>
</svg>
</span>
</span>
</div>
</div>
<path
d="M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z"
/>
</svg>
</span>
</span>
</div>
</div>
</div>
<div
class="ant-space-item"
style="margin-bottom:8px"
>
<div
class="ant-picker"
>
<div
class="ant-picker-input"
>
<input
autocomplete="off"
placeholder="Select quarter"
readonly=""
size="12"
title=""
value=""
/>
<span
class="ant-picker-suffix"
>
<span
aria-label="calendar"
class="anticon anticon-calendar"
role="img"
>
<svg
aria-hidden="true"
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z"
/>
</svg>
</span>
</span>
</div>
</div>
</div>
<div
class="ant-space-item"
>
<div
class="ant-picker"
>
<div
class="ant-picker-input"
>
<input
autocomplete="off"
placeholder="Select year"
readonly=""
size="12"
title=""
value=""
/>
<span
class="ant-picker-suffix"
>
<span
aria-label="calendar"
class="anticon anticon-calendar"
role="img"
>
<svg
aria-hidden="true"
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z"
/>
</svg>
</span>
</span>
</div>
</div>
</div>
@@ -3684,6 +3744,124 @@ exports[`renders ./components/date-picker/demo/suffix.md correctly 1`] = `
</div>
`;
exports[`renders ./components/date-picker/demo/switchable.md correctly 1`] = `
<div
class="ant-space ant-space-horizontal ant-space-align-center"
>
<div
class="ant-space-item"
style="margin-right:8px"
>
<div
class="ant-select ant-select-single ant-select-show-arrow"
>
<div
class="ant-select-selector"
>
<span
class="ant-select-selection-search"
>
<input
aria-activedescendant="undefined_list_0"
aria-autocomplete="list"
aria-controls="undefined_list"
aria-haspopup="listbox"
aria-owns="undefined_list"
autocomplete="off"
class="ant-select-selection-search-input"
readonly=""
role="combobox"
style="opacity:0"
unselectable="on"
value=""
/>
</span>
<span
class="ant-select-selection-item"
title="Time"
>
Time
</span>
</div>
<span
aria-hidden="true"
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none"
unselectable="on"
>
<span
aria-label="down"
class="anticon anticon-down ant-select-suffix"
role="img"
>
<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>
</span>
</span>
</div>
</div>
<div
class="ant-space-item"
>
<div
class="ant-picker"
>
<div
class="ant-picker-input"
>
<input
autocomplete="off"
placeholder="Select time"
readonly=""
size="10"
title=""
value=""
/>
<span
class="ant-picker-suffix"
>
<span
aria-label="clock-circle"
class="anticon anticon-clock-circle"
role="img"
>
<svg
aria-hidden="true"
class=""
data-icon="clock-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 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"
/>
<path
d="M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"
/>
</svg>
</span>
</span>
</div>
</div>
</div>
</div>
`;
exports[`renders ./components/date-picker/demo/time.md correctly 1`] = `
<div
class="ant-space ant-space-vertical"

View File

@@ -4,7 +4,7 @@ exports[`MonthPicker and WeekPicker render MonthPicker 1`] = `
<div>
<div
class="ant-picker-dropdown"
style="opacity:0"
style="opacity:0;pointer-events:none"
>
<div
class="ant-picker-panel-container"
@@ -197,7 +197,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
<div>
<div
class="ant-picker-dropdown"
style="opacity:0"
style="opacity:0;pointer-events:none"
>
<div
class="ant-picker-panel-container"

View File

@@ -14,46 +14,19 @@ title:
Basic use case. Users can select or input a date in panel.
```jsx
import { DatePicker, TimePicker, Select, Space } from 'antd';
import { DatePicker, Space } from 'antd';
const { Option } = Select;
function TypeSelect({ type, onChange }) {
return (
<Select value={type} onChange={onChange}>
<Option value="time">Time</Option>
<Option value="date">Date</Option>
<Option value="week">Week</Option>
<Option value="month">Month</Option>
<Option value="quarter">Quarter</Option>
<Option value="year">Year</Option>
</Select>
);
}
function PickerWithType({ type, onChange }) {
if (type === 'time') return <TimePicker onChange={onChange} />;
if (type === 'date') return <DatePicker onChange={onChange} />;
return <DatePicker picker={type} onChange={onChange} />;
}
function SwitchablePicker() {
const [type, setType] = React.useState('time');
const onChange = value => {
console.log(value);
};
return (
<Space>
<TypeSelect type={type} onChange={setType} />
<PickerWithType type={type} onChange={onChange} />
</Space>
);
function onChange(date, dateString) {
console.log(date, dateString);
}
ReactDOM.render(
<Space direction="vertical" size={12}>
<DatePicker />
<SwitchablePicker />
<Space direction="vertical">
<DatePicker onChange={onChange} />
<DatePicker onChange={onChange} picker="week" />
<DatePicker onChange={onChange} picker="month" />
<DatePicker onChange={onChange} picker="quarter" />
<DatePicker onChange={onChange} picker="year" />
</Space>,
mountNode,
);

View File

@@ -0,0 +1,46 @@
---
order: 1.1
title:
zh-CN: 切换不同的选择器
en-US: Switchable picker
---
## zh-CN
提供选择器,自由切换不同类型的日期选择器,常用于日期筛选场合。
## en-US
Switch in different types of pickers by Select.
```jsx
import React, { useState } from 'react';
import { DatePicker, TimePicker, Select, Space } from 'antd';
const { Option } = Select;
function PickerWithType({ type, onChange }) {
if (type === 'time') return <TimePicker onChange={onChange} />;
if (type === 'date') return <DatePicker onChange={onChange} />;
return <DatePicker picker={type} onChange={onChange} />;
}
function SwitchablePicker() {
const [type, setType] = useState('time');
return (
<Space>
<Select value={type} onChange={setType}>
<Option value="time">Time</Option>
<Option value="date">Date</Option>
<Option value="week">Week</Option>
<Option value="month">Month</Option>
<Option value="quarter">Quarter</Option>
<Option value="year">Year</Option>
</Select>
<PickerWithType type={type} onChange={value => console.log(value)} />
</Space>
);
}
ReactDOM.render(<SwitchablePicker />, mountNode);
```

View File

@@ -156,7 +156,7 @@ Added in `4.1.0`.
| defaultValue | To set default date | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - | |
| defaultPickerValue | To set default picker date | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)\] | - | |
| disabled | If disable start or end | \[boolean, boolean] | - | |
| disabledTime | To specify the time that cannot be selected | function(dates: \[moment, moment], partial: `start` \| `end`) | - | |
| disabledTime | To specify the time that cannot be selected | function(date: moment, partial: `start` \| `end`) | - | |
| format | To set the date format, refer to [moment.js](http://momentjs.com/). When an array is provided, all values are used for parsing and first value is used for formatting | string \| string[] | `YYYY-MM-DD HH:mm:ss` | |
| ranges | The preseted ranges for quick selection | { \[range: string]: [moment](http://momentjs.com/)\[] } \| { \[range: string]: () => [moment](http://momentjs.com/)\[] } | - | |
| renderExtraFooter | Render extra footer in panel | () => React.ReactNode | - | |

View File

@@ -157,7 +157,7 @@ import locale from 'antd/es/locale/zh_CN';
| defaultValue | 默认日期 | [moment](http://momentjs.com/)\[] | - | |
| defaultPickerValue | 默认面板日期 | [moment](http://momentjs.com/)\[] | - | |
| disabled | 禁用起始项 | \[boolean, boolean] | - | |
| disabledTime | 不可选择的时间 | function(dates: \[moment, moment\], partial: `start` \| `end`) | - | |
| disabledTime | 不可选择的时间 | function(date: moment, partial: `start` \| `end`) | - | |
| format | 展示的日期格式 | string | `YYYY-MM-DD HH:mm:ss` | |
| ranges | 预设时间范围快捷选择 | { \[range: string]: [moment](http://momentjs.com/)\[] } \| { \[range: string]: () => [moment](http://momentjs.com/)\[] } | - | |
| renderExtraFooter | 在面板中添加额外的页脚 | () => React.ReactNode | - | |

View File

@@ -0,0 +1,20 @@
import CalendarLocale from 'rc-picker/lib/locale/gl_ES';
import TimePickerLocale from '../../time-picker/locale/gl_ES';
import { PickerLocale } from '../generatePicker';
// Merge into a locale object
const locale: PickerLocale = {
lang: {
placeholder: 'Escolla data',
rangePlaceholder: ['Data inicial', 'Data final'],
...CalendarLocale,
},
timePickerLocale: {
...TimePickerLocale,
},
};
// All settings at:
// https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json
export default locale;

View File

@@ -1,5 +1,5 @@
import CalendarLocale from 'rc-picker/lib/locale/ku_IQ';
import TimePickerLocale from '../../time-picker/locale/ku_IQ';
import CalendarLocale from 'rc-picker/lib/locale/kmr_IQ';
import TimePickerLocale from '../../time-picker/locale/kmr_IQ';
import { PickerLocale } from '../generatePicker';
// Merge into a locale object

View File

@@ -0,0 +1,27 @@
import CalendarLocale from 'rc-picker/lib/locale/lt_LT';
import TimePickerLocale from '../../time-picker/locale/lt_LT';
import { PickerLocale } from '../generatePicker';
// Merge into a locale object
const locale: PickerLocale = {
lang: {
placeholder: 'Pasirinkite datą',
yearPlaceholder: 'Pasirinkite metus',
quarterPlaceholder: 'Pasirinkite ketvirtį',
monthPlaceholder: 'Pasirinkite mėnesį',
weekPlaceholder: 'Pasirinkite savaitę',
rangePlaceholder: ['Pradžios data', 'Pabaigos data'],
rangeYearPlaceholder: ['Pradžios metai', 'Pabaigos metai'],
rangeMonthPlaceholder: ['Pradžios mėnesis', 'Pabaigos mėnesis'],
rangeWeekPlaceholder: ['Pradžios savaitė', 'Pabaigos savaitė'],
...CalendarLocale,
},
timePickerLocale: {
...TimePickerLocale,
},
};
// All settings at:
// https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json
export default locale;

View File

@@ -15,7 +15,7 @@ const locale: PickerLocale = {
monthPlaceholder: 'Выберите месяц',
weekPlaceholder: 'Выберите неделю',
rangePlaceholder: ['Начальная дата', 'Конечная дата'],
rangeYearPlaceholder: ['Начальный годr', 'Год окончания'],
rangeYearPlaceholder: ['Начальный год', 'Год окончания'],
rangeMonthPlaceholder: ['Начальный месяц', 'Конечный месяц'],
rangeWeekPlaceholder: ['Начальная неделя', 'Конечная неделя'],
...CalendarLocale,

View File

@@ -102,6 +102,7 @@
.picker-cell-inner(~'@{picker-cell-inner-cls}');
}
// ======================== Body ==========================
.picker-cell-inner(@cellClassName) {
.@{cellClassName} {
position: relative;
@@ -120,12 +121,21 @@
left: 0;
}
}
&-in-view&-range-end::before {
.@{picker-prefix-cls}-panel-rtl & {
right: 0;
left: 50%;
}
}
&-in-view&-range-start&-range-end::before {
.@{picker-prefix-cls}-panel-rtl & {
right: 50%;
left: 50%;
}
}
.@{picker-prefix-cls}-date-panel
&-in-view&-in-range&-range-hover-start
.@{cellClassName}::after {
@@ -134,12 +144,14 @@
left: -6px - @border-width-base;
}
}
.@{picker-prefix-cls}-date-panel &-in-view&-in-range&-range-hover-end .@{cellClassName}::after {
.@{picker-prefix-cls}-panel-rtl & {
right: -6px - @border-width-base;
left: 0;
}
}
// Hover with range start & end
&-range-hover&-range-start::after {
.@{picker-prefix-cls}-panel-rtl & {
@@ -147,6 +159,7 @@
left: 50%;
}
}
&-range-hover&-range-end::after {
.@{picker-prefix-cls}-panel-rtl & {
right: 50%;
@@ -154,6 +167,20 @@
}
}
// range start border-radius
&-in-view&-range-start:not(&-range-start-single):not(&-range-end) .@{cellClassName} {
.@{picker-prefix-cls}-panel-rtl & {
border-radius: 0 @border-radius-base @border-radius-base 0;
}
}
// range end border-radius
&-in-view&-range-end:not(&-range-end-single):not(&-range-start) .@{cellClassName} {
.@{picker-prefix-cls}-panel-rtl & {
border-radius: @border-radius-base 0 0 @border-radius-base;
}
}
// Edge start
tr > &-in-view&-range-hover:first-child::after,
tr > &-in-view&-range-hover-end:first-child::after,
@@ -208,6 +235,17 @@
}
}
// ======================== Footer ========================
&-footer {
&-extra {
.@{picker-prefix-cls}-dropdown-rtl & {
direction: rtl;
text-align: right;
}
}
}
// ====================== Time Panel ======================
&-time-panel {
.@{picker-prefix-cls}-panel-rtl & {
direction: ltr;

View File

@@ -54,16 +54,18 @@ const Cell: React.FC<CellProps> = ({
style={style}
colSpan={span}
>
{label && (
<span
className={classNames(`${itemPrefixCls}-item-label`, {
[`${itemPrefixCls}-item-no-colon`]: !colon,
})}
>
{label}
</span>
)}
{content && <span className={classNames(`${itemPrefixCls}-item-content`)}>{content}</span>}
<div className={`${itemPrefixCls}-item-container`}>
{label && (
<span
className={classNames(`${itemPrefixCls}-item-label`, {
[`${itemPrefixCls}-item-no-colon`]: !colon,
})}
>
{label}
</span>
)}
{content && <span className={classNames(`${itemPrefixCls}-item-content`)}>{content}</span>}
</div>
</Component>
);
};

View File

@@ -25,46 +25,58 @@ exports[`renders ./components/descriptions/demo/basic.md correctly 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
UserName
</span>
<span
class="ant-descriptions-item-content"
>
Zhou Maomao
</span>
<span
class="ant-descriptions-item-label"
>
UserName
</span>
<span
class="ant-descriptions-item-content"
>
Zhou Maomao
</span>
</div>
</td>
<td
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
Telephone
</span>
<span
class="ant-descriptions-item-content"
>
1810000000
</span>
<span
class="ant-descriptions-item-label"
>
Telephone
</span>
<span
class="ant-descriptions-item-content"
>
1810000000
</span>
</div>
</td>
<td
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
Live
</span>
<span
class="ant-descriptions-item-content"
>
Hangzhou, Zhejiang
</span>
<span
class="ant-descriptions-item-label"
>
Live
</span>
<span
class="ant-descriptions-item-content"
>
Hangzhou, Zhejiang
</span>
</div>
</td>
</tr>
<tr
@@ -74,31 +86,39 @@ exports[`renders ./components/descriptions/demo/basic.md correctly 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
Remark
</span>
<span
class="ant-descriptions-item-content"
>
empty
</span>
<span
class="ant-descriptions-item-label"
>
Remark
</span>
<span
class="ant-descriptions-item-content"
>
empty
</span>
</div>
</td>
<td
class="ant-descriptions-item"
colspan="2"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
Address
</span>
<span
class="ant-descriptions-item-content"
>
No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China
</span>
<span
class="ant-descriptions-item-label"
>
Address
</span>
<span
class="ant-descriptions-item-content"
>
No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China
</span>
</div>
</td>
</tr>
</tbody>
@@ -668,6 +688,156 @@ exports[`renders ./components/descriptions/demo/size.md correctly 1`] = `
<td
class="ant-descriptions-item"
colspan="1"
>
<div
class="ant-descriptions-item-container"
>
<span
class="ant-descriptions-item-label"
>
Product
</span>
<span
class="ant-descriptions-item-content"
>
Cloud Database
</span>
</div>
</td>
<td
class="ant-descriptions-item"
colspan="1"
>
<div
class="ant-descriptions-item-container"
>
<span
class="ant-descriptions-item-label"
>
Billing
</span>
<span
class="ant-descriptions-item-content"
>
Prepaid
</span>
</div>
</td>
<td
class="ant-descriptions-item"
colspan="1"
>
<div
class="ant-descriptions-item-container"
>
<span
class="ant-descriptions-item-label"
>
time
</span>
<span
class="ant-descriptions-item-content"
>
18:00:00
</span>
</div>
</td>
</tr>
<tr
class="ant-descriptions-row"
>
<td
class="ant-descriptions-item"
colspan="1"
>
<div
class="ant-descriptions-item-container"
>
<span
class="ant-descriptions-item-label"
>
Amount
</span>
<span
class="ant-descriptions-item-content"
>
$80.00
</span>
</div>
</td>
<td
class="ant-descriptions-item"
colspan="1"
>
<div
class="ant-descriptions-item-container"
>
<span
class="ant-descriptions-item-label"
>
Discount
</span>
<span
class="ant-descriptions-item-content"
>
$20.00
</span>
</div>
</td>
<td
class="ant-descriptions-item"
colspan="1"
>
<div
class="ant-descriptions-item-container"
>
<span
class="ant-descriptions-item-label"
>
Official
</span>
<span
class="ant-descriptions-item-content"
>
$60.00
</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
`;
exports[`renders ./components/descriptions/demo/text.md correctly 1`] = `
<div
class="ant-descriptions"
>
<div
class="ant-descriptions-header"
>
<div
class="ant-descriptions-title"
>
User Info
</div>
</div>
<div
class="ant-descriptions-view"
>
<table>
<tbody>
<tr
class="ant-descriptions-row"
>
<td
class="ant-descriptions-item"
colspan="1"
>
<div
class="ant-descriptions-item-container"
>
<span
class="ant-descriptions-item-label"
@@ -679,59 +849,155 @@ exports[`renders ./components/descriptions/demo/size.md correctly 1`] = `
>
Cloud Database
</span>
</td>
<td
class="ant-descriptions-item"
colspan="1"
</div>
</td>
<td
class="ant-descriptions-item"
colspan="1"
>
<div
class="ant-descriptions-item-container"
>
<span
class="ant-descriptions-item-label"
>
Billing
Billing Mode
</span>
<span
class="ant-descriptions-item-content"
>
Prepaid
</span>
</td>
<td
class="ant-descriptions-item"
colspan="1"
</div>
</td>
</tr>
<tr
class="ant-descriptions-row"
>
<td
class="ant-descriptions-item"
colspan="1"
>
<div
class="ant-descriptions-item-container"
>
<span
class="ant-descriptions-item-label"
>
time
Automatic Renewal
</span>
<span
class="ant-descriptions-item-content"
>
18:00:00
YES
</span>
</td>
</tr>
<tr
class="ant-descriptions-row"
</div>
</td>
<td
class="ant-descriptions-item"
colspan="1"
>
<td
class="ant-descriptions-item"
colspan="1"
<div
class="ant-descriptions-item-container"
>
<span
class="ant-descriptions-item-label"
>
Amount
Order time
</span>
<span
class="ant-descriptions-item-content"
>
2018-04-24 18:00:00
</span>
</div>
</td>
</tr>
<tr
class="ant-descriptions-row"
>
<td
class="ant-descriptions-item"
colspan="2"
>
<div
class="ant-descriptions-item-container"
>
<span
class="ant-descriptions-item-label"
>
Usage Time
</span>
<span
class="ant-descriptions-item-content"
>
2019-04-24 18:00:00
</span>
</div>
</td>
</tr>
<tr
class="ant-descriptions-row"
>
<td
class="ant-descriptions-item"
colspan="2"
>
<div
class="ant-descriptions-item-container"
>
<span
class="ant-descriptions-item-label"
>
Status
</span>
<span
class="ant-descriptions-item-content"
>
<span
class="ant-badge ant-badge-status ant-badge-not-a-wrapper"
>
<span
class="ant-badge-status-dot ant-badge-status-processing"
/>
<span
class="ant-badge-status-text"
>
Running
</span>
</span>
</span>
</div>
</td>
</tr>
<tr
class="ant-descriptions-row"
>
<td
class="ant-descriptions-item"
colspan="1"
>
<div
class="ant-descriptions-item-container"
>
<span
class="ant-descriptions-item-label"
>
Negotiated Amount
</span>
<span
class="ant-descriptions-item-content"
>
$80.00
</span>
</td>
<td
class="ant-descriptions-item"
colspan="1"
</div>
</td>
<td
class="ant-descriptions-item"
colspan="1"
>
<div
class="ant-descriptions-item-container"
>
<span
class="ant-descriptions-item-label"
@@ -743,26 +1009,199 @@ exports[`renders ./components/descriptions/demo/size.md correctly 1`] = `
>
$20.00
</span>
</td>
<td
class="ant-descriptions-item"
colspan="1"
</div>
</td>
</tr>
<tr
class="ant-descriptions-row"
>
<td
class="ant-descriptions-item"
colspan="1"
>
<div
class="ant-descriptions-item-container"
>
<span
class="ant-descriptions-item-label"
>
Official
Official Receipts
</span>
<span
class="ant-descriptions-item-content"
>
$60.00
</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</td>
<td
class="ant-descriptions-item"
colspan="1"
>
<div
class="ant-descriptions-item-container"
>
<span
class="ant-descriptions-item-label"
>
Config Info
</span>
<span
class="ant-descriptions-item-content"
>
Data disk type: MongoDB
<br />
Database version: 3.4
<br />
Package: dds.mongo.mid
<br />
Storage space: 10 GB
<br />
Replication factor: 3
<br />
Region: East China 1
<br />
</span>
</div>
</td>
</tr>
<tr
class="ant-descriptions-row"
>
<td
class="ant-descriptions-item"
colspan="1"
>
<div
class="ant-descriptions-item-container"
>
<span
class="ant-descriptions-item-label"
>
Official Receipts
</span>
<span
class="ant-descriptions-item-content"
>
$60.00
</span>
</div>
</td>
<td
class="ant-descriptions-item"
colspan="1"
>
<div
class="ant-descriptions-item-container"
>
<span
class="ant-descriptions-item-label"
>
Config Info
</span>
<span
class="ant-descriptions-item-content"
>
<div
class="ant-table-wrapper"
>
<div
class="ant-spin-nested-loading"
>
<div
class="ant-spin-container"
>
<div
class="ant-table ant-table-small"
>
<div
class="ant-table-container"
>
<div
class="ant-table-content"
>
<table
style="table-layout:auto"
>
<colgroup />
<thead
class="ant-table-thead"
>
<tr>
<th
class="ant-table-cell"
>
姓名
</th>
<th
class="ant-table-cell"
>
年龄
</th>
<th
class="ant-table-cell"
>
住址
</th>
</tr>
</thead>
<tbody
class="ant-table-tbody"
>
<tr
class="ant-table-row ant-table-row-level-0"
data-row-key="1"
>
<td
class="ant-table-cell"
>
胡彦斌
</td>
<td
class="ant-table-cell"
>
32
</td>
<td
class="ant-table-cell"
>
西湖区湖底公园1号
</td>
</tr>
<tr
class="ant-table-row ant-table-row-level-0"
data-row-key="2"
>
<td
class="ant-table-cell"
>
胡彦祖
</td>
<td
class="ant-table-cell"
>
42
</td>
<td
class="ant-table-cell"
>
西湖区湖底公园1号
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
`;
@@ -792,31 +1231,43 @@ exports[`renders ./components/descriptions/demo/vertical.md correctly 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
UserName
</span>
<span
class="ant-descriptions-item-label"
>
UserName
</span>
</div>
</th>
<th
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
Telephone
</span>
<span
class="ant-descriptions-item-label"
>
Telephone
</span>
</div>
</th>
<th
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
Live
</span>
<span
class="ant-descriptions-item-label"
>
Live
</span>
</div>
</th>
</tr>
<tr
@@ -826,31 +1277,43 @@ exports[`renders ./components/descriptions/demo/vertical.md correctly 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-content"
<div
class="ant-descriptions-item-container"
>
Zhou Maomao
</span>
<span
class="ant-descriptions-item-content"
>
Zhou Maomao
</span>
</div>
</td>
<td
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-content"
<div
class="ant-descriptions-item-container"
>
1810000000
</span>
<span
class="ant-descriptions-item-content"
>
1810000000
</span>
</div>
</td>
<td
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-content"
<div
class="ant-descriptions-item-container"
>
Hangzhou, Zhejiang
</span>
<span
class="ant-descriptions-item-content"
>
Hangzhou, Zhejiang
</span>
</div>
</td>
</tr>
<tr
@@ -860,21 +1323,29 @@ exports[`renders ./components/descriptions/demo/vertical.md correctly 1`] = `
class="ant-descriptions-item"
colspan="2"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
Address
</span>
<span
class="ant-descriptions-item-label"
>
Address
</span>
</div>
</th>
<th
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
Remark
</span>
<span
class="ant-descriptions-item-label"
>
Remark
</span>
</div>
</th>
</tr>
<tr
@@ -884,21 +1355,29 @@ exports[`renders ./components/descriptions/demo/vertical.md correctly 1`] = `
class="ant-descriptions-item"
colspan="2"
>
<span
class="ant-descriptions-item-content"
<div
class="ant-descriptions-item-container"
>
No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China
</span>
<span
class="ant-descriptions-item-content"
>
No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China
</span>
</div>
</td>
<td
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-content"
<div
class="ant-descriptions-item-container"
>
empty
</span>
<span
class="ant-descriptions-item-content"
>
empty
</span>
</div>
</td>
</tr>
</tbody>

View File

@@ -16,16 +16,20 @@ exports[`Descriptions Descriptions support colon 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label ant-descriptions-item-no-colon"
<div
class="ant-descriptions-item-container"
>
Product
</span>
<span
class="ant-descriptions-item-content"
>
Cloud Database
</span>
<span
class="ant-descriptions-item-label ant-descriptions-item-no-colon"
>
Product
</span>
<span
class="ant-descriptions-item-content"
>
Cloud Database
</span>
</div>
</td>
</tr>
</tbody>
@@ -51,11 +55,15 @@ exports[`Descriptions Descriptions support style 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-content"
<div
class="ant-descriptions-item-container"
>
Cloud Database
</span>
<span
class="ant-descriptions-item-content"
>
Cloud Database
</span>
</div>
</td>
</tr>
</tbody>
@@ -80,16 +88,20 @@ exports[`Descriptions Descriptions.Item support className 1`] = `
class="ant-descriptions-item my-class"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
Product
</span>
<span
class="ant-descriptions-item-content"
>
Cloud Database
</span>
<span
class="ant-descriptions-item-label"
>
Product
</span>
<span
class="ant-descriptions-item-content"
>
Cloud Database
</span>
</div>
</td>
</tr>
</tbody>
@@ -114,46 +126,58 @@ exports[`Descriptions column is number 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
Product
</span>
<span
class="ant-descriptions-item-content"
>
Cloud Database
</span>
<span
class="ant-descriptions-item-label"
>
Product
</span>
<span
class="ant-descriptions-item-content"
>
Cloud Database
</span>
</div>
</td>
<td
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
Billing
</span>
<span
class="ant-descriptions-item-content"
>
Prepaid
</span>
<span
class="ant-descriptions-item-label"
>
Billing
</span>
<span
class="ant-descriptions-item-content"
>
Prepaid
</span>
</div>
</td>
<td
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
time
</span>
<span
class="ant-descriptions-item-content"
>
18:00:00
</span>
<span
class="ant-descriptions-item-label"
>
time
</span>
<span
class="ant-descriptions-item-content"
>
18:00:00
</span>
</div>
</td>
</tr>
<tr
@@ -163,16 +187,20 @@ exports[`Descriptions column is number 1`] = `
class="ant-descriptions-item"
colspan="3"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
Amount
</span>
<span
class="ant-descriptions-item-content"
>
$80.00
</span>
<span
class="ant-descriptions-item-label"
>
Amount
</span>
<span
class="ant-descriptions-item-content"
>
$80.00
</span>
</div>
</td>
</tr>
</tbody>
@@ -197,16 +225,20 @@ exports[`Descriptions should work with React Fragment 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
bamboo
</span>
<span
class="ant-descriptions-item-content"
>
bamboo
</span>
<span
class="ant-descriptions-item-label"
>
bamboo
</span>
<span
class="ant-descriptions-item-content"
>
bamboo
</span>
</div>
</td>
</tr>
<tr
@@ -216,16 +248,20 @@ exports[`Descriptions should work with React Fragment 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
bamboo
</span>
<span
class="ant-descriptions-item-content"
>
bamboo
</span>
<span
class="ant-descriptions-item-label"
>
bamboo
</span>
<span
class="ant-descriptions-item-content"
>
bamboo
</span>
</div>
</td>
</tr>
<tr
@@ -235,16 +271,20 @@ exports[`Descriptions should work with React Fragment 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
bamboo
</span>
<span
class="ant-descriptions-item-content"
>
bamboo
</span>
<span
class="ant-descriptions-item-label"
>
bamboo
</span>
<span
class="ant-descriptions-item-content"
>
bamboo
</span>
</div>
</td>
</tr>
</tbody>
@@ -269,11 +309,15 @@ exports[`Descriptions vertical layout 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
Product
</span>
<span
class="ant-descriptions-item-label"
>
Product
</span>
</div>
</th>
</tr>
<tr
@@ -283,11 +327,15 @@ exports[`Descriptions vertical layout 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-content"
<div
class="ant-descriptions-item-container"
>
Cloud Database
</span>
<span
class="ant-descriptions-item-content"
>
Cloud Database
</span>
</div>
</td>
</tr>
<tr
@@ -297,11 +345,15 @@ exports[`Descriptions vertical layout 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
Billing
</span>
<span
class="ant-descriptions-item-label"
>
Billing
</span>
</div>
</th>
</tr>
<tr
@@ -311,11 +363,15 @@ exports[`Descriptions vertical layout 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-content"
<div
class="ant-descriptions-item-container"
>
Prepaid
</span>
<span
class="ant-descriptions-item-content"
>
Prepaid
</span>
</div>
</td>
</tr>
<tr
@@ -325,11 +381,15 @@ exports[`Descriptions vertical layout 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
time
</span>
<span
class="ant-descriptions-item-label"
>
time
</span>
</div>
</th>
</tr>
<tr
@@ -339,11 +399,15 @@ exports[`Descriptions vertical layout 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-content"
<div
class="ant-descriptions-item-container"
>
18:00:00
</span>
<span
class="ant-descriptions-item-content"
>
18:00:00
</span>
</div>
</td>
</tr>
<tr
@@ -353,11 +417,15 @@ exports[`Descriptions vertical layout 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
Amount
</span>
<span
class="ant-descriptions-item-label"
>
Amount
</span>
</div>
</th>
</tr>
<tr
@@ -367,11 +435,15 @@ exports[`Descriptions vertical layout 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-content"
<div
class="ant-descriptions-item-container"
>
$80.00
</span>
<span
class="ant-descriptions-item-content"
>
$80.00
</span>
</div>
</td>
</tr>
</tbody>
@@ -396,16 +468,20 @@ exports[`Descriptions when item is rendered conditionally 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
Product
</span>
<span
class="ant-descriptions-item-content"
>
Cloud Database
</span>
<span
class="ant-descriptions-item-label"
>
Product
</span>
<span
class="ant-descriptions-item-content"
>
Cloud Database
</span>
</div>
</td>
</tr>
<tr
@@ -415,16 +491,20 @@ exports[`Descriptions when item is rendered conditionally 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
Billing
</span>
<span
class="ant-descriptions-item-content"
>
Prepaid
</span>
<span
class="ant-descriptions-item-label"
>
Billing
</span>
<span
class="ant-descriptions-item-content"
>
Prepaid
</span>
</div>
</td>
</tr>
<tr
@@ -434,16 +514,20 @@ exports[`Descriptions when item is rendered conditionally 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
time
</span>
<span
class="ant-descriptions-item-content"
>
18:00:00
</span>
<span
class="ant-descriptions-item-label"
>
time
</span>
<span
class="ant-descriptions-item-content"
>
18:00:00
</span>
</div>
</td>
</tr>
<tr
@@ -453,16 +537,20 @@ exports[`Descriptions when item is rendered conditionally 1`] = `
class="ant-descriptions-item"
colspan="1"
>
<span
class="ant-descriptions-item-label"
<div
class="ant-descriptions-item-container"
>
Amount
</span>
<span
class="ant-descriptions-item-content"
>
$80.00
</span>
<span
class="ant-descriptions-item-label"
>
Amount
</span>
<span
class="ant-descriptions-item-content"
>
$80.00
</span>
</div>
</td>
</tr>
</tbody>

View File

@@ -0,0 +1,87 @@
---
order: 1
debug: true
title:
zh-CN: 复杂文本的情况
en-US: border
---
## zh-CN
带边框和背景颜色列表。
## en-US
Descriptions with border and background color.
```jsx
import { Descriptions, Badge, Table } from 'antd';
const dataSource = [
{
key: '1',
name: '胡彦斌',
age: 32,
address: '西湖区湖底公园1号',
},
{
key: '2',
name: '胡彦祖',
age: 42,
address: '西湖区湖底公园1号',
},
];
const columns = [
{
title: '姓名',
dataIndex: 'name',
key: 'name',
},
{
title: '年龄',
dataIndex: 'age',
key: 'age',
},
{
title: '住址',
dataIndex: 'address',
key: 'address',
},
];
ReactDOM.render(
<Descriptions title="User Info" column={2}>
<Descriptions.Item label="Product">Cloud Database</Descriptions.Item>
<Descriptions.Item label="Billing Mode">Prepaid</Descriptions.Item>
<Descriptions.Item label="Automatic Renewal">YES</Descriptions.Item>
<Descriptions.Item label="Order time">2018-04-24 18:00:00</Descriptions.Item>
<Descriptions.Item label="Usage Time" span={2}>
2019-04-24 18:00:00
</Descriptions.Item>
<Descriptions.Item label="Status" span={3}>
<Badge status="processing" text="Running" />
</Descriptions.Item>
<Descriptions.Item label="Negotiated Amount">$80.00</Descriptions.Item>
<Descriptions.Item label="Discount">$20.00</Descriptions.Item>
<Descriptions.Item label="Official Receipts">$60.00</Descriptions.Item>
<Descriptions.Item label="Config Info">
Data disk type: MongoDB
<br />
Database version: 3.4
<br />
Package: dds.mongo.mid
<br />
Storage space: 10 GB
<br />
Replication factor: 3
<br />
Region: East China 1<br />
</Descriptions.Item>
<Descriptions.Item label="Official Receipts">$60.00</Descriptions.Item>
<Descriptions.Item label="Config Info">
<Table size="small" pagination={false} dataSource={dataSource} columns={columns} />
</Descriptions.Item>
</Descriptions>,
mountNode,
);
```

View File

@@ -82,6 +82,7 @@
&-item-content {
display: table-cell;
flex: 1;
color: @text-color;
font-size: @font-size-base;
line-height: @line-height-base;
@@ -89,10 +90,15 @@
&-item {
padding-bottom: 0;
vertical-align: top;
> span {
display: inline-flex;
align-items: baseline;
}
&-container {
display: flex;
}
}
&-middle {

View File

@@ -14,13 +14,11 @@ A divider line separates different content.
## API
### Divider
| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
| className | The className of container | string | - | |
| dashed | Whether line is dashed | boolean | false | |
| orientation | The position of title inside divider | `left` \| `right` \| `center` | `center` | |
| plain | Divider text show as plain style | boolean | true | 4.2.0 |
| style | The style object of container | CSSProperties | - | |
| type | The direction type of divider | `horizontal` \| `vertical` | `horizontal` | |
| plain | Divider text show as plain style | boolean | true | 4.2.0 |

View File

@@ -20,6 +20,6 @@ cover: https://gw.alipayobjects.com/zos/alicdn/5swjECahe/Divider.svg
| className | 分割线样式类 | string | - | |
| dashed | 是否虚线 | boolean | false | |
| orientation | 分割线标题的位置 | `left` \| `right` \| `center` | `center` | |
| plain | 文字是否显示为普通正文样式 | boolean | false | 4.2.0 |
| style | 分割线样式对象 | CSSProperties | - | |
| type | 水平还是垂直类型 | `horizontal` \| `vertical` | `horizontal` | |
| plain | 文字是否显示为普通正文样式 | boolean | false | 4.2.0 |

View File

@@ -11,7 +11,7 @@ Array [
<div>
<div
class="ant-dropdown"
style="opacity:0"
style="opacity:0;pointer-events:none"
>
<div>
menu
@@ -32,10 +32,10 @@ Array [
<div>
<div
class="ant-dropdown"
style="opacity:0"
style="opacity:0;pointer-events:none"
>
<span>
overlayNode
string
</span>
</div>
</div>,

View File

@@ -87,7 +87,7 @@ const Dropdown: DropdownInterface = props => {
overlayNode = overlay;
}
overlayNode = React.Children.only(
typeof overlayNode === 'string' ? <span>overlayNode</span> : overlayNode,
typeof overlayNode === 'string' ? <span>{overlayNode}</span> : overlayNode,
);
const overlayProps = overlayNode.props;

View File

@@ -19,14 +19,14 @@ When there are more than a few options to choose from, you can wrap them in a `D
| --- | --- | --- | --- | --- |
| arrow | Whether the dropdown arrow should be visible | boolean | false | |
| disabled | Whether the dropdown menu is disabled | boolean | - | |
| getPopupContainer | To set the container of the dropdown menu. The default is to create a `div` element in `body`, but you can reset it to the scrolling area and make a relative reposition. [Example on CodePen](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | function(triggerNode) | () => document.body | |
| getPopupContainer | To set the container of the dropdown menu. The default is to create a div element in body, but you can reset it to the scrolling area and make a relative reposition. [Example on CodePen](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | function(triggerNode) | () => document.body | |
| overlay | The dropdown menu | [Menu](/components/menu) \| () => Menu | - | |
| overlayClassName | Class name of the dropdown root element | string | - | |
| overlayStyle | Style of the dropdown root element | object | - | |
| overlayClassName | The class name of the dropdown root element | string | - | |
| overlayStyle | The style of the dropdown root element | object | - | |
| onVisibleChange | Called when the visible state is changed | function(visible) | - | |
| placement | Placement of popup menu: `bottomLeft`, `bottomCenter`, `bottomRight`, `topLeft`, `topCenter` or `topRight` | string | `bottomLeft` | |
| trigger | The trigger mode which executes the dropdown action. Note that hover can't be used on touchscreens | Array&lt;`click`\|`hover`\|`contextMenu`> | \[`hover`] | |
| visible | Whether the dropdown menu is currently visible | boolean | - | |
| onVisibleChange | Called when the visible state is changed | function(visible) | - | |
You should use [Menu](/components/menu/) as `overlay`. The menu items and dividers are also available by using `Menu.Item` and `Menu.Divider`.
@@ -38,14 +38,14 @@ You should use [Menu](/components/menu/) as `overlay`. The menu items and divide
| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
| buttonsRender | Custom buttons inside Dropdown.Button | ([buttons: ReactNode[]]) => ReactNode | - | |
| disabled | Whether the dropdown menu is disabled | boolean | - | |
| icon | Icon (appears on the right) | ReactNode | - | |
| onClick | The same as [Button](/components/button): called when you click the button on the left | function | - | |
| onVisibleChange | Called when the visible state is changed | function | - | |
| overlay | The dropdown menu | [Menu](/components/menu) | - | |
| placement | Placement of popup menu: `bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | string | `bottomLeft` | |
| size | Size of the button, the same as [Button](/components/button) | string | `default` | |
| trigger | The trigger mode which executes the dropdown action | Array&lt;`click`\|`hover`\|`contextMenu`> | \[`hover`] | |
| type | Type of the button, the same as [Button](/components/button) | string | `default` | |
| visible | Whether the dropdown menu is currently visible | boolean | - | |
| onClick | The same as [Button](/components/button): called when you click the button on the left | function | - | |
| onVisibleChange | Called when the visible state is changed | function | - | |
| buttonsRender | Custom buttons inside Dropdown.Button | ([buttons: ReactNode[]]) => ReactNode | - | |

View File

@@ -27,29 +27,29 @@ cover: https://gw.alipayobjects.com/zos/alicdn/eedWN59yJ/Dropdown.svg
| overlay | 菜单 | [Menu](/components/menu) \| () => Menu | - | |
| overlayClassName | 下拉根元素的类名称 | string | - | |
| overlayStyle | 下拉根元素的样式 | object | - | |
| onVisibleChange | 菜单显示状态改变时调用,参数为 `visible` | function(visible) | - | |
| placement | 菜单弹出位置:`bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | string | `bottomLeft` | |
| trigger | 触发下拉的行为, 移动端不支持 hover | Array&lt;`click`\|`hover`\|`contextMenu`> | \[`hover`] | |
| visible | 菜单是否显示 | boolean | - | |
| onVisibleChange | 菜单显示状态改变时调用,参数为 `visible` | function(visible) | - | |
`overlay` 菜单使用 [Menu](/components/menu/),还包括菜单项 `Menu.Item`,分割线 `Menu.Divider`
> 注意: Menu.Item 必须设置唯一的 key 属性。
>
> Dropdown 下的 Menu 默认不可选中。如果需要菜单可选中,可以指定 `<Menu selectable>`.
> Dropdown 下的 Menu 默认不可选中。如果需要菜单可选中,可以指定 `<Menu selectable>`
### Dropdown.Button
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| buttonsRender | 自定义左右两个按钮 | ([buttons: ReactNode[]]) => ReactNode | - | |
| disabled | 菜单是否禁用 | boolean | - | |
| icon | 右侧的 icon | ReactNode | - | |
| onClick | 点击左侧按钮的回调,和 [Button](/components/button/) 一致 | function | - | |
| onVisibleChange | 菜单显示状态改变时调用,参数为 `visible` | function | - | |
| overlay | 菜单 | [Menu](/components/menu/) | - | |
| placement | 菜单弹出位置:`bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | string | `bottomLeft` | |
| size | 按钮大小,和 [Button](/components/button/) 一致 | string | `default` | |
| trigger | 触发下拉的行为 | Array&lt;`click`\|`hover`\|`contextMenu`> | \[`hover`] | |
| type | 按钮类型,和 [Button](/components/button/) 一致 | string | `default` | |
| visible | 菜单是否显示 | boolean | - | |
| onClick | 点击左侧按钮的回调,和 [Button](/components/button/) 一致 | function | - | |
| onVisibleChange | 菜单显示状态改变时调用,参数为 `visible` | function | - | |
| buttonsRender | 自定义左右两个按钮 | ([buttons: ReactNode[]]) => ReactNode | - | |

View File

@@ -16,7 +16,7 @@
}
&-menu {
&-rtl {
&&-rtl {
direction: rtl;
text-align: right;
}

View File

@@ -99,9 +99,9 @@ exports[`renders ./components/empty/demo/config-provider.md correctly 1`] = `
<div
class="config-provider"
>
<h3>
<h4>
Select
</h3>
</h4>
<div
class="ant-select ant-select-single ant-select-show-arrow"
style="width:200px"
@@ -159,9 +159,9 @@ exports[`renders ./components/empty/demo/config-provider.md correctly 1`] = `
</span>
</span>
</div>
<h3>
<h4>
TreeSelect
</h3>
</h4>
<div
class="ant-select ant-tree-select ant-select-single ant-select-show-arrow"
style="width:200px"
@@ -219,9 +219,9 @@ exports[`renders ./components/empty/demo/config-provider.md correctly 1`] = `
</span>
</span>
</div>
<h3>
<h4>
Cascader
</h3>
</h4>
<span
class="ant-cascader-picker ant-cascader-picker-show-search"
style="width:200px"
@@ -259,9 +259,9 @@ exports[`renders ./components/empty/demo/config-provider.md correctly 1`] = `
</svg>
</span>
</span>
<h3>
<h4>
Transfer
</h3>
</h4>
<div
class="ant-transfer"
>
@@ -532,9 +532,9 @@ exports[`renders ./components/empty/demo/config-provider.md correctly 1`] = `
</div>
</div>
</div>
<h3>
<h4>
Table
</h3>
</h4>
<div
class="ant-table-wrapper"
style="margin-top:8px"
@@ -640,9 +640,9 @@ exports[`renders ./components/empty/demo/config-provider.md correctly 1`] = `
</div>
</div>
</div>
<h3>
<h4>
List
</h3>
</h4>
<div
class="ant-list ant-list-split"
>

View File

@@ -58,19 +58,19 @@ class Demo extends React.Component {
<ConfigProvider renderEmpty={customize && customizeRenderEmpty}>
<div className="config-provider">
<h3>Select</h3>
<h4>Select</h4>
<Select style={style} />
<h3>TreeSelect</h3>
<h4>TreeSelect</h4>
<TreeSelect style={style} treeData={[]} />
<h3>Cascader</h3>
<h4>Cascader</h4>
<Cascader style={style} options={[]} showSearch />
<h3>Transfer</h3>
<h4>Transfer</h4>
<Transfer />
<h3>Table</h3>
<h4>Table</h4>
<Table
style={{ marginTop: 8 }}
columns={[
@@ -87,7 +87,7 @@ class Demo extends React.Component {
]}
/>
<h3>List</h3>
<h4>List</h4>
<List />
</div>
</ConfigProvider>
@@ -100,7 +100,7 @@ ReactDOM.render(<Demo />, mountNode);
```
<style>
.code-box-demo .config-provider h3 {
.code-box-demo .config-provider h4 {
font-size: inherit;
margin: 16px 0 8px 0;
}

View File

@@ -1,29 +1,33 @@
import * as React from 'react';
import { useMemo } from 'react';
import classNames from 'classnames';
import FieldForm, { List } from 'rc-field-form';
import { FormProps as RcFormProps } from 'rc-field-form/lib/Form';
import { ValidateErrorEntity } from 'rc-field-form/lib/interface';
import { ColProps } from '../grid/col';
import { ConfigContext, ConfigConsumerProps } from '../config-provider';
import { FormContext } from './context';
import { FormContext, FormContextProps } from './context';
import { FormLabelAlign } from './interface';
import useForm, { FormInstance } from './hooks/useForm';
import SizeContext, { SizeType, SizeContextProvider } from '../config-provider/SizeContext';
export type RequiredMark = boolean | 'optional';
export type FormLayout = 'horizontal' | 'inline' | 'vertical';
export interface FormProps extends Omit<RcFormProps, 'form'> {
export interface FormProps<Values = any> extends Omit<RcFormProps<Values>, 'form'> {
prefixCls?: string;
hideRequiredMark?: boolean;
colon?: boolean;
name?: string;
layout?: FormLayout;
labelAlign?: FormLabelAlign;
labelCol?: ColProps;
wrapperCol?: ColProps;
form?: FormInstance;
form?: FormInstance<Values>;
size?: SizeType;
scrollToFirstError?: boolean;
requiredMark?: RequiredMark;
/** @deprecated Will warning in future branch. Pls use `requiredMark` instead. */
hideRequiredMark?: boolean;
}
const InternalForm: React.ForwardRefRenderFunction<unknown, FormProps> = (props, ref) => {
@@ -44,17 +48,30 @@ const InternalForm: React.ForwardRefRenderFunction<unknown, FormProps> = (props,
hideRequiredMark,
layout = 'horizontal',
scrollToFirstError,
requiredMark,
onFinishFailed,
...restFormProps
} = props;
const mergedRequiredMark = useMemo(() => {
if (requiredMark !== undefined) {
return requiredMark;
}
if (hideRequiredMark) {
return false;
}
return true;
}, [hideRequiredMark, requiredMark]);
const prefixCls = getPrefixCls('form', customizePrefixCls);
const formClassName = classNames(
prefixCls,
{
[`${prefixCls}-${layout}`]: true,
[`${prefixCls}-hide-required-mark`]: hideRequiredMark,
[`${prefixCls}-hide-required-mark`]: mergedRequiredMark === false,
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-${size}`]: size,
},
@@ -65,7 +82,7 @@ const InternalForm: React.ForwardRefRenderFunction<unknown, FormProps> = (props,
const { __INTERNAL__ } = wrapForm;
__INTERNAL__.name = name;
const formContextValue = React.useMemo(
const formContextValue = useMemo<FormContextProps>(
() => ({
name,
labelAlign,
@@ -73,9 +90,10 @@ const InternalForm: React.ForwardRefRenderFunction<unknown, FormProps> = (props,
wrapperCol,
vertical: layout === 'vertical',
colon,
requiredMark: mergedRequiredMark,
itemRef: __INTERNAL__.itemRef,
}),
[name, labelAlign, labelCol, wrapperCol, layout, colon],
[name, labelAlign, labelCol, wrapperCol, layout, colon, mergedRequiredMark],
);
React.useImperativeHandle(ref, () => wrapForm);
@@ -105,7 +123,9 @@ const InternalForm: React.ForwardRefRenderFunction<unknown, FormProps> = (props,
);
};
const Form = React.forwardRef<FormInstance, FormProps>(InternalForm);
const Form = React.forwardRef<FormInstance, FormProps>(InternalForm) as <Values = any>(
props: React.PropsWithChildren<FormProps<Values>> & { ref?: React.Ref<FormInstance<Values>> },
) => React.ReactElement;
export { useForm, List, FormInstance };

View File

@@ -50,6 +50,7 @@ export interface FormItemProps extends FormItemLabelProps, FormItemInputProps, R
validateStatus?: ValidateStatus;
required?: boolean;
hidden?: boolean;
initialValue?: any;
/** Auto passed by List render props. User should not use this. */
fieldKey?: React.Key | React.Key[];
@@ -86,7 +87,7 @@ function FormItem(props: FormItemProps): React.ReactElement {
} = props;
const destroyRef = React.useRef(false);
const { getPrefixCls } = React.useContext(ConfigContext);
const { name: formName } = React.useContext(FormContext);
const { name: formName, requiredMark } = React.useContext(FormContext);
const { updateItemErrors } = React.useContext(FormItemContext);
const [domErrorVisible, innerSetDomErrorVisible] = React.useState(!!help);
const prevValidateStatusRef = React.useRef<ValidateStatus | undefined>(validateStatus);
@@ -142,7 +143,7 @@ function FormItem(props: FormItemProps): React.ReactElement {
meta?: Meta,
isRequired?: boolean,
): React.ReactNode {
if (noStyle) {
if (noStyle && !hidden) {
return baseChildren;
}
@@ -224,7 +225,13 @@ function FormItem(props: FormItemProps): React.ReactElement {
])}
>
{/* Label */}
<FormItemLabel htmlFor={fieldId} required={isRequired} {...props} prefixCls={prefixCls} />
<FormItemLabel
htmlFor={fieldId}
required={isRequired}
requiredMark={requiredMark}
{...props}
prefixCls={prefixCls}
/>
{/* Input Group */}
<FormItemInput
{...props}

View File

@@ -5,12 +5,13 @@ import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled';
import CheckCircleFilled from '@ant-design/icons/CheckCircleFilled';
import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled';
import useMemo from 'rc-util/lib/hooks/useMemo';
import CSSMotion from 'rc-animate/lib/CSSMotion';
import CSSMotion from 'rc-motion';
import Col, { ColProps } from '../grid/col';
import { ValidateStatus } from './FormItem';
import { FormContext } from './context';
import useCacheErrors from './hooks/useCacheErrors';
import useForceUpdate from '../_util/hooks/useForceUpdate';
interface FormItemInputMiscProps {
prefixCls: string;
@@ -45,7 +46,7 @@ const FormItemInput: React.FC<FormItemInputProps & FormItemInputMiscProps> = ({
validateStatus,
extra,
}) => {
const [, forceUpdate] = React.useState({});
const forceUpdate = useForceUpdate();
const baseClassName = `${prefixCls}-item`;
@@ -68,7 +69,7 @@ const FormItemInput: React.FC<FormItemInputProps & FormItemInputMiscProps> = ({
onDomErrorVisibleChange(true);
});
}
forceUpdate({});
forceUpdate();
},
!!help,
);

View File

@@ -3,6 +3,9 @@ import classNames from 'classnames';
import Col, { ColProps } from '../grid/col';
import { FormLabelAlign } from './interface';
import { FormContext, FormContextProps } from './context';
import { RequiredMark } from './Form';
import { useLocaleReceiver } from '../locale-provider/LocaleReceiver';
import defaultLocale from '../locale/default';
export interface FormItemLabelProps {
colon?: boolean;
@@ -10,6 +13,7 @@ export interface FormItemLabelProps {
label?: React.ReactNode;
labelAlign?: FormLabelAlign;
labelCol?: ColProps;
requiredMark?: RequiredMark;
}
const FormItemLabel: React.FC<FormItemLabelProps & { required?: boolean; prefixCls: string }> = ({
@@ -20,7 +24,10 @@ const FormItemLabel: React.FC<FormItemLabelProps & { required?: boolean; prefixC
labelAlign,
colon,
required,
requiredMark,
}) => {
const [formLocale] = useLocaleReceiver('Form');
if (!label) return null;
return (
@@ -51,8 +58,21 @@ const FormItemLabel: React.FC<FormItemLabelProps & { required?: boolean; prefixC
labelChildren = (label as string).replace(/[:|]\s*$/, '');
}
// Add required mark if optional
if (requiredMark === 'optional' && !required) {
labelChildren = (
<>
{labelChildren}
<span className={`${prefixCls}-item-optional`}>
{formLocale?.optional || defaultLocale.Form?.optional}
</span>
</>
);
}
const labelClassName = classNames({
[`${prefixCls}-item-required`]: required,
[`${prefixCls}-item-required-mark-optional`]: requiredMark === 'optional',
[`${prefixCls}-item-no-colon`]: !computedColon,
});

View File

@@ -10,7 +10,7 @@ export interface FormListFieldData {
}
export interface FormListOperation {
add: (defaultValue?: StoreValue) => void;
add: (defaultValue?: StoreValue, insertIndex?: number) => void;
remove: (index: number | number[]) => void;
move: (from: number, to: number) => void;
}

View File

@@ -1592,6 +1592,39 @@ exports[`renders ./components/form/demo/dynamic-form-item.md correctly 1`] = `
Add field
</span>
</button>
<button
class="ant-btn ant-btn-dashed"
style="width:60%;margin-top:20px"
type="button"
>
<span
aria-label="plus"
class="anticon anticon-plus"
role="img"
>
<svg
aria-hidden="true"
class=""
data-icon="plus"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<defs />
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
<span>
Add field at head
</span>
</button>
</div>
</div>
</div>
@@ -3487,6 +3520,201 @@ exports[`renders ./components/form/demo/register.md correctly 1`] = `
</form>
`;
exports[`renders ./components/form/demo/required-mark.md correctly 1`] = `
<form
class="ant-form ant-form-vertical"
>
<div
class="ant-row ant-form-item"
>
<div
class="ant-col ant-form-item-label"
>
<label
class="ant-form-item-required-mark-optional"
for="requiredMark"
title="Required Mark"
>
Required Mark
<span
class="ant-form-item-optional"
>
(optional)
</span>
</label>
</div>
<div
class="ant-col ant-form-item-control"
>
<div
class="ant-form-item-control-input"
>
<div
class="ant-form-item-control-input-content"
>
<div
class="ant-radio-group ant-radio-group-outline"
id="requiredMark"
>
<label
class="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
>
<span
class="ant-radio-button ant-radio-button-checked"
>
<input
checked=""
class="ant-radio-button-input"
type="radio"
value="optional"
/>
<span
class="ant-radio-button-inner"
/>
</span>
<span>
Optional
</span>
</label>
<label
class="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
>
<input
class="ant-radio-button-input"
type="radio"
value="true"
/>
<span
class="ant-radio-button-inner"
/>
</span>
<span>
Required
</span>
</label>
<label
class="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
>
<input
class="ant-radio-button-input"
type="radio"
value="false"
/>
<span
class="ant-radio-button-inner"
/>
</span>
<span>
Hidden
</span>
</label>
</div>
</div>
</div>
</div>
</div>
<div
class="ant-row ant-form-item"
>
<div
class="ant-col ant-form-item-label"
>
<label
class="ant-form-item-required ant-form-item-required-mark-optional"
title="Field A"
>
Field A
</label>
</div>
<div
class="ant-col ant-form-item-control"
>
<div
class="ant-form-item-control-input"
>
<div
class="ant-form-item-control-input-content"
>
<input
class="ant-input"
placeholder="input placeholder"
type="text"
value=""
/>
</div>
</div>
</div>
</div>
<div
class="ant-row ant-form-item"
>
<div
class="ant-col ant-form-item-label"
>
<label
class="ant-form-item-required-mark-optional"
title="Field B"
>
Field B
<span
class="ant-form-item-optional"
>
(optional)
</span>
</label>
</div>
<div
class="ant-col ant-form-item-control"
>
<div
class="ant-form-item-control-input"
>
<div
class="ant-form-item-control-input-content"
>
<input
class="ant-input"
placeholder="input placeholder"
type="text"
value=""
/>
</div>
</div>
</div>
</div>
<div
class="ant-row ant-form-item"
>
<div
class="ant-col ant-form-item-control"
>
<div
class="ant-form-item-control-input"
>
<div
class="ant-form-item-control-input-content"
>
<button
class="ant-btn ant-btn-primary"
type="button"
>
<span>
Submit
</span>
</button>
</div>
</div>
</div>
</div>
</form>
`;
exports[`renders ./components/form/demo/size.md correctly 1`] = `
<form
class="ant-form ant-form-horizontal ant-form-default"
@@ -5827,7 +6055,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
</svg>
</span>
<span>
Click to upload
Click to upload
</span>
</button>
</span>

View File

@@ -1,6 +1,35 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Form Form item hidden 1`] = `
exports[`Form Form item hidden noStyle should not work when hidden 1`] = `
<form
class="ant-form ant-form-horizontal"
>
<div
class="ant-row ant-form-item ant-form-item-hidden"
>
<div
class="ant-col ant-form-item-control"
>
<div
class="ant-form-item-control-input"
>
<div
class="ant-form-item-control-input-content"
>
<input
class="ant-input"
id="light"
type="text"
value=""
/>
</div>
</div>
</div>
</div>
</form>
`;
exports[`Form Form item hidden should work 1`] = `
<form
class="ant-form ant-form-horizontal"
>

View File

@@ -699,14 +699,39 @@ describe('Form', () => {
expect(wrapper.find('input').prop('onBlur')).toBeTruthy();
});
it('Form item hidden', () => {
describe('Form item hidden', () => {
it('should work', () => {
const wrapper = mount(
<Form>
<Form.Item name="light" hidden>
<Input />
</Form.Item>
</Form>,
);
expect(wrapper).toMatchRenderedSnapshot();
});
it('noStyle should not work when hidden', () => {
const wrapper = mount(
<Form>
<Form.Item name="light" hidden noStyle>
<Input />
</Form.Item>
</Form>,
);
expect(wrapper).toMatchRenderedSnapshot();
});
});
it('legacy hideRequiredMark', () => {
const wrapper = mount(
<Form>
<Form.Item name="light" hidden>
<Form hideRequiredMark>
<Form.Item name="light" required>
<Input />
</Form.Item>
</Form>,
);
expect(wrapper).toMatchRenderedSnapshot();
expect(wrapper.find('form').hasClass('ant-form-hide-required-mark')).toBeTruthy();
});
});

View File

@@ -1,7 +1,12 @@
import * as React from 'react';
import Form from '..';
import Form, { FormInstance } from '..';
import Input from '../../input';
interface FormValues {
username?: string;
path1?: { path2?: number };
}
describe('Form.typescript', () => {
it('Form.Item', () => {
const form = (
@@ -14,4 +19,52 @@ describe('Form.typescript', () => {
expect(form).toBeTruthy();
});
describe('generic', () => {
it('hooks', () => {
const Demo = () => {
const [form] = Form.useForm<FormValues>();
form.setFieldsValue({ path1: { path2: 2333 } });
return (
<Form
form={form}
onFinish={values => {
expect(values).toBeTruthy();
expect(values.username).toBeTruthy();
expect(values.path1?.path2).toBeTruthy();
}}
/>
);
};
expect(Demo).toBeTruthy();
});
it('ref', () => {
class Demo extends React.Component {
formRef = React.createRef<FormInstance<FormValues>>();
componentDidMount() {
this.formRef.current?.setFieldsValue({ path1: { path2: 233 } });
}
render() {
return (
<Form
ref={this.formRef}
onFinish={values => {
expect(values).toBeTruthy();
expect(values.username).toBeTruthy();
expect(values.path1?.path2).toBeTruthy();
}}
/>
);
}
}
expect(Demo).toBeTruthy();
});
});
});

View File

@@ -4,6 +4,7 @@ import { FormProvider as RcFormProvider } from 'rc-field-form';
import { FormProviderProps as RcFormProviderProps } from 'rc-field-form/lib/FormContext';
import { ColProps } from '../grid/col';
import { FormLabelAlign } from './interface';
import { RequiredMark } from './Form';
/**
* Form Context
@@ -16,6 +17,7 @@ export interface FormContextProps {
labelAlign?: FormLabelAlign;
labelCol?: ColProps;
wrapperCol?: ColProps;
requiredMark?: RequiredMark;
itemRef: (name: (string | number)[]) => (node: React.ReactElement) => void;
}

View File

@@ -3,6 +3,7 @@ order: 99
title:
zh-CN: Dep Debug
en-US: Dep Debug
debug: true
---
## zh-CN

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