Compare commits

...

148 Commits
3.2.2 ... 3.3.3

Author SHA1 Message Date
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
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
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
愚指导
cdfbb6a3bd Bump 3.2.3 2018-03-02 20:12:06 +08:00
Sam Chen
fd147deb75 Update input group demo (#9482) 2018-03-02 15:26:05 +08:00
afc163
2fe64d429a Fix button group align issue in chrome, close #1019 2018-03-02 15:25:31 +08:00
Wei Zhu
5e7bff8b5e Update snapshot 2018-03-02 14:12:30 +08:00
byuanama
98f938798d Update index.en-US.md (#9479) 2018-03-02 13:18:06 +08:00
Wei Zhu
a4fea8f22c docs: Add Table pagination position to demo 2018-03-02 12:35:25 +08:00
afc163
7d3573d471 use more clear function name, close #9465 2018-03-02 12:06:33 +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
愚指导
2548a4bcf9 add polyfill for ie (#9444) 2018-03-02 11:49:56 +08:00
twobin
d816879e78 fix: add props of onPopupScroll in Select (#9475) 2018-03-02 10:15:01 +08:00
Chang Wang
c51f041ebc Update downloads badge to point to graph of downloads (#9477) 2018-03-02 10:13:48 +08:00
Karthik K
f24e41806d Minor punctuation correction (#9472) 2018-03-01 22:08:31 +08:00
Wei Zhu
1b3118e1dc Use week year
Fix #9463
2018-03-01 17:24:06 +08:00
Wei Zhu
9634bea391 Complicate with less 3
Fix #7850
2018-02-28 14:35:02 +08:00
afc163
8a6b76acde support less vars for tabs title font size 2018-02-28 11:07:26 +08:00
afc163
bea95bf77c Merge branch 'master' into feature-3.3.0 2018-02-28 10:56:45 +08:00
VTHINKXIE
23e7716137 fix(module:timeline): fix timeline head custom style error in chrome (#9429) 2018-02-27 20:44:28 +08:00
Wei Zhu
755b3e9043 Fix Select dropdown box-radius
refer 82092c15
2018-02-27 18:27:31 +08:00
Wei Zhu
aa9b7a4e4d Update snapshot 2018-02-27 18:07:39 +08:00
Wei Zhu
82092c154a Fix Select dropdown border 2018-02-27 17:21:33 +08:00
afc163
40e354c373 Merge branch 'master' into feature-3.3.0 2018-02-27 10:12:19 +08:00
Wei Zhu
5df04e6827 Fix lint 2018-02-26 17:24:55 +08:00
Wei Zhu
54242e968f Set Table filter dropdown menu popup container
Fix #9209
2018-02-26 16:45:26 +08:00
afc163
d4a5d2c188 site: fix home button align 2018-02-26 13:54:09 +08:00
afc163
e6a5c9be9e update 2018-02-25 13:20:52 +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
165 changed files with 1759 additions and 629 deletions

View File

@@ -63,6 +63,7 @@ if (process.env.RUN_ENV === 'DEMO') {
'eol-last': 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,
});

View File

@@ -1,3 +1,7 @@
<!--
两会期间,如果遇到官网无法访问,请使用代理或者访问国内镜像 http://ant-design.gitee.io
-->
<!--
IMPORTANT: Please use the following link to create a new issue:

View File

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

View File

@@ -15,6 +15,73 @@ timeline: true
---
## 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 multiple line display issue. [#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`
- 🐞 Fix props `onPopupScroll` ts define in `Select`. [#9475](https://github.com/ant-design/ant-design/pull/9475) [@twobin](https://github.com/twobin)
- 🐞 Fix `Table` filter dropdown menu popup container. [#9209](https://github.com/ant-design/ant-design/issues/9209)
- 🐞 Fix `Timeline` head custom style error in chrome. [#9429](https://github.com/ant-design/ant-design/pull/9429) [@vthinkxie](https://github.com/vthinkxie)
- 🐞 Fix `Select` dropdown border. [82092c1](https://github.com/ant-design/ant-design/commit/82092c154ac1fa7ff2f89e1adbdf0aaf22e3ff53)
- 🐞 Fix compatibility with less 3. [#7850](https://github.com/ant-design/ant-design/issues/7850)
- 🐞 Fix `DatePicker.WeekPicker` year. [#9463](https://github.com/ant-design/ant-design/issues/9463)
- 🐞 Fix `Button.Group` align issue in chrome. [#9457](https://github.com/ant-design/ant-design/issues/9457)
## 3.2.2
`2018-02-24`

View File

@@ -15,6 +15,72 @@ timeline: true
---
`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` 样式以修复标题多行展示问题。 [#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`
- 🐞 修复组件 `Select` 中的 `onPopupScroll` 属性的 ts 定义。 [#9475](https://github.com/ant-design/ant-design/pull/9475) [@twobin](https://github.com/twobin)
- 🐞 修复 `Table` 过滤条件下拉选择框的问题。 [#9209](https://github.com/ant-design/ant-design/issues/9209)
- 🐞 修复 `Timeline` 自定义头部样式在 Chrome 下的显示问题。 [#9429](https://github.com/ant-design/ant-design/pull/9429) [@vthinkxie](https://github.com/vthinkxie)
- 🐞 修复 `Select` 下拉窗口的边框显示问题。 [82092c1](https://github.com/ant-design/ant-design/commit/82092c154ac1fa7ff2f89e1adbdf0aaf22e3ff53)
- 🐞 修复对 less 3 的兼容性问题。 [#7850](https://github.com/ant-design/ant-design/issues/7850)
- 🐞 修复 `DatePicker.WeekPicker` 年份问题。 [#9463](https://github.com/ant-design/ant-design/issues/9463)
- 🐞 修复 `Button.Group` 在 Chrome 下的定位对齐问题。 [#9457](https://github.com/ant-design/ant-design/issues/9457)
## 3.2.2
`2018-02-24`

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) 的企业级开发框架
- 全链路开发和设计工具体系
## 支持环境

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)(中文)
@@ -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,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[]) => () => {

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 = {
visiable: true,
}
handleClose = () => {
this.setState({ visiable: false });
}
render() {
return (
<div>
{
this.state.visiable ? (
<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

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

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

View File

@@ -28,6 +28,24 @@ describe('Button', () => {
expect(wrapper2).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', () => {
const wrapper = mount(
<Button>Button Text</Button>

View File

@@ -95,13 +95,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 +113,10 @@ export default class Button extends React.Component<ButtonProps, any> {
}
}
componentDidUpdate() {
this.fixTwoCNChar();
}
componentWillUnmount() {
if (this.timeout) {
clearTimeout(this.timeout);
@@ -128,6 +126,23 @@ export default class Button extends React.Component<ButtonProps, any> {
}
}
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>) => {
// Add click effect
this.setState({ clicked: true });

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)`);
@@ -108,6 +111,7 @@
display: inline-block;
> .@{btnClassName} {
position: relative;
line-height: @btn-height-base - 2px;
&:hover,
&:focus,
@@ -124,10 +128,12 @@
// size
&-lg > .@{btnClassName} {
.button-size(@btn-height-lg; @btn-padding-lg; @btn-font-size-lg; @btn-border-radius-base);
line-height: @btn-height-lg - 2px;
}
&-sm > .@{btnClassName} {
.button-size(@btn-height-sm; @btn-padding-sm; @font-size-base; @btn-border-radius-sm);
line-height: @btn-height-sm - 2px;
> .@{iconfont-css-prefix} {
font-size: @font-size-base;
}
@@ -199,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

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

@@ -616,8 +616,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 +637,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 +713,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 +742,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 +766,7 @@ exports[`renders ./components/card/demo/tabs.md correctly 1`] = `
class="ant-card-body"
>
<p>
article content
app content
</p>
</div>
</div>

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

@@ -36,6 +36,8 @@ 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, {}> {
@@ -123,7 +125,7 @@ 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,
bordered = true, type, cover, actions, tabList, children, activeTabKey, defaultActiveTabKey, ...others,
} = this.props;
const classString = classNames(prefixCls, className, {
@@ -160,9 +162,21 @@ export default class Card extends React.Component<CardProps, {}> {
</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

@@ -6,6 +6,7 @@ exports[`renders ./components/carousel/demo/autoplay.md correctly 1`] = `
>
<div
class="slick-initialized slick-slider"
dir="ltr"
>
<div
class="slick-list"
@@ -16,13 +17,14 @@ exports[`renders ./components/carousel/demo/autoplay.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="-1"
tabindex="-1"
>
<h3>
4
</h3>
</div>
<div
class="slick-slide slick-active slick-cloned"
class="slick-slide slick-active slick-cloned slick-current"
data-index="0"
style="outline:none"
tabindex="-1"
@@ -64,6 +66,7 @@ exports[`renders ./components/carousel/demo/autoplay.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="4"
tabindex="-1"
>
<h3>
1
@@ -72,6 +75,7 @@ exports[`renders ./components/carousel/demo/autoplay.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="5"
tabindex="-1"
>
<h3>
2
@@ -80,6 +84,7 @@ exports[`renders ./components/carousel/demo/autoplay.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="6"
tabindex="-1"
>
<h3>
3
@@ -88,6 +93,7 @@ exports[`renders ./components/carousel/demo/autoplay.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="7"
tabindex="-1"
>
<h3>
4
@@ -105,6 +111,7 @@ exports[`renders ./components/carousel/demo/basic.md correctly 1`] = `
>
<div
class="slick-initialized slick-slider"
dir="ltr"
>
<div
class="slick-list"
@@ -115,13 +122,14 @@ exports[`renders ./components/carousel/demo/basic.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="-1"
tabindex="-1"
>
<h3>
4
</h3>
</div>
<div
class="slick-slide slick-active slick-cloned"
class="slick-slide slick-active slick-cloned slick-current"
data-index="0"
style="outline:none"
tabindex="-1"
@@ -163,6 +171,7 @@ exports[`renders ./components/carousel/demo/basic.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="4"
tabindex="-1"
>
<h3>
1
@@ -171,6 +180,7 @@ exports[`renders ./components/carousel/demo/basic.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="5"
tabindex="-1"
>
<h3>
2
@@ -179,6 +189,7 @@ exports[`renders ./components/carousel/demo/basic.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="6"
tabindex="-1"
>
<h3>
3
@@ -187,6 +198,7 @@ exports[`renders ./components/carousel/demo/basic.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="7"
tabindex="-1"
>
<h3>
4
@@ -204,6 +216,7 @@ exports[`renders ./components/carousel/demo/fade.md correctly 1`] = `
>
<div
class="slick-initialized slick-slider"
dir="ltr"
>
<div
class="slick-list"
@@ -212,9 +225,9 @@ exports[`renders ./components/carousel/demo/fade.md correctly 1`] = `
class="slick-track"
>
<div
class="slick-slide slick-active slick-cloned"
class="slick-slide slick-active slick-cloned 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;position:relative;left:0;opacity:1;transition:opacity 500ms ease, visibility 500ms ease;-webkit-transition:opacity 500ms ease, visibility 500ms ease"
tabindex="-1"
>
<h3>
@@ -224,7 +237,7 @@ exports[`renders ./components/carousel/demo/fade.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="1"
style="outline:none;position:relative;left:0;opacity:0;transition:opacity 500ms ease;-webkit-transition:opacity 500ms ease"
style="outline:none;position:relative;left:0;opacity:0;transition:opacity 500ms ease, visibility 500ms ease;-webkit-transition:opacity 500ms ease, visibility 500ms ease"
tabindex="-1"
>
<h3>
@@ -234,7 +247,7 @@ exports[`renders ./components/carousel/demo/fade.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="2"
style="outline:none;position:relative;left:0;opacity:0;transition:opacity 500ms ease;-webkit-transition:opacity 500ms ease"
style="outline:none;position:relative;left:0;opacity:0;transition:opacity 500ms ease, visibility 500ms ease;-webkit-transition:opacity 500ms ease, visibility 500ms ease"
tabindex="-1"
>
<h3>
@@ -244,7 +257,7 @@ exports[`renders ./components/carousel/demo/fade.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="3"
style="outline:none;position:relative;left:0;opacity:0;transition:opacity 500ms ease;-webkit-transition:opacity 500ms ease"
style="outline:none;position:relative;left:0;opacity:0;transition:opacity 500ms ease, visibility 500ms ease;-webkit-transition:opacity 500ms ease, visibility 500ms ease"
tabindex="-1"
>
<h3>
@@ -263,6 +276,7 @@ exports[`renders ./components/carousel/demo/vertical.md correctly 1`] = `
>
<div
class="slick-initialized slick-slider slick-vertical"
dir="ltr"
>
<div
class="slick-list"
@@ -273,13 +287,14 @@ exports[`renders ./components/carousel/demo/vertical.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="-1"
tabindex="-1"
>
<h3>
4
</h3>
</div>
<div
class="slick-slide slick-active slick-cloned"
class="slick-slide slick-active slick-cloned slick-current"
data-index="0"
style="outline:none"
tabindex="-1"
@@ -321,6 +336,7 @@ exports[`renders ./components/carousel/demo/vertical.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="4"
tabindex="-1"
>
<h3>
1
@@ -329,6 +345,7 @@ exports[`renders ./components/carousel/demo/vertical.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="5"
tabindex="-1"
>
<h3>
2
@@ -337,6 +354,7 @@ exports[`renders ./components/carousel/demo/vertical.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="6"
tabindex="-1"
>
<h3>
3
@@ -345,6 +363,7 @@ exports[`renders ./components/carousel/demo/vertical.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="7"
tabindex="-1"
>
<h3>
4

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

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

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

@@ -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: MouseEvent;
}
export default class Checkbox extends React.Component<CheckboxProps, {}> {
static Group: typeof CheckboxGroup;
static defaultProps = {

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

@@ -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)) || '';
@@ -11,7 +12,7 @@ function formatValue(value: moment.Moment | null, format: string): string {
export default class WeekPicker extends React.Component<any, any> {
static defaultProps = {
format: 'YYYY-wo',
format: 'gggg-wo',
allowClear: true,
};
@@ -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',

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

@@ -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,6 +47,7 @@ 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) | - |

View File

@@ -14,7 +14,7 @@ const MonthPicker = wrapPicker(createPicker(MonthCalendar), 'YYYY-MM');
Object.assign(DatePicker, {
RangePicker: wrapPicker(RangePicker),
MonthPicker,
WeekPicker: wrapPicker(WeekPicker, 'YYYY-wo'),
WeekPicker: wrapPicker(WeekPicker, 'gggg-wo'),
});
export default DatePicker as DatePickerDecorator;

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

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

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

@@ -29,6 +29,30 @@ exports[`renders ./components/divider/demo/horizontal.md correctly 1`] = `
<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-left"
>
<span
class="ant-divider-inner-text"
>
With 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"
>
With 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>
`;

View File

@@ -25,6 +25,10 @@ ReactDOM.render(
<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 dashed />
<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="left">With 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">With 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 | this is optional, if not set it will have the text in the center | enum: `left` `right` | `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

@@ -44,17 +44,81 @@
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 {
border-top: 0;
&:before,

View File

@@ -56,6 +56,8 @@ export default class FormItem extends React.Component<FormItemProps, any> {
context: FormItemContext;
state = { helpShow: false };
componentDidMount() {
warning(
this.getControls(this.props.children, true).length <= 1,
@@ -89,7 +91,7 @@ export default class FormItem extends React.Component<FormItemProps, any> {
const child = childrenArray[i] as React.ReactElement<any>;
if (child.type &&
(child.type as any === FormItem || (child.type as any).displayName === 'FormItem')) {
(child.type as any === FormItem || (child.type as any).displayName === 'FormItem')) {
continue;
}
if (!child.props) {
@@ -126,6 +128,10 @@ export default class FormItem extends React.Component<FormItemProps, any> {
return this.getChildProp(FIELD_DATA_PROP);
}
onHelpAnimEnd = (_key: string, helpShow: boolean) => {
this.setState({ helpShow });
}
renderHelp() {
const prefixCls = this.props.prefixCls;
const help = this.getHelpMsg();
@@ -135,7 +141,13 @@ export default class FormItem extends React.Component<FormItemProps, any> {
</div>
) : null;
return (
<Animate transitionName="show-help" component="" transitionAppear key="help">
<Animate
transitionName="show-help"
component=""
transitionAppear
key="help"
onEnd={this.onHelpAnimEnd}
>
{children}
</Animate>
);
@@ -298,7 +310,7 @@ export default class FormItem extends React.Component<FormItemProps, any> {
const style = props.style;
const itemClassName = {
[`${prefixCls}-item`]: true,
[`${prefixCls}-item-with-help`]: !!this.getHelpMsg(),
[`${prefixCls}-item-with-help`]: !!this.getHelpMsg() || this.state.helpShow,
[`${prefixCls}-item-no-colon`]: !props.colon,
[`${props.className}`]: !!props.className,
};

View File

@@ -2503,7 +2503,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
/>
<div
class="ant-slider-track"
style="visibility:visible;left:0%;width:0%"
style="left:0%;width:0%"
/>
<div
class="ant-slider-step"

View File

@@ -107,8 +107,8 @@ ReactDOM.render(
display: flex;
}
.ant-advanced-search-form .ant-form-item-label {
overflow: visible;
.ant-advanced-search-form .ant-form-item-control-wrapper {
flex: 1;
}
````

View File

@@ -18,41 +18,43 @@ import { Button, Modal, Form, Input, Radio } from 'antd';
const FormItem = Form.Item;
const CollectionCreateForm = Form.create()(
(props) => {
const { visible, onCancel, onCreate, form } = props;
const { getFieldDecorator } = form;
return (
<Modal
visible={visible}
title="Create a new collection"
okText="Create"
onCancel={onCancel}
onOk={onCreate}
>
<Form layout="vertical">
<FormItem label="Title">
{getFieldDecorator('title', {
rules: [{ required: true, message: 'Please input the title of collection!' }],
})(
<Input />
)}
</FormItem>
<FormItem label="Description">
{getFieldDecorator('description')(<Input type="textarea" />)}
</FormItem>
<FormItem className="collection-create-form_last-form-item">
{getFieldDecorator('modifier', {
initialValue: 'public',
})(
<Radio.Group>
<Radio value="public">Public</Radio>
<Radio value="private">Private</Radio>
</Radio.Group>
)}
</FormItem>
</Form>
</Modal>
);
class extends React.Component {
render() {
const { visible, onCancel, onCreate, form } = this.props;
const { getFieldDecorator } = form;
return (
<Modal
visible={visible}
title="Create a new collection"
okText="Create"
onCancel={onCancel}
onOk={onCreate}
>
<Form layout="vertical">
<FormItem label="Title">
{getFieldDecorator('title', {
rules: [{ required: true, message: 'Please input the title of collection!' }],
})(
<Input />
)}
</FormItem>
<FormItem label="Description">
{getFieldDecorator('description')(<Input type="textarea" />)}
</FormItem>
<FormItem className="collection-create-form_last-form-item">
{getFieldDecorator('modifier', {
initialValue: 'public',
})(
<Radio.Group>
<Radio value="public">Public</Radio>
<Radio value="private">Private</Radio>
</Radio.Group>
)}
</FormItem>
</Form>
</Modal>
);
}
}
);
@@ -67,7 +69,7 @@ class CollectionsPage extends React.Component {
this.setState({ visible: false });
}
handleCreate = () => {
const form = this.form;
const form = this.formRef.props.form;
form.validateFields((err, values) => {
if (err) {
return;
@@ -78,15 +80,15 @@ class CollectionsPage extends React.Component {
this.setState({ visible: false });
});
}
saveFormRef = (form) => {
this.form = form;
saveFormRef = (formRef) => {
this.formRef = formRef;
}
render() {
return (
<div>
<Button type="primary" onClick={this.showModal}>New Collection</Button>
<CollectionCreateForm
ref={this.saveFormRef}
wrappedComponentRef={this.saveFormRef}
visible={this.state.visible}
onCancel={this.handleCancel}
onCreate={this.handleCreate}

View File

@@ -60,7 +60,7 @@ class RegistrationForm extends React.Component {
const value = e.target.value;
this.setState({ confirmDirty: this.state.confirmDirty || !!value });
}
checkPassword = (rule, value, callback) => {
compareToFirstPassword = (rule, value, callback) => {
const form = this.props.form;
if (value && value !== form.getFieldValue('password')) {
callback('Two passwords that you enter is inconsistent!');
@@ -68,14 +68,13 @@ class RegistrationForm extends React.Component {
callback();
}
}
checkConfirm = (rule, value, callback) => {
validateToNextPassword = (rule, value, callback) => {
const form = this.props.form;
if (value && this.state.confirmDirty) {
form.validateFields(['confirm'], { force: true });
}
callback();
}
handleWebsiteChange = (value) => {
let autoCompleteResult;
if (!value) {
@@ -85,7 +84,6 @@ class RegistrationForm extends React.Component {
}
this.setState({ autoCompleteResult });
}
render() {
const { getFieldDecorator } = this.props.form;
const { autoCompleteResult } = this.state;
@@ -149,7 +147,7 @@ class RegistrationForm extends React.Component {
rules: [{
required: true, message: 'Please input your password!',
}, {
validator: this.checkConfirm,
validator: this.validateToNextPassword,
}],
})(
<Input type="password" />
@@ -163,7 +161,7 @@ class RegistrationForm extends React.Component {
rules: [{
required: true, message: 'Please confirm your password!',
}, {
validator: this.checkPassword,
validator: this.compareToFirstPassword,
}],
})(
<Input type="password" onBlur={this.handleConfirmBlur} />

View File

@@ -73,7 +73,6 @@ input[type="checkbox"] {
.reset-component;
margin-bottom: @form-item-margin-bottom;
vertical-align: top;
transition: margin .15s steps(1);
// nested FormItem
&-control > &:last-child,
@@ -93,7 +92,6 @@ input[type="checkbox"] {
&-with-help {
margin-bottom: @form-item-margin-bottom - @font-size-base * @line-height-base - @form-help-margin-top;
transition: none;
}
&-label {
@@ -375,7 +373,7 @@ form {
margin-bottom: 24px;
}
> div {
> .@{form-prefix-cls}-item-control-wrapper, > .@{form-prefix-cls}-item-label {
display: inline-block;
vertical-align: middle;
}

View File

@@ -480,7 +480,7 @@ exports[`renders ./components/grid/demo/playground.md correctly 1`] = `
/>
<div
class="ant-slider-track"
style="visibility:visible;left:0%;width:20%"
style="left:0%;width:20%"
/>
<div
class="ant-slider-step"
@@ -578,7 +578,7 @@ exports[`renders ./components/grid/demo/playground.md correctly 1`] = `
/>
<div
class="ant-slider-track"
style="visibility:visible;left:0%;width:40%"
style="left:0%;width:40%"
/>
<div
class="ant-slider-step"

View File

@@ -13,8 +13,7 @@ export interface ColSize {
pull?: number;
}
export interface ColProps {
className?: string;
export interface ColProps extends React.HTMLAttributes<HTMLDivElement> {
span?: number;
order?: number;
offset?: number;
@@ -27,7 +26,6 @@ export interface ColProps {
xl?: number | ColSize;
xxl?: number | ColSize;
prefixCls?: string;
style?: React.CSSProperties;
}
export default class Col extends React.Component<ColProps, {}> {

View File

@@ -31,13 +31,11 @@ export type BreakpointMap = {
xxl?: string
};
export interface RowProps {
className?: string;
export interface RowProps extends React.HTMLAttributes<HTMLDivElement> {
gutter?: number | BreakpointMap;
type?: 'flex';
align?: 'top' | 'middle' | 'bottom';
justify?: 'start' | 'end' | 'center' | 'space-around' | 'space-between';
style?: React.CSSProperties;
prefixCls?: string;
}

View File

@@ -0,0 +1,4 @@
import InputNumber from '..';
import focusTest from '../../../tests/shared/focusTest';
focusTest(InputNumber);

View File

@@ -39,21 +39,38 @@ export default class Search extends React.Component<SearchProps, any> {
this.input = node;
}
getButtonOrIcon() {
const { enterButton, prefixCls, size } = this.props;
if (!enterButton) {
return <Icon className={`${prefixCls}-icon`} type="search" key="searchIcon" />;
}
const enterButtonAsElement = enterButton as React.ReactElement<any>;
if (enterButtonAsElement.type === Button || enterButtonAsElement.type === 'button') {
return React.cloneElement(enterButtonAsElement, enterButtonAsElement.type === Button ? {
className: `${prefixCls}-button`,
size,
onClick: this.onSearch,
} : {
onClick: this.onSearch,
});
}
return (
<Button
className={`${prefixCls}-button`}
type="primary"
size={size}
onClick={this.onSearch}
key="enterButton"
>
{enterButton === true ? <Icon type="search" /> : enterButton}
</Button>
);
}
render() {
const { className, prefixCls, inputPrefixCls, size, enterButton, suffix, ...others } = this.props;
const { className, prefixCls, inputPrefixCls, size, suffix, enterButton, ...others } = this.props;
delete (others as any).onSearch;
const buttonOrIcon = enterButton
? (
<Button
className={`${prefixCls}-button`}
type="primary"
size={size}
onClick={this.onSearch}
key="enterButton"
>
{enterButton === true ? <Icon type="search" /> : enterButton}
</Button>
) : <Icon className={`${prefixCls}-icon`} type="search" key="searchIcon" />;
const buttonOrIcon = this.getButtonOrIcon();
const searchSuffix = suffix ? [suffix, buttonOrIcon] : buttonOrIcon;
const inputClassName = classNames(prefixCls, className, {
[`${prefixCls}-enter-button`]: !!enterButton,

View File

@@ -1,6 +1,23 @@
import React from 'react';
import { mount } from 'enzyme';
import Search from '../Search';
import Button from '../../button';
import focusTest from '../../../tests/shared/focusTest';
describe('Input.Search', () => {
focusTest(Search);
it('should support custom button', () => {
const wrapper = mount(
<Search enterButton={<button>ok</button>} />
);
expect(wrapper.render()).toMatchSnapshot();
});
it('should support custom Button', () => {
const wrapper = mount(
<Search enterButton={<Button>ok</Button>} />
);
expect(wrapper.render()).toMatchSnapshot();
});
});

View File

@@ -0,0 +1,42 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Input.Search should support custom Button 1`] = `
<span
class="ant-input-search ant-input-search-enter-button ant-input-affix-wrapper"
>
<input
class="ant-input"
type="text"
/>
<span
class="ant-input-suffix"
>
<button
class="ant-btn ant-input-search-button"
type="button"
>
<span>
ok
</span>
</button>
</span>
</span>
`;
exports[`Input.Search should support custom button 1`] = `
<span
class="ant-input-search ant-input-search-enter-button ant-input-affix-wrapper"
>
<input
class="ant-input"
type="text"
/>
<span
class="ant-input-suffix"
>
<button>
ok
</button>
</span>
</span>
`;

View File

@@ -177,7 +177,7 @@ exports[`renders ./components/input/demo/group.md correctly 1`] = `
class="ant-input-group ant-input-group-lg"
>
<div
class="ant-col-4"
class="ant-col-5"
>
<input
class="ant-input"

View File

@@ -63,7 +63,7 @@ class CompactDemo extends React.Component {
return (
<div>
<InputGroup size="large">
<Col span={4}>
<Col span={5}>
<Input defaultValue="0571" />
</Col>
<Col span={8}>

View File

@@ -327,6 +327,9 @@
z-index: 2;
line-height: 0;
color: @input-color;
:not(.anticon) {
line-height: @line-height-base;
}
}
.@{inputClass}-prefix {

View File

@@ -31,10 +31,8 @@ const dimensionMap = {
export type CollapseType = 'clickTrigger' | 'responsive';
export interface SiderProps {
style?: React.CSSProperties;
export interface SiderProps extends React.HTMLAttributes<HTMLDivElement> {
prefixCls?: string;
className?: string;
collapsible?: boolean;
collapsed?: boolean;
defaultCollapsed?: boolean;

View File

@@ -27,7 +27,7 @@ The first level navigation is inclined left near a logo, and the secondary menu
## Visualization rules
Style of a navigation should conform to the its level.
Style of a navigation should conform to its level.
- **Emphasis by colorblock**
@@ -43,7 +43,7 @@ The first level navigation is inclined left near a logo, and the secondary menu
- **Enlarge the size of the font**
`12px``14px` is a standard font size of navigations`14px` is used for the first and the second level of the navigation. You can choose a approprigate font size in terms of the level of your navigation.
`12px``14px` is a standard font size of navigations`14px` is used for the first and the second level of the navigation. You can choose a appropriate font size in terms of the level of your navigation.
## Component Overview

View File

@@ -3,10 +3,8 @@ import PropTypes from 'prop-types';
import classNames from 'classnames';
import { SiderProps } from './Sider';
export interface BasicProps {
style?: React.CSSProperties;
export interface BasicProps extends React.HTMLAttributes<HTMLDivElement> {
prefixCls?: string;
className?: string;
hasSider?: boolean;
}

View File

@@ -1396,7 +1396,6 @@ exports[`renders ./components/list/demo/vertical.md correctly 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Previous Page"
>
<a
@@ -1415,7 +1414,6 @@ exports[`renders ./components/list/demo/vertical.md correctly 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-next"
tabindex="0"
title="Next Page"
>
<a

View File

@@ -66,7 +66,6 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Previous Page"
>
<a
@@ -1554,7 +1553,6 @@ exports[`renders ./components/locale-provider/demo/basic.md correctly 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Previous Page"
>
<a

View File

@@ -2394,7 +2394,6 @@ exports[`Locale Provider should display the text as ar 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="الصفحة السابقة"
>
<a
@@ -5703,6 +5702,7 @@ exports[`Locale Provider should display the text as ar 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -5789,6 +5789,7 @@ exports[`Locale Provider should display the text as ar 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -6990,7 +6991,6 @@ exports[`Locale Provider should display the text as bg 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Предишна страница"
>
<a
@@ -10299,6 +10299,7 @@ exports[`Locale Provider should display the text as bg 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -10385,6 +10386,7 @@ exports[`Locale Provider should display the text as bg 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -11586,7 +11588,6 @@ exports[`Locale Provider should display the text as ca 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Pàgina prèvia"
>
<a
@@ -14895,6 +14896,7 @@ exports[`Locale Provider should display the text as ca 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -14981,6 +14983,7 @@ exports[`Locale Provider should display the text as ca 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -16182,7 +16185,6 @@ exports[`Locale Provider should display the text as cs 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Předchozí strana"
>
<a
@@ -19491,6 +19493,7 @@ exports[`Locale Provider should display the text as cs 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -19577,6 +19580,7 @@ exports[`Locale Provider should display the text as cs 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -20778,7 +20782,6 @@ exports[`Locale Provider should display the text as de 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Vorherige Seite"
>
<a
@@ -24087,6 +24090,7 @@ exports[`Locale Provider should display the text as de 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -24173,6 +24177,7 @@ exports[`Locale Provider should display the text as de 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -25374,7 +25379,6 @@ exports[`Locale Provider should display the text as el 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Προηγούμενη Σελίδα"
>
<a
@@ -28683,6 +28687,7 @@ exports[`Locale Provider should display the text as el 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -28769,6 +28774,7 @@ exports[`Locale Provider should display the text as el 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -29970,7 +29976,6 @@ exports[`Locale Provider should display the text as en 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Previous Page"
>
<a
@@ -33279,6 +33284,7 @@ exports[`Locale Provider should display the text as en 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -33365,6 +33371,7 @@ exports[`Locale Provider should display the text as en 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -34566,7 +34573,6 @@ exports[`Locale Provider should display the text as en-gb 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Previous Page"
>
<a
@@ -37875,6 +37881,7 @@ exports[`Locale Provider should display the text as en-gb 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -37961,6 +37968,7 @@ exports[`Locale Provider should display the text as en-gb 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -39162,7 +39170,6 @@ exports[`Locale Provider should display the text as es 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Página anterior"
>
<a
@@ -42471,6 +42478,7 @@ exports[`Locale Provider should display the text as es 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -42557,6 +42565,7 @@ exports[`Locale Provider should display the text as es 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -43758,7 +43767,6 @@ exports[`Locale Provider should display the text as et 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Eelmine leht"
>
<a
@@ -47067,6 +47075,7 @@ exports[`Locale Provider should display the text as et 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -47153,6 +47162,7 @@ exports[`Locale Provider should display the text as et 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -48354,7 +48364,6 @@ exports[`Locale Provider should display the text as fa 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="صفحه قبلی"
>
<a
@@ -51663,6 +51672,7 @@ exports[`Locale Provider should display the text as fa 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -51749,6 +51759,7 @@ exports[`Locale Provider should display the text as fa 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -52950,7 +52961,6 @@ exports[`Locale Provider should display the text as fi 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Edellinen sivu"
>
<a
@@ -56259,6 +56269,7 @@ exports[`Locale Provider should display the text as fi 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -56345,6 +56356,7 @@ exports[`Locale Provider should display the text as fi 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -57546,7 +57558,6 @@ exports[`Locale Provider should display the text as fr 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Page précédente"
>
<a
@@ -60855,6 +60866,7 @@ exports[`Locale Provider should display the text as fr 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -60941,6 +60953,7 @@ exports[`Locale Provider should display the text as fr 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -62142,7 +62155,6 @@ exports[`Locale Provider should display the text as fr 2`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Page précédente"
>
<a
@@ -65451,6 +65463,7 @@ exports[`Locale Provider should display the text as fr 2`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -65537,6 +65550,7 @@ exports[`Locale Provider should display the text as fr 2`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -66738,7 +66752,6 @@ exports[`Locale Provider should display the text as is 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Fyrri síða"
>
<a
@@ -70047,6 +70060,7 @@ exports[`Locale Provider should display the text as is 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -70133,6 +70147,7 @@ exports[`Locale Provider should display the text as is 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -71334,7 +71349,6 @@ exports[`Locale Provider should display the text as it 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Pagina precedente"
>
<a
@@ -74643,6 +74657,7 @@ exports[`Locale Provider should display the text as it 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -74729,6 +74744,7 @@ exports[`Locale Provider should display the text as it 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -75930,7 +75946,6 @@ exports[`Locale Provider should display the text as ja 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="前のページ"
>
<a
@@ -79239,6 +79254,7 @@ exports[`Locale Provider should display the text as ja 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -79325,6 +79341,7 @@ exports[`Locale Provider should display the text as ja 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -80526,7 +80543,6 @@ exports[`Locale Provider should display the text as ko 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="이전 페이지"
>
<a
@@ -83835,6 +83851,7 @@ exports[`Locale Provider should display the text as ko 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -83921,6 +83938,7 @@ exports[`Locale Provider should display the text as ko 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -85122,7 +85140,6 @@ exports[`Locale Provider should display the text as ku-iq 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Rûpelê Pêş"
>
<a
@@ -88431,6 +88448,7 @@ exports[`Locale Provider should display the text as ku-iq 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -88517,6 +88535,7 @@ exports[`Locale Provider should display the text as ku-iq 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -89718,7 +89737,6 @@ exports[`Locale Provider should display the text as nb 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Forrige side"
>
<a
@@ -93027,6 +93045,7 @@ exports[`Locale Provider should display the text as nb 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -93113,6 +93132,7 @@ exports[`Locale Provider should display the text as nb 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -94314,7 +94334,6 @@ exports[`Locale Provider should display the text as nl 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Vorige pagina"
>
<a
@@ -97623,6 +97642,7 @@ exports[`Locale Provider should display the text as nl 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -97709,6 +97729,7 @@ exports[`Locale Provider should display the text as nl 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -98910,7 +98931,6 @@ exports[`Locale Provider should display the text as nl-be 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Vorige pagina"
>
<a
@@ -102219,6 +102239,7 @@ exports[`Locale Provider should display the text as nl-be 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -102305,6 +102326,7 @@ exports[`Locale Provider should display the text as nl-be 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -103506,7 +103528,6 @@ exports[`Locale Provider should display the text as pl 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Poprzednia strona"
>
<a
@@ -106815,6 +106836,7 @@ exports[`Locale Provider should display the text as pl 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -106901,6 +106923,7 @@ exports[`Locale Provider should display the text as pl 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -108102,7 +108125,6 @@ exports[`Locale Provider should display the text as pt 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Página Anterior"
>
<a
@@ -111411,6 +111433,7 @@ exports[`Locale Provider should display the text as pt 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -111497,6 +111520,7 @@ exports[`Locale Provider should display the text as pt 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -112698,7 +112722,6 @@ exports[`Locale Provider should display the text as pt-br 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Página anterior"
>
<a
@@ -116007,6 +116030,7 @@ exports[`Locale Provider should display the text as pt-br 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -116093,6 +116117,7 @@ exports[`Locale Provider should display the text as pt-br 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -117294,7 +117319,6 @@ exports[`Locale Provider should display the text as ru 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Назад"
>
<a
@@ -120603,6 +120627,7 @@ exports[`Locale Provider should display the text as ru 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -120689,6 +120714,7 @@ exports[`Locale Provider should display the text as ru 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -121890,7 +121916,6 @@ exports[`Locale Provider should display the text as sk 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Predchádzajúca strana"
>
<a
@@ -125199,6 +125224,7 @@ exports[`Locale Provider should display the text as sk 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -125285,6 +125311,7 @@ exports[`Locale Provider should display the text as sk 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -126486,7 +126513,6 @@ exports[`Locale Provider should display the text as sr 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Prethodna strana"
>
<a
@@ -129795,6 +129821,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -129881,6 +129908,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -131082,7 +131110,6 @@ exports[`Locale Provider should display the text as sv 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Föreg sida"
>
<a
@@ -134391,6 +134418,7 @@ exports[`Locale Provider should display the text as sv 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -134477,6 +134505,7 @@ exports[`Locale Provider should display the text as sv 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -135678,7 +135707,6 @@ exports[`Locale Provider should display the text as th 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="หน้าก่อนหน้า"
>
<a
@@ -138987,6 +139015,7 @@ exports[`Locale Provider should display the text as th 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -139073,6 +139102,7 @@ exports[`Locale Provider should display the text as th 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -140274,8 +140304,7 @@ exports[`Locale Provider should display the text as tr 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Previous Page"
title="Önceki Sayfa"
>
<a
class="ant-pagination-item-link"
@@ -140330,7 +140359,7 @@ exports[`Locale Provider should display the text as tr 1`] = `
aria-disabled="false"
class=" ant-pagination-next"
tabindex="0"
title="Next Page"
title="Sonraki Sayfa"
>
<a
class="ant-pagination-item-link"
@@ -140357,9 +140386,9 @@ exports[`Locale Provider should display the text as tr 1`] = `
<div
class="ant-select-selection-selected-value"
style="display: block; opacity: 1;"
title="10 / page"
title="10 / sayfa"
>
10 / page
10 / sayfa
</div>
</div>
<span
@@ -140459,7 +140488,7 @@ exports[`Locale Provider should display the text as tr 1`] = `
<a
class="ant-calendar-clear-btn"
role="button"
title="Clear"
title="Temizle"
/>
</div>
<div
@@ -140474,12 +140503,12 @@ exports[`Locale Provider should display the text as tr 1`] = `
<a
class="ant-calendar-prev-year-btn"
role="button"
title="Last year (Control + left)"
title="Önceki Yıl (Control + Sol)"
/>
<a
class="ant-calendar-prev-month-btn"
role="button"
title="Previous month (PageUp)"
title="Önceki Ay (PageUp)"
/>
<span
class="ant-calendar-my-select"
@@ -140487,25 +140516,25 @@ exports[`Locale Provider should display the text as tr 1`] = `
<a
class="ant-calendar-month-select"
role="button"
title="Choose a month"
title="Ay Seç"
>
Eyl
</a>
<a
class="ant-calendar-year-select"
role="button"
title="Choose a year"
title="Yıl Seç"
>
2017
</a>
</span>
<a
class="ant-calendar-next-month-btn"
title="Next month (PageDown)"
title="Sonraki Ay (PageDown)"
/>
<a
class="ant-calendar-next-year-btn"
title="Next year (Control + right)"
title="Sonraki Yıl (Control + Sağ)"
/>
</div>
</div>
@@ -141193,7 +141222,7 @@ exports[`Locale Provider should display the text as tr 1`] = `
role="button"
title="18 Eylül 2017"
>
Today
Bugün
</a>
</span>
</div>
@@ -142059,12 +142088,12 @@ exports[`Locale Provider should display the text as tr 1`] = `
<a
class="ant-calendar-prev-year-btn"
role="button"
title="Last year (Control + left)"
title="Önceki Yıl (Control + Sol)"
/>
<a
class="ant-calendar-prev-month-btn"
role="button"
title="Previous month (PageUp)"
title="Önceki Ay (PageUp)"
/>
<span
class="ant-calendar-my-select"
@@ -142072,14 +142101,14 @@ exports[`Locale Provider should display the text as tr 1`] = `
<a
class="ant-calendar-month-select"
role="button"
title="Choose a month"
title="Ay Seç"
>
Eyl
</a>
<a
class="ant-calendar-year-select"
role="button"
title="Choose a year"
title="Yıl Seç"
>
2017
</a>
@@ -142797,25 +142826,25 @@ exports[`Locale Provider should display the text as tr 1`] = `
<a
class="ant-calendar-month-select"
role="button"
title="Choose a month"
title="Ay Seç"
>
Eki
</a>
<a
class="ant-calendar-year-select"
role="button"
title="Choose a year"
title="Yıl Seç"
>
2017
</a>
</span>
<a
class="ant-calendar-next-month-btn"
title="Next month (PageDown)"
title="Sonraki Ay (PageDown)"
/>
<a
class="ant-calendar-next-year-btn"
title="Next year (Control + right)"
title="Sonraki Yıl (Control + Sağ)"
/>
</div>
</div>
@@ -143583,6 +143612,7 @@ exports[`Locale Provider should display the text as tr 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -143669,6 +143699,7 @@ exports[`Locale Provider should display the text as tr 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -143806,7 +143837,7 @@ exports[`Locale Provider should display the text as tr 1`] = `
/>
</span>
<span>
Month
Ay
</span>
</label>
<label
@@ -143825,7 +143856,7 @@ exports[`Locale Provider should display the text as tr 1`] = `
/>
</span>
<span>
Year
Yıl
</span>
</label>
</div>
@@ -144870,7 +144901,6 @@ exports[`Locale Provider should display the text as uk 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Попередня сторінка"
>
<a
@@ -148179,6 +148209,7 @@ exports[`Locale Provider should display the text as uk 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -148265,6 +148296,7 @@ exports[`Locale Provider should display the text as uk 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -149466,7 +149498,6 @@ exports[`Locale Provider should display the text as vi 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Trang Trước"
>
<a
@@ -152775,6 +152806,7 @@ exports[`Locale Provider should display the text as vi 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -152861,6 +152893,7 @@ exports[`Locale Provider should display the text as vi 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -154062,7 +154095,6 @@ exports[`Locale Provider should display the text as zh-cn 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="上一页"
>
<a
@@ -157371,6 +157403,7 @@ exports[`Locale Provider should display the text as zh-cn 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -157457,6 +157490,7 @@ exports[`Locale Provider should display the text as zh-cn 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -158658,7 +158692,6 @@ exports[`Locale Provider should display the text as zh-tw 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="上一頁"
>
<a
@@ -161967,6 +162000,7 @@ exports[`Locale Provider should display the text as zh-tw 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"
@@ -162053,6 +162087,7 @@ exports[`Locale Provider should display the text as zh-tw 1`] = `
<input
class="ant-checkbox-input"
type="checkbox"
value="on"
/>
<span
class="ant-checkbox-inner"

View File

@@ -87,7 +87,7 @@ const App = () => (
describe('Locale Provider', () => {
beforeAll(() => {
MockDate.set(moment('2017-09-18T03:30:07.795Z').valueOf() + (new Date().getTimezoneOffset() * 60 * 1000));
MockDate.set(moment('2017-09-18T03:30:07.795'));
});
afterAll(() => {

View File

@@ -1,4 +1,4 @@
import Pagination from 'rc-pagination/lib/locale/en_US';
import Pagination from 'rc-pagination/lib/locale/tr_TR';
import DatePicker from '../date-picker/locale/tr_TR';
import TimePicker from '../time-picker/locale/tr_TR';
import Calendar from '../calendar/locale/tr_TR';

View File

@@ -29,9 +29,15 @@ class PopoverContainer extends React.Component {
getSuggestionContainer = () => {
return this.popover.getPopupDomNode();
}
visibleChange = (visible) => {
if (visible && this.mention) {
this.mention.focus();
}
}
render() {
const mention = (
<Mention
ref={ele => this.mention = ele}
style={{ width: '100%' }}
onChange={onChange}
defaultValue={toContentState('@afc163')}
@@ -41,7 +47,13 @@ class PopoverContainer extends React.Component {
/>
);
return (
<Popover trigger="click" content={mention} title="Title" ref={popover => this.popover = popover}>
<Popover
trigger="click"
content={mention}
title="Title"
ref={popover => this.popover = popover}
onVisibleChange={this.visibleChange}
>
<Button type="primary">Click Me</Button>
</Popover>
);

View File

@@ -4,7 +4,7 @@ type: Data Entry
title: Mention
---
Mention component
Mention component.
## When To Use

View File

@@ -111,7 +111,7 @@ export default class Mention extends React.Component<MentionProps, MentionState>
}
}
focus = () => {
this.mentionEle._editor.focus();
this.mentionEle._editor.focusEditor();
}
mentionRef = (ele: any) => {
this.mentionEle = ele;

View File

@@ -18,13 +18,17 @@ class MenuItem extends React.Component<any, any> {
render() {
const { inlineCollapsed } = this.context;
const props = this.props;
return <Tooltip
title={inlineCollapsed && props.level === 1 ? props.children : ''}
placement="right"
overlayClassName={`${props.rootPrefixCls}-inline-collapsed-tooltip`}
>
<Item {...props} ref={this.saveMenuItem} />
</Tooltip>;
const item = <Item {...props} ref={this.saveMenuItem} />;
if (inlineCollapsed && props.level === 1) {
return <Tooltip
title={props.children}
placement="right"
overlayClassName={`${props.rootPrefixCls}-inline-collapsed-tooltip`}
>
{item}
</Tooltip>;
}
return item;
}
}

View File

@@ -63,8 +63,6 @@
&:before {
position: absolute;
background-color: transparent;
width: 100%;
height: 100%;
top: 0;
left: 0;
bottom: 0;
@@ -286,6 +284,9 @@
&:hover {
color: @menu-highlight-color;
}
&:before {
bottom: -2px;
}
}
}

View File

@@ -7,6 +7,7 @@ let defaultTop: number;
let messageInstance: any;
let key = 1;
let prefixCls = 'ant-message';
let transitionName = 'move-up';
let getContainer: () => HTMLElement;
function getMessageInstance(callback: (i: any) => void) {
@@ -16,7 +17,7 @@ function getMessageInstance(callback: (i: any) => void) {
}
Notification.newInstance({
prefixCls,
transitionName: 'move-up',
transitionName,
style: { top: defaultTop }, // 覆盖原来的样式
getContainer,
}, (instance: any) => {
@@ -81,6 +82,7 @@ export interface ConfigOptions {
duration?: number;
prefixCls?: string;
getContainer?: () => HTMLElement;
transitionName?: string;
}
export default {
@@ -117,6 +119,10 @@ export default {
if (options.getContainer !== undefined) {
getContainer = options.getContainer;
}
if (options.transitionName !== undefined) {
transitionName = options.transitionName;
messageInstance = null; // delete messageInstance for new transitionName
}
},
destroy() {
if (messageInstance) {

View File

@@ -47,6 +47,7 @@ export interface ModalProps {
bodyStyle?: React.CSSProperties;
maskStyle?: React.CSSProperties;
mask?: boolean;
keyboard?: boolean;
}
export interface ModalFuncProps {
@@ -68,6 +69,7 @@ export interface ModalFuncProps {
okCancel?: boolean;
style?: React.CSSProperties;
type?: string;
keyboard?: boolean;
}
export type ModalFunc = (props: ModalFuncProps) => {

View File

@@ -14,7 +14,7 @@ interface ConfirmDialogProps extends ModalFuncProps {
const IS_REACT_16 = !!ReactDOM.createPortal;
const ConfirmDialog = (props: ConfirmDialogProps) => {
const { onCancel, onOk, close, zIndex, afterClose, visible } = props;
const { onCancel, onOk, close, zIndex, afterClose, visible, keyboard } = props;
const iconType = props.iconType || 'question-circle';
const okType = props.okType || 'primary';
const prefixCls = props.prefixCls || 'ant-confirm';
@@ -55,6 +55,7 @@ const ConfirmDialog = (props: ConfirmDialogProps) => {
width={width}
zIndex={zIndex}
afterClose={afterClose}
keyboard={keyboard}
>
<div className={`${prefixCls}-body-wrapper`}>
<div className={`${prefixCls}-body`}>

View File

@@ -25,6 +25,10 @@
font-weight: 500;
font-size: @font-size-lg;
line-height: 22px;
display: block;
// create BFC to avoid
// https://user-images.githubusercontent.com/507615/37702510-ba844e06-2d2d-11e8-9b67-8e19be57f445.png
overflow: auto;
}
.@{confirm-prefix-cls}-content {
@@ -38,7 +42,6 @@
font-size: 22px;
margin-right: 16px;
float: left;
min-height: 48px;
}
}

View File

@@ -8,7 +8,6 @@ exports[`renders ./components/pagination/demo/basic.md correctly 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Previous Page"
>
<a
@@ -281,7 +280,6 @@ exports[`renders ./components/pagination/demo/itemRender.md correctly 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Previous Page"
>
<a>
@@ -477,7 +475,6 @@ exports[`renders ./components/pagination/demo/mini.md correctly 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Previous Page"
>
<a
@@ -547,7 +544,6 @@ exports[`renders ./components/pagination/demo/mini.md correctly 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Previous Page"
>
<a
@@ -667,7 +663,6 @@ exports[`renders ./components/pagination/demo/mini.md correctly 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Previous Page"
>
<a
@@ -899,7 +894,6 @@ exports[`renders ./components/pagination/demo/total.md correctly 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Previous Page"
>
<a
@@ -975,7 +969,6 @@ exports[`renders ./components/pagination/demo/total.md correctly 1`] = `
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
tabindex="0"
title="Previous Page"
>
<a

View File

@@ -66,7 +66,7 @@
&-active {
border-color: @primary-color;
font-weight: 500;
font-weight: @pagination-font-weight-active;
a {
color: @primary-color;

View File

@@ -0,0 +1,13 @@
import React from 'react';
import { mount } from 'enzyme';
import Progress from '..';
describe('Progress', () => {
it('successPercent should decide the progress status when it exists', async () => {
const wrapper = mount(<Progress percent={100} successPercent={50} />);
expect(wrapper.find('.ant-progress-status-success')).toHaveLength(0);
wrapper.setProps({ percent: 50, successPercent: 100 });
expect(wrapper.find('.ant-progress-status-success')).toHaveLength(1);
});
});

View File

@@ -60,8 +60,8 @@ export default class Progress extends React.Component<ProgressProps, {}> {
prefixCls, className, percent = 0, status, format, trailColor, size, successPercent,
type, strokeWidth, width, showInfo, gapDegree = 0, gapPosition, ...restProps,
} = props;
const progressStatus = parseInt(percent.toString(), 10) >= 100 && !('status' in props) ?
'success' : (status || 'normal');
const progressStatus = parseInt((successPercent ? successPercent.toString() : percent.toString()), 10) >= 100 &&
!('status' in props) ? 'success' : (status || 'normal');
let progressInfo;
let progress;
const textFormatter = format || (percentNumber => `${percentNumber}%`);

View File

@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import classNames from 'classnames';
import shallowEqual from 'shallowequal';
import Radio from './radio';
import { RadioGroupProps, RadioGroupState } from './interface';
import { RadioGroupProps, RadioGroupState, RadioChangeEvent } from './interface';
function getCheckedValue(children: React.ReactNode) {
let value = null;
@@ -73,7 +73,7 @@ export default class RadioGroup extends React.Component<RadioGroupProps, RadioGr
!shallowEqual(this.state, nextState);
}
onRadioChange = (ev: React.ChangeEvent<HTMLInputElement>) => {
onRadioChange = (ev: RadioChangeEvent) => {
const lastValue = this.state.value;
const { value } = ev.target;
if (!('value' in this.props)) {

View File

@@ -5,7 +5,7 @@ import { AbstractCheckboxProps } from '../checkbox/Checkbox';
export interface RadioGroupProps extends AbstractCheckboxGroupProps {
defaultValue?: any;
value?: any;
onChange?: React.ChangeEventHandler<HTMLInputElement>;
onChange?: (e: RadioChangeEvent) => void;
size?: 'large' | 'default' | 'small';
onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
@@ -27,4 +27,15 @@ export interface RadioGroupContext {
};
}
export type RadioProps = AbstractCheckboxProps;
export type RadioProps = AbstractCheckboxProps<RadioChangeEvent>;
export interface RadioChangeEventTarget extends RadioProps {
checked: boolean;
}
export interface RadioChangeEvent {
target: RadioChangeEventTarget;
stopPropagation: () => void;
preventDefault: () => void;
nativeEvent: MouseEvent;
}

View File

@@ -2,8 +2,9 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import { AbstractCheckboxProps } from '../checkbox/Checkbox';
import Radio from './radio';
import { RadioChangeEvent } from './interface';
export type RadioButtonProps = AbstractCheckboxProps;
export type RadioButtonProps = AbstractCheckboxProps<RadioChangeEvent>;
export default class RadioButton extends React.Component<RadioButtonProps, any> {
static defaultProps = {

View File

@@ -15,7 +15,7 @@
outline: none;
&-disabled &-star {
cursor: not-allowed;
cursor: default;
&:hover {
transform: scale(1);
}

View File

@@ -15,7 +15,7 @@ A complete multiple select sample with remote search, debounce fetch, ajax callb
````jsx
import { Select, Spin } from 'antd';
import debounce from 'lodash.debounce';
import debounce from 'lodash/debounce';
const Option = Select.Option;
class UserRemoteSelect extends React.Component {

View File

@@ -37,10 +37,10 @@ Select component to select value from options.
| labelInValue | whether to embed label in value, turn the format of value from `string` to `{key: string, label: ReactNode}` | boolean | false |
| maxTagCount | Max tag count to show | number | - |
| maxTagPlaceholder | Placeholder for not showing tags | ReactNode/function(omittedValues) | - |
| mode | Set mode of Select (Support after 2.9) | 'multiple' \| 'tags' \| 'combobox' | - |
| mode | Set mode of Select (Support after 2.9) | 'default' \| 'multiple' \| 'tags' \| 'combobox' | 'default' |
| notFoundContent | Specify content to show when no result matches.. | string | 'Not Found' |
| optionFilterProp | Which prop value of option will be used for filter if filterOption is true | string | value |
| optionLabelProp | Which prop value of option will render as content of select. | string | `children` |
| optionLabelProp | Which prop value of option will render as content of select. | string | `value` for `combobox`, `children` for other modes |
| placeholder | Placeholder of select | string\|ReactNode | - |
| showSearch | Whether show search input in single mode. | boolean | false |
| showArrow | Whether to show the drop-down arrow | boolean | true |

View File

@@ -43,6 +43,7 @@ export interface SelectProps extends AbstractSelectProps {
onDeselect?: (value: SelectValue) => any;
onBlur?: () => any;
onFocus?: () => any;
onPopupScroll?: () => any;
onInputKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
maxTagCount?: number;
maxTagPlaceholder?: React.ReactNode | ((omittedValues: SelectValue[]) => React.ReactNode);

View File

@@ -489,6 +489,14 @@
background-color: @item-hover-bg;
}
&:first-child {
border-radius: @border-radius-base @border-radius-base 0 0;
}
&:last-child {
border-radius: 0 0 @border-radius-base @border-radius-base;
}
&-disabled {
color: @disabled-color;
cursor: not-allowed;

View File

@@ -10,7 +10,7 @@ exports[`renders ./components/slider/demo/basic.md correctly 1`] = `
/>
<div
class="ant-slider-track"
style="visibility:visible;left:0%;width:30%"
style="left:0%;width:30%"
/>
<div
class="ant-slider-step"
@@ -37,7 +37,7 @@ exports[`renders ./components/slider/demo/basic.md correctly 1`] = `
/>
<div
class="ant-slider-track ant-slider-track-1"
style="visibility:visible;left:20%;width:30%"
style="left:20%;width:30%"
/>
<div
class="ant-slider-step"
@@ -88,7 +88,7 @@ exports[`renders ./components/slider/demo/event.md correctly 1`] = `
/>
<div
class="ant-slider-track"
style="visibility:visible;left:0%;width:30%"
style="left:0%;width:30%"
/>
<div
class="ant-slider-step"
@@ -115,7 +115,7 @@ exports[`renders ./components/slider/demo/event.md correctly 1`] = `
/>
<div
class="ant-slider-track ant-slider-track-1"
style="visibility:visible;left:20%;width:30%"
style="left:20%;width:30%"
/>
<div
class="ant-slider-step"
@@ -163,7 +163,7 @@ exports[`renders ./components/slider/demo/icon-slider.md correctly 1`] = `
/>
<div
class="ant-slider-track"
style="visibility:visible;left:0%;width:0%"
style="left:0%;width:0%"
/>
<div
class="ant-slider-step"
@@ -205,7 +205,7 @@ exports[`renders ./components/slider/demo/input-number.md correctly 1`] = `
/>
<div
class="ant-slider-track"
style="visibility:visible;left:0%;width:0%"
style="left:0%;width:0%"
/>
<div
class="ant-slider-step"
@@ -293,7 +293,7 @@ exports[`renders ./components/slider/demo/input-number.md correctly 1`] = `
/>
<div
class="ant-slider-track"
style="visibility:visible;left:0%;width:0%"
style="left:0%;width:0%"
/>
<div
class="ant-slider-step"
@@ -383,7 +383,7 @@ exports[`renders ./components/slider/demo/mark.md correctly 1`] = `
/>
<div
class="ant-slider-track"
style="visibility:visible;left:0%;width:37%"
style="left:0%;width:37%"
/>
<div
class="ant-slider-step"
@@ -454,7 +454,7 @@ exports[`renders ./components/slider/demo/mark.md correctly 1`] = `
/>
<div
class="ant-slider-track ant-slider-track-1"
style="visibility:visible;left:26%;width:11%"
style="left:26%;width:11%"
/>
<div
class="ant-slider-step"
@@ -536,10 +536,6 @@ exports[`renders ./components/slider/demo/mark.md correctly 1`] = `
<div
class="ant-slider-rail"
/>
<div
class="ant-slider-track"
style="visibility:hidden;left:0%;width:37%"
/>
<div
class="ant-slider-step"
>
@@ -612,7 +608,7 @@ exports[`renders ./components/slider/demo/mark.md correctly 1`] = `
/>
<div
class="ant-slider-track"
style="visibility:visible;left:0%;width:37%"
style="left:0%;width:37%"
/>
<div
class="ant-slider-step"
@@ -686,7 +682,7 @@ exports[`renders ./components/slider/demo/mark.md correctly 1`] = `
/>
<div
class="ant-slider-track"
style="visibility:visible;left:0%;width:37%"
style="left:0%;width:37%"
/>
<div
class="ant-slider-step"
@@ -762,7 +758,7 @@ exports[`renders ./components/slider/demo/tip-formatter.md correctly 1`] = `
/>
<div
class="ant-slider-track"
style="visibility:visible;left:0%;width:0%"
style="left:0%;width:0%"
/>
<div
class="ant-slider-step"
@@ -789,7 +785,7 @@ exports[`renders ./components/slider/demo/tip-formatter.md correctly 1`] = `
/>
<div
class="ant-slider-track"
style="visibility:visible;left:0%;width:0%"
style="left:0%;width:0%"
/>
<div
class="ant-slider-step"
@@ -826,7 +822,7 @@ exports[`renders ./components/slider/demo/vertical.md correctly 1`] = `
/>
<div
class="ant-slider-track"
style="visibility:visible;bottom:0%;height:30%"
style="bottom:0%;height:30%"
/>
<div
class="ant-slider-step"
@@ -857,7 +853,7 @@ exports[`renders ./components/slider/demo/vertical.md correctly 1`] = `
/>
<div
class="ant-slider-track ant-slider-track-1"
style="visibility:visible;bottom:20%;height:30%"
style="bottom:20%;height:30%"
/>
<div
class="ant-slider-step"
@@ -898,7 +894,7 @@ exports[`renders ./components/slider/demo/vertical.md correctly 1`] = `
/>
<div
class="ant-slider-track ant-slider-track-1"
style="visibility:visible;bottom:26%;height:11%"
style="bottom:26%;height:11%"
/>
<div
class="ant-slider-step"

View File

@@ -0,0 +1,43 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Slider should show tooltip when hovering slider handler 1`] = `
<div>
<div
class="ant-tooltip ant-tooltip-placement-top "
>
<div
class="ant-tooltip-content"
>
<div
class="ant-tooltip-arrow"
/>
<div
class="ant-tooltip-inner"
>
30
</div>
</div>
</div>
</div>
`;
exports[`Slider should show tooltip when hovering slider handler 2`] = `
<div>
<div
class="ant-tooltip ant-tooltip-placement-top ant-tooltip-hidden"
>
<div
class="ant-tooltip-content"
>
<div
class="ant-tooltip-arrow"
/>
<div
class="ant-tooltip-inner"
>
30
</div>
</div>
</div>
</div>
`;

View File

@@ -0,0 +1,15 @@
import React from 'react';
import { render, mount } from 'enzyme';
import Slider from '..';
describe('Slider', () => {
it('should show tooltip when hovering slider handler', () => {
const wrapper = mount(
<Slider defaultValue={30} />
);
wrapper.find('.ant-slider-handle').at(0).simulate('mouseEnter');
expect(render(wrapper.find('Trigger').instance().getComponent())).toMatchSnapshot();
wrapper.find('.ant-slider-handle').at(0).simulate('mouseLeave');
expect(render(wrapper.find('Trigger').instance().getComponent())).toMatchSnapshot();
});
});

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