Compare commits

...

367 Commits
3.2.3 ... 3.5.2

Author SHA1 Message Date
valleykid
41b9a79edb release 3.5.2 2018-05-13 22:51:50 +08:00
afc163
35b751da15 site: better responsive 2018-05-12 14:02:34 +08:00
Oleg Kuzava
71abb96de7 Allow to use any CSS units for layout width (#10479)
* Allow to use any CSS units for layout width

* Fix ts issues

* Fix parseFloat type check

* add tests for width in Sider

* clean up
2018-05-12 02:30:33 +08:00
dependabot[bot]
dd7fb9d351 Update unified requirement to ^7.0.0 (#10474)
Updates the requirements on [unified](https://github.com/unifiedjs/unified) to permit the latest version.
- [Release notes](https://github.com/unifiedjs/unified/releases)
- [Commits](https://github.com/unifiedjs/unified/commits/7.0.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-05-11 16:02:36 +08:00
tangjinzhou
4adf0b2571 docs: add vue-antd-ui link (#10463) 2018-05-10 23:56:22 +08:00
jiang
9e01b24272 fix 10445 (#10457)
* fix 10445

* re help anim timing

* refactor

* use this.helpShow

* is show no set state

* remove state.helpShow
2018-05-10 21:48:11 +08:00
jiang
1b8030ec59 Update customize-theme.zh-CN.md 2018-05-10 19:56:38 +08:00
jiang
2747aa341d Update customize-theme.en-US.md 2018-05-10 19:56:18 +08:00
picodoth
030c745e1b fix: checkbox trigger twice
regression introduced from d93cfde
2018-05-10 19:04:37 +08:00
Christopher Deutsch
dd0d4214d1 Omit 'ref' from ButtonProps otherwise typing conflicts occur. (#10426)
Fixes #10405
2018-05-10 11:21:07 +08:00
afc163
6eef4d0a42 chore: code style 2018-05-10 11:01:58 +08:00
afc163
6e6b1ccdec chore: code style 2018-05-10 10:59:33 +08:00
Jinxuan Zhu
832c524b32 Use local tslint config; simplify editor configuration (#10450) 2018-05-10 00:36:19 +08:00
afc163
bc4143f8a3 Fix Cascader displayRender z-index issue, close #10433 2018-05-09 18:16:08 +08:00
afc163
be31f17bca Change Dropdown.Button default icon to ellipsis 2018-05-09 18:01:07 +08:00
Lyndon001
dcb75a789d Update work-with-us.zh-CN.md 2018-05-09 17:56:19 +08:00
afc163
ffc182f4eb release 3.5.1 2018-05-09 16:35:18 +08:00
afc163
fbf09e86af site: show version info in home page 2018-05-09 10:45:45 +08:00
Xiaoming
7f2159e928 Message doc update & change variable statement (#10420)
* eslint disallow use of chained assignment expressions

eslint disallow use of chained assignment expressions

* revert

* message-doc-update

1.If a variable is never reassigned, using the const declaration is
better.
2.Defaultvalue’s type must be ‘number’ depend on type
2018-05-08 21:59:28 +08:00
Wei Zhu
04ee8526ab Revert "Fix table scroll x (#9704)"
This reverts commit 0d9dcb1714.
2018-05-08 16:23:10 +08:00
konakona
06f205874f Add missing semicolon (#10410)
* Add missing semicolon

* Remove semicolon for custom-typings.d.ts
2018-05-08 13:03:27 +08:00
afc163
20495dd5ba Fix monospaced number font weight issue
http://codesandbox.io/s/w705jk5wz7
2018-05-07 21:19:16 +08:00
陈帅
d5c5219111 new edit Table demo (#10119)
* new edit Table demo

* fix test error

* fix ci

* typo

* Skip edit-row test for React 15

* Set column width

* Update snapshot
2018-05-07 20:50:43 +08:00
afc163
5e99a93930 Fix collapse focused style 2018-05-07 17:57:49 +08:00
Zohaib Ijaz
bd81877cf8 #10007: Dynamic/Runtime Theme (#10384)
- Added links  to related articles
2018-05-07 16:12:28 +08:00
Wei Zhu
8a6d9b92b7 Improve table types
Fix #10374
2018-05-07 12:32:26 +08:00
afc163
d93cfdef09 clean up unnecessary z-index
close #9840

close #10385
2018-05-06 21:50:50 +08:00
afc163
e86f17186b Fix select test snapshot 2018-05-06 14:58:05 +08:00
afc163
6d91a3eb4a Fix select arrow overlap bug, close #10383
introduced by #10092, this commit also fix #10092
2018-05-06 14:54:27 +08:00
afc163
d95379cfa5 Fix broken style of Input with addons, close #10371 2018-05-05 19:50:48 +08:00
afc163
dbde26e560 docs: add disabled prop doc for Button, close #10373 2018-05-05 13:18:50 +08:00
Karol Majewski
1479726932 Use exact type for Breadcrumb.Item (#10372)
Using "any" breaks the build for TSLint users having the "no-unsafe-any" rule enabled.

See https://palantir.github.io/tslint/rules/no-unsafe-any/
2018-05-05 00:47:44 +08:00
愚指导
9368e2df87 Bump 3.5.0 (#10297) 2018-05-04 18:15:28 +08:00
Zheeeng
7f8cb838e3 Remove the side effects in render method (#10357) 2018-05-04 17:37:31 +08:00
愚指导
0f7794946f upgrade rc-cascader to 1.13.0 for support filedNames (#10365) 2018-05-04 17:27:34 +08:00
Christian
f4b8a58480 fixes #10289 and #10209: lost of user selection on table data updates (#10332)
* fixes #10289 and #10209: lost of user selection on table data updates

* adds shallowequal check
2018-05-04 14:51:15 +08:00
Wu Haotian
6019245365 fix(button): use React.HTMLProps for button's props (#10229) 2018-05-04 14:48:41 +08:00
Wei Zhu
3fd9397174 Keep text align center
Fix prev commit
2018-05-04 14:33:06 +08:00
Wei Zhu
f1e38a1573 Fix table merged header cell border
Fix #10359
2018-05-04 14:30:21 +08:00
愚道
013df45a70 merge https://github.com/ant-design/ant-design/pull/10306 from feature-3.5.0 2018-05-03 16:58:50 +08:00
afc163
5ee4d20e2a should still have padding when card which set padding to 0 is loading 2018-05-03 15:17:04 +08:00
afc163
c9017b6c6c release 3.4.5 2018-05-03 14:27:37 +08:00
Michael Wang
05e702a2b4 Remove useless characters in doc (#10340) 2018-05-03 11:52:50 +08:00
paranoidjk
8e166915a9 fix(Select): value tsd (#10336) 2018-05-03 11:28:30 +08:00
Xiaoming
9c6fef0604 treeSelect doc (#10302)
TreeSelect implement Tree as popup panel which use title as the display
text.
To follow the Select definition (label as display text), TreeSelect
internal convert the prop label into title to the Tree component (but
will follow if title is set).
ref:
https://github.com/react-component/tree-select/blob/master/src/Select.js
x#L44
2018-05-03 11:26:59 +08:00
paranoidjk
b6f8ab89c7 Fix: Form tsd (#10324)
* Fix(form): wrappedComponentRef interface

- ref: https://github.com/react-component/form/blob/master/src/createBaseForm.js#L499

* refactor: use ts conditional type

* fix: merge

* Revert "refactor: use ts conditional type"

This reverts commit ab3035da83.
2018-05-02 18:24:51 +08:00
Wei Zhu
56e3384c6b Revert "MenuItem: avoid rendering Tooltip unless necessary (#9636)"
This reverts commit 0754845aff.

Conditional rendering will break the transition animation,
since React will create new DOM node when inlineCollapsed changges.

Fix https://github.com/react-component/menu/issues/139
2018-05-02 14:49:20 +08:00
afc163
b5a52d26f2 fix snapshot 2018-05-02 14:28:16 +08:00
afc163
70a42545e3 fix fileToObject, close #10319 2018-05-02 13:56:54 +08:00
afc163
fb38e55cc0 more test about button text 2018-05-01 19:36:11 +08:00
afc163
c7471a4653 tweak insert space logic of loading button 2018-05-01 19:33:38 +08:00
afc163
726f0466bc menu should be unfocusable defaultly 2018-05-01 18:53:44 +08:00
Wei Zhu
a4261f9344 Only lock issues 2018-05-01 18:32:48 +08:00
Wei Zhu
0616b05583 Add lock threads robot 2018-05-01 13:56:25 +08:00
afc163
d0c3752a4e we can remove @types/node now 2018-05-01 13:49:37 +08:00
Daniel Gomez
3a5fce7256 Fix UploadFile's lastModifiedDate property name (#10315) 2018-05-01 00:11:18 +08:00
afc163
74e36325a2 site: tweak style 2018-04-29 23:02:07 +08:00
Junbin Huang
3a3d550b54 chore: upgrade menu (#10305)
* chore: upgrade menu and select

* Add test case for coverage percent
2018-04-29 23:01:58 +08:00
Ash Kumar
013932e6d3 Feature: (Issue 10213): Column 'sorter' function is passed 'sortOrder' as param (#10306)
* Table Column's sorter prop can now be provided a fn to which 'sortOrder' is passed as param

* head.md: added documentation for new use of 'sorter' prop function
2018-04-29 22:08:28 +08:00
Benjy Cui
cd6ad64cab chore: remove advertisement for yuque (#10299) 2018-04-29 10:42:45 +08:00
afc163
81dd432e31 update select demo 2018-04-28 23:56:38 +08:00
afc163
4535e9d4f1 Fix Select extra space taken up when arrow disabled
close #10092
2018-04-28 23:38:05 +08:00
偏右
4956dd8042 Release 3.4.4 (#10296)
* add `lib/**/style/*` as sideEffects (#10217)

* Fix upload onChange arg type when beforeUpload return false, close #10293

* 3.4.4

* Fix ts error temporarily, DefinitelyTyped/DefinitelyTyped#25342
2018-04-28 15:36:19 +08:00
guifu
548d8c9c51 chore: update menu to ~6.3.0 2018-04-28 14:12:37 +08:00
愚道
8b64882562 Merge branch 'master' of github.com:ant-design/ant-design 2018-04-28 11:10:54 +08:00
愚道
6682a56922 fix snapshot ci 2018-04-28 11:09:15 +08:00
afc163
e97977b891 Fix upload onChange arg type when beforeUpload return false, close #10293 2018-04-28 11:06:32 +08:00
愚道
b45146486a merge feature-3.5.0 2018-04-28 11:04:10 +08:00
afc163
8b02a21d36 site: valid primary color range 2018-04-27 22:09:49 +08:00
afc163
be43e56835 site: fix color tool, close #10265 2018-04-27 21:23:51 +08:00
afc163
7f8f89cbff doc: Add mode and onPanelChange in API document, close #9785 2018-04-27 20:17:39 +08:00
Thiebaud Thomas
a1e186b8a3 Fix type for placeholder in select component (#10282) 2018-04-27 18:22:10 +08:00
afc163
3d079af7cd Fix Input.Group align issue in Form, close #10281 2018-04-27 15:57:27 +08:00
afc163
1f6107e94a Fix naming convention, close #10275 2018-04-27 13:21:51 +08:00
afc163
e40c2a7f45 Fix notification icon hover color, close #10272 2018-04-27 10:48:40 +08:00
afc163
d9053a2526 Tweak sort position again 2018-04-26 16:15:04 +08:00
afc163
4b1857d587 fix spin loading 2018-04-26 16:06:18 +08:00
Marcela Bomfim
b1c41c665e Fix typo (#10250)
Fix typo
2018-04-25 21:59:14 +08:00
afc163
c85758fd01 Fix spin container interaction, close #10227 2018-04-25 14:55:16 +08:00
afc163
52c8f34a73 Fix radio border radius 2018-04-25 11:08:21 +08:00
Wu Haotian
4ea20e696c fix(form): fix typing for Form.onValuesChange (#10231) 2018-04-24 23:33:58 +08:00
afc163
a268dc8d62 Fix dashed Divider, close #10216 2018-04-24 20:17:48 +08:00
Wu Haotian
262ed8eec3 add lib/**/style/* as sideEffects (#10217) 2018-04-24 14:03:32 +08:00
Samuel Gaus
4bc28ac471 Update jsx.md (#10203)
Made it clear that you can't use components other than Column or ColumnGroup as children to Table.
2018-04-23 21:57:43 +08:00
愚指导
4101d182e0 Bump 3.4.3 (#10198) 2018-04-23 17:23:35 +08:00
薛定谔的猫
14dbcb95ed fix: sideEffects: false cause css file not bundled (fixes #10190) (#10197) 2018-04-23 17:08:24 +08:00
dependabot[bot]
14fa376dff Update majo requirement to ^0.6.2 (#10195)
Updates the requirements on [majo](https://github.com/egoist/majo) to permit the latest version.
- [Release notes](https://github.com/egoist/majo/releases)
- [Commits](https://github.com/egoist/majo/commits/v0.6.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-04-23 16:00:37 +08:00
Zheeeng
6a3e6f55cf Fix typo (#10193) 2018-04-23 16:00:24 +08:00
Wei Zhu
fa5491a390 Add @babel/types@7.0.0-beta.44 as devDependencies 2018-04-23 15:03:17 +08:00
Zheeeng
4ad5985df7 Prefer using 'truthy' over 'falsyless' (#10191) 2018-04-23 11:23:25 +08:00
Jiabin Peng
bb720aaab9 Fix menu item's clickable region in dark theme (#10187)
* remove redundant style for submenu

* Fix menu item's clickable region in dark theme
2018-04-23 00:31:36 +08:00
afc163
8ab4aeb9c4 site: fix ad flush 2018-04-22 22:37:58 +08:00
Benjy Cui
e444dc5e39 chore: add ad for yuque (#10182) 2018-04-22 18:58:40 +08:00
偏右
631596022e Add changelog for 3.4.2 (#10185)
* Add changelog for 3.4.2

* update
2018-04-22 17:21:58 +08:00
Wei Zhu
7ee2eca848 Pass CheckboxGroup/RadioGroup prefixCls down to children (#10002)
Close #9950
2018-04-22 16:35:34 +08:00
afc163
15c6d58796 Table getCheckboxProps should be updated when rerender
close #10133
2018-04-22 15:19:04 +08:00
afc163
b9d94971e4 Add successPercent as Progress[format] argument, close #10096 2018-04-22 14:00:49 +08:00
afc163
2078354bc5 Fix collapsedWidth string bug, close #10140 2018-04-22 13:56:23 +08:00
Jin ZHANG
a95209cf55 scale fallback string (#10184) 2018-04-22 13:09:42 +08:00
yiminanci
26f35280a8 Update README-zh_CN.md (#10181) 2018-04-21 15:43:22 +08:00
niko
d50ec436d5 List integrate pagination functional fixed: #9303 (#10135) 2018-04-20 15:41:40 +08:00
Jin ZHANG
e1c74eb799 add maxCount config to message (#10169) 2018-04-20 15:40:43 +08:00
Zheeeng
d016471638 Feature 3.5.0 time line reverse api (#10057)
* Add reverse api for TimeLine

* Update TimeLine test snapshot

* Add specifications for reverse api and pending api
2018-04-20 11:23:37 +08:00
afc163
f4ae9294c0 Improve card loading style, ref #9862 2018-04-20 11:19:30 +08:00
Zheeeng
572ae5ce14 Bugfix issue.9862 (#10052)
* Fix issue 9862

* Update Card test snapshot
2018-04-20 10:44:33 +08:00
Yevhen Hryhorevskyi
754c94c447 Bump up rc-notification version to 3.1.0 (#10161)
Bump up `rc-notification` version to 3.1.0 that supports notification update by key
2018-04-19 21:18:09 +08:00
Dmitry Gladkikh
0d0632b2f3 Add getPopupContainer method decl to MenuProps interface (#10158)
* add getPopupContainer to MenuProps

see https://github.com/ant-design/ant-design/issues/10145

* Update getPopupContainer signature of MenuProps

* getPopupContainer prop is optional
2018-04-19 20:33:12 +08:00
Wei Zhu
410fb50f44 site: use qingting 2018-04-19 18:05:27 +08:00
Wei Zhu
a9f4a6cc85 site: use https 2018-04-19 17:50:36 +08:00
Wei Zhu
163f2aae64 site: fix typo 2018-04-19 17:49:29 +08:00
Wei Zhu
05d6d80e3d site: more verbose redirects 2018-04-19 17:23:38 +08:00
Wei Zhu
1f39cbf36a site: Tweak redirects 2018-04-19 17:15:34 +08:00
Wei Zhu
9aa914922d site: Add more redirects 2018-04-19 17:08:49 +08:00
Wei Zhu
9ba7818b69 site: Add redirects 2018-04-19 16:56:40 +08:00
Wei Zhu
81adba222d site: set production build command 2018-04-19 16:41:06 +08:00
Wei Zhu
22bfc68f33 Remove ID 2018-04-19 16:39:18 +08:00
Wei Zhu
10aaee0e27 Copy netlify.toml to _site 2018-04-19 16:32:34 +08:00
VTHINKXIE
fbad7efacb doc: add stream compute user case (#10155)
* doc: add stream compute user case

* Update cases.en-US.md
2018-04-19 16:27:26 +08:00
Wei Zhu
bbf3163cc2 Add netlify.toml 2018-04-19 16:23:13 +08:00
Zheeeng
069e9207a9 Swap positions between List.footer and List.pagination (#10045)
* Swap positions between List.footer and List.pagination

* Update List test snapshots
2018-04-19 13:48:55 +08:00
afc163
649d733048 fix snapshot ci 2018-04-19 11:54:44 +08:00
Wu Haotian
7eb2792072 fix typing for Upload.beforeUpload (#10059)
* fix typing for `Upload.beforeUpload`
fix #9775

* add RcFile interface, fix tests

* fix typing of `Upload.onStart`
2018-04-19 11:54:28 +08:00
Zheeeng
d0d69fbf13 Remove useless style (#10054) 2018-04-19 11:50:28 +08:00
Wei Zhu
61e4f8011a Remove sCU from Form (#10029)
Related #9790

Form and Form.Item are not considered as pure components
2018-04-19 11:49:50 +08:00
Zen
d7f9270a6f fix button/demo/disabled.md (#10009)
add `ghost` property to ghost buttons
2018-04-19 11:43:22 +08:00
afc163
a7513bfac1 fix stylelint 2018-04-19 11:40:58 +08:00
davidhatten
74d1c5e6b6 Add collapse styles to default.less (#9943)
* push collapse styling into overridable defaults

* Changes to ensure backwards compatibiliy, switch bg-color to be based on default style

* change background-color to bg in style names

* simplify and consolodate content-padding

* I figured out why the styling is split across content and box like that

The collapse/show animation doesn't work right without the padding set up across the two elements like this. From an end-user point of view, I think this is the easiest thing.

* pushing all padding styling on to the box instead of the content, keeping var name the same because the end user doesn't need to know the difference

* Pushing header-bg-color back up to the top of the component heirarchy

* shorten content padding
2018-04-19 11:36:53 +08:00
afc163
f0660836b7 fix snapshot ci 2018-04-19 11:34:19 +08:00
afc163
d4a0cf8054 Merge branch 'master' of github.com:ant-design/ant-design 2018-04-19 11:09:27 +08:00
dependabot[bot]
1cc7ebc03b Update react-slick requirement to ~0.23.1 (#9948)
Updates the requirements on [react-slick](https://github.com/akiran/react-slick) to permit the latest version.
- [Release notes](https://github.com/akiran/react-slick/releases)
- [Changelog](https://github.com/akiran/react-slick/blob/master/CHANGELOG.md)
- [Commits](https://github.com/akiran/react-slick/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-04-19 11:07:29 +08:00
dependabot[bot]
d0906c6661 Update stylelint requirement to 9.2.0 (#9897)
Updates the requirements on [stylelint](https://github.com/stylelint/stylelint) to permit the latest version.
- [Release notes](https://github.com/stylelint/stylelint/releases)
- [Changelog](https://github.com/stylelint/stylelint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stylelint/stylelint/commits/9.2.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-04-19 11:07:05 +08:00
afc163
61502ef942 Fix form demo error in IE9 2018-04-18 14:08:06 +08:00
afc163
04b3aad451 Fix menu arrow style of disabled, close #10113 2018-04-18 13:47:40 +08:00
afc163
2604623b7e fix showInfo when precent is out of range 2018-04-18 11:10:32 +08:00
afc163
0eb835772d Fix invalid progress like <Progress precent={120} /> 2018-04-18 10:45:07 +08:00
Dmitry Manannikov
c0e60f8097 Fix wrong List property (#10123) (#10128)
This diff excludes `locale` from `rest` variable to
avoid passing to div.

Close #10123
2018-04-18 00:15:22 +08:00
Zheeeng
05a522c343 Update ButtonType (#10129) 2018-04-17 23:54:55 +08:00
Open Next
ad721111a4 fix bug in getting-started - date is null when clear the DatePick (#10111) 2018-04-17 16:49:11 +08:00
刘红
ee4f788ae0 添加BMP的支持 (#10110) 2018-04-17 14:44:43 +08:00
Jin ZHANG
f3f3c63c30 fix class for week date render (#10081) 2018-04-17 13:50:27 +08:00
afc163
3b00cf8971 Fix image when file.url has query or hash
close #10102
2018-04-17 13:49:03 +08:00
何志勇
7e8295769a Markdown error (#10100)
There are six preset values, not five
2018-04-17 10:50:14 +08:00
Pierre
09fec16b6f [TS] AutoComplete : Make dataSource optional (#10077)
When using children :
https://ant.design/components/auto-complete/#components-auto-complete-demo-options
2018-04-16 17:42:31 +08:00
dependabot[bot]
e5030dfa64 Update majo requirement to ^0.5.1 (#10069)
Updates the requirements on [majo](https://github.com/egoist/majo) to permit the latest version.
- [Release notes](https://github.com/egoist/majo/releases)
- [Commits](https://github.com/egoist/majo/commits/v0.5.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-04-16 16:00:24 +08:00
薛定谔的猫
63c0c2e38a chore: set sideEffects: false (#10043)
so webpack can do better tree-shaking.
2018-04-16 15:28:32 +08:00
Wei Zhu
1a26268bd5 Remove duplicate SpinSize 2018-04-16 15:02:03 +08:00
诸岳
265770b4e3 Fix incompatible type error for Spin[size] prop, close #10053 (#10055) 2018-04-16 14:44:42 +08:00
Rallets
8157be2f4a Add files via upload (#10068) 2018-04-16 14:16:43 +08:00
Albert 理斯特
b7411febce A: 新增关于 childrenColumnName 的文档,fix #9035 (#10062) 2018-04-16 13:26:33 +08:00
Ed Moore
31e50e50b6 Fix types (#10063)
* Fix types

Fix https://github.com/ant-design/ant-design/issues/8796

* Fix exported types
2018-04-16 10:58:17 +08:00
Charles Covey-Brandt
e1efa990ca Update Alert smooth-closed demo for spelling "visible" (#10060) 2018-04-16 09:41:53 +08:00
afc163
04a5cc2a8b Merge branch 'master' into feature-3.5.0 2018-04-15 19:52:24 +08:00
afc163
8fdce7cb4f test: remove bisheng:build test to speed up the progress 2018-04-15 17:27:30 +08:00
Zheeeng
b41af97d1f Fix typo (#10050) 2018-04-15 16:52:04 +08:00
偏右
88cacb6c35 Revert "Feature time line.reverse (#10026)" (#10056)
This reverts commit 92a07d1b9d.
2018-04-15 16:51:05 +08:00
Zheeeng
92a07d1b9d Feature time line.reverse (#10026)
* Add reverse api for Timeline

* Update TimeLine test snapshot
2018-04-15 16:50:02 +08:00
afc163
9b64a778d0 demo: fix console warning 2018-04-15 15:13:59 +08:00
afc163
4486c569f2 demo: update localeProvider demo 2018-04-15 15:11:59 +08:00
afc163
e1a5063daf test: fix ci warning 2018-04-15 15:10:25 +08:00
afc163
e3446840fa Fix test case of LocaleProvider
which is broken by #10047

use constructor over componentDidMount
2018-04-15 15:09:13 +08:00
诸岳
b52053051c Input.Search should disable enter button when disabled prop is true (#10051)
* Input Search should disable enter button when disabled prop is true, close #10040

* test: Add test case for commit bd21722
2018-04-15 13:14:26 +08:00
Zheeeng
08f5c27b0b Use componentDidMount to replace componentWillMount: componentWillMount is deprecating (#10047) 2018-04-14 13:37:24 +08:00
Zheeeng
b92779f821 Fix the infinite & virtualized List is invisible that caused by its height can't be calculated (#10046) 2018-04-14 11:18:34 +08:00
afc163
92eeb7f8c9 Tweak list grid margin 2018-04-13 15:35:51 +08:00
afc163
2939aea4ec Fix list extra border, close #10028 2018-04-13 15:35:51 +08:00
afc163
5f51d8dc43 update demo 2018-04-13 15:35:51 +08:00
afc163
d94e7bd7f0 fix typo 2018-04-13 15:35:51 +08:00
Chenjia
5634881eda add docs for keyboard props on modal component #8818 (#10030) 2018-04-13 12:01:51 +08:00
Ludwig Bäcklund
74d81c2d07 Add title prop to Badge that shows when hovering it 2018-04-12 11:53:32 +08:00
Bill Fienberg
66f5e75cff Fix typo in link to InputNumber component (#9994)
Before:
>Synchronize with [InptNumber](/components/input-number/) component.

After:
>Synchronize with [InputNumber](/components/input-number/) component.
2018-04-11 23:18:10 +08:00
Wei Zhu
82b721a432 Extend CardProps from native div element attributes
Close #9933
2018-04-11 19:41:54 +08:00
Wei Zhu
f9b8bf7e4d Revert "Checkbox[disabled] should have higher priority than Checkbox.Group[disabled]"
This reverts commit 5580791a70.
2018-04-11 16:59:22 +08:00
Wei Zhu
5580791a70 Checkbox[disabled] should have higher priority than Checkbox.Group[disabled]
Fix #9973
2018-04-11 16:35:05 +08:00
Bill Fienberg
833e076eb7 Fix typo (#9991)
Before:
>Customerize tooltip

After:
>Customize tooltip
2018-04-11 15:49:12 +08:00
afc163
3612144c6d site: avoid hash jump in demo 2018-04-11 15:15:24 +08:00
Wei Zhu
2a5479a524 Fix type errors
Close #9988
2018-04-11 12:01:28 +08:00
zombiej
0437d858f2 update testcase sync with Tree 1.8.12. Ref: https://github.com/ant-design/ant-design/issues/9899 2018-04-10 19:29:18 +08:00
Wei Zhu
921361313a Add explicit types for default props
Fix #8796
Close #8820
2018-04-10 10:50:59 +08:00
jim
a5e2020908 add icon prop in .d.ts 2018-04-09 14:22:06 +08:00
ddcat1115
9578083b92 update changelog 2018-04-08 22:12:25 +08:00
ddcat1115
0f01459d77 bump 3.4.1 2018-04-08 18:25:27 +08:00
afc163
e8d8741ec5 Fix divider layout with float elements, close #9956 2018-04-08 12:37:24 +08:00
偏右
a7f898e4b2 Update zh-CN.js 2018-04-08 00:20:57 +08:00
Wei Zhu
43537ed368 Fix type error
Close #9931
2018-04-04 17:51:51 +08:00
偏右
a9376ef1ca Fix image url display with non-image extention in Upload (#9936)
now we treat url following below rules:

1. `data:image..` => image
2. `http://xxx.com/xxxx.(webp|svg|png|gif|jpg|jpeg)` => image
3. `http://xxx.com/xxx.zip` other extensions => non-image
4. `data:application..` other minetypes in base64 text => non-image
5. `http://xxx.com/xxx` without any extensions => image

close #9835

close #9681

ref #9621
2018-04-04 17:17:01 +08:00
zombieJ
49719b20d8 update tree doc for customize icon (#9893)
* update doc for customize icon
* add test case
2018-04-04 16:39:50 +08:00
ddcat1115
1612ef6990 fix #9882 2018-04-04 16:01:14 +08:00
afc163
e6b3490a8e fix test case 2018-04-04 15:50:08 +08:00
ddcat1115
a402fdd8b3 fix #9907 (#9908)
* fix #9907

* update snapshot
2018-04-04 15:29:59 +08:00
dependabot[bot]
d71834011c Update eslint-plugin-babel requirement to ^5.0.0 (#9896)
Updates the requirements on [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) to permit the latest version.
- [Release notes](https://github.com/babel/eslint-plugin-babel/releases)
- [Commits](https://github.com/babel/eslint-plugin-babel/commits/v5.0.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-04-04 15:08:21 +08:00
Wei Zhu
5336bd688f Fix type error 2018-04-04 14:49:14 +08:00
André
245e1cf3d0 Minor typo (#9922)
Fixes minor typo
2018-04-03 22:00:31 +08:00
afc163
cab162b562 doc: update divider doc and demo 2018-04-03 14:25:47 +08:00
afc163
779a35e4cc doc: update message duration description 2018-04-03 13:41:44 +08:00
afc163
bf6e91be3a Tweak table sorter icon click area again 2018-04-03 11:33:37 +08:00
Nokecy
98d56b2dd0 Fixed typescript definition and add table props onHeaderRow (#9902) 2018-04-02 17:15:17 +08:00
dependabot[bot]
2807d75937 Update enquire-js requirement to ^0.2.1 (#9895)
Updates the requirements on [enquire-js](https://github.com/jljsj/enquire-js) to permit the latest version.
- [Release notes](https://github.com/jljsj/enquire-js/releases)
- [Commits](https://github.com/jljsj/enquire-js/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-04-02 15:42:34 +08:00
Wei Zhu
ef3f10ab8e docs: Remove extra whitespace 2018-04-01 21:15:50 +08:00
Wei Zhu
98685ae20e Lock stylelint to 9.1.3 2018-04-01 20:49:03 +08:00
Wei Zhu
ce7c9438b8 Bump 3.4.0 2018-04-01 20:43:45 +08:00
Wei Zhu
266c8ad17c docs: Add emoji 2018-04-01 20:35:56 +08:00
Wei Zhu
5e52247083 docs: Update changelog
skip ci
2018-04-01 20:33:45 +08:00
Wei Zhu
7fa8364caf Add 3.4.0 changelog (#9890) 2018-04-01 17:57:02 +08:00
Wei Zhu
bac892080d Merge branch 'feature-3.4.0' 2018-04-01 12:28:09 +08:00
Zach Guo
280f907297 Fix Layout.Sider typos (#9885) 2018-04-01 01:15:42 +08:00
Wei Zhu
da4062f9c1 Add Anchor[getContainer] (#9694) 2018-03-30 15:55:54 +08:00
Hughen
53abf888cb fix: fixed modal content overflowed
- fixed modal content overflowed, when the very long english
  word fill in Modal title
2018-03-30 15:33:33 +08:00
Wei Zhu
c4698154b4 Merge branch 'master' into feature-3.4.0 2018-03-30 15:09:38 +08:00
afc163
134e60fe2b site: fix color index 2018-03-30 11:20:13 +08:00
Wei Zhu
502e7df2e5 Update snapshot for React 16.3 2018-03-30 11:04:49 +08:00
zombiej
c135572730 Fix conduct logic on node disabled, update test snapshot 2018-03-29 19:46:01 +08:00
zombiej
08b6011ed7 update deps of rc-tree 2018-03-29 18:09:54 +08:00
zombiej
c6475ce4bf Merge branch 'master' of github.com:ant-design/ant-design 2018-03-29 18:04:55 +08:00
zombiej
c5f84c7902 clean up 2018-03-29 18:03:14 +08:00
dependabot[bot]
0377f18b23 Update typescript requirement to ~2.8.1 (#9843)
Updates the requirements on [typescript](https://github.com/Microsoft/TypeScript) to permit the latest version.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/commits/v2.8.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-03-29 17:59:50 +08:00
zombiej
52f0ac10a4 Revert "Fix WeekPick style prop, close #9848"
This reverts commit c526e175c7.
2018-03-29 17:53:54 +08:00
zombiej
0baef252bb update deps of rc-tree 2018-03-29 16:03:48 +08:00
afc163
c526e175c7 Fix WeekPick style prop, close #9848 2018-03-29 11:26:38 +08:00
Scott Sturgeon
f2e60209c9 Changed zero-width layout trigger color to use layout-trigger-color var (#9851) 2018-03-29 10:50:58 +08:00
Kenneth Luján Rosas
d7b44bda07 Fixes LocaleProvider moment usage (#9853) 2018-03-29 10:42:33 +08:00
Wei Zhu
0d2a6c4ed9 Update ISSUE_TEMPLATE.md 2018-03-28 12:15:02 +08:00
jojoLockLock
7915e58f1f fix base.less @at-root syntax error (#9832) 2018-03-28 10:41:54 +08:00
Wei Zhu
70ea209857 docs: Clarify Table[scroll] useage
Related issue:

https://github.com/ant-design/ant-design/issues/2203
https://github.com/ant-design/ant-design/issues/2130
2018-03-27 17:46:01 +08:00
jljsj
a7107c6adf fix site icon hover transition 2018-03-27 15:40:31 +08:00
zombiej
d5d348d2d1 update change log 2018-03-27 09:48:26 +08:00
Wei Zhu
c4480145b4 docs: Add link of "Theming Ant Design with Sass and Webpack>"
Close #9815
2018-03-26 21:36:02 +08:00
afc163
c3f70f57ac renew AUTHORS.txt 2018-03-26 19:26:17 +08:00
afc163
e400ef6d30 site: fix extra space in page bottom 2018-03-26 16:53:02 +08:00
afc163
2d4d85bdbc update snapshot 2018-03-26 15:47:29 +08:00
pellea
b61f4c1ad3 fix code sample in the Form component doc (issue #9591) (#9705)
* fix code sample in the Form component doc (issue #9591)

* fix wrong space indent

* add trailing comma
2018-03-26 15:41:42 +08:00
dependabot[bot]
31bce60530 Update react-slick requirement to ~0.22.3 (#9812)
Updates the requirements on [react-slick](https://github.com/akiran/react-slick) to permit the latest version.
- [Release notes](https://github.com/akiran/react-slick/releases)
- [Changelog](https://github.com/akiran/react-slick/blob/master/CHANGELOG.md)
- [Commits](https://github.com/akiran/react-slick/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-03-26 15:41:05 +08:00
偏右
f6f5fb3672 Test case for warning message of importing all components (#9814)
* Add test case

* fix test case
2018-03-26 15:36:44 +08:00
afc163
1abe1517d8 Add deer tracking code 2018-03-26 15:35:39 +08:00
afc163
99cc5b9607 site: add search input in home page 2018-03-26 15:32:48 +08:00
afc163
e7ba4fb3f0 remove unused comment 2018-03-26 15:04:36 +08:00
gregahren
b6ce947894 Slovenian locale added (sl_SI) (#9724)
* Add sl_SI locale (Slovenian)

* fix lint issues
snapshot tests

* add description

* bump rc pagination to 1.16.1 which includes sl_SI(Slovenian) locale
then include it
2018-03-26 11:44:27 +08:00
Wei Zhu
f6be27fd4e docs: Update changelog 2018-03-25 12:00:33 +08:00
Wei Zhu
738eb28505 Bump 3.3.3 2018-03-25 11:46:43 +08:00
Wei Zhu
5ab1c4ce53 Revert "Convert file object"
This reverts commit ee0bf41672.
2018-03-25 11:40:51 +08:00
afc163
99e030cc4c Merge branch 'master' into feature-3.4.0 2018-03-25 01:39:27 +08:00
Bryan Berger
c3df0bc688 Fix <Switch /> small margin (#9602)
* should be 13px. Size of the circle (12px) + desired spacing (1px).

* add single responsibility var
2018-03-24 21:52:47 +08:00
Wei Zhu
51d1f27a76 dcos: Detail Select[optionLabelProp] default value
Close #9745
2018-03-24 21:38:25 +08:00
meesvandongen
2c5231f0ed Made expanded row background (table) a less variable. (#9789) 2018-03-24 13:18:38 +08:00
Jonny Buchanan
d7086ce193 Add nwb example to the "other boilerplates" docs (#9787) 2018-03-24 13:05:13 +08:00
zombiej
c74ef5d40a bump 3.3.2 2018-03-24 12:47:48 +08:00
afc163
4502ad8376 Fix button two-chinese-words update bug 2018-03-23 22:23:03 +08:00
afc163
07d6988f0d Add some tests 2018-03-23 19:19:29 +08:00
afc163
ba7b7d0d6b link colors should be related with @link-color 2018-03-23 18:04:02 +08:00
afc163
ec6f370d8d update snapshot 2018-03-23 15:29:02 +08:00
afc163
caf497d08f Fix underline of Button[href], close #9755 2018-03-23 14:45:08 +08:00
Yunus EŞ
9413f20ef6 Pagination Turkish Update (#9679) 2018-03-23 14:21:32 +08:00
afc163
454567dee4 remove !important 2018-03-23 11:45:39 +08:00
Wei Zhu
827746efd7 Revert "Lock postcss-less version"
This reverts commit 64cbf0910a.
2018-03-23 11:25:00 +08:00
Wei Zhu
ee0bf41672 Convert file object
Close #9775
2018-03-23 11:23:47 +08:00
Jiabin Peng
6c77d336d9 Fix menu item clickable region (#9666) 2018-03-22 15:14:53 +08:00
Sangle
eb338425fe docs: fix syntax error (#9764) 2018-03-22 14:54:46 +08:00
Wei Zhu
64cbf0910a Lock postcss-less version
https://github.com/shellscape/postcss-less/issues/99
2018-03-21 20:52:52 +08:00
诸岳
aadba9b0e3 docs: add align prop description (#9749) 2018-03-21 17:42:19 +08:00
afc163
f8f52b09be Fix Modal.confirm content layout
close #9374

created a BFC to resolve multiple lines of title render bug

https://www.smashingmagazine.com/2017/12/understanding-css-layout-block-formatting-context/
2018-03-21 17:35:31 +08:00
ViviaRui
82711504a4 Update customize-theme.zh-CN.md (#9753) 2018-03-21 16:47:00 +08:00
Wei Zhu
edbbaac5f9 Fix date mocking
new Date returns a UTC time in node

Close #9743
2018-03-21 12:27:41 +08:00
Wei Zhu
1c0b5ed21e Revert "Update snapshot"
This reverts commit 98356e87ff.
2018-03-21 12:01:58 +08:00
zhuyue
98356e87ff Update snapshot 2018-03-21 10:51:52 +08:00
zhuyue
3dcab8767a fix: cursor style of disabled Rate should be default, close #9747 2018-03-21 10:30:25 +08:00
afc163
a1d1ca4dc6 update snapshot 2018-03-19 15:40:43 +08:00
afc163
b880549d59 upgrade react-slick to 0.21.0, close #3659 2018-03-19 14:56:16 +08:00
jim
8b922bcfb1 upgrade version 2018-03-19 14:24:43 +08:00
Wei Zhu
04ff6ed768 docs: Update TreeSelect labelInValue description
Close #9726
2018-03-19 14:20:47 +08:00
陈帅
a915a29a0d add 3.3.1 doc in change log (#9718)
add 3.3.1 doc in change log
2018-03-19 14:05:16 +08:00
afc163
29cb526cd7 fix readme link 2018-03-18 15:38:19 +08:00
Bryan Berger
a0e161ccdd Add variable for Pagination font-weight when active (#9603) 2018-03-18 13:06:00 +08:00
Wei Zhu
0d9dcb1714 Fix table scroll x (#9704) 2018-03-18 12:58:33 +08:00
Wei Zhu
381b88e9b0 Tweak table border radius (#9674)
Close #6750
2018-03-18 11:14:31 +08:00
afc163
411181e6ec doc: update practical-project 2018-03-17 18:07:33 +08:00
afc163
50aae9408e doc: update getting-started 2018-03-17 15:18:45 +08:00
afc163
540b31fd02 update features 2018-03-16 13:35:43 +08:00
afc163
fef1ba1ff3 update README.md 2018-03-15 15:12:21 +08:00
afc163
606475c767 Add context menu component to recommend list 2018-03-15 15:12:21 +08:00
Benjy Cui
9d7d70becd docs: should not use ref for wrapped form, close: #9598 (#9685) 2018-03-15 14:40:47 +08:00
afc163
554dec3bab update table demo 2018-03-15 14:30:01 +08:00
Wei Zhu
7392bf4590 Remove @babel/types 2018-03-15 11:59:46 +08:00
afc163
8db3b1f46f update snapshot 2018-03-15 11:42:42 +08:00
nestoralonso
43d7be5478 Update fixed-columns.md (#9680)
Fix typo scoll.x => scroll.x
2018-03-15 10:30:23 +08:00
Terence
4458f3dde1 Fix missing key of column.title in Table (#9658) (#9670) 2018-03-14 17:46:56 +08:00
jiang
76994bd772 Remove Form Item help transition, fix #8831 (#9675)
* fix #8831

* remove help transition
2018-03-14 17:43:02 +08:00
afc163
37506b238f sync placeholder node size when node is sticky by Affix, close #9536 2018-03-14 16:22:45 +08:00
Wei Zhu
aa97310421 Update ISSUE_TEMPLATE.md 2018-03-14 12:25:34 +08:00
afc163
eb2290a87f Tweak table sort icons position 2018-03-14 11:54:32 +08:00
Wu Haotian
0754845aff MenuItem: avoid rendering Tooltip unless necessary (#9636)
* MenuItem: avoid rendering Tooltip unless necessary

* MenuItem: remove extra check for tooltip.title
2018-03-14 11:13:06 +08:00
VTHINKXIE
0070628fa8 style(module:form): narrow css selector (#9648) 2018-03-14 11:08:07 +08:00
Wei Zhu
85c78e49a9 Fix TimePicker isMoment call 2018-03-13 22:53:02 +08:00
afc163
8b1d0224cb Tweak danger button focus style 2018-03-13 18:20:12 +08:00
拷钉
d3c57f09ea doc webpackrc (#9651) 2018-03-13 13:42:12 +08:00
Wei Zhu
f402e87fe0 docs: Add afterClose
Close #9640
2018-03-13 11:40:11 +08:00
afc163
4f1f5fd152 update form demo style 2018-03-12 21:52:13 +08:00
afc163
b28b394bf8 Fix test case for #9639 2018-03-12 21:02:20 +08:00
afc163
66c3108565 should support custom button node in Search[enterButton]
close #9639
2018-03-12 20:51:04 +08:00
afc163
fc99a6a436 site: use ant-design-palettes 2018-03-12 17:11:41 +08:00
zhuyue
463c3b0906 Bump 3.3.0 2018-03-12 15:40:45 +08:00
Wei Zhu
a0f9150b20 Update ISSUE_TEMPLATE.md 2018-03-12 15:23:31 +08:00
诸岳
5766c5e15b Add changelog of 3.3.0 (#9620) 2018-03-12 15:18:42 +08:00
Junbin Huang
869d572c6e docs: add layout.md translation (#9593) 2018-03-12 13:50:45 +08:00
Junbin Huang
3bca8f3055 docs: translate font.md (#9587) 2018-03-12 13:43:56 +08:00
Wei Zhu
62c9dee43e Remove timezone from mock date 2018-03-12 11:22:59 +08:00
王集鹄
decb6d8390 Compatible with non-image format file preview in UploadList (#9621)
* Compatible with non-image format file preview in UploadList

* Add unit test about Upload List should non-image format file preview
2018-03-11 22:24:09 +08:00
zhuyue
ed70ba694e Merge branch 'feature-3.3.0' 2018-03-11 14:50:25 +08:00
诸岳
40e7e0c193 Fix: successPercent should decide the progress status when it exists, close #9382 (#9614)
* fix: successPercent should decide the progress status when it exists, close #9382

* Add test for e361df0 that successPercent should decide the progress status when it exists
2018-03-11 00:11:52 +08:00
诸岳
398788b2c9 Fix: import correct locale file from rc-calendar, close #9373 (#9613)
* fix: import correct locale file from rc-calendar, close #9373

* Update snapshot
2018-03-11 00:11:21 +08:00
Wei Zhu
c5fc656ec8 Fix date mocking
Close #9599

It's an interesting bug, the time we store in the snapshot is in the summertime when you run it in wintertime, it fails.
2018-03-10 17:25:28 +08:00
u3u
30fe88d4bd Add the defaultActiveTabKey property for the Card component (#9526)
* Add the defaultActiveTabKey property for the Card component (close #8789, #8942)

* `activeTabKey` should be added

* Improve

* Fix large tabs font size, close #9509

* docs: Add TreeSelect[dropdownClassName]

* Fix passing dropdownClassName to tree-select

* build: update remark-parse requirement to ^5.0.0 (#9545)

Updates the requirements on [remark-parse](https://github.com/remarkjs/remark) to permit the latest version.
- [Release notes](https://github.com/remarkjs/remark/releases)
- [Commits](https://github.com/remarkjs/remark/commits/remark@5.0.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* add Tooltip  contextMenu doc

* Improve Grid and Layout type definition

* fix: focus editor (#9548)

* Fix test case for new jsdom (#9527)

* Fix test case for new jsdom

* use setTimeout as raf in jest jsdom

* Fix cancelAnimationFrame

* Add comment for facebook/jest#5147

* longer timeout

* fix snap

* upgrade antd-tools

* Update typescript requirement to ~2.7.2 (#9522)

Updates the requirements on [typescript](https://github.com/Microsoft/TypeScript) to permit the latest version.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/commits/v2.7.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* Fix a ts error

* build: update react-slick requirement to ~0.20.0 (#9543)

Updates the requirements on [react-slick](https://github.com/akiran/react-slick) to permit the latest version.
- [Changelog](https://github.com/akiran/react-slick/blob/master/CHANGELOG.md)
- [Commits](https://github.com/akiran/react-slick/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* Fix test cases

* site: fix intersection-observer polyfill

* docs: update recommendation

* Fix typo WeexPickerProps -> WeekPickerProps (#9564)

* use lodash

* Fixed typo on Visualization rules (#9575)

Style of a navigation should conform to the its level.

should be

Style of a navigation should conform to its level.

* Improve Radio/Checkbox type definition

Close #9574

* Remove AbstractCheckboxChangeEvent, fix TS4029 error

See https://github.com/Microsoft/TypeScript/issues/9944

* Update index.en-US.md (#9579)

* add transitionName from message.config (#9580)

* add transitionName from message.config

* Update index.en-US.md (#9579)

* modify doc

* build: update react-virtualized requirement to ~9.18.5 (#9544)

Updates the requirements on [react-virtualized](https://github.com/bvaughn/react-virtualized) to permit the latest version.
- [Changelog](https://github.com/bvaughn/react-virtualized/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bvaughn/react-virtualized/commits/9.18.5)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* When treeNode is disabled, its switcher is highlight and clickabled (#9539)

* When treeNode is disabled, its switcher is highlight and clickabled

* rc-tree@1.7.11

* Fix moment require (#9528)

Fix #9502

* Update snapshot
2018-03-10 14:44:12 +08:00
Wei Zhu
b6d7151486 docs: Document Calendar[validRange] 2018-03-09 17:55:49 +08:00
Wei Zhu
7f5f09ff47 Add more tests for Calendar[validRange] 2018-03-09 17:43:13 +08:00
Rohan Malhotra
71f65a0be8 Added validRange props in calendar to control date range 2018-03-09 17:42:54 +08:00
Camol
2aed46012e [feature]: add native Event - related to #9368 (#9376)
* [feature]: add native Event - related to #9368

* update tests and rc-checkbox's version
2018-03-09 15:16:57 +08:00
Wei Zhu
fe4d294c64 Fix moment require (#9528)
Fix #9502
2018-03-09 15:04:21 +08:00
valleykid
ae78a4bbec When treeNode is disabled, its switcher is highlight and clickabled (#9539)
* When treeNode is disabled, its switcher is highlight and clickabled

* rc-tree@1.7.11
2018-03-09 15:04:09 +08:00
SimpleFrontend
528c6fa1e0 Added pendingDot to Timeline (#9546)
* Added selectionColumnWidth to TableRowSelection

* Updated documents

* Renamed selectionColumnWidth to columnWidth

* Added pendingDot to Timeline

* Added pendingDot to Timeline

* Minor update according to the feedback

* Updated according to feedback
2018-03-09 15:03:19 +08:00
Hughen
6998f66eb5 feat: add afterClose to Alert (#9448)
- add afterClose to Alert, in in order to achieve smoothly unmount.
2018-03-09 15:02:13 +08:00
dependabot[bot]
5157b7b8a2 build: update react-virtualized requirement to ~9.18.5 (#9544)
Updates the requirements on [react-virtualized](https://github.com/bvaughn/react-virtualized) to permit the latest version.
- [Changelog](https://github.com/bvaughn/react-virtualized/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bvaughn/react-virtualized/commits/9.18.5)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-03-09 14:59:53 +08:00
MuYu
f61967b496 add transitionName from message.config (#9580)
* add transitionName from message.config

* Update index.en-US.md (#9579)

* modify doc
2018-03-09 13:30:50 +08:00
Kevin BON
b1bcf842d7 Update index.en-US.md (#9579) 2018-03-09 00:48:23 +08:00
Xoce51
e142bce0a0 Update documentation to match with the select search method #9494 (#9577) 2018-03-09 00:47:38 +08:00
Wei Zhu
473872af66 Remove AbstractCheckboxChangeEvent, fix TS4029 error
See https://github.com/Microsoft/TypeScript/issues/9944
2018-03-08 21:42:22 +08:00
Wei Zhu
f78e0098fa Improve Radio/Checkbox type definition
Close #9574
2018-03-08 20:39:34 +08:00
Angga
43e4622ef8 Fixed typo on Visualization rules (#9575)
Style of a navigation should conform to the its level.

should be

Style of a navigation should conform to its level.
2018-03-08 19:14:41 +08:00
afc163
e071002fae use lodash 2018-03-08 14:46:47 +08:00
Pierre
1259d703c7 Fix typo WeexPickerProps -> WeekPickerProps (#9564) 2018-03-07 23:56:24 +08:00
afc163
d40d59ab68 docs: update recommendation 2018-03-07 15:59:02 +08:00
afc163
468a7629e7 site: fix intersection-observer polyfill 2018-03-07 15:56:40 +08:00
愚道
59b7195c06 Merge branch 'master' into feature-3.3.0 2018-03-07 14:17:43 +08:00
afc163
15e69d09ca Fix test cases 2018-03-06 21:47:05 +08:00
dependabot[bot]
324e07fbf0 build: update react-slick requirement to ~0.20.0 (#9543)
Updates the requirements on [react-slick](https://github.com/akiran/react-slick) to permit the latest version.
- [Changelog](https://github.com/akiran/react-slick/blob/master/CHANGELOG.md)
- [Commits](https://github.com/akiran/react-slick/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-03-06 21:29:54 +08:00
afc163
2f427e172a Fix a ts error 2018-03-06 21:28:54 +08:00
dependabot[bot]
442673a934 Update typescript requirement to ~2.7.2 (#9522)
Updates the requirements on [typescript](https://github.com/Microsoft/TypeScript) to permit the latest version.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/commits/v2.7.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-03-06 21:28:35 +08:00
偏右
8226ede38e Fix test case for new jsdom (#9527)
* Fix test case for new jsdom

* use setTimeout as raf in jest jsdom

* Fix cancelAnimationFrame

* Add comment for facebook/jest#5147

* longer timeout

* fix snap

* upgrade antd-tools
2018-03-06 21:21:01 +08:00
陆离
cc06f0f7a5 fix: focus editor (#9548) 2018-03-06 20:59:03 +08:00
Wei Zhu
518c424ca4 Improve Grid and Layout type definition 2018-03-06 15:51:06 +08:00
jim
26934b37c8 add Tooltip contextMenu doc 2018-03-06 15:21:37 +08:00
dependabot[bot]
8466028b5a build: update remark-parse requirement to ^5.0.0 (#9545)
Updates the requirements on [remark-parse](https://github.com/remarkjs/remark) to permit the latest version.
- [Release notes](https://github.com/remarkjs/remark/releases)
- [Commits](https://github.com/remarkjs/remark/commits/remark@5.0.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-03-06 15:14:43 +08:00
Wei Zhu
69b154f9a9 Fix passing dropdownClassName to tree-select 2018-03-06 11:23:03 +08:00
Wei Zhu
56e4ce099d docs: Add TreeSelect[dropdownClassName] 2018-03-06 10:43:56 +08:00
afc163
c7dd7cbbc4 Fix large tabs font size, close #9509 2018-03-05 18:35:33 +08:00
SimpleFrontend
9073237e70 Added selectionColumnWidth to TableRowSelection (#9474)
* Added selectionColumnWidth to TableRowSelection

* Updated documents

* Renamed selectionColumnWidth to columnWidth
2018-03-05 18:23:01 +08:00
dependabot[bot]
c611fe74c0 Update remark-stringify requirement to ^5.0.0 (#9523)
Updates the requirements on [remark-stringify](https://github.com/remarkjs/remark) to permit the latest version.
- [Release notes](https://github.com/remarkjs/remark/releases)
- [Commits](https://github.com/remarkjs/remark/commits/remark@5.0.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-03-05 15:46:16 +08:00
dependabot[bot]
d250f35cf3 Update jest requirement to ^22.4.2 (#9521)
Updates the requirements on [jest](https://github.com/facebook/jest) to permit the latest version.
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v22.4.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-03-05 15:44:36 +08:00
dependabot[bot]
765beb7570 Update lint-staged requirement to ^7.0.0 (#9519)
Updates the requirements on [lint-staged](https://github.com/okonet/lint-staged) to permit the latest version.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/commits/v7.0.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-03-05 15:41:01 +08:00
Wei Zhu
c0e9a22fa9 Update snapshot 2018-03-05 11:23:26 +08:00
dependabot[bot]
3793412e6d Update eslint-plugin-react requirement to 7.7.0 (#9506)
Updates the requirements on [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) to permit the latest version.
- [Release notes](https://github.com/yannickcr/eslint-plugin-react/releases)
- [Changelog](https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yannickcr/eslint-plugin-react/commits/v7.7.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-03-04 18:06:02 +08:00
dependabot[bot]
5839c852a4 Update stylelint requirement to ^9.1.1 (#9508)
Updates the requirements on [stylelint](https://github.com/stylelint/stylelint) to permit the latest version.
- [Release notes](https://github.com/stylelint/stylelint/releases)
- [Changelog](https://github.com/stylelint/stylelint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stylelint/stylelint/commits/9.1.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-03-04 18:05:50 +08:00
dependabot[bot]
b2bb35b13d Update react-slick requirement to ~0.19.0 (#9504)
Updates the requirements on [react-slick](https://github.com/akiran/react-slick) to permit the latest version.
- [Release notes](https://github.com/akiran/react-slick/releases)
- [Changelog](https://github.com/akiran/react-slick/blob/master/CHANGELOG.md)
- [Commits](https://github.com/akiran/react-slick/commits/0.19.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-03-04 17:45:38 +08:00
dependabot[bot]
192c6bbb38 Update scrollama requirement to ^1.4.1 (#9507)
Updates the requirements on [scrollama](https://github.com/russellgoldenberg/scrollama) to permit the latest version.
- [Commits](https://github.com/russellgoldenberg/scrollama/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-03-04 17:44:57 +08:00
afc163
af8e54f1d6 Fix table radius in chrome 2018-03-03 16:42:48 +08:00
afc163
a2018e7c44 site: fix scroll to current hash in chrome 2018-03-03 16:42:48 +08:00
偏右
d0c58946ee Update README.md 2018-03-03 15:35:30 +08:00
Arnab Sen
d40a3408c6 Corrected typo (#9490) 2018-03-02 22:19:10 +08:00
Wei Zhu
5e7bff8b5e Update snapshot 2018-03-02 14:12:30 +08:00
Wei Zhu
a4fea8f22c docs: Add Table pagination position to demo 2018-03-02 12:35:25 +08:00
Camol
ae2990e241 feature: [Table] Pagination on the top in addition to the bottom. fix… (#9357)
* feature: [Table] Pagination on the top in addition to the bottom. fix (#9346)

* refactor pagination of table (#9357)

* specify the position of pagination when using table  - add test

* specify the position of pagination when using table - update API docs

* update api docs

* fix error

* add TablePaginationConfig extends PaginationProps
2018-03-02 12:00:28 +08:00
afc163
bea95bf77c Merge branch 'master' into feature-3.3.0 2018-02-28 10:56:45 +08:00
afc163
40e354c373 Merge branch 'master' into feature-3.3.0 2018-02-27 10:12:19 +08:00
afc163
220d28d3e4 support keyboard for Modal.confirm, close #8818 2018-02-11 13:45:32 +08:00
Juan Rodrigo Venegas Boesch
0e591ef01c Divider orientation feature (#9275)
User can align the text to the left or right with "orientation" prop, if not set it will be centered.
2018-02-11 11:51:56 +08:00
afc163
e8fa1f168b Merge branch 'master' into feature-3.3.0 2018-02-11 11:51:05 +08:00
Wei Zhu
2aaef6564d docs: add inputReadOnly 2018-02-11 10:28:17 +08:00
Jesper We
4a69446be1 Implement inputReadOnly for TimePicker (#9327)
* Update package.json

* Document inputReadOnly

* Add inputReadOnly declaration.
2018-02-10 20:22:18 -06:00
jim
0df2efccd0 ~ -> ^ 2018-02-09 11:43:46 +08:00
jim
50863acb1b datePicker add dropdownClassName prop fix #7211 2018-02-09 11:35:13 +08:00
317 changed files with 11998 additions and 3215 deletions

View File

@@ -61,8 +61,10 @@ if (process.env.RUN_ENV === 'DEMO') {
'no-console': 0,
'no-plusplus': 0,
'eol-last': 0,
'no-script-url': 0,
'prefer-rest-params': 0,
'react/no-multi-comp': 0,
'react/prefer-stateless-function': 0,
'jsx-a11y/href-no-hash': 0,
'import/newline-after-import': 0,
});

14
.github/lock.yml vendored Normal file
View File

@@ -0,0 +1,14 @@
# Configuration for lock-threads - https://github.com/dessant/lock-threads
# Number of days of inactivity before a closed issue or pull request is locked
daysUntilLock: 365
# Comment to post before locking. Set to `false` to disable
lockComment: >
This thread has been automatically locked because it has not had recent
activity. Please open a new issue for related bugs and link to relevant
comments in this thread.
# Issues or pull requests with these labels will not be locked
# exemptLabels:
# - no-locking
# Limit to only `issues` or `pulls`
only: issues

View File

@@ -43,7 +43,6 @@ module.exports = {
snapshotSerializers: [
'enzyme-to-json/serializer',
],
mapCoverage: true,
globals: {
'ts-jest': {
tsConfigFile: './tsconfig.test.json',

View File

@@ -19,7 +19,6 @@ matrix:
- env: REACT=15 TEST_TYPE=test:es
- env: REACT=15 TEST_TYPE=test:dom
- env: REACT=15 TEST_TYPE=test:node
- env: REACT=16 TEST_TYPE=bisheng:build
before_script:
- scripts/install-react.sh

View File

@@ -1,18 +1,26 @@
778758944 <778758944@qq.com>
Aaron Planell López <aaronplanell@gmail.com>
Adrian Dimitrov <dimitrov.adrian@gmail.com>
Albert Zheng <lisong.zheng@gmail.com>
Albert 理斯特 <shuaizhexu@gmail.com>
Aleck Landgraf <aleck.landgraf@gmail.com>
Alexander <labriko@yandex.ru>
Alexander Suevalov <suevalov.work@gmail.com>
Alexandre Kirszenberg <a.kirszenberg@gmail.com>
Amorites <751809522@qq.com>
Anas Tawfeek <anas.tawfeek@outlook.com>
Andrew Murray <radarhere@gmail.com>
Andrey G <plandem@gmail.com>
Arnab Sen <arnabsen@gmail.com>
Arthur Denner Oliveira Santos <arthurdenner7@gmail.com>
Arvin Xu <arvinx@foxmail.com>
BK Heleth <bon.hoo@hotmail.com>
Babajide Fowotade <jide.b.tade@gmail.com>
Bartek <bartek.kozera@gmail.com>
Benjamin Kniffler <bkniffler@me.com>
Benjy Cui <benjytrys@gmail.com>
Bernie <bernie.wangbj@gmail.com>
Bilal Sirazitdinov <bilalsir@yandex.ru>
Bill Sheikh <bilawals22@gmail.com>
Bo Chen <bochen2014@yahoo.com>
Bozhao <yubz86@gmail.com>
@@ -20,113 +28,187 @@ Brett Lamy <bel423@me.com>
Brook Shi <iwxiaot@gmail.com>
Bruce Mitchener <bruce.mitchener@gmail.com>
Bruno Maia <bruno.mm.maia@gmail.com>
Bryan Berger <bb@ga.co>
C <4019980@qq.com>
Cam Song <neosoyn@gmail.com>
Camol <kwwnjujlc@sina.com>
Canwen Xu <canwenxu@126.com>
Catalin Miron <mironcatalin@gmail.com>
Cee Cirno <i@cee.moe>
Chang Wang <cheapsteak@gmail.com>
Chikara Chan <chenhongtu@51xianqu.net>
Chris Kelly <cjke.7777@gmail.com>
ChrisFan <chris.fan.dev@gmail.com>
Christopher Deutsch <cd@cdeutsch.com>
Chuang Yu <cyu9960@gmail.com>
Claudio Restifo <claudio.restifo@gmail.com>
Cody Chan <int64ago@gmail.com>
Colton Pierson <colton@coltonpierson.com>
Confiks <confiks@scriptbase.org>
Conway Anderson <hello@conwayanderson.com>
Cordaro <elvis07@163.com>
D & R <jdz321@qq.com>
Damian Green <damian.green@microlease.com>
Dan Minshew <ofenixculpa@gmail.com>
Dane David <dndavid102@gmail.com>
Danny Hoower Antonio Viasus Avila <danjavia@gmail.com>
Daqi Song <dqaria@gmail.com>
Darren Poon <dyhpoon@gmail.com>
David Schneider <davschne@gmail.com>
DengYun <tdzl2003@gmail.com>
Dimitri Mitropoulos <dimitrimitropoulos@gmail.com>
Dmitry Bolotin <bolotin.dmitriy@gmail.com>
Dorian <dorian@doma.io>
DosLin <doslino@gmail.com>
EcmaProSrc.P/ka <asoiso@foxmail.com>
Edd Hannay <accounts@edd.fm>
Eddie Xie <oeddyo@gmail.com>
Eden Wang <Eden.Wang@Akmii.com>
Eden Wang <yociduo@vip.qq.com>
Egor Yurtaev <yurtaev.egor@gmail.com>
Eli White <github@eli-white.com>
Emma <sima.zhang1990@gmail.com>
Eric <84263800@qq.com>
Erwann Mest <m+github@kud.io>
Evgeny Kuznetsov <jackk@ya.ru>
Eward Song <eward.song@gmail.com>
Flynn <li.fulin@foxmail.com>
For177 <mengqiang.q@gmail.com>
Geoff Holden <geoff@brightloudnoise.com>
George Gray <george@ummodesign.com>
Graeme Yeates <gyeates@clearpath.ai>
Graeme Yeates <yeatesgraeme@gmail.com>
Gray Choi <gray.choi.1988@gmail.com>
Guan Hao <raptium@gmail.com>
Guan Yu Pan (Jacky) <jackypan1989@gmail.com>
HJin.me <hjin.me@gmail.com>
Hai Phan Nguyen <pnghai@gmail.com>
Haibin Yu <haibin.yu@oceanwing.com>
Hanai <ihanai1991@gmail.com>
Haroen Viaene <fingebimus@me.com>
Harshit Mehrotra <harshitmehrotra@hotmail.com>
Henri Normak <henri.normak@gmail.com>
Hubert Argasinski <argasinski.hubert@gmail.com>
Hughen <446370503@163.com>
Hugo LEHMANN <shogi31@gmail.com>
Igor G <i.gaidai4uk@gmail.com>
ImJoeHs <865439601@qq.com>
Inclined.Z <zjq0717@163.com>
Infinity <305870677@qq.com>
Ivan Kravets <me@ikravets.com>
Ivo Stratev <ivo.stratev.tues@gmail.com>
JaePil Jung <jjp5023@gmail.com>
James <james@schoolshape.com>
Jeffrey Carl Faden <jeffreyatw@gmail.com>
Jerry Bendy <jerry@icewingcc.com>
Jesper We <jesper@journeyman.se>
Jiabin Peng <png.inside@gmail.com>
Jialei <jialeicui@126.com>
Jieraaa <842533841@qq.com>
Jing Ma <mjingm87@qq.com>
Joe <qiaolibo@126.com>
Joe Hsu <jhsu.x1@gmail.com>
John Johnson III <john@johnjohnson.cc>
John Nguyen <jtnguyen236@gmail.com>
Jonatas Walker <jonataswalker@gmail.com>
Jonny Buchanan <jonathan.buchanan@gmail.com>
Jordan Hornblow <jordan@jch254.com>
Josué <ujosuegt@outlook.com>
Juan Rodrigo Venegas Boesch <jrvboesch@gmail.com>
Junyu Zhan <irrigator@yeah.net>
Kaien Liao <liaokaien@gmail.com>
Kenaniah Cerny <kenaniah@gmail.com>
Kenneth Truong <kenneth.e.truong@gmail.com>
Kevin Ivan <info@kevinivan.com>
KgTong <kgtong1992@gmail.com>
Khalifa Lame <khalibloo@gmail.com>
Kiho · Cham <monkindey@163.com>
Kimmo Saari <kimmo.saari@revolt.fi>
Kirill Stiopin <kirill.stiopin@hotmail.com>
Knacktus <knacktus@gmail.com>
Kyle Kelley <rgbkrk@gmail.com>
Kyle Rosenberg <kyle.rosenberg@gmail.com>
Larry Laski <larry.laski@gmail.com>
LeeHarlan <709886167@qq.com>
LeezQ <lizhenq2009@gmail.com>
Leo <clinyong@gmail.com>
Leon Shi <superRaytin@163.com>
Leon Shi <superRaytin@gmail.com>
Liu Yang <zation1@gmail.com>
LongYinan <lynweklm@gmail.com>
Lyndon001 <lld207@126.com>
MG12 <wuzhao.mail@gmail.com>
Ma Tianxiao <matx2215@outlook.com>
Madis Väin <madisvain@gmail.com>
Manjit Kumar <manjit1727@gmail.com>
Manweill <mic.liangwenwei@foxmail.com>
Marco Afonso <mafonso333@gmail.com>
Marcus Bransbury <marcus.bransbury@gmail.com>
Marius Ileana <visvadw@gmail.com>
Mars Wong <marswong618@gmail.com>
Marshall Chen <Juniors.fei@gmail.com>
Martin Litvaj <kamahl19@gmail.com>
Martin Novák <martinnovak@outlook.com>
Mathew <khayaanimations@gmail.com>
Maximilian Meyer <Maximilian.Meyer@br.de>
Meck <yesmeck@gmail.com>
MeiLin <postget.me@gmail.com>
Meow-z <372086270@qq.com>
Miaow <i@zfeng.net>
Michalis Macheras <diodosier@gmail.com>
Min <dicklwm@163.com>
MinJeong Kim <min7859@gmail.com>
Minqi Pan <pmq2001@gmail.com>
Minsung Ryu <ryums0227@gmail.com>
Mitchell Demler <mitchell.demler@harcourts.net>
Mohamed Seada <mohamed.seada.1994@gmail.com>
Mr.Tone <vector@malubei.com>
MuYu <mr.muzea@gmail.com>
Mário Gonçalves <mario.mc.goncalves@gmail.com>
Nathan Griffin <nathan@gatherhere.com>
Nathan Tavares Nascimento <nathan.tnascimento@gmail.com>
Nathan Wells <nwwells@gmail.com>
Neekey <ni184775761@gmail.com>
Nekron <nekron.hyt@gmail.com>
Neverland <chenjiahan@buaa.edu.cn>
Nico <nicolas@freddelacompta.com>
Nidhi Agarwal <nidhi.agarwal@zomato.com>
Nimo <nimo.jser@gmail.com>
Nishant Arora <na.nishantarora@gmail.com>
Nokecy <Nokecy@163.com>
OAwan <georgio.wan@gmail.com>
Oleksandr Kovalchuk <me.olexandr.kovalchuk@gmail.com>
OuYancey <ou.yancey@gmail.com>
Panjie Setiawan Wicaksono <panjie@panjiesw.com>
Patrick Gidich <patrick.gidich@simnova.com>
Patryk <longer44@gmail.com>
Peter <usstpeter@gmail.com>
Peter Berg <atticusberg@gmail.com>
Pierre <pierre@bazoge.com>
Pierre Neter <pierreneter@gmail.com>
Piper Chester <piperchester@gmail.com>
Pixy Yuan <pixy.bupt@gmail.com>
Pyiner <lijiuyang1992@gmail.com>
Pyroboomka <qwaarty@mail.ru>
Qiaosen Huang <joesonw@gmail.com>
Qingrong Ke <keqingrong1992@gmail.com>
Rafael Cosman <rafaelcosman@alumni.stanford.edu>
Ramsés Moreno <ramses@cuatromedios.com>
Randy <randypriv@gmail.com>
RaoHai <surgesoft@gmail.com>
Reed Sun <superreedsun@gmail.com>
Rex <zhangzilong.zzl@163.com>
Ricardo Raphael Joson <rrjoson08@gmail.com>
Richard D. Worth <rdworth@gmail.com>
Robert Wilkinson <wilkinson.robert.a@gmail.com>
Rohan Malhotra <rohan.root@gmail.com>
Rrrandom <emanonhere@gmail.com>
SHEN Lin <shenlin192@gmail.com>
Sakol Assawasagool <koobitor@gmail.com>
Sam Chen <chenxsan@gmail.com>
Sam Maxwell <sam@paybase.io>
Sangle <whb97@163.com>
Sanjay Kumar <kris.gooner@gmail.com>
Sanjay Kumar <sk@tectusdreamlab.com>
Sean Lin <sean@ejoy.com>
Sean Sun <pinggodstudio@gmail.com>
@@ -134,39 +216,74 @@ Sebastian Blade <blade254353074@hotmail.com>
Sergio Crisostomo <sergiosbox@gmail.com>
Shawn Sit <xueqingxiao@gmail.com>
ShiTengFei <shitengfei@goyoo.com>
Shubham Kanodia <shubhamsizzles@gmail.com>
SimaQ <sima.zhang1990@gmail.com>
Spencer <spjy@hawaii.edu>
Stephen Esser <Stephen.Esser@gmail.com>
Tao <magicdawn@qq.com>
Tao Zhang <windse7en@gmail.com>
Taylor Sabell <taylorsabell@gmail.com>
Tengjiao Cai <caitengjiao1987@gmail.com>
Terence <trence320@163.com>
The Rock <zhoguoxin@126.com>
Tino D <ginodeis@gmail.com>
Tom Gao <tom@zoomsoft.cc>
Trotyl Yu <trotyl@qq.com>
Troy Thompson <troynt@gmail.com>
Tyler <chaotyler@gmail.com>
Ubaldo Quintana <blkdr@hotmail.com>
Vadim Macagon <vadim.macagon@gmail.com>
Valentin Vichnal <valentin@vichnal.com>
Vemund Santi <veund@santi.no>
Vemund Santi <vemund@santi.no>
Vic <709147950@qq.com>
Vincent Zhang <vxzhong@qq.com>
ViviaRui <zr1450995198@163.com>
Walter Barbagallo <turbometalskater@gmail.com>
Wang Jun <amos.callmexyz@gmail.com>
Warren Seymour <warren@fountainhead.tech>
Wei Zhu <yesmeck@gmail.com>
Wenchao Hu <zjuhwc@gmail.com>
Will Chen <willchen90@gmail.com>
WingGao <wing.gao@live.com>
Wu Haotian <whtsky@gmail.com>
XBTop1! <xbtop1@gmail.com>
Xie Guanglei <xieguanglei@hotmail.com>
XuMM_12 <owiatsq@sina.cn>
Yang Bin <yangkghjh@gmail.com>
Yasin Uslu <nepjua@gmail.com>
Yiming <ymjrcc@qq.com>
Yogesh <yogeshkumar180592@gmail.com>
YuChao Liang <l.yuch@foxmail.com>
Yunus EŞ <yunus@yunuses.com>
Yury Kozyrev <urakozz@me.com>
Yusuke Ito <novi.mad@gmail.com>
Yuwei Ba <i@xiaoba.me>
YuyingWu <wuyuying1128@gmail.com>
Zack Craig <zack@zack6849.com>
Zap <a124116186@qq.com>
Zhang Zhi <fytriht@gmail.com>
Zheeeng <hi@zheeeng.me>
Ziluo <gyfzzu@gmail.com>
afc163 <afc163@gmail.com>
ahalimkara <ahalimkara@gmail.com>
ascoders <576625322@qq.com>
ashishg-qburst <ashishg@qburst.com>
bang <sqibang@gmail.com>
bang88 <sqibang@gmail.com>
blankzust <450811238@qq.com>
byuanama <byuan@ama.com.au>
bzone <yarnbcoder@gmail.com>
caoyi <caoyi0905@mail.hfut.edu.cn>
cathayandy <wzm_andy@126.com>
chaofeis <408067385@qq.com>
chchen <cc272309126@gmail.com>
chencheng (云谦) <sorrycc@gmail.com>
chencheng <sorrycc@gmail.com>
cjahv <cjahv@qq.com>
clinyong <clinyong@gmail.com>
corneyl <cornieljoosse@gmail.com>
ddcat1115 <ddcat1115@gmail.com>
delesseps <andrewlessels@gmail.com>
denzw <denzw@21cn.com>
detailyang <detailyang@gmail.com>
devqin <devqin@gmail.com>
@@ -181,40 +298,67 @@ feng zhi hao <fzhihao@outlook.com>
fengmk2 <m@fengmk2.com>
flashback313 <windmark2012@gmail.com>
genie <genie88@163.com>
gregahren <grega.hren@gmail.com>
handycode <lihandi@gmail.com>
hansnow <hansnow2012@gmail.com>
haoxin <coderhaoxin@outlook.com>
hardfist <yangjianzju@gmail.com>
hauwa123 <hauwa.aminu@outlook.com>
henryv0 <henryvo94@gmail.com>
hi-caicai <hi@cai-cai.me>
huzzbuzz <huzzbuzz@outlook.com>
iamcastelli <sowed@cyberdude.com>
imosapatryk <imosa.patryk@gmail.com>
infeng <fzhihao@outlook.com>
int2d <int2d@qq.com>
ioldfish <fish.wangl@gmail.com>
jasonslyvia <jasonslyvia@gmail.com>
jasonxia23 <xia.jason23@gmail.com>
jiang <155259966@qq.com>
jim <wasd2144@hotmail.com>
jinouwuque <ee2win@gmail.com>
junjing.zhang <zhangjunjing@gmail.com>
kacjay <45483388@qq.com>
kagawagao <kingsongao1221@gmail.com>
kaifei <150641329@qq.com>
kasinooya <kasinooya@gmail.com>
kayw <kayw@outlook.com>
kdenz <ksnz93@gmail.com>
kdepp <kdepp.cd@gmail.com>
keng <keng@renderinghouse.com>
keqingrong <keqingrong1992@gmail.com>
ko <git@yaksok.net>
konakona <lovekonakona@gmail.com>
kossel <lis.yichao@gmail.com>
kuang <p2227@hotmail.com>
kun sam <kunsam624@icloud.com>
leadream <857098475@qq.com>
lehug <zcszuo5811@126.com>
leon.shi <superRaytin@163.com>
lgmcolin <gengmin.lgm@gmail.com>
lgmcolin <lgmcolin@gmail.com>
liangfei <njliangfei@gmail.com>
liekkas <zjq0717@163.com>
lihqi <455711093@qq.com>
lixiaochou077 <qi.liqi07@gmail.com>
lixiaoyang <lixiaoyang2345@gmail.com>
lixiaoyang1992 <lixiaoyang2345@gmail.com>
lizhaocai <lzc09008@gmail.com>
lizhen <lizhen@youzan.com>
loganpowell <loganp@tepper.cmu.edu>
luyiming <luyimingchn@gmail.com>
lvren <luren6049@qq.com>
mArker <252133226@qq.com>
memoryza <jincai.wang@foxmail.com>
mgrdevport <mgrdevport@gmail.com>
mitchell.demler <mitchell.demler@harcourts.net>
mkermani144 <mkermani144@gmail.com>
monkindey <monkindey@163.com>
muzuiget <muzuiget@gmail.com>
natergj <nater_nater@me.com>
neekey <ni184775761@gmail.com>
niko <644506165@qq.com>
nikogu <644506165@qq.com>
paranoidjk <hust2012jiangkai@gmail.com>
parlop <parlop@gmail.com>
pd4d10 <pd4d10@gmail.com>
@@ -224,8 +368,11 @@ pizn <pizner@gmail.com>
plandem <plandem@gmail.com>
popomore <sakura9515@gmail.com>
qubaoming <qubaoming@didichuxing.com>
ravirambles <ravirambles@gmail.com>
ryangun <ryangun@foxmail.com>
ryanhoho <hswacoal@gmail.com>
sadmark <zhoubin@laidian360.com>
sallen450 <jqh101@sina.com>
shelwin <wxfans@gmail.com>
shenlin192@gmail.com <shenlin192@gmail.com>
shlice <licesh@gmail.com>
@@ -236,17 +383,26 @@ snadn <snadn@snadn.cn>
sojournerc <cmeyer@zvelo.com>
sorrycc <sorrycc@gmail.com>
swindme <swindme@163.com>
syssam <s.y.s.sam.sys@gmail.com>
thegatheringstorm <tgs@tgs.blue>
tianli.zhao <275287902@qq.com>
tom <caolvchong@gmail.com>
twobin <twobin@live.com>
u3u <qwq@qwq.cat>
ustccjw <317713370@qq.com>
valleykid <valleykiddy@gmail.com>
vgeyi <vgeyiz@126.com>
wangtao0101 <yuecjn@gmail.com>
wangxiaolei <fatelei@gmail.com>
warmhug <hualei5280@gmail.com>
whtang906 <whtang906@gmail.com>
wizawu <wizawu@gmail.com>
wonyun <wy393767068@163.com>
xiaofan2406 <xiaofan2406@gmail.com>
yangwukang <yangwukang@boco.com.cn>
yeliex <yeliex@yeliex.com>
yiminghe <yiminghe@gmail.com>
yociduo <yociduo@vip.qq.com>
yubozhao <yubz86@gmail.com>
yuche <i@yuche.me>
z <haig8@msn.com>
@@ -255,26 +411,46 @@ zerob4wl <zerob4wl@gmail.com>
zhangpc <zhangpc@tenxcloud.com>
zhaocai <lzc09008@gmail.com>
zhujun24 <zhujun87654321@gmail.com>
zhuyue <fuping.dfp@antfin.com>
zilong <jzlxiaohei@163.com>
zinkey <yaya@uloveit.com.cn>
zollero <corona7@163.com>
zombiej <smith3816@gmail.com>
zuiidea <zuiiidea@gmail.com>
一喵呜 <hyb628@gmail.com>
乔奕轩 <qiao_yixuan@163.com>
低位 <zhujun87654321@gmail.com>
偏右 <afc163@gmail.com>
可乐 <zaxlct@foxmail.com>
吕立青 <jimmy.jinglv@gmail.com>
广彬-梁 <326741518@qq.com>
柚子男 <yozman@sina.com>
白羊座小葛 <abeyuhang@gmail.com>
英布 <chaoren1641@gmail.com>
蔡伦 <sliuqin@gmail.com>
逸达 <dqaria@gmail.com>
邦 <sqibang@gmail.com>
闲耘™ <hotoo.cn@gmail.com>
爱but的苍蝇 <354788473@qq.com>
拷钉 <41830859@qq.com>
竹尔 <Juelchiang@gmail.com>
偏右 <afc163@gmail.com>
英布 <chaoren1641@gmail.com>
朮厃 <cn.ah.liu@gmail.com>
诸岳 <dengfuping_develop@163.com>
逸达 <dqaria@gmail.com>
蔡伦 <sliuqin@gmail.com>
陆离 <surgesoft@gmail.com>
愚道 <tingzhao.ytz@antfin.com>
陈帅 <wasd2144@hotmail.com>
马斯特 <sd4399340@126.com>
马金花儿 <o.o@mug.dog>
松子 <window.pibarr@gmail.com>
可乐 <zaxlct@foxmail.com>
山客 <zeakhold@gmail.com>
曾凯 <zengkai2009@foxmail.com>
低位 <zhujun87654321@gmail.com>
广彬-梁 <326741518@qq.com>
徐坤龙 <272992168@qq.com>
黄子毅 <576625322@qq.com>
翁润雨 <593110501@qq.com>
崔宏森 <948346354@qq.com>
闲耘™ <hotoo.cn@gmail.com>
一喵呜 <hyb628@gmail.com>
吕立青 <jimmy.jinglv@gmail.com>
隋鑫磊 <joshuasui@gmail.com>
乔奕轩 <qiao_yixuan@163.com>
马斯特 <sd4399340@126.com>
王集鹄 <wjhu111@21cn.com>
柚子男 <yozman@sina.com>
愚指导 <yutingzhao1991@sina.com>
愚指导-TZ <yutingzhao1991@sina.com>
超能刚哥 <margox@foxmail.com>
马金花儿 <o.o@mug.dog>
रोहन मल्होत्रा <rohan.malhotra@adwyze.com>
白羊座小葛 <abeyuhang@gmail.com>

View File

@@ -15,6 +15,198 @@ timeline: true
---
## 3.5.2
`2018-05-13`
- 🐞 Fixed `Cascader` displayRender z-index issue. [#10433](https://github.com/ant-design/ant-design/issues/10433)
- 🐞 Fixed `Button` Types of property 'ref' are incompatible. [#10405](https://github.com/ant-design/ant-design/issues/10405)
- 🐞 Fixed `Table` filter doesn't work on checkbox click. [#10452](https://github.com/ant-design/ant-design/issues/10452)
- 🐞 Fixed the height of `Form` item when checks position is dithered. [#10445](https://github.com/ant-design/ant-design/issues/10445)
- 🌟 Allow to use any CSS units for `Layout` width. [#10479](https://github.com/ant-design/ant-design/pull/10479)
## 3.5.1
`2018-05-09`
- 🐞 Fixed broken style of Input.Group under Form. [#10371](https://github.com/ant-design/ant-design/issues/10371)
- 🐞 Fixed overlay style of Select. [#10383](https://github.com/ant-design/ant-design/issues/10383)
- 🐞 Remove focused style of Collapse.
- 🐞 Remove unnecessary `z-index` of Input.Group and Checkbox. [#9840](https://github.com/ant-design/ant-design/issues/9840) [#10385](https://github.com/ant-design/ant-design/issues/10385)
- 🐞 Fixed that monospaced font family can't be bold.
- Table
- 💄 Rewrited the editable table demo. [#10119](https://github.com/ant-design/ant-design/pull/10119)
- 🐞 Fixed that table column overlay each other. [#9822](https://github.com/ant-design/ant-design/issues/9822)
- TypeScript
- 🐞 Fixed Breadcrumb.Item type. [#10372](https://github.com/ant-design/ant-design/pull/10372) [@karol-majewski](https://github.com/karol-majewski)
- 🐞 Fixed Table `rowSelection` type。[#10374](https://github.com/ant-design/ant-design/issues/10374)
## 3.5.0
`2018-05-04`
- 🌟 Add `title` prop to `Badge` that shows when hovering it. [74d81c2](https://github.com/ant-design/ant-design/commit/74d81c2d078a3c84b3e44cbfbdd99b8f479ea71d) [@ludwigbacklund](https://github.com/ludwigbacklund)
- 🌟 Add `successPercent` as `Progress[format]` argument. [#10096](https://github.com/ant-design/ant-design/issues/10096)
- 🌟 Update `rc-notification` to 3.1.0 so that `Notification` support set `maxCount`. [#10161](https://github.com/ant-design/ant-design/pull/10161) [@jzhangs](https://github.com/jzhangs)
- 🌟 Update `rc-cascader` to 1.13.0 so that `Cascader` support set `filedNames`. [react-component/cascader#23](https://github.com/react-component/cascader/pull/23) [@405go](https://github.com/405go)
- 🌟 Add ability to update `Notification` props by key. [react-component/notification#40](https://github.com/react-component/notification/pull/40) [@yevhen-hryhorevskyi](https://github.com/yevhen-hryhorevskyi)
- 🌟 `List` support pagination by default. [#10135](https://github.com/ant-design/ant-design/pull/10135)
- Table
- 🌟 Column `sorter` function is passed `sortOrder` as param. [#10306](https://github.com/ant-design/ant-design/pull/10306) [@kumarashwin](https://github.com/kumarashwin)
- 🐞 Fix merged header cell border. [#10359](https://github.com/ant-design/ant-design/issues/10359)
- 🐞 Fix lost of user selection on data updates. [#10332](https://github.com/ant-design/ant-design/pull/10332) [@chrvadala](https://github.com/chrvadala)
- `Menu` upgrade `rc-menu` to `7.x` [#10305](https://github.com/ant-design/ant-design/pull/10305)
- 🌟 Better aria-* attributes support. [react-component/menu#137](https://github.com/react-component/menu/pull/137)
- 🌟 Improve Menu performance by avoiding unnecessary updates. [react-component/menu#133](https://github.com/react-component/menu/pull/133)
- 🌟 Support passing props through to MenuItem list item. [react-component/menu#135](https://github.com/react-component/menu/pull/135)
- 🐞 Minor key shortcut bug fixes. [react-component/menu#132](https://github.com/react-component/menu/pull/132)
- Collapse
- 🌟 Support custom `Collapse` styles with less. [#9943](https://github.com/ant-design/ant-design/pull/9943) [@davidhatten](https://github.com/davidhatten)
- 🌟 Update `rc-collapse` to 1.9.0 to add `Collapse` keyboard support. [react-component/collapse#84](https://github.com/react-component/collapse/pull/84/) [@kossel](https://github.com/kossel)
- Select
- 🐞 Fix type for `placeholder`. [#10282](https://github.com/ant-design/ant-design/pull/10282) [@thomasthiebaud](https://github.com/thomasthiebaud)
- 🐞 Fix extra space taken up when arrow disabled. [#10296](https://github.com/ant-design/ant-design/pull/10296)
- 🐞 Fix property `value` typescript type. [#10336](https://github.com/ant-design/ant-design/pull/10336) [@paranoidjk](https://github.com/paranoidjk)
- Input
- 🐞 Fix `Input.Search` not disable enter button when disabled prop is true. [#10040](https://github.com/ant-design/ant-design/issues/10040)
- 🐞 Fix `Input.Group` align issue in Form. [#10281](https://github.com/ant-design/ant-design/issues/10281)
- Form
- 🐞 Fix typing for `Form.onValuesChange`. [#10231](https://github.com/ant-design/ant-design/pull/10231) [@whtsky](https://github.com/whtsky)
- 🐞 Fix typescript interface `ComponentDecorator`. [#10324](https://github.com/ant-design/ant-design/pull/10324) [@paranoidjk](https://github.com/paranoidjk)
- 🐞 Fix dashed `Divider`. [#10216](https://github.com/ant-design/ant-design/issues/10216)
- 🐞 Fix `Spin` container interaction. [#10227](https://github.com/ant-design/ant-design/issues/10227)
- 🐞 Fix `Notification` icon hover color. [#10272](https://github.com/ant-design/ant-design/issues/10272)
- 🐞 Fix `Upload` property `lastModifiedDate` name. [#10315](https://github.com/ant-design/ant-design/pull/10315) [@danielg2002](https://github.com/danielg2002)
- 🐞 Fix `Button` props type, use `React.HTMLProps`. [#10229](https://github.com/ant-design/ant-design/pull/10229) [@whtsky](https://github.com/whtsky)
- 🐞 Fix less var naming convention. [#10275](https://github.com/ant-design/ant-design/issues/10275)
## 3.4.5
`2018-05-03`
- 🐞 Fix file object is empty and file name not showing in Upload. [#10319](https://github.com/ant-design/ant-design/issues/10319)
## 3.4.4
`2018-04-28`
- 🐞 Fix that Upload file in`onChange({ file })` is not a File instance introduced in `3.4.2`. [#10293](https://github.com/ant-design/ant-design/issues/10293)
- 🐞 Fix style lose bug when use tree shaking in webpack@4. [#10217](https://github.com/ant-design/ant-design/pull/10217) [@whtsky](https://github.com/whtsky)
## 3.4.3
`2018-04-23`
- 🐞 Fix style lose bug when use tree shaking in webpack@4. [#10197](https://github.com/ant-design/ant-design/pull/10197) [@Aladdin-ADD](https://github.com/Aladdin-ADD)
- 🐞 Fix `Menu` item's clickable region in dark theme. [#10187](https://github.com/ant-design/ant-design/pull/10187) [@dgeibi ](https://github.com/dgeibi )
## 3.4.2
`2018-04-22`
- 💄 Deployed site by [netlify](http://netlify.com/) to avoid blocking by GFW.
- 🐞 Fix TypeScript definitions of Menu, Tooltip, Card, Anchor, Avatar, Form, Tabs, Transfer, Tree, AutoComplete and etc.
- 💄 Added `sideEffects` to `package.json` for better Tree-Shaking. [#10043](https://github.com/ant-design/ant-design/pull/10043) [@Aladdin-ADD](https://github.com/Aladdin-ADD)
- List
- 🐞 Fix extra border. [#10028](https://github.com/ant-design/ant-design/issues/10028)
- 🐞 Fix extra prop warning of `locale`. [#10128](https://github.com/ant-design/ant-design/pull/10128) [@slonoed](https://github.com/slonoed)
- 🐞 Fix wrong preview image of Upload list when file.url contains url params. [#10102](https://github.com/ant-design/ant-design/issues/10102)
- 🐞 Fix Progress when percent is out of range. [0eb8357](https://github.com/ant-design/ant-design/commit/0eb835772dbaa7ed14babe03fc177821c5bd5ca5)
- Menu
- 🐞 Fix arrow style of disabled SubMenu. [#10113](https://github.com/ant-design/ant-design/issues/10113)
- 🐞 Fix that menu width is wrong when `collapsedWidth` is assigned as px string like `40px`. [#10140](https://github.com/ant-design/ant-design/issues/10140)
- 🐞 Fix that sometimes controlled input in Form cannot be edited. [#9790](https://github.com/ant-design/ant-design/issues/9790)
- 🐞 Fix padding jumping issue of loading Card. [#10052](https://github.com/ant-design/ant-design/pull/10052) [@zheeeng](https://github.com/zheeeng)
- 🐞 Fix that Avatar's fallback text don't scale as the text avatar does. [#10184](https://github.com/ant-design/ant-design/pull/10184)
- 🐞 Fix Table `getCheckboxProps` cannot be updated as expected. [#10133](https://github.com/ant-design/ant-design/issues/10133)
- 🐞 Fix CheckboxGroup `prefixCls` prop not passed to Checkbox. [#9950](https://github.com/ant-design/ant-design/issues/9950)
## 3.4.1
`2018-04-08`
- 🐞 Fix TypeScript type error caused by code error of Badge. [#9931](https://github.com/ant-design/ant-design/issues/9931)
- 💄 Improve clicking region of Card `actions`. [#9882](https://github.com/ant-design/ant-design/issues/9882)
- 🐞 Fix Divider style issue when used with float elements. [#9956](https://github.com/ant-design/ant-design/issues/9956)
- 🐞 Fix style issue of Form in advanced-search mode. [#9907](https://github.com/ant-design/ant-design/issues/9907)
- 🐞 Add `onHeaderRow` TypeScript type definitions for Table. [#9902](https://github.com/ant-design/ant-design/pull/9902) [@Nokecy](https://github.com/Nokecy)
- 💄 Improve the customized-icon demo of Tree. [#9893](https://github.com/ant-design/ant-design/pull/9893)
- 🐞 Fix image url display with non-image extention in Upload. [#9936](https://github.com/ant-design/ant-design/pull/9936)
## 3.4.0
`2018-04-01`
- Tree
- 🛠 In this version, we refactored the underlying code of Tree to resolve some long living issues.
- 🌟 Added `defaultExpandParent` for expanding parent at first render.
- 🌟 Added `disabled` for disabling the whole tree.
- 🌟 Added `TreeNode[icon]` to allow setting custom node icon.
- 🌟 Improved the check logic for disabled TreeNode.
- 🌟 Anchor added `getContainer` for setting the container of scroll content.
- 🌟 Table added a new less variable `@table-expanded-row-bg`. [#9789](https://github.com/ant-design/ant-design/pull/9789)
- 🐞 Fixed a less syntax error. [#9832](https://github.com/ant-design/ant-design/pull/9832) [@jojoLockLock](https://github.com/jojoLockLock)
- 🐞 Fixed `moment.locale` invoking error in LocaleProvider. [#9853](https://github.com/ant-design/ant-design/pull/9853)
- 🐞 Fixed issue resulting in `style` of WeekPicker not works. [#9848](https://github.com/ant-design/ant-design/issues/9848)
- 🐞 Fixed type definition of Layout.Sider. [#9885](https://github.com/ant-design/ant-design/pull/9885) [@zachguo](https://github.com/zachguo)
- 💄 Improved style of Modal for long contents. [#9592](https://github.com/ant-design/ant-design/pull/9592)
- 🌟 Added new locale Slovenian.
## 3.3.3
`2018-03-25`
- Revert Upload `file` type change in previous version which causes breaking change.
## 3.3.2
`2018-03-24`
- 🐞 `Carousel`: Upgrade `react-slick` version to fix width calculation. [#3659](https://github.com/ant-design/ant-design/issues/3659)
- 💄 `Rate`: Adjust `disabled` style. [#9747](https://github.com/ant-design/ant-design/issues/9747)
- 💄 `Modal`: Adjust `confirm-modal` style to fix display issue when content use grid layout. [#9374](https://github.com/ant-design/ant-design/issues/9374)
- 💄 `Menu`: Adjust style to fix mouse trigger event region. [#9666](https://github.com/ant-design/ant-design/pull/9666) [@dgeibi](https://github.com/dgeibi)
- 🐞 `Upload`: Fix type of `file` on `beforeUpload` function. [#9775](https://github.com/ant-design/ant-design/issues/9775)
- 🐞 `Button`: Fix `two-chinese-words` space not re-calculate when text changed. [4502ad8](https://github.com/ant-design/ant-design/commit/4502ad8376e536c450fa4f27d2a5855be5a153e7)
## 3.3.1
`2018-03-18`
- 💄 Tweak danger button focus style.
- 🐞 Fix a show error when the value of enterButton is a button element. [#9639](https://github.com/ant-design/ant-design/issues/9639)
- 🐞 Fix missing key of `column.title` in Table .[#9658](https://github.com/ant-design/ant-design/issues/9658) [@terence55](https://github.com/terence55)
- 🐞 Fix `scroll: { x: true }` not working if `.ant-table-scroll table` width is `auto`. [#9704](https://github.com/ant-design/ant-design/pull/9704)
- 🐞 Fix when the helper message disappears, the input box will shake. [#8831](https://github.com/ant-design/ant-design/issues/8831)
- 🐞 Fix isMoment call in `TimePicker` will report error in parcel. [85c78e4](https://github.com/ant-design/ant-design/commit/85c78e49a91737c2841dc42621db21ca248b62b4)
- 🐞 Tweak `Table` border radius. [#9674](https://github.com/ant-design/ant-design/pull/9674)
## 3.3.0
`2018-03-12`
- 🌟 Add `afterClose` prop for `Alert` to achieve smooth unmount. [#9448](https://github.com/ant-design/ant-design/pull/9448) [@Hughen](https://github.com/Hughen)
- 🌟 Add `validRange` prop for `Calendar` to set the date range. [71f65a0](https://github.com/ant-design/ant-design/commit/71f65a0be8e72a67f334c57e79ae3ff5fb640630) [@Rohanhacker](https://github.com/Rohanhacker)
- 🌟 Add `defaultActiveTabKey` prop for `Card` to initial TabPane's active key. [30fe88d](https://github.com/ant-design/ant-design/commit/30fe88d4bdcec765bf92ca32a755d9646b36978e) [@u3u](https://github.com/u3u)
- `DatePicker`
- 🌟 Add `dropdownClassName` prop to set the className of popup calendar. [#7211](https://github.com/ant-design/ant-design/issues/7211)
- 🐞 Fix the error of resolving `moment` object. [#9539](https://github.com/ant-design/ant-design/pull/9539)
- 🐞 Fix uncorrect import of `turkish(tr_TR)` locale file. [#9373](https://github.com/ant-design/ant-design/issues/9373)
- 🌟 Add `orientation` prop for `Divider` to set the alignment of text in divider. [#9275](https://github.com/ant-design/ant-design/pull/9275) [@jrvboesch](https://github.com/jrvboesch)
- 🌟 Add `keyboard` prop for `Modal` to set whether Modal could be closed by `Esc` key. [#8818](https://github.com/ant-design/ant-design/issues/8818)
- 🌟 Improve the TypeScript definition of `event` param in `onChange` prop for `Radio` and `Checkbox`. [#9574](https://github.com/ant-design/ant-design/issues/9574)
- `Table`
- 🌟 Add `position` prop in `pagination` prop to set the position of pagination. [#9357](https://github.com/ant-design/ant-design/pull/9357) [@kanweiwei](https://github.com/kanweiwei)
- 🌟 Add event param of `onSelect` prop in `rowSelection` prop. [#9376](https://github.com/ant-design/ant-design/pull/9376) [@kanweiwei](https://github.com/kanweiwei)
- 🌟 Add `columnWidth` prop in `rowSelection` prop to set the column width of selection. [#9474](https://github.com/ant-design/ant-design/pull/9474) [@SimpleFrontend](https://github.com/SimpleFrontend)
- 🐞 Fix border radius issue in `Chrome` for `Table`. [af8e54f](https://github.com/ant-design/ant-design/commit/af8e54f1d6ac2891892e39b153cbe3e998370f61)
- 🌟 Add `pendingDot` prop for `Timeline` to set icon of ghost node. [#9546](https://github.com/ant-design/ant-design/pull/9546) [@SimpleFrontend](https://github.com/SimpleFrontend)
- 🌟 Add `inputReadOnly` prop for `TimePicker` to set if it's read only. [4a69446](https://github.com/ant-design/ant-design/commit/4a69446be155c1c176b18cb2c31459f999aa5d5e) [@JesperWe](https://github.com/JesperWe)
- 🌟 Add `dropdownClassName` prop for `TreeSelect`. [69b154f](https://github.com/ant-design/ant-design/commit/69b154f9a9cfa5f2d89a82b6ed730d4d8793de73) [56e4ce0](https://github.com/ant-design/ant-design/commit/56e4ce099d950601538d72243563021e8083776b)
- 🌟 Improve the preview for `Upload` when uploading the file of non-image format. [#9621](https://github.com/ant-design/ant-design/pull/9621) [@zswang](https://github.com/zswang)
- 🐞 Fix `successPercent` prop that cannot decide the success status for `Progress`. [#9382](https://github.com/ant-design/ant-design/issues/9382)
- 🐞 Fix font size for `Tabs`. [#9509](https://github.com/ant-design/ant-design/pull/9509)
- 🐞 Fix that disabled parent node cannot spread for `Tree` and `TreeSelect`. [#9539](https://github.com/ant-design/ant-design/pull/9539)
## 3.2.3
`2018-03-02`
@@ -79,7 +271,7 @@ timeline: true
- 🐞 Fix issue resulting date panel being closed without animation when click on the preset range. [#6364](https://github.com/ant-design/ant-design/issues/6364)
- 🐞 Fix issue resulting `onOk` is not being trigged, when click on the preset range. [#7747](https://github.com/ant-design/ant-design/issues/7747)
- Select
- 🌟 Improve `onChange``onDeselect`, they will receive selected `Option` as second paramteter.
- 🌟 Improve `onChange`, `onDeselect`, they will receive selected `Option` as second paramteter.
- 🐞 Fix issue resulting in `onSelect` is not trigged when using automatic tokenization. [#9094](https://github.com/ant-design/ant-design/issues/9094)
- 🐞 Fix the missing scrollbar in Chrome.
- 🌟 Improve Table's `rowSelection[getCheckboxProps]` prop, now the all the properties returned by `getCheckboxProps` will be passed to checkbox. [#9054](https://github.com/ant-design/ant-design/pull/9054) [@mgrdevport](https://github.com/ant-design/ant-design/pull/9054)
@@ -344,7 +536,7 @@ We provide a [migration tool](https://github.com/ant-design/antd-migration-helpe
- 🌟 `status` can use whith `children` now. [#8164](https://github.com/ant-design/ant-design/issues/8164)
- Card
- 🌟 Added new `inner` type. [Demo](https://ant.design/components/card/#components-card-demo-inner)。
- 🌟 Added `cover``actions` and a new `Meta` component. [Demo](https://ant.design/components/card/#components-card-demo-meta)。
- 🌟 Added `cover`, `actions` and a new `Meta` component. [Demo](https://ant.design/components/card/#components-card-demo-meta)。
- DatePicker
- 🌟 Added `mode` and `onPanelChange`to allow controlling the panel mode. [Demo](https://ant.design/components/date-picker/#components-date-picker-demo-mode)。
- 🌟 Added `WeekPicker` component. [Demo](https://ant.design/components/date-picker/#components-date-picker-demo-basic)
@@ -380,7 +572,7 @@ We provide a [migration tool](https://github.com/ant-design/antd-migration-helpe
- 🌟 Added `column[defaultSortOrder]` to allow setting default sort order. [#8111](https://github.com/ant-design/ant-design/pull/8111) [@megawac](https://github.com/megawac)
- 🌟 Added `rowSelection[fixed]` to allow fixing the selection column.。
- 🙅 Deprecated `getBodyWrapper`, please use `components` instead.
- 🙅 Deprecated `onRowClick``onRowDoubleClick``onRowContextMenu``onRowMouseEnter``onRowMouseLeave`, please use `onRow` instead.
- 🙅 Deprecated `onRowClick``onRowDoubleClick`, `onRowContextMenu`, `onRowMouseEnter`, `onRowMouseLeave`, please use `onRow` instead.
```javascript
<Table onRow={(record) => ({
onClick: () => {},

View File

@@ -15,6 +15,199 @@ timeline: true
---
## 3.5.2
`2018-05-13`
- 🐞 修复 `Cascader` displayRender 问题。[#10433](https://github.com/ant-design/ant-design/issues/10433)
- 🐞 修复 `Button` ref 不兼容问题。[#10405](https://github.com/ant-design/ant-design/issues/10405)
- 🐞 修复 `Table` 过滤器在复选框上不起作用。[#10452](https://github.com/ant-design/ant-design/issues/10452)
- 🐞 修复 `Form` 表单项校验位置高度时出现抖动问题。[#10445](https://github.com/ant-design/ant-design/issues/10445)
- 🌟 设置 `Layout` 宽度时,允许使用任何的 CSS 单位。 [#10479](https://github.com/ant-design/ant-design/pull/10479)
## 3.5.1
`2018-05-09`
- 🐞 修复 Input.Group 在 Form 下样式错位的问题。[#10371](https://github.com/ant-design/ant-design/issues/10371)
- 🐞 修复 Select 箭头和内容重叠的问题。[#10383](https://github.com/ant-design/ant-design/issues/10383)
- 🐞 移除 Collapse 点击时的 focus 样式。
- 🐞 移除 Input.Group 和 Checkbox 不必要的 `z-index`。[#9840](https://github.com/ant-design/ant-design/issues/9840) [#10385](https://github.com/ant-design/ant-design/issues/10385)
- 🐞 修复一个数字等宽字体没有加粗的问题。
- Table
- 💄 重写了可编辑表格的演示。[#10119](https://github.com/ant-design/ant-design/pull/10119)
- 🐞 修复一个表格列内容互相重叠的问题。[#9822](https://github.com/ant-design/ant-design/issues/9822)
- TypeScript
- 🐞 调整 Breadcrumb.Item 的类型。[#10372](https://github.com/ant-design/ant-design/pull/10372) [@karol-majewski](https://github.com/karol-majewski)
- 🐞 修复 Table 的 `rowSelection` 的类型。[#10374](https://github.com/ant-design/ant-design/issues/10374)
## 3.5.0
`2018-05-04`
- 🌟 组件 `Badge` 新增 `title` 属性支持鼠标 hover 的时候显示。[74d81c2](https://github.com/ant-design/ant-design/commit/74d81c2d078a3c84b3e44cbfbdd99b8f479ea71d) [@ludwigbacklund](https://github.com/ludwigbacklund)
- 🌟 添加 `successPercent``Progress[format]` 的参数。[#10096](https://github.com/ant-design/ant-design/issues/10096)
- 🌟 更新 `rc-notification` 到 3.1.0 来支持组件 `Notification``maxCount` 属性。[#10161](https://github.com/ant-design/ant-design/pull/10161) [@jzhangs](https://github.com/jzhangs)
- 🌟 更新 `rc-cascader` 到 1.13.0 来支持组件 `Cascader``filedNames` 属性。[react-component/cascader#23](https://github.com/react-component/cascader/pull/23) [@405go](https://github.com/405go)
- 🌟 组件 `Notification` 支持通过 key 更新通知属性。 [react-component/notification#40](https://github.com/react-component/notification/pull/40) [@yevhen-hryhorevskyi](https://github.com/yevhen-hryhorevskyi)
- 🌟 组件 `List` 支持内置的翻页功能。[#10135](https://github.com/ant-design/ant-design/pull/10135)
- Table
- 🌟 新增 `sortOrder` 参数传递给列配置中的 `sorter` 方法。[#10306](https://github.com/ant-design/ant-design/pull/10306) [@kumarashwin](https://github.com/kumarashwin)
- 🐞 修复头部单元格的边框样式问题。[#10359](https://github.com/ant-design/ant-design/issues/10359)
- 🐞 修复当数据变化时用户选择项丢失的问题。[#10332](https://github.com/ant-design/ant-design/pull/10332) [@chrvadala](https://github.com/chrvadala)
- `Menu` 升级 `rc-menu``7.x` [#10305](https://github.com/ant-design/ant-design/pull/10305)
- 🌟 更好的 aria-* 属性支持。[react-component/menu#137](https://github.com/react-component/menu/pull/137)
- 🌟 一些内部优化提升组件性能。[react-component/menu#133](https://github.com/react-component/menu/pull/133)
- 🌟 支持将属性传递到菜单项中。[react-component/menu#135](https://github.com/react-component/menu/pull/135)
- 🐞 修复一些快捷键的问题。[react-component/menu#132](https://github.com/react-component/menu/pull/132)
- Collapse
- 🌟 更新 `rc-collapse` 到 1.9.0 优化键盘支持。[react-component/collapse#84](https://github.com/react-component/collapse/pull/84/) [@kossel](https://github.com/kossel)
- 🌟 支持通过 less 定义组件 `Collapse` 的样式。[#9943](https://github.com/ant-design/ant-design/pull/9943) [@davidhatten](https://github.com/davidhatten)
- Select
- 🐞 修复 `placeholder` 的 ts 类型问题。[#10282](https://github.com/ant-design/ant-design/pull/10282) [@thomasthiebaud](https://github.com/thomasthiebaud)
- 🐞 修复不显示箭头时多余的空白。[#10296](https://github.com/ant-design/ant-design/pull/10296)
- 🐞 修复属性 `value` 的 typescript 类型错误。[#10336](https://github.com/ant-design/ant-design/pull/10336) [@paranoidjk](https://github.com/paranoidjk)
- Input
- 🐞 修复 `Input.Search` 当 disabled 为 true 时按钮没有被禁用的问题。[#10040](https://github.com/ant-design/ant-design/issues/10040)
- 🐞 修复 `Input.Group` 在表单中对齐的问题。[#10281](https://github.com/ant-design/ant-design/issues/10281)
- Form
- 🐞 修复 `Form.onValuesChange` 的 ts 类型错误。[#10231](https://github.com/ant-design/ant-design/pull/10231) [@whtsky](https://github.com/whtsky)
- 🐞 修复 `ComponentDecorator` typescript 定义的错误。[#10324](https://github.com/ant-design/ant-design/pull/10324) [@paranoidjk](https://github.com/paranoidjk)
- 🐞 修复 `Divider` 为 dashed 时的样式问题。[#10216](https://github.com/ant-design/ant-design/issues/10216)
- 🐞 修复 `Spin` 覆盖层的展示问题。[#10227](https://github.com/ant-design/ant-design/issues/10227)
- 🐞 修复 `Notification` 鼠标 hover 是图标的颜色问题。[#10272](https://github.com/ant-design/ant-design/issues/10272)
- 🐞 修复 `Upload` 组件属性 `lastModifiedDate` 的拼写错误。[#10315](https://github.com/ant-design/ant-design/pull/10315) [@danielg2002](https://github.com/danielg2002)
- 🐞 修复 `Button` 的属性类型,使用 `React.HTMLProps`。[#10229](https://github.com/ant-design/ant-design/pull/10229) [@whtsky](https://github.com/whtsky)
- 🐞 修复 less 命名约定不一致的问题。 [#10275](https://github.com/ant-design/ant-design/issues/10275)
## 3.4.5
`2018-05-03`
- 🐞 修复 Upload 上传文件名不展示file 对象属性为空)的问题。[#10319](https://github.com/ant-design/ant-design/issues/10319)
## 3.4.4
`2018-04-28`
- 🐞 修复 3.4.2 中引入的 Upload 中 onChange 参数 `{ file }` file 不是 File 实例的问题。[#10293](https://github.com/ant-design/ant-design/issues/10293)
- 🐞 修复 webpack@4 下使用 Tree Shaking 样式丢失的问题。[#10217](https://github.com/ant-design/ant-design/pull/10217) [@whtsky](https://github.com/whtsky)
## 3.4.3
`2018-04-23`
- 🐞 修复了 webpack@4 下使用 Tree Shaking 样式丢失的问题。[#10197](https://github.com/ant-design/ant-design/pull/10197) [@Aladdin-ADD](https://github.com/Aladdin-ADD)
- 🐞 修复 `Menu` 组件在 `dark` 主题下点击区域的问题。[#10187](https://github.com/ant-design/ant-design/pull/10187) [@dgeibi](https://github.com/dgeibi)
## 3.4.2
`2018-04-22`
- 💄 部署网站到 [netlify](http://netlify.com/),解决网站被墙的问题。
- 🐞 修复和调整 Menu、Tooltip、Card、Anchor、Avatar、Form、Tabs、Transfer、Tree、AutoComplete 等组件的 TypeScript 定义。
- 💄 增加 `sideEffects` 配置以优化 Tree Shaking 效果。[#10043](https://github.com/ant-design/ant-design/pull/10043) [@Aladdin-ADD](https://github.com/Aladdin-ADD)
- List
- 🐞 修复多余边框问题。[#10028](https://github.com/ant-design/ant-design/issues/10028)
- 🐞 修复 `locale` 属性被传递给 div 的警告。[#10128](https://github.com/ant-design/ant-design/pull/10128) [@slonoed](https://github.com/slonoed)
- 🐞 修复 Upload 的文件 url 带有参数时,图片预览效果失效的问题。[#10102](https://github.com/ant-design/ant-design/issues/10102)
- 🐞 修复 Progress 的百分比越界时的展现。[0eb8357](https://github.com/ant-design/ant-design/commit/0eb835772dbaa7ed14babe03fc177821c5bd5ca5)
- Menu
- 🐞 修复 SubMenu 的失效箭头样式。[#10113](https://github.com/ant-design/ant-design/issues/10113)
- 🐞 修复 `collapsedWidth` 为像素字符串 `40px` 菜单宽度失效的问题。[#10140](https://github.com/ant-design/ant-design/issues/10140)
- 🐞 修复一个某些情况下 Form 内使用受控组件时无法编辑的问题。[#9790](https://github.com/ant-design/ant-design/issues/9790)
- 🐞 修复 Card 切换 loading 状态时的内边距跳动问题。[#10052](https://github.com/ant-design/ant-design/pull/10052) [@zheeeng](https://github.com/zheeeng)
- 🐞 修复 Avatar 图片加载失败时的文字没有正确缩放的问题。[#10184](https://github.com/ant-design/ant-design/pull/10184)
- 🐞 修复 Table 的 `getCheckboxProps` 无法动态更新的问题。[#10133](https://github.com/ant-design/ant-design/issues/10133)
- 🐞 修复 CheckGroup 指定 `prefixCls` 没有传递给 Checkbox 的问题。[#9950](https://github.com/ant-design/ant-design/issues/9950)
## 3.4.1
`2018-04-08`
- 🐞 修复了 Badge 代码错误引起的 TypeScript 类型报错。[#9931](https://github.com/ant-design/ant-design/issues/9931)
- 💄 优化了 Card `actions` 点击区域的范围。[#9882](https://github.com/ant-design/ant-design/issues/9882)
- 🐞 修复了 Divider 与浮动元素一起使用时的样式问题。[#9956](https://github.com/ant-design/ant-design/issues/9956)
- 🐞 修复了 Form 高级搜索模式下的样式问题。[#9907](https://github.com/ant-design/ant-design/issues/9907)
- 🐞 补充了 Table 缺失的 `onHeaderRow` TypeScript 定义。[#9902](https://github.com/ant-design/ant-design/pull/9902) [@Nokecy](https://github.com/Nokecy)
- 💄 优化了 Tree 自定义图标示例。[#9893](https://github.com/ant-design/ant-design/pull/9893)
- 🐞 修复了 Upload 对无扩展名图片地址的预览展示问题。[#9936](https://github.com/ant-design/ant-design/pull/9936)
## 3.4.0
`2018-04-01`
- Tree
- 🛠 在这个版本里,我们重构了 Tree 底层的代码,以解决一些存在了很久的问题。
- 🌟 新增 `defaultExpandParent` 用于在第一次渲染时自动展开父节点。
- 🌟 新增 `disabled` 用于禁用整棵树。
- 🌟 TreeNode 新增 `icon` 用于设置自定义图标。
- 🌟 优化了 TreeNode 设置 `disabled` 时的勾选逻辑。
- 🌟 Anchor 新增 `getContainer` 用于指定内容滚动的容器。
- 🌟 Table 新增 less 变量 `@table-expanded-row-bg`。[#9789](https://github.com/ant-design/ant-design/pull/9789)
- 🐞 修复一处 less 语法错误。[#9832](https://github.com/ant-design/ant-design/pull/9832) [@jojoLockLock](https://github.com/jojoLockLock)
- 🐞 修复 LocaleProvider 中 moment.locale 调用报错的问题。 [#9853](https://github.com/ant-design/ant-design/pull/9853)
- 🐞 修复 WeekPicker 的 style 属性不生效的问题。[#9848](https://github.com/ant-design/ant-design/issues/9848)
- 🐞 修复 Layout.Sider 的 TypeScript 定义。[#9885](https://github.com/ant-design/ant-design/pull/9885) [@zachguo](https://github.com/zachguo)
- 💄 优化了 Modal 中超长内容的显示。[#9592](https://github.com/ant-design/ant-design/pull/9592)
- 🌟 新增斯洛维尼亚语。
## 3.3.3
`2018-03-25`
- 回退上个版本 Upload 中 `file` 类型的修改。
## 3.3.2
`2018-03-24`
- 🐞 `Carousel`: 升级 `react-slick` 版本以修复宽度计算错误。 [#3659](https://github.com/ant-design/ant-design/issues/3659)
- 💄 `Rate`: 调整 `disabled` 样式。 [#9747](https://github.com/ant-design/ant-design/issues/9747)
- 💄 `Modal`: 调整 `confirm-modal` 样式以修复 content 内使用栅格会错位的问题。 [#9374](https://github.com/ant-design/ant-design/issues/9374)
- 💄 `Menu`: 调整样式以修复鼠标事件范围。[#9666](https://github.com/ant-design/ant-design/pull/9666) [@dgeibi](https://github.com/dgeibi)
- 🐞 `Upload`: 修复 `beforeUpload``file` 类型错误。 [#9775](https://github.com/ant-design/ant-design/issues/9775)
- 🐞 `Button`: 修复文本改变时,空格插入没有重新计算 [4502ad8](https://github.com/ant-design/ant-design/commit/4502ad8376e536c450fa4f27d2a5855be5a153e7)
## 3.3.1
`2018-03-18`
- 💄 调整 danger Button 的 `focus` 样式。
- 🐞 修复 enterButton 的值为 button 元素时显示错误的问题。 [#9639](https://github.com/ant-design/ant-design/issues/9639)
- 🐞 修复 Table 中的 `column.title` 的缺少 key 的问题。 [#9658](https://github.com/ant-design/ant-design/issues/9658) [@terence55](https://github.com/terence55)
- 🐞 修复 `scroll: { x: true }``.ant-table-scroll table`宽度为 `auto`的情况下不工作的问题。[#9704](https://github.com/ant-design/ant-design/pull/9704)
- 🐞 修复表单校验文字消失的时候输入框会抖一下的问题。 [#8831](https://github.com/ant-design/ant-design/issues/8831)
- 🐞 修复 `TimePicker` 里的 isMoment 调用在 parcel 里会报错的问题。[85c78e4](https://github.com/ant-design/ant-design/commit/85c78e49a91737c2841dc42621db21ca248b62b4)
- 💄 调整 Table 的圆角样式。 [#9674](https://github.com/ant-design/ant-design/pull/9674)
## 3.3.0
`2018-03-12`
- 🌟 `Alert` 组件新增 `afterClose` 属性,用于实现更流畅的关闭效果。[#9448](https://github.com/ant-design/ant-design/pull/9448) [@Hughen](https://github.com/Hughen)
- 🌟 `Calendar` 组件新增 `validRange` 属性,用于设置显示的时间范围。[71f65a0](https://github.com/ant-design/ant-design/commit/71f65a0be8e72a67f334c57e79ae3ff5fb640630) [@Rohanhacker](https://github.com/Rohanhacker)
- 🌟 `Card` 组件新增 `defaultActiveTabKey` 属性,用于初始化选中面板的 key。[30fe88d](https://github.com/ant-design/ant-design/commit/30fe88d4bdcec765bf92ca32a755d9646b36978e) [@u3u](https://github.com/u3u)
- `DatePicker`
- 🌟 新增 `dropdownClassName` 属性,用于设置弹出日历的 className。[#7211](https://github.com/ant-design/ant-design/issues/7211)
- 🐞 修复解析 `moment` 对象出错的问题。[#9539](https://github.com/ant-design/ant-design/pull/9539)
- 🐞 修复引入土耳其语 `tr_TR` 文件的问题。[#9373](https://github.com/ant-design/ant-design/issues/9373)
- 🌟 `Divider` 组件新增 `orientation` 属性,用于设置分割线内文本的对齐方式。[#9275](https://github.com/ant-design/ant-design/pull/9275) [@jrvboesch](https://github.com/jrvboesch)
- 🌟 `Modal` 组件新增 `keyboard` 属性,用于设置按下 `Esc` 键是否可以关闭 `Modal`。[#8818](https://github.com/ant-design/ant-design/issues/8818)
- 🌟 优化 `Radio``Checkbox` 组件 `onChange` 属性中的事件参数的 `TypeScript` 类型定义的问题。[#9574](https://github.com/ant-design/ant-design/issues/9574)
- `Table`
- 🌟 新增 `pagination` 属性的配置项 `position`,用于设置分页的显示位置。[#9357](https://github.com/ant-design/ant-design/pull/9357) [@kanweiwei](https://github.com/kanweiwei)
- 🌟 新增 `rowSelection` 属性的配置项 `onSelect` 回调函数的事件参数。[#9376](https://github.com/ant-design/ant-design/pull/9376) [@kanweiwei](https://github.com/kanweiwei)
- 🌟 新增 `rowSelection` 属性的配置项 `columnWidth`,用于设置选择框的列宽。[#9474](https://github.com/ant-design/ant-design/pull/9474) [@SimpleFrontend](https://github.com/SimpleFrontend)
- 🐞 修复 `Table` 组件在 `Chrome` 下圆角边框样式的问题。[af8e54f](https://github.com/ant-design/ant-design/commit/af8e54f1d6ac2891892e39b153cbe3e998370f61)
- 🌟 `Timeline` 组件新增 `pendingDot` 属性,用于设置幽灵节点的图标。[#9546](https://github.com/ant-design/ant-design/pull/9546) [@SimpleFrontend](https://github.com/SimpleFrontend)
- 🌟 `TimePicker` 组件新增 `inputReadOnly` 属性,用于设置组件是否只读。[4a69446](https://github.com/ant-design/ant-design/commit/4a69446be155c1c176b18cb2c31459f999aa5d5e) [@JesperWe](https://github.com/JesperWe)
- 🌟 `TreeSelect` 组件新增 `dropdownClassName` 属性。[69b154f](https://github.com/ant-design/ant-design/commit/69b154f9a9cfa5f2d89a82b6ed730d4d8793de73) [56e4ce0](https://github.com/ant-design/ant-design/commit/56e4ce099d950601538d72243563021e8083776b)
- 🌟 优化 `Upload` 组件在上传非图片格式文件时的预览效果。[#9621](https://github.com/ant-design/ant-design/pull/9621) [@zswang](https://github.com/zswang)
- 🐞 修复 `Progress` 组件的 `successPercent` 属性无法决定组件是否处于 `success` 状态的问题。[#9382](https://github.com/ant-design/ant-design/issues/9382)
- 🐞 修复 `Tabs` 组件字体尺寸的问题。[#9509](https://github.com/ant-design/ant-design/pull/9509)
- 🐞 修复 `Tree``TreeSelect` 组件的父节点在 `disabled` 状态下无法展开的问题。[#9539](https://github.com/ant-design/ant-design/pull/9539)
## 3.2.3
`2018-03-02`

View File

@@ -11,7 +11,7 @@
[![Dependency Status](https://img.shields.io/gemnasium/react-component/trigger.svg?style=flat-square)](https://gemnasium.com/ant-design/ant-design)
[![npm package](https://img.shields.io/npm/v/antd.svg?style=flat-square)](https://www.npmjs.org/package/antd)
[![NPM downloads](http://img.shields.io/npm/dm/antd.svg?style=flat-square)](https://npmjs.org/package/antd)
[![NPM downloads](http://img.shields.io/npm/dm/antd.svg?style=flat-square)](http://www.npmtrends.com/antd)
[![Percentage of issues still open](http://isitmaintained.com/badge/open/ant-design/ant-design.svg)](http://isitmaintained.com/project/ant-design/ant-design "Percentage of issues still open")
[![Gitter](https://badges.gitter.im/ant-design/ant-design-english.svg)](https://gitter.im/ant-design/ant-design-english?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) (English)
[![Join the chat at https://gitter.im/ant-design/ant-design](https://img.shields.io/gitter/room/ant-design/ant-design.svg?style=flat-square)](https://gitter.im/ant-design/ant-design?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)(中文)
@@ -25,7 +25,7 @@
- 提炼自企业级中后台产品的交互语言和视觉风格。
- 开箱即用的高质量 React 组件。
- 使用 TypeScript 构建,提供完整的类型定义文件。
- 基于 npm + webpack + [dva](https://github.com/dvajs/dva) 的企业级开发框架
- 全链路开发和设计工具体系
## 支持环境
@@ -88,6 +88,7 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
```bash
$ git clone git@github.com:ant-design/ant-design.git
$ cd ant-design
$ npm install
$ npm start
```

View File

@@ -11,7 +11,7 @@
[![Dependency Status](https://img.shields.io/gemnasium/react-component/trigger.svg?style=flat-square)](https://gemnasium.com/ant-design/ant-design)
[![npm package](https://img.shields.io/npm/v/antd.svg?style=flat-square)](https://www.npmjs.org/package/antd)
[![NPM downloads](http://img.shields.io/npm/dm/antd.svg?style=flat-square)](https://npmcharts.com/compare/antd?minimal=true)
[![NPM downloads](http://img.shields.io/npm/dm/antd.svg?style=flat-square)](http://www.npmtrends.com/antd)
[![Percentage of issues still open](http://isitmaintained.com/badge/open/ant-design/ant-design.svg)](http://isitmaintained.com/project/ant-design/ant-design "Percentage of issues still open")
[![Gitter](https://badges.gitter.im/ant-design/ant-design-english.svg)](https://gitter.im/ant-design/ant-design-english?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) (English)
[![Join the chat at https://gitter.im/ant-design/ant-design](https://img.shields.io/gitter/room/ant-design/ant-design.svg?style=flat-square)](https://gitter.im/ant-design/ant-design?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)(中文)
@@ -26,10 +26,10 @@ An enterprise-class UI design language and React-based implementation.
## Features
- An enterprise-class UI design language for web applications.
- An enterprise-class UI design system for desktop applications.
- A set of high-quality React components out of the box.
- Written in TypeScript with complete define types.
- A npm + webpack + [dva](https://github.com/dvajs/dva) front-end development workflow.
- Written in TypeScript with predictable static types.
- The whole package of development and design resources and tools.
## Environment Support

View File

@@ -1,7 +1,15 @@
import * as antd from '..';
const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
const antd = require('..');
describe('antd', () => {
it('exports modules correctly', () => {
expect(Object.keys(antd)).toMatchSnapshot();
});
it('should hint when import all components', () => {
expect(warnSpy).toBeCalledWith(
'You are using a whole package of antd, please use https://www.npmjs.com/package/babel-plugin-import to reduce app bundle size.'
);
warnSpy.mockRestore();
});
});

View File

@@ -1,4 +0,0 @@
// https://github.com/moment/moment/issues/3650
export default function callMoment(moment: any, ...args: any[]) {
return (moment.default || moment)(...args);
}

View File

@@ -0,0 +1,4 @@
// https://github.com/moment/moment/issues/3650
export default function interopDefault(m: any) {
return m.default || m;
}

View File

@@ -2,7 +2,7 @@ import getRequestAnimationFrame, { cancelRequestAnimationFrame } from '../_util/
const reqAnimFrame = getRequestAnimationFrame();
export default function throttleByAnimationFrame(fn: () => void) {
export default function throttleByAnimationFrame(fn: (...args: any[]) => void) {
let requestId: number | null;
const later = (args: any[]) => () => {

3
components/_util/type.ts Normal file
View File

@@ -0,0 +1,3 @@
export type Diff<T extends string, U extends string> = ({ [P in T]: P } &
{ [P in U]: never } & { [x: string]: never })[T];
export type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;

View File

@@ -95,6 +95,7 @@ export default class Affix extends React.Component<AffixProps, AffixState> {
};
private fixedNode: HTMLElement;
private placeholderNode: HTMLElement;
setAffixStyle(e: any, affixStyle: React.CSSProperties | null) {
const { onChange = noop, target = getDefaultTarget } = this.props;
@@ -123,6 +124,21 @@ export default class Affix extends React.Component<AffixProps, AffixState> {
this.setState({ placeholderStyle: placeholderStyle as React.CSSProperties });
}
syncPlaceholderStyle(e: any) {
const { affixStyle } = this.state;
if (!affixStyle) {
return;
}
this.placeholderNode.style.cssText = '';
this.setAffixStyle(e, {
...affixStyle,
width: this.placeholderNode.offsetWidth,
});
this.setPlaceholderStyle({
width: this.placeholderNode.offsetWidth,
});
}
@throttleByAnimationFrameDecorator()
updatePosition(e: any) {
let { offsetTop, offsetBottom, offset, target = getDefaultTarget } = this.props;
@@ -194,6 +210,10 @@ export default class Affix extends React.Component<AffixProps, AffixState> {
}
this.setPlaceholderStyle(null);
}
if (e.type === 'resize') {
this.syncPlaceholderStyle(e);
}
}
componentDidMount() {
@@ -245,6 +265,10 @@ export default class Affix extends React.Component<AffixProps, AffixState> {
this.fixedNode = node;
}
savePlaceholderNode = (node: HTMLDivElement) => {
this.placeholderNode = node;
}
render() {
const className = classNames({
[this.props.prefixCls || 'ant-affix']: this.state.affixStyle,
@@ -253,7 +277,7 @@ export default class Affix extends React.Component<AffixProps, AffixState> {
const props = omit(this.props, ['prefixCls', 'offsetTop', 'offsetBottom', 'target', 'onChange']);
const placeholderStyle = { ...this.state.placeholderStyle, ...this.props.style };
return (
<div {...props} style={placeholderStyle}>
<div {...props} style={placeholderStyle} ref={this.savePlaceholderNode}>
<div className={className} ref={this.saveFixedNode} style={this.state.affixStyle}>
{this.props.children}
</div>

View File

@@ -366,6 +366,34 @@ exports[`renders ./components/alert/demo/icon.md correctly 1`] = `
</div>
`;
exports[`renders ./components/alert/demo/smooth-closed.md correctly 1`] = `
<div>
<div
class="ant-alert ant-alert-success ant-alert-no-icon"
data-show="true"
>
<span
class="ant-alert-message"
>
Alert Message Text
</span>
<span
class="ant-alert-description"
/>
<a
class="ant-alert-close-icon"
>
<i
class="anticon anticon-cross"
/>
</a>
</div>
<p>
placeholder text here
</p>
</div>
`;
exports[`renders ./components/alert/demo/style.md correctly 1`] = `
<div>
<div

View File

@@ -0,0 +1,48 @@
---
order: 7
title:
zh-CN: 平滑地卸载
en-US: Smoothly Unmount
---
## zh-CN
平滑、自然的卸载提示
## en-US
Smoothly and unaffectedly unmount Alert.
````jsx
import { Alert } from 'antd';
class App extends React.Component {
state = {
visible: true,
}
handleClose = () => {
this.setState({ visible: false });
}
render() {
return (
<div>
{
this.state.visible ? (
<Alert
message="Alert Message Text"
type="success"
closable
afterClose={this.handleClose}
/>
) : null
}
<p>placeholder text here</p>
</div>
);
}
}
ReactDOM.render(
<App />
, mountNode);
````

View File

@@ -15,6 +15,7 @@ Alert component for feedback.
| Property | Description | Type | Default |
| -------- | ----------- | ---- | ------- |
| afterClose | Called when close animation is finished | () => void | - |
| banner | Whether to show as banner | boolean | false |
| closable | Whether Alert can be closed | boolean | - |
| closeText | Close text to show | string\|ReactNode | - |
@@ -23,4 +24,4 @@ Alert component for feedback.
| showIcon | Whether to show icon | boolean | false, in `banner` mode default is true |
| iconType | Icon type, effective when `showIcon` is `true` | string | - |
| type | Type of Alert styles, options: `success`, `info`, `warning`, `error` | string | `info`, in `banner` mode default is `warning` |
| onClose | Callback when Alert is closed | Function | - |
| onClose | Callback when Alert is closed | (e: MouseEvent) => void | - |

View File

@@ -21,6 +21,8 @@ export interface AlertProps {
description?: React.ReactNode;
/** Callback when close Alert */
onClose?: React.MouseEventHandler<HTMLAnchorElement>;
/** Trigger when animation ending of Alert */
afterClose?: () => void;
/** Whether to show icon */
showIcon?: boolean;
iconType?: string;
@@ -56,6 +58,7 @@ export default class Alert extends React.Component<AlertProps, any> {
closed: true,
closing: true,
});
(this.props.afterClose || noop)();
}
render() {
let {

View File

@@ -16,6 +16,7 @@ title: Alert
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| afterClose | 关闭动画结束后的回掉 | () => void | - |
| banner | 是否用作顶部公告 | boolean | false |
| closable | 默认不显示关闭按钮 | boolean | 无 |
| closeText | 自定义关闭按钮 | string\|ReactNode | 无 |
@@ -24,4 +25,4 @@ title: Alert
| showIcon | 是否显示辅助图标 | boolean | false`banner` 模式下默认值为 true |
| iconType | 自定义图标类型,`showIcon``true` 时有效 | string | - |
| type | 指定警告提示的样式,有四种选择 `success``info``warning``error` | string | `info``banner` 模式下默认值为 `warning` |
| onClose | 关闭时触发的回调函数 | Function | 无 |
| onClose | 关闭时触发的回调函数 | (e: MouseEvent) => void | 无 |

View File

@@ -8,11 +8,11 @@ import AnchorLink from './AnchorLink';
import getScroll from '../_util/getScroll';
import getRequestAnimationFrame from '../_util/getRequestAnimationFrame';
function getDefaultTarget() {
function getDefaultContainer() {
return window;
}
function getOffsetTop(element: HTMLElement): number {
function getOffsetTop(element: HTMLElement, container: AnchorContainer): number {
if (!element) {
return 0;
}
@@ -24,9 +24,11 @@ function getOffsetTop(element: HTMLElement): number {
const rect = element.getBoundingClientRect();
if (rect.width || rect.height) {
const doc = element.ownerDocument;
const docElem = doc.documentElement;
return rect.top - docElem.clientTop;
if (container === window) {
container = element.ownerDocument.documentElement;
return rect.top - container.clientTop;
}
return rect.top - (container as HTMLElement).getBoundingClientRect().top;
}
return rect.top;
@@ -43,21 +45,27 @@ function easeInOutCubic(t: number, b: number, c: number, d: number) {
const reqAnimFrame = getRequestAnimationFrame();
const sharpMatcherRegx = /#([^#]+)$/;
function scrollTo(href: string, offsetTop = 0, target: () => Window | HTMLElement, callback = () => { }) {
const scrollTop = getScroll(target(), true);
function scrollTo(href: string, offsetTop = 0, getContainer: () => AnchorContainer, callback = () => { }) {
const container = getContainer();
const scrollTop = getScroll(container, true);
const sharpLinkMatch = sharpMatcherRegx.exec(href);
if (!sharpLinkMatch) { return; }
const targetElement = document.getElementById(sharpLinkMatch[1]);
if (!targetElement) {
return;
}
const eleOffsetTop = getOffsetTop(targetElement);
const eleOffsetTop = getOffsetTop(targetElement, container);
const targetScrollTop = scrollTop + eleOffsetTop - offsetTop;
const startTime = Date.now();
const frameFunc = () => {
const timestamp = Date.now();
const time = timestamp - startTime;
window.scrollTo(window.pageXOffset, easeInOutCubic(time, scrollTop, targetScrollTop, 450));
const nextScrollTop = easeInOutCubic(time, scrollTop, targetScrollTop, 450);
if (container === window) {
window.scrollTo(window.pageXOffset, nextScrollTop);
} else {
(container as HTMLElement).scrollTop = nextScrollTop;
}
if (time < 450) {
reqAnimFrame(frameFunc);
} else {
@@ -73,6 +81,8 @@ type Section = {
top: number;
};
export type AnchorContainer = HTMLElement | Window;
export interface AnchorProps {
prefixCls?: string;
className?: string;
@@ -82,7 +92,14 @@ export interface AnchorProps {
bounds?: number;
affix?: boolean;
showInkInFixed?: boolean;
target?: () => HTMLElement | Window;
getContainer?: () => AnchorContainer;
}
export interface AnchorDefaultProps extends AnchorProps {
prefixCls: string;
affix: boolean;
showInkInFixed: boolean;
getContainer: () => AnchorContainer;
}
export default class Anchor extends React.Component<AnchorProps, any> {
@@ -92,6 +109,7 @@ export default class Anchor extends React.Component<AnchorProps, any> {
prefixCls: 'ant-anchor',
affix: true,
showInkInFixed: false,
getContainer: getDefaultContainer,
};
static childContextTypes = {
@@ -133,8 +151,8 @@ export default class Anchor extends React.Component<AnchorProps, any> {
}
componentDidMount() {
const getTarget = this.props.target || getDefaultTarget;
this.scrollEvent = addEventListener(getTarget(), 'scroll', this.handleScroll);
const { getContainer } = this.props as AnchorDefaultProps;
this.scrollEvent = addEventListener(getContainer(), 'scroll', this.handleScroll);
this.handleScroll();
}
@@ -159,10 +177,10 @@ export default class Anchor extends React.Component<AnchorProps, any> {
}
handleScrollTo = (link: string) => {
const { offsetTop, target = getDefaultTarget } = this.props;
const { offsetTop, getContainer } = this.props as AnchorDefaultProps;
this.animating = true;
this.setState({ activeLink: link });
scrollTo(link, offsetTop, target, () => {
scrollTo(link, offsetTop, getContainer, () => {
this.animating = false;
});
}
@@ -174,16 +192,20 @@ export default class Anchor extends React.Component<AnchorProps, any> {
}
const linkSections: Array<Section> = [];
const { getContainer } = this.props as AnchorDefaultProps;
const container = getContainer();
this.links.forEach(link => {
const sharpLinkMatch = sharpMatcherRegx.exec(link.toString());
if (!sharpLinkMatch) { return; }
const target = document.getElementById(sharpLinkMatch[1]);
if (target && getOffsetTop(target) < offsetTop + bounds) {
const top = getOffsetTop(target);
linkSections.push({
link,
top,
});
if (target) {
const top = getOffsetTop(target, container);
if (top < offsetTop + bounds) {
linkSections.push({
link,
top,
});
}
}
});
@@ -199,7 +221,8 @@ export default class Anchor extends React.Component<AnchorProps, any> {
return;
}
const { prefixCls } = this.props;
const linkNode = ReactDOM.findDOMNode(this as any).getElementsByClassName(`${prefixCls}-link-title-active`)[0];
const anchorNode = ReactDOM.findDOMNode(this) as Element;
const linkNode = anchorNode.getElementsByClassName(`${prefixCls}-link-title-active`)[0];
if (linkNode) {
this.inkNode.style.top = `${(linkNode as any).offsetTop + linkNode.clientHeight / 2 - 4.5}px`;
}

View File

@@ -19,6 +19,7 @@ For displaying anchor hyperlinks on page and jumping between them.
| -------- | ----------- | ---- | ------- |
| affix | Fixed mode of Anchor | boolean | true |
| bounds | Bounding distance of anchor area | number | 5(px) |
| getContainer | Scrolling container | () => HTMLElement | () => window |
| offsetBottom | Pixels to offset from bottom when calculating position of scroll | number | - |
| offsetTop | Pixels to offset from top when calculating position of scroll | number | 0 |
| showInkInFixed | Whether show ink-balls in Fixed mode | boolean | false |

View File

@@ -20,6 +20,7 @@ title: Anchor
| --- | --- | --- | --- |
| affix | 固定模式 | boolean | true |
| bounds | 锚点区域边界 | number | 5(px) |
| getContainer | 指定滚动的容器 | () => HTMLElement | () => window |
| offsetBottom | 距离窗口底部达到指定偏移量后触发 | number | |
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | number | |
| showInkInFixed | 固定模式是否显示小圆点 | boolean | false |

View File

@@ -19,7 +19,7 @@ exports[`renders ./components/auto-complete/demo/basic.md correctly 1`] = `
<div
class="ant-select-selection__placeholder"
style="display:block;user-select:none;-webkit-user-select:none"
unselectable="unselectable"
unselectable="on"
>
input here
</div>
@@ -47,7 +47,7 @@ exports[`renders ./components/auto-complete/demo/basic.md correctly 1`] = `
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
unselectable="on"
>
<b />
</span>
@@ -78,7 +78,7 @@ exports[`renders ./components/auto-complete/demo/certain-category.md correctly 1
<div
class="ant-select-selection__placeholder"
style="display:block;user-select:none;-webkit-user-select:none"
unselectable="unselectable"
unselectable="on"
>
input here
</div>
@@ -117,7 +117,7 @@ exports[`renders ./components/auto-complete/demo/certain-category.md correctly 1
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
unselectable="on"
>
<b />
</span>
@@ -166,7 +166,7 @@ exports[`renders ./components/auto-complete/demo/custom.md correctly 1`] = `
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
unselectable="on"
>
<b />
</span>
@@ -193,7 +193,7 @@ exports[`renders ./components/auto-complete/demo/non-case-sensitive.md correctly
<div
class="ant-select-selection__placeholder"
style="display:block;user-select:none;-webkit-user-select:none"
unselectable="unselectable"
unselectable="on"
>
try to type \`b\`
</div>
@@ -221,7 +221,7 @@ exports[`renders ./components/auto-complete/demo/non-case-sensitive.md correctly
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
unselectable="on"
>
<b />
</span>
@@ -248,7 +248,7 @@ exports[`renders ./components/auto-complete/demo/options.md correctly 1`] = `
<div
class="ant-select-selection__placeholder"
style="display:block;user-select:none;-webkit-user-select:none"
unselectable="unselectable"
unselectable="on"
>
input here
</div>
@@ -276,7 +276,7 @@ exports[`renders ./components/auto-complete/demo/options.md correctly 1`] = `
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
unselectable="on"
>
<b />
</span>
@@ -307,7 +307,7 @@ exports[`renders ./components/auto-complete/demo/uncertain-category.md correctly
<div
class="ant-select-selection__placeholder"
style="display:block;user-select:none;-webkit-user-select:none"
unselectable="unselectable"
unselectable="on"
>
input here
</div>
@@ -351,7 +351,7 @@ exports[`renders ./components/auto-complete/demo/uncertain-category.md correctly
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
unselectable="on"
>
<b />
</span>

View File

@@ -21,7 +21,7 @@ export type ValidInputElement =
export interface AutoCompleteProps extends AbstractSelectProps {
value?: SelectValue;
defaultValue?: SelectValue;
dataSource: DataSourceItemType[];
dataSource?: DataSourceItemType[];
optionLabelProp?: string;
onChange?: (value: SelectValue) => void;
onSelect?: (value: SelectValue, option: Object) => any;

View File

@@ -8,4 +8,22 @@ describe('Avatar Render', () => {
const children = wrapper.find('.ant-avatar-string');
expect(children.length).toBe(1);
});
it('should render fallback string correctly', () => {
const div = global.document.createElement('div');
global.document.body.appendChild(div);
const wrapper = mount(<Avatar src="http://error.url">Fallback</Avatar>, { attachTo: div });
wrapper.instance().setScale = jest.fn(() => wrapper.instance().setState({ scale: 0.5 }));
wrapper.setState({ isImgExist: false });
const children = wrapper.find('.ant-avatar-string');
expect(children.length).toBe(1);
expect(children.text()).toBe('Fallback');
expect(wrapper.instance().setScale).toBeCalled();
expect(div.querySelector('.ant-avatar-string').style.transform).toBe('scale(0.5)');
wrapper.detach();
global.document.body.removeChild(div);
});
});

View File

@@ -46,7 +46,8 @@ export default class Avatar extends React.Component<AvatarProps, AvatarState> {
componentDidUpdate(prevProps: AvatarProps, prevState: AvatarState) {
if (prevProps.children !== this.props.children
|| (prevState.scale !== this.state.scale && this.state.scale === 1)) {
|| (prevState.scale !== this.state.scale && this.state.scale === 1)
|| (prevState.isImgExist !== this.state.isImgExist)) {
this.setScale();
}
}
@@ -55,7 +56,8 @@ export default class Avatar extends React.Component<AvatarProps, AvatarState> {
const childrenNode = this.avatarChildren;
if (childrenNode) {
const childrenWidth = childrenNode.offsetWidth;
const avatarWidth = ReactDOM.findDOMNode(this).getBoundingClientRect().width;
const avatarNode = ReactDOM.findDOMNode(this) as Element;
const avatarWidth = avatarNode.getBoundingClientRect().width;
// add 4px gap for each side to get better performance
if (avatarWidth - 8 < childrenWidth) {
this.setState({

View File

@@ -19,6 +19,6 @@ describe('BackTop', () => {
jest.runAllTimers();
wrapper.find('.ant-back-top').simulate('click');
jest.runAllTimers();
expect(Math.round(document.documentElement.scrollTop)).toBe(0);
expect(Math.abs(Math.round(document.documentElement.scrollTop))).toBe(0);
});
});

View File

@@ -106,7 +106,7 @@ export default class ScrollNumber extends Component<ScrollNumberProps, ScrollNum
return createElement('span', {
className: `${this.props.prefixCls}-only`,
style: {
transition: removeTransition && 'none',
transition: removeTransition ? 'none' : undefined,
msTransform: `translateY(${-position * 100}%)`,
WebkitTransform: `translateY(${-position * 100}%)`,
transform: `translateY(${-position * 100}%)`,

View File

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

View File

@@ -7,8 +7,14 @@ describe('Badge', () => {
const badge = mount(<Badge count={10} dot />);
expect(badge.find('.ant-card-multiple-words').length).toBe(0);
});
test('badge dot not showing count == 0', () => {
const badge = mount(<Badge count={0} dot />);
expect(badge.find('.ant-badge-dot').length).toBe(0);
});
it('should have an overriden title attribute', () => {
const badge = mount(<Badge count={10} title="Custom title" />);
expect(badge.find('.ant-scroll-number').getDOMNode().attributes.getNamedItem('title').value).toEqual('Custom title');
});
});

View File

@@ -0,0 +1,39 @@
---
order: 7
title:
zh-CN: 自定义标题
en-US: Title
---
## zh-CN
设置鼠标放在状态点上时显示的文字
## en-US
The badge will display `title` when hovered over, instead of `count`.
````jsx
import { Badge } from 'antd';
ReactDOM.render(
<div>
<Badge count={5} title="Custom hover text">
<a href="#" className="head-example" />
</Badge>
</div>
, mountNode);
````
<style>
.ant-badge:not(.ant-badge-status) {
margin-right: 20px;
}
.head-example {
width: 42px;
height: 42px;
border-radius: 4px;
background: #eee;
display: inline-block;
}
</style>

View File

@@ -31,3 +31,4 @@ Badge normally appears in proximity to notifications or user avatars with eye-ca
| showZero | Whether to show badge when `count` is zero | boolean | `false` |
| status | Set Badge as a status dot | `success` \| `processing` \| `default` \| `error` \| `warning` | `''` |
| text | If `status` is set, `text` sets the display text of the status `dot` | string | `''` |
| title | Text to show when hovering over the badge | string | `count` |

View File

@@ -21,6 +21,7 @@ export interface BadgeProps {
status?: 'success' | 'processing' | 'default' | 'error' | 'warning';
text?: string;
offset?: [number | string, number | string];
title?: string;
}
export default class Badge extends React.Component<BadgeProps, any> {
@@ -57,6 +58,7 @@ export default class Badge extends React.Component<BadgeProps, any> {
status,
text,
offset,
title,
...restProps,
} = this.props;
let displayCount = (count as number) > (overflowCount as number) ? `${overflowCount}+` : count;
@@ -103,7 +105,7 @@ export default class Badge extends React.Component<BadgeProps, any> {
data-show={!hidden}
className={scrollNumberCls}
count={displayCount}
title={count}
title={title || count}
style={styleWithOffset}
/>
);

View File

@@ -32,3 +32,4 @@ title: Badge
| showZero | 当数值为 0 时,是否展示 Badge | boolean | false |
| status | 设置 Badge 为状态点 | Enum{ 'success', 'processing, 'default', 'error', 'warning' } | '' |
| text | 在设置了 `status` 的前提下有效,设置状态点的文本 | string | '' |
| title | 设置鼠标放在状态点上时显示的文字 | string | `count` |

View File

@@ -113,7 +113,10 @@
top: auto;
display: block;
position: relative;
transform: none !important;
}
&-not-a-wrapper .@{badge-prefix-cls}-count {
transform: none;
}
}

View File

@@ -41,7 +41,7 @@ function defaultItemRender(route: Route, params: any, routes: Route[], paths: st
}
export default class Breadcrumb extends React.Component<BreadcrumbProps, any> {
static Item: any;
static Item: typeof BreadcrumbItem;
static defaultProps = {
prefixCls: 'ant-breadcrumb',

View File

@@ -212,7 +212,7 @@ exports[`renders ./components/button/demo/disabled.md correctly 1`] = `
</button>
<br />
<button
class="ant-btn"
class="ant-btn ant-btn-background-ghost"
type="button"
>
<span>
@@ -220,7 +220,7 @@ exports[`renders ./components/button/demo/disabled.md correctly 1`] = `
</span>
</button>
<button
class="ant-btn"
class="ant-btn ant-btn-background-ghost"
disabled=""
type="button"
>

View File

@@ -66,6 +66,48 @@ exports[`Button renders Chinese characters correctly 3`] = `
</button>
`;
exports[`Button renders Chinese characters correctly 4`] = `
<button
class="ant-btn"
type="button"
>
<i
class="anticon anticon-search"
/>
<span>
按钮
</span>
</button>
`;
exports[`Button renders Chinese characters correctly 5`] = `
<button
class="ant-btn ant-btn-loading"
type="button"
>
<i
class="anticon anticon-spin anticon-loading"
/>
<span>
按钮
</span>
</button>
`;
exports[`Button renders Chinese characters correctly 6`] = `
<button
class="ant-btn ant-btn-loading"
type="button"
>
<i
class="anticon anticon-spin anticon-loading"
/>
<span>
按 钮
</span>
</button>
`;
exports[`Button renders correctly 1`] = `
<button
class="ant-btn"

View File

@@ -26,6 +26,39 @@ describe('Button', () => {
<Button><Icon type="search" />按钮</Button>
);
expect(wrapper2).toMatchSnapshot();
// should not insert space when there is icon
const wrapper3 = render(
<Button icon="search">按钮</Button>
);
expect(wrapper3).toMatchSnapshot();
// should not insert space when there is icon while loading
const wrapper4 = render(
<Button icon="search" loading>按钮</Button>
);
expect(wrapper4).toMatchSnapshot();
// should insert space while loading
const wrapper5 = render(
<Button loading>按钮</Button>
);
expect(wrapper5).toMatchSnapshot();
});
it('renders Chinese characters correctly in HOC', () => {
const Text = props => <span>{props.children}</span>;
const wrapper = mount(
<Button><Text>按钮</Text></Button>
);
expect(wrapper.find('.ant-btn').hasClass('ant-btn-two-chinese-chars')).toBe(true);
wrapper.setProps({
children: <Text>大按钮</Text>,
});
wrapper.update();
expect(wrapper.find('.ant-btn').hasClass('ant-btn-two-chinese-chars')).toBe(false);
wrapper.setProps({
children: <Text>按钮</Text>,
});
wrapper.update();
expect(wrapper.find('.ant-btn').hasClass('ant-btn-two-chinese-chars')).toBe(true);
});
it('have static perperty for type detecting', () => {

View File

@@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
import classNames from 'classnames';
import omit from 'omit.js';
import Icon from '../icon';
import { Omit } from '../_util/type';
import Group from './button-group';
const rxTwoCNChar = /^[\u4e00-\u9fa5]{2}$/;
@@ -34,33 +35,30 @@ function insertSpace(child: React.ReactChild, needInserted: boolean) {
return child;
}
export type ButtonType = 'primary' | 'ghost' | 'dashed' | 'danger';
export type ButtonType = 'default' | 'primary' | 'ghost' | 'dashed' | 'danger';
export type ButtonShape = 'circle' | 'circle-outline';
export type ButtonSize = 'small' | 'default' | 'large';
export interface ButtonProps {
export interface BaseButtonProps<T> extends Omit<React.HTMLProps<T>, 'ref' | 'size'> {
type?: ButtonType;
htmlType?: string;
icon?: string;
shape?: ButtonShape;
size?: ButtonSize;
onClick?: React.FormEventHandler<any>;
onMouseUp?: React.FormEventHandler<any>;
onMouseDown?: React.FormEventHandler<any>;
onKeyPress?: React.KeyboardEventHandler<any>;
onKeyDown?: React.KeyboardEventHandler<any>;
tabIndex?: number;
loading?: boolean | { delay?: number };
disabled?: boolean;
style?: React.CSSProperties;
prefixCls?: string;
className?: string;
ghost?: boolean;
target?: string;
href?: string;
download?: string;
}
export interface AnchorButtonProps extends BaseButtonProps<HTMLAnchorElement> {
href: string;
}
export interface NativeButtonProps extends BaseButtonProps<HTMLButtonElement> {}
export type ButtonProps = AnchorButtonProps | NativeButtonProps;
export default class Button extends React.Component<ButtonProps, any> {
static Group: typeof Group;
static __ANT_BUTTON = true;
@@ -95,13 +93,7 @@ export default class Button extends React.Component<ButtonProps, any> {
}
componentDidMount() {
// Fix for HOC usage like <FormatMessage />
const buttonText = (findDOMNode(this) as HTMLElement).innerText;
if (this.isNeedInserted() && isTwoCNChar(buttonText)) {
this.setState({
hasTwoCNChar: true,
});
}
this.fixTwoCNChar();
}
componentWillReceiveProps(nextProps: ButtonProps) {
@@ -119,6 +111,10 @@ export default class Button extends React.Component<ButtonProps, any> {
}
}
componentDidUpdate() {
this.fixTwoCNChar();
}
componentWillUnmount() {
if (this.timeout) {
clearTimeout(this.timeout);
@@ -128,7 +124,24 @@ export default class Button extends React.Component<ButtonProps, any> {
}
}
handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
fixTwoCNChar() {
// Fix for HOC usage like <FormatMessage />
const node = (findDOMNode(this) as HTMLElement);
const buttonText = node.textContent || node.innerText;
if (this.isNeedInserted() && isTwoCNChar(buttonText)) {
if (!this.state.hasTwoCNChar) {
this.setState({
hasTwoCNChar: true,
});
}
} else if (this.state.hasTwoCNChar) {
this.setState({
hasTwoCNChar: false,
});
}
}
handleClick = (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {
// Add click effect
this.setState({ clicked: true });
clearTimeout(this.timeout);
@@ -136,14 +149,13 @@ export default class Button extends React.Component<ButtonProps, any> {
const onClick = this.props.onClick;
if (onClick) {
onClick(e);
(onClick as (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void)(e);
}
}
isNeedInserted() {
const { loading, icon, children } = this.props;
const iconType = loading ? 'loading' : icon;
return React.Children.count(children) === 1 && (!iconType || iconType === 'loading');
const { icon, children } = this.props;
return React.Children.count(children) === 1 && !icon;
}
render() {
@@ -166,7 +178,7 @@ export default class Button extends React.Component<ButtonProps, any> {
break;
}
const ComponentProp = others.href ? 'a' : 'button';
const ComponentProp = (others as AnchorButtonProps).href ? 'a' : 'button';
const classes = classNames(prefixCls, className, {
[`${prefixCls}-${type}`]: type,
@@ -187,7 +199,7 @@ export default class Button extends React.Component<ButtonProps, any> {
return (
<ComponentProp
{...omit(others, ['loading'])}
type={others.href ? undefined : (htmlType || 'button')}
type={(others as AnchorButtonProps).href ? undefined : (htmlType || 'button')}
className={classes}
onClick={this.handleClick}
>

View File

@@ -24,8 +24,8 @@ ReactDOM.render(
<Button>Default</Button>
<Button disabled>Default(disabled)</Button>
<br />
<Button>Ghost</Button>
<Button disabled>Ghost(disabled)</Button>
<Button ghost>Ghost</Button>
<Button ghost disabled>Ghost(disabled)</Button>
<br />
<Button type="dashed">Dashed</Button>
<Button type="dashed" disabled>Dashed(disabled)</Button>

View File

@@ -21,6 +21,7 @@ To get a customized button, just set `type`/`shape`/`size`/`loading`/`disabled`.
| 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 of button, see: Icon component | string | - |
| loading | set the loading status of button | boolean \| { delay: number } | false |
| disabled | disabled state of button | boolean | `false` |
| shape | can be set to `circle` or omitted | string | - |
| size | can be set to `small` `large` or omitted | string | `default` |
| target | same as target attribute of a, works when href is specified | string | - |

View File

@@ -24,6 +24,7 @@ subtitle: 按钮
| htmlType | 设置 `button` 原生的 `type` 值,可选值请参考 [HTML 标准](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) | string | `button` |
| icon | 设置按钮的图标类型 | string | - |
| loading | 设置按钮载入状态 | boolean \| { delay: number } | `false` |
| disabled | 按钮失效状态 | boolean | `false` |
| shape | 设置按钮形状,可选值为 `circle` 或者不设 | string | - |
| size | 设置按钮大小,可选值为 `small` `large` 或者不设 | string | `default` |
| target | 相当于 a 链接的 target 属性href 存在时生效 | string | - |

View File

@@ -54,11 +54,14 @@
.button-variant-danger(@color; @background; @border) {
.button-color(@color; @background; @border);
&:hover,
&:focus {
&:hover {
.button-color(@btn-primary-color; ~`colorPalette("@{color}", 5)`; ~`colorPalette("@{color}", 5)`);
}
&:focus {
.button-color(~`colorPalette("@{color}", 5)`; #fff; ~`colorPalette("@{color}", 5)`);
}
&:active,
&.active {
.button-color(@btn-primary-color; ~`colorPalette("@{color}", 7)`; ~`colorPalette("@{color}", 7)`);
@@ -202,6 +205,7 @@
&:active,
&.active {
background: @btn-default-bg;
text-decoration: none;
}
}

View File

@@ -2,7 +2,7 @@ import * as React from 'react';
import * as moment from 'moment';
import { PREFIX_CLS } from './Constants';
import Select from '../select';
import { Group, Button } from '../radio';
import { Group, Button, RadioChangeEvent } from '../radio';
const Option = Select.Option;
export interface HeaderProps {
@@ -15,6 +15,7 @@ export interface HeaderProps {
onValueChange?: (value: moment.Moment) => void;
onTypeChange?: (type: string) => void;
value: any;
validRange ?: [moment.Moment, moment.Moment];
}
export default class Header extends React.Component<HeaderProps, any> {
@@ -27,11 +28,21 @@ export default class Header extends React.Component<HeaderProps, any> {
private calenderHeaderNode: HTMLDivElement;
getYearSelectElement(year: number) {
const { yearSelectOffset, yearSelectTotal, locale, prefixCls, fullscreen } = this.props;
const start = year - (yearSelectOffset as number);
const end = start + (yearSelectTotal as number);
const {
yearSelectOffset,
yearSelectTotal,
locale,
prefixCls,
fullscreen,
validRange,
} = this.props;
let start = year - (yearSelectOffset as number);
let end = start + (yearSelectTotal as number);
if (validRange) {
start = validRange[0].get('year');
end = validRange[1].get('year') + 1;
}
const suffix = locale.year === '年' ? '年' : '';
const options: React.ReactElement<any>[] = [];
for (let index = start; index < end; index++) {
options.push(<Option key={`${index}`}>{index + suffix}</Option>);
@@ -63,13 +74,22 @@ export default class Header extends React.Component<HeaderProps, any> {
getMonthSelectElement(month: number, months: number[]) {
const props = this.props;
const { prefixCls, fullscreen } = props;
const { prefixCls, fullscreen, validRange, value } = props;
const options: React.ReactElement<any>[] = [];
for (let index = 0; index < 12; index++) {
let start = 0;
let end = 12;
if (validRange) {
const [rangeStart, rangeEnd] = validRange;
const currentYear = value.get('year');
if (rangeEnd.get('year') === currentYear) {
end = rangeEnd.get('month') + 1;
} else {
start = rangeStart.get('month');
}
}
for (let index = start; index < end; index++) {
options.push(<Option key={`${index}`}>{months[index]}</Option>);
}
return (
<Select
size={fullscreen ? 'default' : 'small'}
@@ -85,8 +105,21 @@ export default class Header extends React.Component<HeaderProps, any> {
}
onYearChange = (year: string) => {
const newValue = this.props.value.clone();
const { value, validRange } = this.props;
const newValue = value.clone();
newValue.year(parseInt(year, 10));
// switch the month so that it remains within range when year changes
if (validRange) {
const [ start, end ] = validRange;
const newYear = newValue.get('year');
const newMonth = newValue.get('month');
if (newYear === end.get('year') && newMonth > end.get('month')) {
newValue.month(end.get('month'));
}
if (newYear === start.get('year') && newMonth < start.get('month')) {
newValue.month(start.get('month'));
}
}
const onValueChange = this.props.onValueChange;
if (onValueChange) {
@@ -103,7 +136,7 @@ export default class Header extends React.Component<HeaderProps, any> {
}
}
onTypeChange = (e: React.ChangeEvent<HTMLInputElement>) => {
onTypeChange = (e: RadioChangeEvent) => {
const onTypeChange = this.props.onTypeChange;
if (onTypeChange) {
onTypeChange(e.target.value);

View File

@@ -33,7 +33,7 @@ exports[`renders ./components/calendar/demo/basic.md correctly 1`] = `
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
unselectable="on"
>
<b />
</span>
@@ -65,7 +65,7 @@ exports[`renders ./components/calendar/demo/basic.md correctly 1`] = `
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
unselectable="on"
>
<b />
</span>
@@ -1042,7 +1042,7 @@ exports[`renders ./components/calendar/demo/card.md correctly 1`] = `
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
unselectable="on"
>
<b />
</span>
@@ -1074,7 +1074,7 @@ exports[`renders ./components/calendar/demo/card.md correctly 1`] = `
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
unselectable="on"
>
<b />
</span>
@@ -2049,7 +2049,7 @@ exports[`renders ./components/calendar/demo/notice-calendar.md correctly 1`] = `
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
unselectable="on"
>
<b />
</span>
@@ -2081,7 +2081,7 @@ exports[`renders ./components/calendar/demo/notice-calendar.md correctly 1`] = `
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
unselectable="on"
>
<b />
</span>
@@ -3466,7 +3466,7 @@ exports[`renders ./components/calendar/demo/select.md correctly 1`] = `
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
unselectable="on"
>
<b />
</span>
@@ -3498,7 +3498,7 @@ exports[`renders ./components/calendar/demo/select.md correctly 1`] = `
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
unselectable="on"
>
<b />
</span>

View File

@@ -15,6 +15,66 @@ describe('Calendar', () => {
expect(Moment.isMoment(value)).toBe(true);
});
it('only Valid range should be selectable', () => {
const onSelect = jest.fn();
const validRange = [Moment('2018-02-02'), Moment('2018-02-18')];
const wrapper = mount(
<Calendar onSelect={onSelect} validRange={validRange} defaultValue={Moment('2018-02-02')} />
);
wrapper.find('[title="February 1, 2018"]').at(0).simulate('click');
wrapper.find('[title="February 2, 2018"]').at(0).simulate('click');
expect(onSelect.mock.calls.length).toBe(1);
});
it('dates other than in valid range should be disabled', () => {
const onSelect = jest.fn();
const validRange = [Moment('2018-02-02'), Moment('2018-02-18')];
const wrapper = mount(
<Calendar onSelect={onSelect} validRange={validRange} defaultValue={Moment('2018-02-02')} />
);
wrapper.find('[title="February 20, 2018"]').at(0).simulate('click');
const elem = wrapper.find('[title="February 20, 2018"]').hasClass('ant-fullcalendar-disabled-cell');
expect(elem).toEqual(true);
expect(onSelect.mock.calls.length).toBe(0);
});
it('months other than in valid range should be disabled', () => {
const onSelect = jest.fn();
const validRange = [Moment('2018-02-02'), Moment('2018-05-18')];
const wrapper = mount(
<Calendar onSelect={onSelect} validRange={validRange} defaultValue={Moment('2018-02-02')} mode="year" />
);
expect(wrapper.find('[title="Jan"]').at(0).hasClass('ant-fullcalendar-month-panel-cell-disabled')).toBe(true);
expect(wrapper.find('[title="Feb"]').at(0).hasClass('ant-fullcalendar-month-panel-cell-disabled')).toBe(false);
expect(wrapper.find('[title="Jun"]').at(0).hasClass('ant-fullcalendar-month-panel-cell-disabled')).toBe(true);
wrapper.find('[title="Jan"]').at(0).simulate('click');
wrapper.find('[title="Mar"]').at(0).simulate('click');
expect(onSelect.mock.calls.length).toBe(1);
});
it('months other than in valid range should not be shown in header', () => {
const validRange = [Moment('2017-02-02'), Moment('2018-05-18')];
const wrapper = mount(
<Calendar validRange={validRange} />
);
wrapper.find('.ant-fullcalendar-year-select').hostNodes().simulate('click');
wrapper.find('.ant-select-dropdown-menu-item').first().simulate('click');
wrapper.find('.ant-fullcalendar-month-select').hostNodes().simulate('click');
// 2 years and 11 months
expect(wrapper.find('.ant-select-dropdown-menu-item').length).toBe(13);
});
it('getDateRange should returns a disabledDate function', () => {
const validRange = [Moment('2018-02-02'), Moment('2018-05-18')];
const wrapper = mount(
<Calendar validRange={validRange} defaultValue={Moment('2018-02-02')} />
);
const instance = wrapper.instance();
const disabledDate = instance.getDateRange(validRange);
expect(disabledDate(Moment('2018-06-02'))).toBe(true);
expect(disabledDate(Moment('2018-04-02'))).toBe(false);
});
it('Calendar should change mode by prop', () => {
const monthMode = 'month';
const yearMode = 'year';

View File

@@ -40,6 +40,7 @@ When data is in the form of dates, such as schedules, timetables, prices calenda
| mode | The display mode of the calendar | `month` \| `year` | `month` |
| monthCellRender | Customize the display of the month cell, the returned content will be appended to the cell | function(date: moment): ReactNode | - |
| monthFullCellRender | Customize the display of the month cell, the returned content will override the cell | function(date: moment): ReactNode | - |
| validRange | to set valid range | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - |
| value | The current selected date | [moment](http://momentjs.com/) | current date |
| onPanelChange | Callback for when panel changes | function(date: moment, mode: string) | - |
| onSelect | Callback for when a date is selected | function(date: moment | - |

View File

@@ -5,7 +5,7 @@ import FullCalendar from 'rc-calendar/lib/FullCalendar';
import LocaleReceiver from '../locale-provider/LocaleReceiver';
import { PREFIX_CLS } from './Constants';
import Header from './Header';
import callMoment from '../_util/callMoment';
import interopDefault from '../_util/interopDefault';
import enUS from './locale/en_US';
export { HeaderProps } from './Header';
@@ -37,6 +37,7 @@ export interface CalendarProps {
onPanelChange?: (date?: moment.Moment, mode?: CalendarMode) => void;
onSelect?: (date?: moment.Moment) => void;
disabledDate?: (current: moment.Moment) => boolean;
validRange ?: [moment.Moment, moment.Moment];
}
export interface CalendarState {
@@ -72,8 +73,8 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
constructor(props: CalendarProps) {
super(props);
const value = props.value || props.defaultValue || callMoment(moment);
if (!moment.isMoment(value)) {
const value = props.value || props.defaultValue || interopDefault(moment)();
if (!interopDefault(moment).isMoment(value)) {
throw new Error(
'The value/defaultValue of Calendar must be a moment object after `antd@2.0`, ' +
'see: https://u.ant.design/calendar-value',
@@ -166,6 +167,21 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
this.setValue(value, 'select');
}
getDateRange = (
validRange: [moment.Moment, moment.Moment],
disabledDate?: (current: moment.Moment) => boolean,
) => (current: moment.Moment) => {
if (!current) {
return false;
}
const [ startDate, endDate ] = validRange;
const inRange = !current.isBetween(startDate, endDate, 'days', '[]');
if (disabledDate) {
return (disabledDate(current) || inRange);
}
return inRange;
}
renderCalendar = (locale: any, localeCode: string) => {
const { state, props } = this;
const { value, mode } = state;
@@ -183,6 +199,12 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
const monthCellRender = monthFullCellRender || this.monthCellRender;
const dateCellRender = dateFullCellRender || this.dateCellRender;
let disabledDate = props.disabledDate;
if (props.validRange) {
disabledDate = this.getDateRange(props.validRange, disabledDate);
}
return (
<div className={cls} style={style}>
<Header
@@ -193,9 +215,11 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
prefixCls={prefixCls}
onTypeChange={this.onHeaderTypeChange}
onValueChange={this.onHeaderValueChange}
validRange={props.validRange}
/>
<FullCalendar
{...props}
disabledDate={disabledDate}
Select={noop}
locale={locale.lang}
type={type}

View File

@@ -41,6 +41,7 @@ title: Calendar
| mode | 初始模式,`month/year` | string | month |
| monthCellRender | 自定义渲染月单元格,返回内容会被追加到单元格 | function(date: moment): ReactNode | 无 |
| monthFullCellRender | 自定义渲染月单元格,返回内容覆盖单元格 | function(date: moment): ReactNode | 无 |
| validRange | 设置可以显示的日期 | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | 无 |
| value | 展示日期 | [moment](http://momentjs.com/) | 当前日期 |
| onPanelChange | 日期面板变化回调 | function(date: moment, mode: string) | 无 |
| onSelect | 点击选择日期回调 | function(date: moment | 无 |

View File

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

View File

@@ -371,79 +371,175 @@ exports[`renders ./components/card/demo/inner.md correctly 1`] = `
`;
exports[`renders ./components/card/demo/loading.md correctly 1`] = `
<div
class="ant-card ant-card-loading ant-card-bordered"
style="width:34%"
>
<div>
<div
class="ant-card-head"
class="ant-card ant-card-loading ant-card-bordered"
>
<div
class="ant-card-head-wrapper"
class="ant-card-head"
>
<div
class="ant-card-head-title"
class="ant-card-head-wrapper"
>
Card title
<div
class="ant-card-head-title"
>
Card title
</div>
</div>
</div>
<div
class="ant-card-body"
>
<div
class="ant-card-loading-content"
>
<div
class="ant-row"
style="margin-left:-4px;margin-right:-4px"
>
<div
class="ant-col-22"
style="padding-left:4px;padding-right:4px"
>
<div
class="ant-card-loading-block"
/>
</div>
</div>
<div
class="ant-row"
style="margin-left:-4px;margin-right:-4px"
>
<div
class="ant-col-8"
style="padding-left:4px;padding-right:4px"
>
<div
class="ant-card-loading-block"
/>
</div>
<div
class="ant-col-15"
style="padding-left:4px;padding-right:4px"
>
<div
class="ant-card-loading-block"
/>
</div>
</div>
<div
class="ant-row"
style="margin-left:-4px;margin-right:-4px"
>
<div
class="ant-col-6"
style="padding-left:4px;padding-right:4px"
>
<div
class="ant-card-loading-block"
/>
</div>
<div
class="ant-col-18"
style="padding-left:4px;padding-right:4px"
>
<div
class="ant-card-loading-block"
/>
</div>
</div>
<div
class="ant-row"
style="margin-left:-4px;margin-right:-4px"
>
<div
class="ant-col-13"
style="padding-left:4px;padding-right:4px"
>
<div
class="ant-card-loading-block"
/>
</div>
<div
class="ant-col-9"
style="padding-left:4px;padding-right:4px"
>
<div
class="ant-card-loading-block"
/>
</div>
</div>
<div
class="ant-row"
style="margin-left:-4px;margin-right:-4px"
>
<div
class="ant-col-4"
style="padding-left:4px;padding-right:4px"
>
<div
class="ant-card-loading-block"
/>
</div>
<div
class="ant-col-3"
style="padding-left:4px;padding-right:4px"
>
<div
class="ant-card-loading-block"
/>
</div>
<div
class="ant-col-16"
style="padding-left:4px;padding-right:4px"
>
<div
class="ant-card-loading-block"
/>
</div>
</div>
<div
class="ant-row"
style="margin-left:-4px;margin-right:-4px"
>
<div
class="ant-col-8"
style="padding-left:4px;padding-right:4px"
>
<div
class="ant-card-loading-block"
/>
</div>
<div
class="ant-col-6"
style="padding-left:4px;padding-right:4px"
>
<div
class="ant-card-loading-block"
/>
</div>
<div
class="ant-col-8"
style="padding-left:4px;padding-right:4px"
>
<div
class="ant-card-loading-block"
/>
</div>
</div>
</div>
</div>
</div>
<div
class="ant-card-body"
<button
class="ant-btn"
style="margin-top:16px"
type="button"
>
<div
class="ant-card-loading-content"
>
<p
class="ant-card-loading-block"
style="width:94%"
/>
<p>
<span
class="ant-card-loading-block"
style="width:28%"
/>
<span
class="ant-card-loading-block"
style="width:62%"
/>
</p>
<p>
<span
class="ant-card-loading-block"
style="width:22%"
/>
<span
class="ant-card-loading-block"
style="width:66%"
/>
</p>
<p>
<span
class="ant-card-loading-block"
style="width:56%"
/>
<span
class="ant-card-loading-block"
style="width:39%"
/>
</p>
<p>
<span
class="ant-card-loading-block"
style="width:21%"
/>
<span
class="ant-card-loading-block"
style="width:15%"
/>
<span
class="ant-card-loading-block"
style="width:40%"
/>
</p>
</div>
</div>
<span>
Toggle loading
</span>
</button>
</div>
`;
@@ -616,8 +712,8 @@ exports[`renders ./components/card/demo/tabs.md correctly 1`] = `
/>
<div
aria-disabled="false"
aria-selected="true"
class="ant-tabs-tab-active ant-tabs-tab"
aria-selected="false"
class=" ant-tabs-tab"
role="tab"
>
tab1
@@ -637,11 +733,11 @@ exports[`renders ./components/card/demo/tabs.md correctly 1`] = `
</div>
<div
class="ant-tabs-content ant-tabs-content-animated"
style="margin-left:0%"
style="display:none"
>
<div
aria-hidden="false"
class="ant-tabs-tabpane ant-tabs-tabpane-active"
aria-hidden="true"
class="ant-tabs-tabpane ant-tabs-tabpane-inactive"
role="tabpanel"
/>
<div
@@ -713,16 +809,16 @@ exports[`renders ./components/card/demo/tabs.md correctly 1`] = `
/>
<div
aria-disabled="false"
aria-selected="true"
class="ant-tabs-tab-active ant-tabs-tab"
aria-selected="false"
class=" ant-tabs-tab"
role="tab"
>
article
</div>
<div
aria-disabled="false"
aria-selected="false"
class=" ant-tabs-tab"
aria-selected="true"
class="ant-tabs-tab-active ant-tabs-tab"
role="tab"
>
app
@@ -742,18 +838,18 @@ exports[`renders ./components/card/demo/tabs.md correctly 1`] = `
</div>
<div
class="ant-tabs-content ant-tabs-content-animated"
style="margin-left:0%"
style="margin-left:-100%"
>
<div
aria-hidden="false"
class="ant-tabs-tabpane ant-tabs-tabpane-active"
role="tabpanel"
/>
<div
aria-hidden="true"
class="ant-tabs-tabpane ant-tabs-tabpane-inactive"
role="tabpanel"
/>
<div
aria-hidden="false"
class="ant-tabs-tabpane ant-tabs-tabpane-active"
role="tabpanel"
/>
<div
aria-hidden="true"
class="ant-tabs-tabpane ant-tabs-tabpane-inactive"
@@ -766,7 +862,7 @@ exports[`renders ./components/card/demo/tabs.md correctly 1`] = `
class="ant-card-body"
>
<p>
article content
app content
</p>
</div>
</div>

View File

@@ -0,0 +1,152 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Card should still have padding when card which set padding to 0 is loading 1`] = `
<div
class="ant-card ant-card-loading ant-card-bordered"
>
<div
class="ant-card-body"
style="padding: 0px;"
>
<div
class="ant-card-loading-content"
style="padding: 24px;"
>
<div
class="ant-row"
style="margin-left: -4px; margin-right: -4px;"
>
<div
class="ant-col-22"
style="padding-left: 4px; padding-right: 4px;"
>
<div
class="ant-card-loading-block"
/>
</div>
</div>
<div
class="ant-row"
style="margin-left: -4px; margin-right: -4px;"
>
<div
class="ant-col-8"
style="padding-left: 4px; padding-right: 4px;"
>
<div
class="ant-card-loading-block"
/>
</div>
<div
class="ant-col-15"
style="padding-left: 4px; padding-right: 4px;"
>
<div
class="ant-card-loading-block"
/>
</div>
</div>
<div
class="ant-row"
style="margin-left: -4px; margin-right: -4px;"
>
<div
class="ant-col-6"
style="padding-left: 4px; padding-right: 4px;"
>
<div
class="ant-card-loading-block"
/>
</div>
<div
class="ant-col-18"
style="padding-left: 4px; padding-right: 4px;"
>
<div
class="ant-card-loading-block"
/>
</div>
</div>
<div
class="ant-row"
style="margin-left: -4px; margin-right: -4px;"
>
<div
class="ant-col-13"
style="padding-left: 4px; padding-right: 4px;"
>
<div
class="ant-card-loading-block"
/>
</div>
<div
class="ant-col-9"
style="padding-left: 4px; padding-right: 4px;"
>
<div
class="ant-card-loading-block"
/>
</div>
</div>
<div
class="ant-row"
style="margin-left: -4px; margin-right: -4px;"
>
<div
class="ant-col-4"
style="padding-left: 4px; padding-right: 4px;"
>
<div
class="ant-card-loading-block"
/>
</div>
<div
class="ant-col-3"
style="padding-left: 4px; padding-right: 4px;"
>
<div
class="ant-card-loading-block"
/>
</div>
<div
class="ant-col-16"
style="padding-left: 4px; padding-right: 4px;"
>
<div
class="ant-card-loading-block"
/>
</div>
</div>
<div
class="ant-row"
style="margin-left: -4px; margin-right: -4px;"
>
<div
class="ant-col-8"
style="padding-left: 4px; padding-right: 4px;"
>
<div
class="ant-card-loading-block"
/>
</div>
<div
class="ant-col-6"
style="padding-left: 4px; padding-right: 4px;"
>
<div
class="ant-card-loading-block"
/>
</div>
<div
class="ant-col-8"
style="padding-left: 4px; padding-right: 4px;"
>
<div
class="ant-card-loading-block"
/>
</div>
</div>
</div>
</div>
</div>
`;

View File

@@ -34,4 +34,9 @@ describe('Card', () => {
wrapper.update();
expect(wrapper.find('.ant-card-wider-padding').length).toBe(0);
});
it('should still have padding when card which set padding to 0 is loading', () => {
const wrapper = mount(<Card loading bodyStyle={{ padding: 0 }}>xxx</Card>);
expect(wrapper.render()).toMatchSnapshot();
});
});

View File

@@ -14,11 +14,30 @@ title:
Shows a loading indicator while the contents of the card is being fetched.
````jsx
import { Card } from 'antd';
import { Card, Button } from 'antd';
class LoadingCard extends React.Component {
state = {
loading: true,
}
handleClick = () => {
this.setState({ loading: !this.state.loading });
}
render() {
return (
<div>
<Card loading={this.state.loading} title="Card title">
Whatever content
</Card>
<Button onClick={this.handleClick} style={{ marginTop: 16 }}>Toggle loading</Button>
</div>
);
}
}
ReactDOM.render(
<Card loading title="Card title" style={{ width: '34%' }}>
Whatever content
</Card>
<LoadingCard />
, mountNode);
````

View File

@@ -49,7 +49,7 @@ const contentListNoTitle = {
class TabsCard extends React.Component {
state = {
key: 'tab1',
noTitleKey: 'article',
noTitleKey: 'app',
}
onTabChange = (key, type) => {
console.log(key, type);
@@ -71,6 +71,7 @@ class TabsCard extends React.Component {
<Card
style={{ width: '100%' }}
tabList={tabListNoTitle}
activeTabKey={this.state.noTitleKey}
onTabChange={(key) => { this.onTabChange(key, 'noTitleKey'); }}
>
{contentListNoTitle[this.state.noTitleKey]}

View File

@@ -29,6 +29,8 @@ A card can be used to display content related to a single subject. The content c
| hoverable | Lift up when hovering card | boolean | false |
| loading | Shows a loading indicator while the contents of the card are being fetched | boolean | false |
| tabList | List of TabPane's head. | Array&lt;{key: string, tab: ReactNode}> | - |
| activeTabKey | Current TabPane's key | string | - |
| defaultActiveTabKey | Initial active TabPane's key, if `activeTabKey` is not set. | string | - |
| title | Card title | string\|ReactNode | - |
| type | Card style type, can be set to `inner` or not set | string | - |
| onTabChange | Callback when tab is switched | (key) => void | - |

View File

@@ -5,8 +5,11 @@ import omit from 'omit.js';
import Grid from './Grid';
import Meta from './Meta';
import Tabs from '../tabs';
import Row from '../row';
import Col from '../col';
import { throttleByAnimationFrameDecorator } from '../_util/throttleByAnimationFrame';
import warning from '../_util/warning';
import { Omit } from '../_util/type';
export { CardGridProps } from './Grid';
export { CardMetaProps } from './Meta';
@@ -18,7 +21,7 @@ export interface CardTabListType {
tab: React.ReactNode;
}
export interface CardProps {
export interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
prefixCls?: string;
title?: React.ReactNode;
extra?: React.ReactNode;
@@ -36,16 +39,24 @@ export interface CardProps {
actions?: Array<React.ReactNode>;
tabList?: CardTabListType[];
onTabChange?: (key: string) => void;
activeTabKey?: string;
defaultActiveTabKey?: string;
}
export default class Card extends React.Component<CardProps, {}> {
export interface CardState {
widerPadding: boolean;
}
export default class Card extends React.Component<CardProps, CardState> {
static Grid: typeof Grid = Grid;
static Meta: typeof Meta = Meta;
resizeEvent: any;
updateWiderPaddingCalled: boolean;
state = {
widerPadding: false,
};
private resizeEvent: any;
private updateWiderPaddingCalled: boolean = false;
private container: HTMLDivElement;
componentDidMount() {
this.updateWiderPadding();
@@ -54,9 +65,9 @@ export default class Card extends React.Component<CardProps, {}> {
if ('noHovering' in this.props) {
warning(
!this.props.noHovering,
'`noHovering` of Card is deperated, you can remove it safely or use `hoverable` instead.',
'`noHovering` of Card is deprecated, you can remove it safely or use `hoverable` instead.',
);
warning(!!this.props.noHovering, '`noHovering={false}` of Card is deperated, use `hoverable` instead.');
warning(!!this.props.noHovering, '`noHovering={false}` of Card is deprecated, use `hoverable` instead.');
}
}
componentWillUnmount() {
@@ -70,14 +81,14 @@ export default class Card extends React.Component<CardProps, {}> {
if (!this.container) {
return;
}
// 936 is a magic card width pixer number indicated by designer
const WIDTH_BOUDARY_PX = 936;
if (this.container.offsetWidth >= WIDTH_BOUDARY_PX && !this.state.widerPadding) {
// 936 is a magic card width pixel number indicated by designer
const WIDTH_BOUNDARY_PX = 936;
if (this.container.offsetWidth >= WIDTH_BOUNDARY_PX && !this.state.widerPadding) {
this.setState({ widerPadding: true }, () => {
this.updateWiderPaddingCalled = true; // first render without css transition
});
}
if (this.container.offsetWidth < WIDTH_BOUDARY_PX && this.state.widerPadding) {
if (this.container.offsetWidth < WIDTH_BOUNDARY_PX && this.state.widerPadding) {
this.setState({ widerPadding: false }, () => {
this.updateWiderPaddingCalled = true; // first render without css transition
});
@@ -122,8 +133,8 @@ export default class Card extends React.Component<CardProps, {}> {
}
render() {
const {
prefixCls = 'ant-card', className, extra, bodyStyle, noHovering, hoverable, title, loading,
bordered = true, type, cover, actions, tabList, children, ...others,
prefixCls = 'ant-card', className, extra, bodyStyle = {}, noHovering, hoverable, title, loading,
bordered = true, type, cover, actions, tabList, children, activeTabKey, defaultActiveTabKey, ...others,
} = this.props;
const classString = classNames(prefixCls, className, {
@@ -137,32 +148,83 @@ export default class Card extends React.Component<CardProps, {}> {
[`${prefixCls}-type-${type}`]: !!type,
});
const loadingBlockStyle = (bodyStyle.padding === 0 || bodyStyle.padding === '0px')
? { padding: 24 } : undefined;
const loadingBlock = (
<div className={`${prefixCls}-loading-content`}>
<p className={`${prefixCls}-loading-block`} style={{ width: '94%' }} />
<p>
<span className={`${prefixCls}-loading-block`} style={{ width: '28%' }} />
<span className={`${prefixCls}-loading-block`} style={{ width: '62%' }} />
</p>
<p>
<span className={`${prefixCls}-loading-block`} style={{ width: '22%' }} />
<span className={`${prefixCls}-loading-block`} style={{ width: '66%' }} />
</p>
<p>
<span className={`${prefixCls}-loading-block`} style={{ width: '56%' }} />
<span className={`${prefixCls}-loading-block`} style={{ width: '39%' }} />
</p>
<p>
<span className={`${prefixCls}-loading-block`} style={{ width: '21%' }} />
<span className={`${prefixCls}-loading-block`} style={{ width: '15%' }} />
<span className={`${prefixCls}-loading-block`} style={{ width: '40%' }} />
</p>
<div
className={`${prefixCls}-loading-content`}
style={loadingBlockStyle}
>
<Row gutter={8}>
<Col span={22}>
<div className={`${prefixCls}-loading-block`} />
</Col>
</Row>
<Row gutter={8}>
<Col span={8}>
<div className={`${prefixCls}-loading-block`} />
</Col>
<Col span={15}>
<div className={`${prefixCls}-loading-block`} />
</Col>
</Row>
<Row gutter={8}>
<Col span={6}>
<div className={`${prefixCls}-loading-block`} />
</Col>
<Col span={18}>
<div className={`${prefixCls}-loading-block`} />
</Col>
</Row>
<Row gutter={8}>
<Col span={13}>
<div className={`${prefixCls}-loading-block`} />
</Col>
<Col span={9}>
<div className={`${prefixCls}-loading-block`} />
</Col>
</Row>
<Row gutter={8}>
<Col span={4}>
<div className={`${prefixCls}-loading-block`} />
</Col>
<Col span={3}>
<div className={`${prefixCls}-loading-block`} />
</Col>
<Col span={16}>
<div className={`${prefixCls}-loading-block`} />
</Col>
</Row>
<Row gutter={8}>
<Col span={8}>
<div className={`${prefixCls}-loading-block`} />
</Col>
<Col span={6}>
<div className={`${prefixCls}-loading-block`} />
</Col>
<Col span={8}>
<div className={`${prefixCls}-loading-block`} />
</Col>
</Row>
</div>
);
const hasActiveTabKey = activeTabKey !== undefined;
const extraProps = {
[hasActiveTabKey ? 'activeKey' : 'defaultActiveKey']: hasActiveTabKey
? activeTabKey
: defaultActiveTabKey,
};
let head;
const tabs = tabList && tabList.length ? (
<Tabs className={`${prefixCls}-head-tabs`} size="large" onChange={this.onTabChange}>
<Tabs
{...extraProps}
className={`${prefixCls}-head-tabs`}
size="large"
onChange={this.onTabChange}
>
{tabList.map(item => <Tabs.TabPane tab={item.tab} key={item.key} />)}
</Tabs>
) : null;

View File

@@ -30,6 +30,8 @@ cols: 1
| hoverable | 鼠标移过时可浮起 | boolean | false |
| loading | 当卡片内容还在加载中时,可以用 loading 展示一个占位 | boolean | false |
| tabList | 页签标题列表 | Array&lt;{key: string, tab: ReactNode}> | - |
| activeTabKey | 当前激活页签的 key | string | - |
| defaultActiveTabKey | 初始化选中页签的 key如果没有设置 activeTabKey | string | 第一个页签 |
| title | 卡片标题 | string\|ReactNode | - |
| type | 卡片类型,可设置为 `inner` 或 不设置 | string | - |
| onTabChange | 页签切换的回调 | (key) => void | - |

View File

@@ -72,7 +72,7 @@
.clearfix;
}
&-contain-grid &-body {
&-contain-grid:not(&-loading) {
margin: -1px 0 0 -1px;
padding: 0;
}
@@ -135,10 +135,16 @@
& > .anticon {
font-size: 16px;
line-height: 22px;
display: block;
width: 100%;
}
a {
color: @text-color-secondary;
line-height: 22px;
display: inline-block;
width: 100%;
&:hover {
color: @primary-color;
@@ -165,10 +171,6 @@
transition: padding .3s;
}
&-padding-transition &-extra {
transition: right .3s;
}
&-type-inner &-head {
padding: 0 @card-padding-base;
background: @background-color-light;
@@ -219,20 +221,17 @@
&-loading &-body {
user-select: none;
padding: 0;
}
&-loading-content {
padding: @card-padding-base;
p {
margin: 0;
}
}
&-loading-block {
display: inline-block;
margin: 5px 2% 0 0;
height: 14px;
margin: 4px 0;
border-radius: @border-radius-sm;
background: linear-gradient(90deg, rgba(207, 216, 220, .2), rgba(207, 216, 220, .4), rgba(207, 216, 220, .2));
animation: card-loading 1.4s ease infinite;

View File

@@ -5,96 +5,213 @@ exports[`renders ./components/carousel/demo/autoplay.md correctly 1`] = `
class="ant-carousel"
>
<div
class="slick-initialized slick-slider"
class="slick-slider slick-initialized"
dir="ltr"
>
<div
class="slick-list"
>
<div
class="slick-track"
style="width:900%;left:-100%"
>
<div
aria-hidden="true"
class="slick-slide slick-cloned"
data-index="-1"
style="width:11.11111111111111%"
tabindex="-1"
>
<h3>
4
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
4
</h3>
</div>
</div>
</div>
<div
class="slick-slide slick-active slick-cloned"
aria-hidden="false"
class="slick-slide slick-active slick-current"
data-index="0"
style="outline:none"
style="outline:none;width:11.11111111111111%"
tabindex="-1"
>
<h3>
1
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
1
</h3>
</div>
</div>
</div>
<div
class="slick-slide slick-cloned"
aria-hidden="true"
class="slick-slide"
data-index="1"
style="outline:none"
style="outline:none;width:11.11111111111111%"
tabindex="-1"
>
<h3>
2
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
2
</h3>
</div>
</div>
</div>
<div
class="slick-slide slick-cloned"
aria-hidden="true"
class="slick-slide"
data-index="2"
style="outline:none"
style="outline:none;width:11.11111111111111%"
tabindex="-1"
>
<h3>
3
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
3
</h3>
</div>
</div>
</div>
<div
class="slick-slide slick-cloned"
aria-hidden="true"
class="slick-slide"
data-index="3"
style="outline:none"
style="outline:none;width:11.11111111111111%"
tabindex="-1"
>
<h3>
4
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
4
</h3>
</div>
</div>
</div>
<div
aria-hidden="true"
class="slick-slide slick-cloned"
data-index="4"
style="width:11.11111111111111%"
tabindex="-1"
>
<h3>
1
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
1
</h3>
</div>
</div>
</div>
<div
aria-hidden="true"
class="slick-slide slick-cloned"
data-index="5"
style="width:11.11111111111111%"
tabindex="-1"
>
<h3>
2
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
2
</h3>
</div>
</div>
</div>
<div
aria-hidden="true"
class="slick-slide slick-cloned"
data-index="6"
style="width:11.11111111111111%"
tabindex="-1"
>
<h3>
3
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
3
</h3>
</div>
</div>
</div>
<div
aria-hidden="true"
class="slick-slide slick-cloned"
data-index="7"
style="width:11.11111111111111%"
tabindex="-1"
>
<h3>
4
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
4
</h3>
</div>
</div>
</div>
</div>
</div>
<ul
class="slick-dots"
style="display:block"
>
<li
class="slick-active"
>
<button>
1
</button>
</li>
<li
class=""
>
<button>
2
</button>
</li>
<li
class=""
>
<button>
3
</button>
</li>
<li
class=""
>
<button>
4
</button>
</li>
</ul>
</div>
</div>
`;
@@ -104,96 +221,213 @@ exports[`renders ./components/carousel/demo/basic.md correctly 1`] = `
class="ant-carousel"
>
<div
class="slick-initialized slick-slider"
class="slick-slider slick-initialized"
dir="ltr"
>
<div
class="slick-list"
>
<div
class="slick-track"
style="width:900%;left:-100%"
>
<div
aria-hidden="true"
class="slick-slide slick-cloned"
data-index="-1"
style="width:11.11111111111111%"
tabindex="-1"
>
<h3>
4
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
4
</h3>
</div>
</div>
</div>
<div
class="slick-slide slick-active slick-cloned"
aria-hidden="false"
class="slick-slide slick-active slick-current"
data-index="0"
style="outline:none"
style="outline:none;width:11.11111111111111%"
tabindex="-1"
>
<h3>
1
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
1
</h3>
</div>
</div>
</div>
<div
class="slick-slide slick-cloned"
aria-hidden="true"
class="slick-slide"
data-index="1"
style="outline:none"
style="outline:none;width:11.11111111111111%"
tabindex="-1"
>
<h3>
2
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
2
</h3>
</div>
</div>
</div>
<div
class="slick-slide slick-cloned"
aria-hidden="true"
class="slick-slide"
data-index="2"
style="outline:none"
style="outline:none;width:11.11111111111111%"
tabindex="-1"
>
<h3>
3
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
3
</h3>
</div>
</div>
</div>
<div
class="slick-slide slick-cloned"
aria-hidden="true"
class="slick-slide"
data-index="3"
style="outline:none"
style="outline:none;width:11.11111111111111%"
tabindex="-1"
>
<h3>
4
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
4
</h3>
</div>
</div>
</div>
<div
aria-hidden="true"
class="slick-slide slick-cloned"
data-index="4"
style="width:11.11111111111111%"
tabindex="-1"
>
<h3>
1
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
1
</h3>
</div>
</div>
</div>
<div
aria-hidden="true"
class="slick-slide slick-cloned"
data-index="5"
style="width:11.11111111111111%"
tabindex="-1"
>
<h3>
2
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
2
</h3>
</div>
</div>
</div>
<div
aria-hidden="true"
class="slick-slide slick-cloned"
data-index="6"
style="width:11.11111111111111%"
tabindex="-1"
>
<h3>
3
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
3
</h3>
</div>
</div>
</div>
<div
aria-hidden="true"
class="slick-slide slick-cloned"
data-index="7"
style="width:11.11111111111111%"
tabindex="-1"
>
<h3>
4
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
4
</h3>
</div>
</div>
</div>
</div>
</div>
<ul
class="slick-dots"
style="display:block"
>
<li
class="slick-active"
>
<button>
1
</button>
</li>
<li
class=""
>
<button>
2
</button>
</li>
<li
class=""
>
<button>
3
</button>
</li>
<li
class=""
>
<button>
4
</button>
</li>
</ul>
</div>
</div>
`;
@@ -203,56 +437,123 @@ exports[`renders ./components/carousel/demo/fade.md correctly 1`] = `
class="ant-carousel"
>
<div
class="slick-initialized slick-slider"
class="slick-slider slick-initialized"
dir="ltr"
>
<div
class="slick-list"
>
<div
class="slick-track"
style="width:900%;left:-100%"
>
<div
class="slick-slide slick-active slick-cloned"
aria-hidden="false"
class="slick-slide slick-active slick-current"
data-index="0"
style="outline:none;position:relative;left:0;opacity:1;transition:opacity 500ms ease;-webkit-transition:opacity 500ms ease"
style="outline:none;width:11.11111111111111%;position:relative;left:0;opacity:1;transition:opacity 500ms ease, visibility 500ms ease;-webkit-transition:opacity 500ms ease, visibility 500ms ease"
tabindex="-1"
>
<h3>
1
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
1
</h3>
</div>
</div>
</div>
<div
class="slick-slide slick-cloned"
aria-hidden="true"
class="slick-slide"
data-index="1"
style="outline:none;position:relative;left:0;opacity:0;transition:opacity 500ms ease;-webkit-transition:opacity 500ms ease"
style="outline:none;width:11.11111111111111%;position:relative;left:-11px;opacity:0;transition:opacity 500ms ease, visibility 500ms ease;-webkit-transition:opacity 500ms ease, visibility 500ms ease"
tabindex="-1"
>
<h3>
2
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
2
</h3>
</div>
</div>
</div>
<div
class="slick-slide slick-cloned"
aria-hidden="true"
class="slick-slide"
data-index="2"
style="outline:none;position:relative;left:0;opacity:0;transition:opacity 500ms ease;-webkit-transition:opacity 500ms ease"
style="outline:none;width:11.11111111111111%;position:relative;left:-22px;opacity:0;transition:opacity 500ms ease, visibility 500ms ease;-webkit-transition:opacity 500ms ease, visibility 500ms ease"
tabindex="-1"
>
<h3>
3
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
3
</h3>
</div>
</div>
</div>
<div
class="slick-slide slick-cloned"
aria-hidden="true"
class="slick-slide"
data-index="3"
style="outline:none;position:relative;left:0;opacity:0;transition:opacity 500ms ease;-webkit-transition:opacity 500ms ease"
style="outline:none;width:11.11111111111111%;position:relative;left:-33px;opacity:0;transition:opacity 500ms ease, visibility 500ms ease;-webkit-transition:opacity 500ms ease, visibility 500ms ease"
tabindex="-1"
>
<h3>
4
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
4
</h3>
</div>
</div>
</div>
</div>
</div>
<ul
class="slick-dots"
style="display:block"
>
<li
class="slick-active"
>
<button>
1
</button>
</li>
<li
class=""
>
<button>
2
</button>
</li>
<li
class=""
>
<button>
3
</button>
</li>
<li
class=""
>
<button>
4
</button>
</li>
</ul>
</div>
</div>
`;
@@ -262,96 +563,213 @@ exports[`renders ./components/carousel/demo/vertical.md correctly 1`] = `
class="ant-carousel ant-carousel-vertical"
>
<div
class="slick-initialized slick-slider slick-vertical"
class="slick-slider slick-vertical slick-initialized"
dir="ltr"
>
<div
class="slick-list"
>
<div
class="slick-track"
style="width:900%;left:-100%"
>
<div
aria-hidden="true"
class="slick-slide slick-cloned"
data-index="-1"
style="width:11.11111111111111%"
tabindex="-1"
>
<h3>
4
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
4
</h3>
</div>
</div>
</div>
<div
class="slick-slide slick-active slick-cloned"
aria-hidden="false"
class="slick-slide slick-active slick-current"
data-index="0"
style="outline:none"
style="outline:none;width:11.11111111111111%"
tabindex="-1"
>
<h3>
1
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
1
</h3>
</div>
</div>
</div>
<div
class="slick-slide slick-cloned"
aria-hidden="true"
class="slick-slide"
data-index="1"
style="outline:none"
style="outline:none;width:11.11111111111111%"
tabindex="-1"
>
<h3>
2
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
2
</h3>
</div>
</div>
</div>
<div
class="slick-slide slick-cloned"
aria-hidden="true"
class="slick-slide"
data-index="2"
style="outline:none"
style="outline:none;width:11.11111111111111%"
tabindex="-1"
>
<h3>
3
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
3
</h3>
</div>
</div>
</div>
<div
class="slick-slide slick-cloned"
aria-hidden="true"
class="slick-slide"
data-index="3"
style="outline:none"
style="outline:none;width:11.11111111111111%"
tabindex="-1"
>
<h3>
4
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
4
</h3>
</div>
</div>
</div>
<div
aria-hidden="true"
class="slick-slide slick-cloned"
data-index="4"
style="width:11.11111111111111%"
tabindex="-1"
>
<h3>
1
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
1
</h3>
</div>
</div>
</div>
<div
aria-hidden="true"
class="slick-slide slick-cloned"
data-index="5"
style="width:11.11111111111111%"
tabindex="-1"
>
<h3>
2
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
2
</h3>
</div>
</div>
</div>
<div
aria-hidden="true"
class="slick-slide slick-cloned"
data-index="6"
style="width:11.11111111111111%"
tabindex="-1"
>
<h3>
3
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
3
</h3>
</div>
</div>
</div>
<div
aria-hidden="true"
class="slick-slide slick-cloned"
data-index="7"
style="width:11.11111111111111%"
tabindex="-1"
>
<h3>
4
</h3>
<div>
<div
style="width:100%;display:inline-block"
tabindex="-1"
>
<h3>
4
</h3>
</div>
</div>
</div>
</div>
</div>
<ul
class="slick-dots"
style="display:block"
>
<li
class="slick-active"
>
<button>
1
</button>
</li>
<li
class=""
>
<button>
2
</button>
</li>
<li
class=""
>
<button>
3
</button>
</li>
<li
class=""
>
<button>
4
</button>
</li>
</ul>
</div>
</div>
`;

View File

@@ -1,5 +1,5 @@
import * as React from 'react';
import debounce from 'lodash.debounce';
import debounce from 'lodash/debounce';
// matchMedia polyfill for
// https://github.com/WickyNilliams/enquire.js/issues/82

View File

@@ -143,6 +143,28 @@ exports[`renders ./components/cascader/demo/disabled-option.md correctly 1`] = `
</span>
`;
exports[`renders ./components/cascader/demo/fileds-name.md correctly 1`] = `
<span
class="ant-cascader-picker"
tabindex="0"
>
<span
class="ant-cascader-picker-label"
/>
<input
autocomplete="off"
class="ant-input ant-cascader-input "
placeholder="Please select"
readonly=""
type="text"
value=""
/>
<i
class="anticon anticon-down ant-cascader-picker-arrow"
/>
</span>
`;
exports[`renders ./components/cascader/demo/hover.md correctly 1`] = `
<span
class="ant-cascader-picker"

View File

@@ -214,3 +214,29 @@ exports[`Cascader popup correctly with defaultValue 1`] = `
</div>
</div>
`;
exports[`Cascader support controlled mode 1`] = `
<span
class="ant-cascader-picker"
tabindex="0"
>
<span
class="ant-cascader-picker-label"
>
Zhejiang / Hangzhou / West Lake
</span>
<input
autocomplete="off"
class="ant-input ant-cascader-input "
readonly=""
type="text"
value=""
/>
<i
class="anticon anticon-cross-circle ant-cascader-picker-clear"
/>
<i
class="anticon anticon-down ant-cascader-picker-arrow"
/>
</span>
`;

View File

@@ -46,6 +46,16 @@ describe('Cascader', () => {
expect(render(wrapper.find('Trigger').instance().getComponent())).toMatchSnapshot();
});
it('support controlled mode', () => {
const wrapper = mount(
<Cascader options={options} />
);
wrapper.setProps({
value: ['zhejiang', 'hangzhou', 'xihu'],
});
expect(wrapper.render()).toMatchSnapshot();
});
it('popup correctly with defaultValue', () => {
const wrapper = mount(
<Cascader options={options} defaultValue={['zhejiang', 'hangzhou']} />

View File

@@ -0,0 +1,50 @@
---
order: 10
title:
zh-CN: 自定义字段名
en-US: Custom Filed Names
---
## zh-CN
自定义字段名。
## en-US
Custom filed names.
````jsx
import { Cascader } from 'antd';
const options = [{
code: 'zhejiang',
name: 'Zhejiang',
items: [{
code: 'hangzhou',
name: 'Hangzhou',
items: [{
code: 'xihu',
name: 'West Lake',
}],
}],
}, {
code: 'jiangsu',
name: 'Jiangsu',
items: [{
code: 'nanjing',
name: 'Nanjing',
items: [{
code: 'zhonghuamen',
name: 'Zhong Hua Men',
}],
}],
}];
function onChange(value) {
console.log(value);
}
ReactDOM.render(
<Cascader filedNames={{ label: 'name', value: 'code', children: 'items' }} options={options} onChange={onChange} placeholder="Please select" />
, mountNode);
````

View File

@@ -52,12 +52,16 @@ function onChange(value, selectedOptions) {
console.log(value, selectedOptions);
}
function filter(inputValue, path) {
return (path.some(option => (option.label).toLowerCase().indexOf(inputValue.toLowerCase()) > -1));
}
ReactDOM.render(
<Cascader
options={options}
onChange={onChange}
placeholder="Please select"
showSearch
showSearch={{ filter }}
/>,
mountNode
);

View File

@@ -42,6 +42,7 @@ Cascade selection box.
| value | selected value | string\[] | - |
| onChange | callback when finishing cascader select | `(value, selectedOptions) => void` | - |
| onPopupVisibleChange | callback when popup shown or hidden | `(value) => void` | - |
| filedNames | custom field name for label and value and children | object | `{ label: 'label', value: 'value', children: 'children' }` |
Fields in `showSearch`:

View File

@@ -8,19 +8,37 @@ import Input from '../input';
import Icon from '../icon';
export interface CascaderOptionType {
value: string;
label: React.ReactNode;
value?: string;
label?: React.ReactNode;
disabled?: boolean;
children?: Array<CascaderOptionType>;
__IS_FILTERED_OPTION?: boolean;
[key: string]: any;
}
export interface FiledNamesType {
value?: string;
label?: string;
children?: string;
}
export interface FilledFiledNamesType {
value: string;
label: string;
children: string;
}
export type CascaderExpandTrigger = 'click' | 'hover';
export interface ShowSearchType {
filter?: (inputValue: string, path: CascaderOptionType[]) => boolean;
render?: (inputValue: string, path: CascaderOptionType[], prefixCls: string | undefined) => React.ReactNode;
sort?: (a: CascaderOptionType[], b: CascaderOptionType[], inputValue: string) => number;
filter?: (inputValue: string, path: CascaderOptionType[], names: FilledFiledNamesType) => boolean;
render?: (
inputValue: string,
path: CascaderOptionType[],
prefixCls: string | undefined,
names: FilledFiledNamesType,
) => React.ReactNode;
sort?: (a: CascaderOptionType[], b: CascaderOptionType[], inputValue: string, names: FilledFiledNamesType) => number;
matchInputWidth?: boolean;
}
@@ -64,6 +82,7 @@ export interface CascaderProps {
inputPrefixCls?: string;
getPopupContainer?: (triggerNode?: HTMLElement) => HTMLElement;
popupVisible?: boolean;
filedNames?: FiledNamesType;
}
export interface CascaderState {
@@ -82,26 +101,41 @@ function highlightKeyword(str: string, keyword: string, prefixCls: string | unde
]);
}
function defaultFilterOption(inputValue: string, path: CascaderOptionType[]) {
return path.some(option => (option.label as string).indexOf(inputValue) > -1);
function defaultFilterOption(inputValue: string, path: CascaderOptionType[], names: FilledFiledNamesType) {
return path.some(option => (option[names.label] as string).indexOf(inputValue) > -1);
}
function defaultRenderFilteredOption(inputValue: string, path: CascaderOptionType[], prefixCls: string | undefined) {
return path.map(({ label }, index) => {
function defaultRenderFilteredOption(
inputValue: string,
path: CascaderOptionType[],
prefixCls: string | undefined,
names: FilledFiledNamesType,
) {
return path.map((option, index) => {
const label = option[names.label];
const node = (label as string).indexOf(inputValue) > -1 ?
highlightKeyword(label as string, inputValue, prefixCls) : label;
return index === 0 ? node : [' / ', node];
});
}
function defaultSortFilteredOption(a: any[], b: any[], inputValue: string) {
function defaultSortFilteredOption(a: any[], b: any[], inputValue: string, names: FilledFiledNamesType) {
function callback(elem: CascaderOptionType) {
return (elem.label as string).indexOf(inputValue) > -1;
return (elem[names.label] as string).indexOf(inputValue) > -1;
}
return a.findIndex(callback) - b.findIndex(callback);
}
function getFilledFieldNames(filedNames: FiledNamesType = {}) {
const names: FilledFiledNamesType = {
children: filedNames.children || 'children',
label: filedNames.label || 'label',
value: filedNames.value || 'value',
};
return names;
}
const defaultDisplayRender = (label: string[]) => label.join(' / ');
export default class Cascader extends React.Component<CascaderProps, CascaderState> {
@@ -128,7 +162,7 @@ export default class Cascader extends React.Component<CascaderProps, CascaderSta
inputValue: '',
inputFocused: false,
popupVisible: props.popupVisible,
flattenOptions: props.showSearch && this.flattenTree(props.options, props.changeOnSelect),
flattenOptions: props.showSearch && this.flattenTree(props.options, props.changeOnSelect, props.filedNames),
};
}
@@ -140,7 +174,9 @@ export default class Cascader extends React.Component<CascaderProps, CascaderSta
this.setState({ popupVisible: nextProps.popupVisible });
}
if (nextProps.showSearch && this.props.options !== nextProps.options) {
this.setState({ flattenOptions: this.flattenTree(nextProps.options, nextProps.changeOnSelect) });
this.setState({
flattenOptions: this.flattenTree(nextProps.options, nextProps.changeOnSelect, nextProps.filedNames),
});
}
}
@@ -207,13 +243,14 @@ export default class Cascader extends React.Component<CascaderProps, CascaderSta
}
getLabel() {
const { options, displayRender = defaultDisplayRender as Function } = this.props;
const { options, displayRender = defaultDisplayRender as Function, filedNames } = this.props;
const names = getFilledFieldNames(filedNames);
const value = this.state.value;
const unwrappedValue = Array.isArray(value[0]) ? value[0] : value;
const selectedOptions: CascaderOptionType[] = arrayTreeFilter(options,
(o: CascaderOptionType, level: number) => o.value === unwrappedValue[level],
(o: CascaderOptionType, level: number) => o[names.value] === unwrappedValue[level],
);
const label = selectedOptions.map(o => o.label);
const label = selectedOptions.map(o => o[names.label]);
return displayRender(label, selectedOptions);
}
@@ -228,43 +265,58 @@ export default class Cascader extends React.Component<CascaderProps, CascaderSta
}
}
flattenTree(options: CascaderOptionType[], changeOnSelect: boolean | undefined, ancestor: CascaderOptionType[] = []) {
flattenTree(
options: CascaderOptionType[],
changeOnSelect: boolean | undefined,
filedNames: FiledNamesType | undefined,
ancestor: CascaderOptionType[] = [],
) {
const names: FiledNamesType = getFilledFieldNames(filedNames);
let flattenOptions: any = [];
let childrenName: any = names.children;
options.forEach((option) => {
const path = ancestor.concat(option);
if (changeOnSelect || !option.children || !option.children.length) {
if (changeOnSelect || !option[childrenName] || !option[childrenName].length) {
flattenOptions.push(path);
}
if (option.children) {
flattenOptions = flattenOptions.concat(this.flattenTree(option.children, changeOnSelect, path));
if (option[childrenName]) {
flattenOptions = flattenOptions.concat(
this.flattenTree(
option[childrenName],
changeOnSelect,
filedNames,
path,
),
);
}
});
return flattenOptions;
}
generateFilteredOptions(prefixCls: string | undefined) {
const { showSearch, notFoundContent } = this.props;
const { showSearch, notFoundContent, filedNames } = this.props;
const names: FilledFiledNamesType = getFilledFieldNames(filedNames);
const {
filter = defaultFilterOption,
render = defaultRenderFilteredOption,
sort = defaultSortFilteredOption,
} = showSearch as ShowSearchType;
const { flattenOptions, inputValue } = this.state;
const filtered = flattenOptions.filter((path) => filter(this.state.inputValue, path))
.sort((a, b) => sort(a, b, inputValue));
const filtered = flattenOptions.filter((path) => filter(this.state.inputValue, path, names))
.sort((a, b) => sort(a, b, inputValue, names));
if (filtered.length > 0) {
return filtered.map((path: any) => {
return {
__IS_FILTERED_OPTION: true,
path,
label: render(inputValue, path, prefixCls),
value: path.map((o: CascaderOptionType) => o.value),
[names.label]: render(inputValue, path, prefixCls, names),
[names.value]: path.map((o: CascaderOptionType) => o[names.value]),
disabled: path.some((o: CascaderOptionType) => o.disabled),
} as CascaderOptionType;
});
}
return [{ label: notFoundContent, value: 'ANT_CASCADER_NOT_FOUND', disabled: true }];
return [{ [names.label]: notFoundContent, [names.value]: 'ANT_CASCADER_NOT_FOUND', disabled: true }];
}
focus() {
@@ -328,6 +380,7 @@ export default class Cascader extends React.Component<CascaderProps, CascaderSta
'renderFilteredOption',
'sortFilteredOption',
'notFoundContent',
'filedNames',
]);
let options = props.options;

View File

@@ -43,6 +43,7 @@ subtitle: 级联选择
| value | 指定选中项 | string\[] | - |
| onChange | 选择完成后的回调 | `(value, selectedOptions) => void` | - |
| onPopupVisibleChange | 显示/隐藏浮层的回调 | `(value) => void` | - |
| filedNames | 自定义 options 中 label name children 的字段 | object | `{ label: 'label', value: 'value', children: 'children' }` |
`showSearch` 为对象时,其中的字段:

View File

@@ -14,6 +14,7 @@
cursor: pointer;
width: 100%;
display: block;
position: static;
}
&-picker {

View File

@@ -5,14 +5,14 @@ import RcCheckbox from 'rc-checkbox';
import shallowEqual from 'shallowequal';
import CheckboxGroup, { CheckboxGroupContext } from './Group';
export interface AbstractCheckboxProps {
export interface AbstractCheckboxProps<T> {
prefixCls?: string;
className?: string;
defaultChecked?: boolean;
checked?: boolean;
style?: React.CSSProperties;
disabled?: boolean;
onChange?: React.ChangeEventHandler<HTMLInputElement>;
onChange?: (e: T) => void;
onMouseEnter?: React.MouseEventHandler<any>;
onMouseLeave?: React.MouseEventHandler<any>;
onKeyPress?: React.KeyboardEventHandler<any>;
@@ -23,10 +23,21 @@ export interface AbstractCheckboxProps {
children?: React.ReactNode;
}
export interface CheckboxProps extends AbstractCheckboxProps {
export interface CheckboxProps extends AbstractCheckboxProps<CheckboxChangeEvent> {
indeterminate?: boolean;
}
export interface CheckboxChangeEventTarget extends CheckboxProps {
checked: boolean;
}
export interface CheckboxChangeEvent {
target: CheckboxChangeEventTarget;
stopPropagation: () => void;
preventDefault: () => void;
nativeEvent: Event;
}
export default class Checkbox extends React.Component<CheckboxProps, {}> {
static Group: typeof CheckboxGroup;
static defaultProps = {

View File

@@ -41,7 +41,7 @@ export interface CheckboxGroupContext {
export default class CheckboxGroup extends React.Component<CheckboxGroupProps, CheckboxGroupState> {
static defaultProps = {
options: [],
prefixCls: 'ant-checkbox-group',
prefixCls: 'ant-checkbox',
};
static propTypes = {
@@ -115,23 +115,25 @@ export default class CheckboxGroup extends React.Component<CheckboxGroupProps, C
render() {
const { props, state } = this;
const { prefixCls, className, style, options } = props;
const groupPrefixCls = `${prefixCls}-group`;
let children = props.children;
if (options && options.length > 0) {
children = this.getOptions().map(option => (
<Checkbox
prefixCls={prefixCls}
key={option.value}
disabled={'disabled' in option ? option.disabled : props.disabled}
value={option.value}
checked={state.value.indexOf(option.value) !== -1}
onChange={() => this.toggleOption(option)}
className={`${prefixCls}-item`}
className={`${groupPrefixCls}-item`}
>
{option.label}
</Checkbox>
));
}
const classString = classNames(prefixCls, className);
const classString = classNames(groupPrefixCls, className);
return (
<div className={classString} style={style}>
{children}

View File

@@ -0,0 +1,46 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`CheckboxGroup passes prefixCls down to checkbox 1`] = `
<div
class="my-checkbox-group"
>
<label
class="my-checkbox-group-item my-checkbox-wrapper"
>
<span
class="my-checkbox"
>
<input
class="my-checkbox-input"
type="checkbox"
value="Apple"
/>
<span
class="my-checkbox-inner"
/>
</span>
<span>
Apple
</span>
</label>
<label
class="my-checkbox-group-item my-checkbox-wrapper"
>
<span
class="my-checkbox"
>
<input
class="my-checkbox-input"
type="checkbox"
value="Orange"
/>
<span
class="my-checkbox-inner"
/>
</span>
<span>
Orange
</span>
</label>
</div>
`;

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { mount } from 'enzyme';
import { mount, render } from 'enzyme';
import Checkbox from '../index';
describe('CheckboxGroup', () => {
@@ -51,4 +51,17 @@ describe('CheckboxGroup', () => {
groupWrapper.find('.ant-checkbox-input').at(1).simulate('change');
expect(onChangeGroup).toBeCalledWith(['Apple']);
});
it('passes prefixCls down to checkbox', () => {
const options = [
{ label: 'Apple', value: 'Apple' },
{ label: 'Orange', value: 'Orange' },
];
const wrapper = render(
<Checkbox.Group prefixCls="my-checkbox" options={options} />
);
expect(wrapper).toMatchSnapshot();
});
});

View File

@@ -1,7 +1,7 @@
import Checkbox from './Checkbox';
import Group from './Group';
export { CheckboxProps } from './Checkbox';
export { CheckboxProps, CheckboxChangeEvent } from './Checkbox';
export { CheckboxGroupProps, CheckboxOptionType } from './Group';
Checkbox.Group = Group;

View File

@@ -72,7 +72,6 @@
&-input {
position: absolute;
left: 0;
z-index: 1;
cursor: pointer;
opacity: 0;
top: 0;

View File

@@ -3,15 +3,16 @@
exports[`renders ./components/collapse/demo/accordion.md correctly 1`] = `
<div
class="ant-collapse"
role="tablist"
>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
class="ant-collapse-header"
role="tab"
tabindex="0"
>
<i
class="arrow"
@@ -21,12 +22,12 @@ exports[`renders ./components/collapse/demo/accordion.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
class="ant-collapse-header"
role="tab"
tabindex="0"
>
<i
class="arrow"
@@ -36,12 +37,12 @@ exports[`renders ./components/collapse/demo/accordion.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
class="ant-collapse-header"
role="tab"
tabindex="0"
>
<i
class="arrow"
@@ -58,12 +59,12 @@ exports[`renders ./components/collapse/demo/basic.md correctly 1`] = `
>
<div
class="ant-collapse-item ant-collapse-item-active"
role="tablist"
>
<div
aria-expanded="true"
class="ant-collapse-header"
role="tab"
role="button"
tabindex="0"
>
<i
class="arrow"
@@ -72,7 +73,6 @@ exports[`renders ./components/collapse/demo/basic.md correctly 1`] = `
</div>
<div
class="ant-collapse-content ant-collapse-content-active"
role="tabpanel"
>
<div
class="ant-collapse-content-box"
@@ -89,12 +89,12 @@ exports[`renders ./components/collapse/demo/basic.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
class="ant-collapse-header"
role="tab"
role="button"
tabindex="0"
>
<i
class="arrow"
@@ -104,12 +104,12 @@ exports[`renders ./components/collapse/demo/basic.md correctly 1`] = `
</div>
<div
class="ant-collapse-item ant-collapse-item-disabled"
role="tablist"
>
<div
aria-expanded="false"
class="ant-collapse-header"
role="tab"
role="button"
tabindex="-1"
>
<i
class="arrow"
@@ -126,12 +126,12 @@ exports[`renders ./components/collapse/demo/borderless.md correctly 1`] = `
>
<div
class="ant-collapse-item ant-collapse-item-active"
role="tablist"
>
<div
aria-expanded="true"
class="ant-collapse-header"
role="tab"
role="button"
tabindex="0"
>
<i
class="arrow"
@@ -140,7 +140,6 @@ exports[`renders ./components/collapse/demo/borderless.md correctly 1`] = `
</div>
<div
class="ant-collapse-content ant-collapse-content-active"
role="tabpanel"
>
<div
class="ant-collapse-content-box"
@@ -155,12 +154,12 @@ exports[`renders ./components/collapse/demo/borderless.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
class="ant-collapse-header"
role="tab"
role="button"
tabindex="0"
>
<i
class="arrow"
@@ -170,12 +169,12 @@ exports[`renders ./components/collapse/demo/borderless.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
class="ant-collapse-header"
role="tab"
role="button"
tabindex="0"
>
<i
class="arrow"
@@ -192,13 +191,13 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
>
<div
class="ant-collapse-item ant-collapse-item-active"
role="tablist"
style="background:#f7f7f7;border-radius:4px;margin-bottom:24px;border:0;overflow:hidden"
>
<div
aria-expanded="true"
class="ant-collapse-header"
role="tab"
role="button"
tabindex="0"
>
<i
class="arrow"
@@ -207,7 +206,6 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
</div>
<div
class="ant-collapse-content ant-collapse-content-active"
role="tabpanel"
>
<div
class="ant-collapse-content-box"
@@ -224,13 +222,13 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
style="background:#f7f7f7;border-radius:4px;margin-bottom:24px;border:0;overflow:hidden"
>
<div
aria-expanded="false"
class="ant-collapse-header"
role="tab"
role="button"
tabindex="0"
>
<i
class="arrow"
@@ -240,13 +238,13 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
style="background:#f7f7f7;border-radius:4px;margin-bottom:24px;border:0;overflow:hidden"
>
<div
aria-expanded="false"
class="ant-collapse-header"
role="tab"
role="button"
tabindex="0"
>
<i
class="arrow"
@@ -263,12 +261,12 @@ exports[`renders ./components/collapse/demo/mix.md correctly 1`] = `
>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
class="ant-collapse-header"
role="tab"
role="button"
tabindex="0"
>
<i
class="arrow"
@@ -278,12 +276,12 @@ exports[`renders ./components/collapse/demo/mix.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
class="ant-collapse-header"
role="tab"
role="button"
tabindex="0"
>
<i
class="arrow"
@@ -293,12 +291,12 @@ exports[`renders ./components/collapse/demo/mix.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
class="ant-collapse-header"
role="tab"
role="button"
tabindex="0"
>
<i
class="arrow"
@@ -315,12 +313,12 @@ exports[`renders ./components/collapse/demo/noarrow.md correctly 1`] = `
>
<div
class="ant-collapse-item ant-collapse-item-active"
role="tablist"
>
<div
aria-expanded="true"
class="ant-collapse-header"
role="tab"
role="button"
tabindex="0"
>
<i
class="arrow"
@@ -329,7 +327,6 @@ exports[`renders ./components/collapse/demo/noarrow.md correctly 1`] = `
</div>
<div
class="ant-collapse-content ant-collapse-content-active"
role="tabpanel"
>
<div
class="ant-collapse-content-box"
@@ -346,12 +343,12 @@ exports[`renders ./components/collapse/demo/noarrow.md correctly 1`] = `
</div>
<div
class="ant-collapse-item ant-collapse-no-arrow"
role="tablist"
>
<div
aria-expanded="false"
class="ant-collapse-header"
role="tab"
role="button"
tabindex="0"
>
This is panel header with no arrow icon
</div>

View File

@@ -3,9 +3,6 @@
@collapse-prefix-cls: ~"@{ant-prefix}-collapse";
@collapse-header-bg: @background-color-light;
@collapse-active-bg: @background-color-base;
.collapse-close() {
transform: rotate(0);
}
@@ -32,7 +29,7 @@
> .@{collapse-prefix-cls}-header {
line-height: 22px;
padding: 12px 0 12px 40px;
padding: @collapse-header-padding;
color: @heading-color;
cursor: pointer;
position: relative;
@@ -53,6 +50,10 @@
content: "\E61F";
}
}
&:focus {
outline: none;
}
}
&.@{collapse-prefix-cls}-no-arrow {
@@ -69,13 +70,11 @@
&-content {
overflow: hidden;
color: @text-color;
padding: 0 @padding-md;
background-color: @component-background;
background-color: @collapse-content-bg;
border-top: @border-width-base @border-style-base @border-color-base;
& > &-box {
padding-top: @padding-md;
padding-bottom: @padding-md;
padding: @collapse-content-padding;
}
&-inactive {

View File

@@ -6,7 +6,7 @@ import RcDatePicker from 'rc-calendar/lib/Picker';
import classNames from 'classnames';
import Icon from '../icon';
import warning from '../_util/warning';
import callMoment from '../_util/callMoment';
import interopDefault from '../_util/interopDefault';
import { RangePickerValue, RangePickerPresetRange } from './interface';
export interface RangePickerState {
@@ -75,8 +75,8 @@ export default class RangePicker extends React.Component<any, RangePickerState>
super(props);
const value = props.value || props.defaultValue || [];
if (
value[0] && !moment.isMoment(value[0]) ||
value[1] && !moment.isMoment(value[1])
value[0] && !interopDefault(moment).isMoment(value[0]) ||
value[1] && !interopDefault(moment).isMoment(value[1])
) {
throw new Error(
'The value/defaultValue of RangePicker must be a moment object array after `antd@2.0`, ' +
@@ -86,7 +86,7 @@ export default class RangePicker extends React.Component<any, RangePickerState>
const pickerValue = !value || isEmptyArray(value) ? props.defaultPickerValue : value;
this.state = {
value,
showDate: pickerValueAdapter(pickerValue || callMoment(moment)),
showDate: pickerValueAdapter(pickerValue || interopDefault(moment)()),
open: props.open,
hoverValue: [],
};

View File

@@ -4,6 +4,7 @@ import Calendar from 'rc-calendar';
import RcDatePicker from 'rc-calendar/lib/Picker';
import classNames from 'classnames';
import Icon from '../icon';
import interopDefault from '../_util/interopDefault';
function formatValue(value: moment.Moment | null, format: string): string {
return (value && value.format(format)) || '';
@@ -20,7 +21,7 @@ export default class WeekPicker extends React.Component<any, any> {
constructor(props: any) {
super(props);
const value = props.value || props.defaultValue;
if (value && !moment.isMoment(value)) {
if (value && !interopDefault(moment).isMoment(value)) {
throw new Error(
'The value/defaultValue of DatePicker or MonthPicker must be ' +
'a moment object after `antd@2.0`, see: https://u.ant.design/date-picker-value',
@@ -39,8 +40,8 @@ export default class WeekPicker extends React.Component<any, any> {
const selectedValue = this.state.value;
const { prefixCls } = this.props;
if (selectedValue &&
current.year() === selectedValue.year() &&
current.week() === selectedValue.week()) {
current.year() === selectedValue.year() &&
current.week() === selectedValue.week()) {
return (
<div className={`${prefixCls}-selected-day`}>
<div className={`${prefixCls}-date`}>
@@ -50,7 +51,7 @@ export default class WeekPicker extends React.Component<any, any> {
);
}
return (
<div className={`${prefixCls}-calendar-date`}>
<div className={`${prefixCls}-date`}>
{current.date()}
</div>
);
@@ -83,6 +84,7 @@ export default class WeekPicker extends React.Component<any, any> {
const {
prefixCls, className, disabled, pickerClass, popupStyle,
pickerInputClass, format, allowClear, locale, localeCode, disabledDate,
style, onFocus, onBlur,
} = this.props;
const pickerValue = this.state.value;
@@ -122,8 +124,9 @@ export default class WeekPicker extends React.Component<any, any> {
value={(value && value.format(format)) || ''}
placeholder={placeholder}
className={pickerInputClass}
onFocus={this.props.onFocus}
onBlur={this.props.onBlur}
onFocus={onFocus}
onBlur={onBlur}
style={style}
/>
{clearIcon}
<span className={`${prefixCls}-picker-icon`} />

View File

@@ -17,7 +17,7 @@ describe('DatePicker', () => {
focusTest(DatePicker);
beforeEach(() => {
MockDate.set(new Date('2016-11-22').getTime() + (new Date().getTimezoneOffset() * 60 * 1000));
MockDate.set(moment('2016-11-22'));
});
afterEach(() => {

View File

@@ -1,3 +1,5 @@
import React from 'react';
import { mount } from 'enzyme';
import DatePicker from '..';
import focusTest from '../../../tests/shared/focusTest';
@@ -5,4 +7,11 @@ const { WeekPicker } = DatePicker;
describe('WeekPicker', () => {
focusTest(WeekPicker);
it('should support style prop', () => {
const wrapper = mount(
<WeekPicker style={{ width: 400 }} />
);
expect(wrapper.render()).toMatchSnapshot();
});
});

View File

@@ -0,0 +1,20 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`WeekPicker should support style prop 1`] = `
<span
class="ant-calendar-picker"
>
<span>
<input
class="ant-calendar-picker-input ant-input"
placeholder="Select date"
readonly=""
style="width: 400px;"
value=""
/>
<span
class="ant-calendar-picker-icon"
/>
</span>
</span>
`;

View File

@@ -443,7 +443,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="1999年12月27日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
27
</div>
@@ -454,7 +454,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="1999年12月28日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
28
</div>
@@ -465,7 +465,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="1999年12月29日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
29
</div>
@@ -476,7 +476,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="1999年12月30日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
30
</div>
@@ -487,7 +487,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="1999年12月31日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
31
</div>
@@ -539,7 +539,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月3日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
3
</div>
@@ -550,7 +550,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月4日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
4
</div>
@@ -561,7 +561,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月5日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
5
</div>
@@ -572,7 +572,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月6日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
6
</div>
@@ -583,7 +583,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月7日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
7
</div>
@@ -594,7 +594,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月8日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
8
</div>
@@ -605,7 +605,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月9日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
9
</div>
@@ -627,7 +627,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月10日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
10
</div>
@@ -638,7 +638,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月11日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
11
</div>
@@ -649,7 +649,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月12日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
12
</div>
@@ -660,7 +660,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月13日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
13
</div>
@@ -671,7 +671,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月14日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
14
</div>
@@ -682,7 +682,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月15日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
15
</div>
@@ -693,7 +693,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月16日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
16
</div>
@@ -715,7 +715,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月17日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
17
</div>
@@ -726,7 +726,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月18日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
18
</div>
@@ -737,7 +737,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月19日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
19
</div>
@@ -748,7 +748,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月20日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
20
</div>
@@ -759,7 +759,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月21日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
21
</div>
@@ -770,7 +770,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月22日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
22
</div>
@@ -781,7 +781,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月23日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
23
</div>
@@ -803,7 +803,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月24日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
24
</div>
@@ -814,7 +814,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月25日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
25
</div>
@@ -825,7 +825,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月26日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
26
</div>
@@ -836,7 +836,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月27日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
27
</div>
@@ -847,7 +847,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月28日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
28
</div>
@@ -858,7 +858,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月29日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
29
</div>
@@ -869,7 +869,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月30日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
30
</div>
@@ -891,7 +891,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年1月31日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
31
</div>
@@ -902,7 +902,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年2月1日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
1
</div>
@@ -913,7 +913,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年2月2日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
2
</div>
@@ -924,7 +924,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年2月3日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
3
</div>
@@ -935,7 +935,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年2月4日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
4
</div>
@@ -946,7 +946,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年2月5日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
5
</div>
@@ -957,7 +957,7 @@ exports[`MonthPicker and WeekPicker render WeekPicker 1`] = `
title="2000年2月6日"
>
<div
class="ant-calendar-calendar-date"
class="ant-calendar-date"
>
6
</div>

View File

@@ -6,7 +6,7 @@ import classNames from 'classnames';
import omit from 'omit.js';
import Icon from '../icon';
import warning from '../_util/warning';
import callMoment from '../_util/callMoment';
import interopDefault from '../_util/interopDefault';
export interface PickerProps {
value?: moment.Moment;
@@ -26,7 +26,7 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
constructor(props: any) {
super(props);
const value = props.value || props.defaultValue;
if (value && !moment.isMoment(value)) {
if (value && !interopDefault(moment).isMoment(value)) {
throw new Error(
'The value/defaultValue of DatePicker or MonthPicker must be ' +
'a moment object after `antd@2.0`, see: https://u.ant.design/date-picker-value',
@@ -132,7 +132,7 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
disabledTime={disabledTime}
locale={locale.lang}
timePicker={props.timePicker}
defaultValue={props.defaultPickerValue || callMoment(moment)}
defaultValue={props.defaultPickerValue || interopDefault(moment)()}
dateInputPlaceholder={placeholder}
prefixCls={prefixCls}
className={calendarClassName}

View File

@@ -47,9 +47,12 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker, WeekPicke
| open | open state of picker | boolean | - |
| placeholder | placeholder of date input | string\|RangePicker\[] | - |
| popupStyle | to customize the style of the popup calendar | object | {} |
| dropdownClassName | to customize the className of the popup calendar | string | - |
| size | determine the size of the input box, the height of `large` and `small`, are 40px and 24px respectively, while default size is 32px | string | - |
| style | to customize the style of the input box | object | {} |
| onOpenChange | a callback function, can be executed whether the popup calendar is popped up or closed | function(status) | - |
| mode | picker panel mode | `time|date|month|year` | 'date' |
| onPanelChange | callback when picker panel mode is changed | function(value, mode) | - |
### Common Methods

View File

@@ -47,7 +47,8 @@ subtitle: 日期选择框
| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
| open | 控制弹层是否展开 | boolean | - |
| placeholder | 输入框提示文字 | string\|RangePicker\[] | - |
| popupStyle | 外的弹出日历样式 | object | {} |
| popupStyle | 外的弹出日历样式 | object | {} |
| dropdownClassName | 额外的弹出日历 className | string | - |
| size | 输入框大小,`large` 高度为 40px`small` 为 24px默认是 32px | string | 无 |
| style | 自定义输入框样式 | object | {} |
| onOpenChange | 弹出日历和关闭日历的回调 | function(status) | 无 |
@@ -73,6 +74,8 @@ subtitle: 日期选择框
| value | 日期 | [moment](http://momentjs.com/) | 无 |
| onChange | 时间发生变化的回调 | function(date: moment, dateString: string) | 无 |
| onOk | 点击确定按钮的回调 | function() | - |
| mode | 日期面板的状态 | `time|date|month|year` | 'date' |
| onPanelChange | 日期面板变化时的回调 | function(value, mode) | - |
### MonthPicker

View File

@@ -12,6 +12,7 @@ export interface PickerProps {
className?: string;
style?: React.CSSProperties;
popupStyle?: React.CSSProperties;
dropdownClassName?: string;
locale?: any;
size?: 'large' | 'small' | 'default';
getCalendarContainer?: (triggerNode: Element) => HTMLElement;
@@ -78,7 +79,7 @@ export interface RangePickerProps extends PickerProps {
onPanelChange?: (value?: RangePickerValue, mode?: string | string[]) => void;
}
export interface WeexPickerProps extends PickerProps, SinglePickerProps {
export interface WeekPickerProps extends PickerProps, SinglePickerProps {
className?: string;
placeholder?: string;
}
@@ -86,5 +87,5 @@ export interface WeexPickerProps extends PickerProps, SinglePickerProps {
export interface DatePickerDecorator extends React.ClassicComponentClass<DatePickerProps> {
RangePicker: React.ClassicComponentClass<RangePickerProps>;
MonthPicker: React.ClassicComponentClass<MonthPickerProps>;
WeekPicker: React.ClassicComponentClass<WeexPickerProps>;
WeekPicker: React.ClassicComponentClass<WeekPickerProps>;
}

View File

@@ -0,0 +1,43 @@
import TimePickerLocale from '../../time-picker/locale/sl_SI';
// Merge into a locale object
const locale = {
lang: {
placeholder: 'Izberite datum',
rangePlaceholder: ['Začetni datum', 'Končni datum'],
today: 'Danes',
now: 'Trenutno',
backToToday: 'Nazaj na trenutni datum',
ok: 'Ok',
clear: 'Počisti',
month: 'Mesec',
year: 'Leto',
timeSelect: 'Izberi čas',
dateSelect: 'Izberi datum',
monthSelect: 'Izberite mesec',
yearSelect: 'Izberite leto',
decadeSelect: 'Izberite desetletje',
yearFormat: 'YYYY',
dateFormat: 'D.M.YYYY',
dayFormat: 'D',
dateTimeFormat: 'D.M.YYYY HH:mm:ss',
monthFormat: 'MMMM',
monthBeforeYear: true,
previousMonth: 'Prejšnji mesec (PageUp)',
nextMonth: 'Naslednji mesec (PageDown)',
previousYear: 'Lansko leto (Control + left)',
nextYear: 'Naslednje leto (Control + right)',
previousDecade: 'Prejšnje desetletje',
nextDecade: 'Naslednje desetletje',
previousCentury: 'Zadnje stoletje',
nextCentury: 'Naslednje stoletje',
},
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,4 +1,4 @@
import CalendarLocale from 'rc-calendar/lib/locale/en_US';
import CalendarLocale from 'rc-calendar/lib/locale/tr_TR';
import TimePickerLocale from '../../time-picker/locale/tr_TR';
// Merge into a locale object

View File

@@ -32,6 +32,35 @@ exports[`renders ./components/divider/demo/horizontal.md correctly 1`] = `
</div>
`;
exports[`renders ./components/divider/demo/orientation.md correctly 1`] = `
<div>
<div
class="ant-divider ant-divider-horizontal ant-divider-with-text-left"
>
<span
class="ant-divider-inner-text"
>
Left Text
</span>
</div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert tamen, quo modo.
</p>
<div
class="ant-divider ant-divider-horizontal ant-divider-with-text-right"
>
<span
class="ant-divider-inner-text"
>
Right Text
</span>
</div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert tamen, quo modo.
</p>
</div>
`;
exports[`renders ./components/divider/demo/vertical.md correctly 1`] = `
<div>
Text

View File

@@ -0,0 +1,27 @@
---
order: 2
title:
zh-CN: 标题位置
en-US: Orientation of title
---
## zh-CN
修改分割线标题的位置。
## en-US
Set orientation of divider to left or right.
````jsx
import { Divider } from 'antd';
ReactDOM.render(
<div>
<Divider orientation="left">Left Text</Divider>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert tamen, quo modo.</p>
<Divider orientation="right">Right Text</Divider>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert tamen, quo modo.</p>
</div>
, mountNode);
````

View File

@@ -18,5 +18,6 @@ A divider line separates different content.
| Property | Description | Type | Default |
| -------- | ----------- | ---- | ------- |
| dashed | whether line is dasded | Boolean | false |
| dashed | whether line is dashed | Boolean | false |
| type | direction type of divider | enum: `horizontal` `vertical` | `horizontal` |
| orientation | position of title inside divider | enum: `left` `right` `center` | `center` |

View File

@@ -4,6 +4,7 @@ import classNames from 'classnames';
export interface DividerProps {
prefixCls?: string;
type?: 'horizontal' | 'vertical';
orientation?: 'left' | 'right';
className?: string;
children?: React.ReactNode;
dashed?: boolean;
@@ -13,14 +14,16 @@ export interface DividerProps {
export default function Divider({
prefixCls = 'ant',
type = 'horizontal',
orientation = '',
className,
children,
dashed,
...restProps,
}: DividerProps) {
const orientationPrefix = (orientation.length > 0) ? '-' + orientation : orientation;
const classString = classNames(
className, `${prefixCls}-divider`, `${prefixCls}-divider-${type}`, {
[`${prefixCls}-divider-with-text`]: children,
[`${prefixCls}-divider-with-text${orientationPrefix}`]: children,
[`${prefixCls}-divider-dashed`]: !!dashed,
});
return (

View File

@@ -18,3 +18,4 @@ subtitle: 分割线
| --- | --- | --- | --- |
| dashed | 是否虚线 | Boolean | false |
| type | 水平还是垂直类型 | enum: `horizontal` `vertical` | `horizontal` |
| orientation | 分割线标题的位置 | enum: `left` `right` | `center` |

View File

@@ -22,6 +22,7 @@
height: 1px;
width: 100%;
margin: 24px 0;
clear: both;
}
&-horizontal&-with-text {
display: table;
@@ -44,18 +45,84 @@
transform: translateY(50%);
}
}
&-inner-text {
display: inline-block;
padding: 0 24px;
}
&-horizontal&-with-text-left {
display: table;
white-space: nowrap;
text-align: center;
background: transparent;
font-weight: 500;
color: @heading-color;
font-size: @font-size-base;
margin: 16px 0;
&:before {
content: '';
display: table-cell;
position: relative;
top: 50%;
width: 5%;
border-top: 1px solid @border-color-split;
transform: translateY(50%);
}
&:after {
content: '';
display: table-cell;
position: relative;
top: 50%;
width: 95%;
border-top: 1px solid @border-color-split;
transform: translateY(50%);
}
&-inner-text {
display: inline-block;
padding: 0 10px;
}
}
&-horizontal&-with-text-right {
display: table;
white-space: nowrap;
text-align: center;
background: transparent;
font-weight: 500;
color: @heading-color;
font-size: @font-size-base;
margin: 16px 0;
&:before {
content: '';
display: table-cell;
position: relative;
top: 50%;
width: 95%;
border-top: 1px solid @border-color-split;
transform: translateY(50%);
}
&:after {
content: '';
display: table-cell;
position: relative;
top: 50%;
width: 5%;
border-top: 1px solid @border-color-split;
transform: translateY(50%);
}
&-inner-text {
display: inline-block;
padding: 0 10px;
}
}
&-dashed {
background: none;
border-top: 1px dashed @border-color-split;
}
&-horizontal&-with-text&-dashed {
&-horizontal&-with-text&-dashed,
&-horizontal&-with-text-left&-dashed,
&-horizontal&-with-text-right&-dashed {
border-top: 0;
&:before,
&:after {

View File

@@ -35,11 +35,11 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
</span>
</button>
<button
class="ant-btn ant-dropdown-trigger ant-btn-default"
class="ant-btn ant-dropdown-trigger ant-btn-default ant-btn-icon-only"
type="button"
>
<i
class="anticon anticon-down"
class="anticon anticon-ellipsis"
/>
</button>
</div>
@@ -57,12 +57,12 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
</span>
</button>
<button
class="ant-btn ant-dropdown-trigger ant-btn-default"
class="ant-btn ant-dropdown-trigger ant-btn-default ant-btn-icon-only"
disabled=""
type="button"
>
<i
class="anticon anticon-down"
class="anticon anticon-ellipsis"
/>
</button>
</div>

View File

@@ -1,7 +1,6 @@
import * as React from 'react';
import Button from '../button';
import { ButtonGroupProps } from '../button/button-group';
import Icon from '../icon';
import Dropdown, { DropDownProps } from './dropdown';
import classNames from 'classnames';
const ButtonGroup = Button.Group;
@@ -9,7 +8,7 @@ const ButtonGroup = Button.Group;
export interface DropdownButtonProps extends ButtonGroupProps, DropDownProps {
type?: 'primary' | 'ghost' | 'dashed';
disabled?: boolean;
onClick?: React.MouseEventHandler<any>;
onClick?: React.MouseEventHandler<HTMLButtonElement>;
children?: any;
}
@@ -54,9 +53,7 @@ export default class DropdownButton extends React.Component<DropdownButtonProps,
{children}
</Button>
<Dropdown {...dropdownProps}>
<Button type={type}>
<Icon type="down" />
</Button>
<Button type={type} icon="ellipsis" />
</Dropdown>
</ButtonGroup>
);

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