Compare commits

...

148 Commits
3.2.0 ... 3.3.0

Author SHA1 Message Date
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
valleykid
07a0a1f336 Changelog of 3.2.2 (#9409) 2018-02-25 08:38:10 +08:00
valleykid
eab4fdfe95 Update snapshot 2018-02-25 07:57:23 +08:00
Ivan Kravets
86ab00fbbd Use default background for button states (#9411) 2018-02-24 22:25:50 +08:00
Wei Zhu
c28d6f1624 Remove table overflow:hidden, fix #7799 2018-02-24 11:46:46 +08:00
Mathew
947cee4475 fix issue #9359 (#9364)
* fix issue #9359

* fix trailing whitespaces
2018-02-24 11:40:44 +08:00
MinJeong Kim
feaf238dfa fix: set -has-trigger class in sider when -trigger div exists (#9399)
* fix: set `-has-trigger` class in sider when `-trigger` div exists

* fix: fix template expr lint error
2018-02-24 10:35:04 +08:00
Wei Zhu
f1fd85780e Revert "fix type of column dataIndex (#9298)"
This reverts commit f8e996ee8e.

Close #9393
2018-02-22 15:56:37 +08:00
Wei Zhu
dc439bd7c3 Remove generic type from ComponentDecorator, fix #9331 2018-02-22 15:52:35 +08:00
Wei Zhu
2c95ea0e5e docs: document Tabs[onChange] argument
Close #9386
2018-02-22 10:44:53 +08:00
Wei Zhu
aeeebab9d9 Upgrade @babel/types 2018-02-21 18:42:13 +08:00
Wei Zhu
a6ffd332fa docs: fix parameter 2018-02-16 15:20:25 +08:00
Christopher Deutsch
97b09b393b onKeyPress and onKeyDown got the wrong type in #9316 (#9365) 2018-02-15 13:10:35 -06:00
Wei Zhu
a438b9b33f Add spin dot className to custom indicator 2018-02-14 12:56:22 +08:00
Wei Zhu
7d5db31e67 Fix table custom spin indicator
Fix #9355
2018-02-14 12:56:22 +08:00
George Gray
053396810b add @badge-font-weight var (#9352) 2018-02-14 12:35:52 +08:00
George Gray
676635abde var to theme pagination font (#9351) 2018-02-13 21:38:34 +08:00
Dimitri Mitropoulos
c92cf5b778 adds missing argument in Select onChange prop (#9332)
* adds missing argument in Select onChange prop

from the docs: 
`function(value, option:Option/Array<Option>)`

also, (from reality) the callback really does send an option or options array.

* updates type to use ReactElement instead of Object
2018-02-13 07:33:25 -06:00
Arvin Xu
2a1612b0c2 📖 Fix misspelling and blank (#9348)
修改个错别字,补充两处盘古之白
2018-02-13 00:11:25 -06:00
MuYu
1d1ea1ac59 fix switch doc error (#9338) 2018-02-12 12:10:07 +08:00
afc163
b574e8ee14 3.2.1 2018-02-12 10:17:29 +08:00
偏右
0e9743e78a Add changelog of 3.2.1 (#9335)
* Add changelog of 3.2.1

* fix version

* Add English changelog
2018-02-12 10:09:11 +08:00
Wei Zhu
4107a4bd8e docs: Remove next version link
Close #9336
2018-02-11 20:11:40 +08:00
afc163
ba236419be Fix badge API doc 2018-02-11 19:21:12 +08:00
afc163
5294a69296 site: fix home page style 2018-02-11 18:10:02 +08:00
afc163
ec399ba27f site: update link description 2018-02-11 17:59:41 +08:00
afc163
d31612f2de site: renew footer links 2018-02-11 17:54:55 +08:00
afc163
c04377e541 Add more icons, #9092 2018-02-11 17:10:18 +08:00
afc163
626ebf2063 Fix upload list update logic when beforeUpload return false
close #8020 #8779 #9248 #9191

ref #8036
2018-02-11 16:11:13 +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
afc163
e3f115dd3d update snapshot 2018-02-11 11:48:59 +08:00
afc163
1ae7da3878 Fix hasFeedback icon position in vertical form layout
close #9153 and #9309
2018-02-11 11:44:49 +08:00
偏右
d72a6dd7b9 Update README.md
close #9254
2018-02-11 11:07:42 +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
afc163
f27bc6bd9d fix snapshot 2018-02-09 17:07:33 +08:00
afc163
fff5680743 fix typo 2018-02-09 16:30:14 +08:00
afc163
5accd6367a Fix submenu z-index, close #9218 2018-02-09 15:56:34 +08:00
afc163
2909e5f651 Fix sorter icon click area overflow in Table
close #8979
2018-02-09 15:50:08 +08:00
Wei Zhu
b5f88c0005 Fix table padding close #9319 2018-02-09 14:58:03 +08:00
jim
0df2efccd0 ~ -> ^ 2018-02-09 11:43:46 +08:00
诸岳
240289ed73 Remove TimePicker wrong line-height style, close #9292 (#9317) 2018-02-09 11:36:43 +08:00
jim
50863acb1b datePicker add dropdownClassName prop fix #7211 2018-02-09 11:35:13 +08:00
Yury Kozyrev
1e92ff8efd onKeyPress and onKeyDown typings (#9316)
* Update Checkbox.tsx

* Update button.tsx
2018-02-08 20:35:54 -06:00
John Johnson III
3ffe718476 fix typo in less good (#9315)
Fix `background` property value by changing it from `transprent` to `transparent`
2018-02-09 10:05:56 +08:00
Benjy Cui
44063967a1 fix: make Mention autosize height by default, close: #9068 (#9307) 2018-02-08 23:50:42 +08:00
Benjy Cui
2411bdb7b7 fix: placeholder of Mention should not be interactable, close: #9215 (#9306) 2018-02-08 22:39:43 +08:00
Marcus Bransbury
3b6cd56820 Update broken links in docs (#9310)
* update link english

* update link chinese
2018-02-08 06:58:36 -06:00
Wei Zhu
7d3ff69e12 Fix small bordered table style
Fix #8980
2018-02-08 16:14:45 +08:00
jim
7b4abe7568 doc add select component showArrow props document 2018-02-08 16:13:09 +08:00
afc163
dc7d9de4cd revert demo code 2018-02-08 15:52:24 +08:00
afc163
70f3afeda0 Fix ButtonGroup style bug when have disabled button, close #9296 2018-02-08 15:51:53 +08:00
afc163
6577616be2 fix demo 2018-02-08 14:26:33 +08:00
afc163
875024cd1e update onRow usage 2018-02-08 14:25:49 +08:00
afc163
3ed3a078e1 Document for Table onRow, ref #355 2018-02-08 14:14:46 +08:00
Leo
f8e996ee8e fix type of column dataIndex (#9298) 2018-02-07 20:26:03 -06:00
David Tsai
a8f1c35dcb Update introduce.en-US.md (#9299)
Providing clarifying language in the following areas:

* Front-end Implementation
* Who's using Ant Design
* How to Contribute

Additionally, I'd like to follow up with a short visual guide for designers to learn how to contribute to the documentation here.
2018-02-08 10:21:22 +08:00
afc163
a5f29f06a5 Fix select arrow style in IE11 2018-02-07 20:29:40 +08:00
Wei Zhu
e992682aa8 Ignore invalid end date
Fix #9267
2018-02-07 14:23:17 +08:00
afc163
33e2ef0f8d revert 1502d36 to fix #9276
ref #7934
2018-02-07 11:43:21 +08:00
Andreas Cederström
f1bd8d0d11 proper class on avatar when image doesnt exist (#9278) 2018-02-07 10:43:27 +08:00
Ubaldo Quintana
7c062bb118 Update CHANGELOG.en-US.md (#9277)
Fix typos
2018-02-06 20:37:55 -06:00
afc163
59b18b4c26 Fix card loading with empty children, close #9258 2018-02-06 11:45:22 +08:00
Wei Zhu
ca6a8d13bd site: Update Table drag demo
Close #9255
2018-02-05 11:08:16 +08:00
Wei Zhu
c725cbe791 docs: fix release title 2018-02-05 00:02:17 +08:00
172 changed files with 3595 additions and 1992 deletions

View File

@@ -12,4 +12,6 @@ If your issue was not created using the app above, it will be closed immediately
http://new-issue.ant.design
不是用上面的链接创建的 issue 会被立即关闭。
两会期间,如果遇到官网无法访问,可以先使用代理访问或者访问国内镜像 http://ant-design.gitee.io
-->

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,14 +15,89 @@ timeline: true
---
# 3.2.0
## 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`
- 🌟 Add font-family variable for `Pagination`. [#9351](https://github.com/ant-design/ant-design/issues/9351)
- 🌟 Add font-weight variable for `Badge`. [#9352](https://github.com/ant-design/ant-design/issues/9352)
- 🐞 Fix table custom spin indicator. [#9355](https://github.com/ant-design/ant-design/issues/9355)
- 🐞 Fix `Form.create`. [#9331](https://github.com/ant-design/ant-design/issues/9331)
- 🐞 Revert typescript definition of `column.dataIndex`. [#9393](https://github.com/ant-design/ant-design/issues/9393)
- 🐞 Fix last menu item in Sider could be blocked by collapse trigger. [#9398](https://github.com/ant-design/ant-design/issues/9398) [@MJ111](https://github.com/MJ111)
- 🐞 Fix badge works wrong in dot mode. [#9359](https://github.com/ant-design/ant-design/issues/9359) [@khayalan-mathew](https://github.com/khayalan-mathew)
## 3.2.1
`2018-02-11`
- 🌟 Add icons of some famous products. [c04377e5](https://github.com/ant-design/ant-design/commit/c04377e5413d344b37c34ceac6fee456933fa516)
- Mention
- 🌟 `multiLines` mode will support autosize.
- 🐞 Fix paste not working when `placeholder` is specified. [#9215](https://github.com/ant-design/ant-design/issues/9215)
- Table
- 🐞 Fix padding of middle size table. [#9319](https://github.com/ant-design/ant-design/issues/9319)
- 🐞 Fix border bug of small size table. [#8980](https://github.com/ant-design/ant-design/issues/8980)
- 🐞 Fix overflow issue of sort icon interactive area. [#8979](https://github.com/ant-design/ant-design/issues/8979)
- 🌟 Improve typescript definition of `column.dataIndex`. [#9298](https://github.com/ant-design/ant-design/pull/9298) [@clinyong](https://github.com/clinyong)
- Select
- 🐞 Fix wrong scroll position when navigating active item with keyboard. [#9276](https://github.com/ant-design/ant-design/issues/9276)
- 🐞 Fix arrow position in IE11.
- 🐞 Fix issue that file item showing `uploading` when Upload `beforeUpload` return false. [#8020](https://github.com/ant-design/ant-design/issues/8020)
- 🐞 Fix misplace of feedback icon of `vertical` layout Form. [#9153](https://github.com/ant-design/ant-design/issues/9153)
- 🐞 Fix loading style missing of empty childen Card. [#9258](https://github.com/ant-design/ant-design/issues/9258)
- 🐞 Fix background color of Avatar when image source is not existe. [#9278](https://github.com/ant-design/ant-design/pull/9278) [@andriijas](https://github.com/andriijas)
- 🐞 Fix RangePicker `Cannot read property 'locale' of undefined` error when select end date. [#9267](https://github.com/ant-design/ant-design/issues/9267)
- 🐞 Fix style problem when using disabled button with Tooltip inside ButtonGroup. [#9296](https://github.com/ant-design/ant-design/issues/9296) [#9296](https://github.com/ant-design/ant-design/issues/9296)
- 🐞 Fix z-index of Dropdown's submenu. [#9218](https://github.com/ant-design/ant-design/issues/9218)
## 3.2.0
`2018-02-04`
- 🌟 Add new `tabBarGutter` prop to Tab to allow setting gutter between tabs. [#8644](https://github.com/ant-design/ant-design/pull/8644) [@lixiaoyang1992](https://github.com/lixiaoyang1992)
- 🌟 Add new `hasSider` prop to Layout to avoid render error when server rendering. [#8937](https://github.com/ant-design/ant-design/issues/8937)
- 🌟 Add new `successPercent` to Progess to alow showing two phases. [Demo](https://ant.design/components/progress/#components-progress-demo-segment)
- 🌟 Add new `iconType` prop to Alert to allow settting type of icon. [#8811](https://github.com/ant-design/ant-design/pull/8811) [@minwe](https://github.com/ant-design/ant-design/pull/8811)
- 🌟 Add new `successPercent` to Progress to allow showing two phases. [Demo](https://ant.design/components/progress/#components-progress-demo-segment)
- 🌟 Add new `iconType` prop to Alert to allow settting icon type. [#8811](https://github.com/ant-design/ant-design/pull/8811) [@minwe](https://github.com/ant-design/ant-design/pull/8811)
- 🌟 Add `id` prop to DatePicker. [#8598](https://github.com/ant-design/ant-design/pull/8598) [@mgrdevport](https://github.com/mgrdevport)
- 🌟 Add new `forceRender` prop to Collapse to allow rendering hide panel. [#9192](https://github.com/ant-design/ant-design/pull/9192) [#Pyroboomka](https://github.com/ant-design/ant-design/pull/9192) [@paulcmason](https://github.com/react-component/collapse/pull/82)
- RangePicker

View File

@@ -15,6 +15,81 @@ timeline: true
---
## 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`
- 🌟 添加 `Pagination` 字体变量。 [#9351](https://github.com/ant-design/ant-design/issues/9351)
- 🌟 添加 `Badge` 字重变量。 [#9352](https://github.com/ant-design/ant-design/issues/9352)
- 🐞 修复 `Table` 当自定义 `loading.indicator`不显示emptyText。 [#9355](https://github.com/ant-design/ant-design/issues/9355)
- 🐞 修复 `Form.create` 。 [#9331](https://github.com/ant-design/ant-design/issues/9331)
- 🐞 回滚 `Table``column.dataIndex` 的 TypeScript 定义。 [#9393](https://github.com/ant-design/ant-design/issues/9393)
- 🐞 修复 `Layout` 中 sider 高度不足时,最后一个菜单无法显示。 [#9398](https://github.com/ant-design/ant-design/issues/9398) [@MJ111](https://github.com/MJ111)
- 🐞 修复 `Badge` dot 模式问题。 [#9359](https://github.com/ant-design/ant-design/issues/9359) [@khayalan-mathew](https://github.com/khayalan-mathew)
## 3.2.1
`2018-02-11`
- 🌟 新增了部分著名产品的图标。[c04377e5](https://github.com/ant-design/ant-design/commit/c04377e5413d344b37c34ceac6fee456933fa516)
- Mention
- 🌟 现在 `multiLines` 模式的高度将默认自适应内容。
- 🐞 修复指定了 `placeholder` 时无法粘贴内容的问题。[#9215](https://github.com/ant-design/ant-design/issues/9215)
- Table
- 🐞 修复中号表格的 padding。[#9319](https://github.com/ant-design/ant-design/issues/9319)
- 🐞 修复小号表格的边框错位问题。[#8980](https://github.com/ant-design/ant-design/issues/8980)
- 🐞 修复排序图标点击区域溢出表头的问题。[#8979](https://github.com/ant-design/ant-design/issues/8979)
- 🌟 优化了 `column.dataIndex` 的 TypeScript 定义。[#9298](https://github.com/ant-design/ant-design/pull/9298) [@clinyong](https://github.com/clinyong)
- Select
- 🐞 修复使用键盘导航时,滚动条不会自动定位的问题。[#9276](https://github.com/ant-design/ant-design/issues/9276)
- 🐞 修复在 IE11 下的箭头位置。
- 🐞 修复 Upload `beforeUpload` 返回 `false` 时,上传文件仍然显示 `uploading` 以及文件列表被替换的问题。[#8020](https://github.com/ant-design/ant-design/issues/8020)
- 🐞 修复 `vertical` 布局的 Form 下反馈图标错位的问题。[#9153](https://github.com/ant-design/ant-design/issues/9153)
- 🐞 修复 Card 没有子节点时 `loading` 样式不生效的问题。[#9258](https://github.com/ant-design/ant-design/issues/9258)
- 🐞 修复 Avatar 的图片不存在时的背景色。[#9278](https://github.com/ant-design/ant-design/pull/9278) [@andriijas](https://github.com/andriijas)
- 🐞 修复 RangePicker 选择结束时间时报 `Cannot read property 'locale' of undefined` 的问题。[#9267](https://github.com/ant-design/ant-design/issues/9267)
- 🐞 修复 ButtonGroup 内使用了失效按钮和 Tooltip 时样式错位的问题。[#9296](https://github.com/ant-design/ant-design/issues/9296) [#9296](https://github.com/ant-design/ant-design/issues/9296)
- 🐞 修复 Dropdown 的子菜单被遮挡的问题。[#9218](https://github.com/ant-design/ant-design/issues/9218)
## 3.2.0
`2018-02-04`
@@ -355,7 +430,7 @@ timeline: true
```
- Select
- 🌟 默认和多选模式下 Option 的值允许使用 number。
- 🌟 新增 `maxTagCount 和 `maxTagPlaceholder`,用设置最多可显示的选中项。
- 🌟 新增 `maxTagCount 和 `maxTagPlaceholder`,用设置最多可显示的选中项。
- 🌟 新增 `showAction`,用于设置出发下拉框打开的事件。
- 🌟 新增 `onMouseEnter``onMouseLeave` 事件回调。
- LocaleProvider

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)](https://npmcharts.com/compare/antd?minimal=true)
[![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.
- Work with great development and design resources and tools.
## Environment Support
@@ -92,6 +92,7 @@ See [i18n](http://ant.design/docs/react/i18n).
```bash
$ git clone git@github.com:ant-design/ant-design.git
$ cd ant-design
$ npm install
$ npm start
```

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

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

@@ -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?: Function;
/** 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

@@ -83,7 +83,7 @@ export default class Avatar extends React.Component<AvatarProps, AvatarState> {
const classString = classNames(prefixCls, className, sizeCls, {
[`${prefixCls}-${shape}`]: shape,
[`${prefixCls}-image`]: src,
[`${prefixCls}-image`]: src && this.state.isImgExist,
[`${prefixCls}-icon`]: icon,
});

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

@@ -423,6 +423,13 @@ exports[`renders ./components/badge/demo/dot.md correctly 1`] = `
data-show="true"
/>
</span>
<span
class="ant-badge"
>
<i
class="anticon anticon-notification"
/>
</span>
<span
class="ant-badge"
>

View File

@@ -0,0 +1,14 @@
import React from 'react';
import { mount } from 'enzyme';
import Badge from '../index';
describe('Badge', () => {
test('badge dot not scaling count > 9', () => {
const badge = mount(<Badge count={10} dot />);
expect(badge.find('.ant-card-multiple-words').length).toBe(0);
});
test('badge dot not showing count == 0', () => {
const badge = mount(<Badge count={0} dot />);
expect(badge.find('.ant-badge-dot').length).toBe(0);
});
});

View File

@@ -12,6 +12,7 @@ title:
## en-US
This will simply display a red badge, without a specific count.
If count equals 0, it won't display the dot.
````jsx
import { Badge, Icon } from 'antd';
@@ -21,6 +22,9 @@ ReactDOM.render(
<Badge dot>
<Icon type="notification" />
</Badge>
<Badge count={0} dot>
<Icon type="notification" />
</Badge>
<Badge dot>
<a href="#">Link something</a>
</Badge>

View File

@@ -26,7 +26,7 @@ Badge normally appears in proximity to notifications or user avatars with eye-ca
| -------- | ----------- | ---- | ------- |
| count | Number to show in badge | number\|ReactNode | |
| dot | Whether to display a red dot instead of `count` | boolean | `false` |
| offset | set offset of the badge dot, like [x, y] | [number, number] | - |
| offset | set offset of the badge dot, like`[x, y]` | `[number, number]` | - |
| overflowCount | Max count to show | number | 99 |
| showZero | Whether to show badge when `count` is zero | boolean | `false` |
| status | Set Badge as a status dot | `success` \| `processing` \| `default` \| `error` \| `warning` | `''` |

View File

@@ -59,14 +59,13 @@ export default class Badge extends React.Component<BadgeProps, any> {
offset,
...restProps,
} = this.props;
const isDot = dot || status;
let displayCount = (count as number) > (overflowCount as number) ? `${overflowCount}+` : count;
const isZero = displayCount === '0' || displayCount === 0;
const isDot = (dot && !isZero) || status;
// dot mode don't need count
if (isDot) {
displayCount = '';
}
const isZero = displayCount === '0' || displayCount === 0;
const isEmpty = displayCount === null || displayCount === undefined || displayCount === '';
const hidden = (isEmpty || (isZero && !showZero)) && !isDot;
const statusCls = classNames({
@@ -76,7 +75,7 @@ export default class Badge extends React.Component<BadgeProps, any> {
const scrollNumberCls = classNames({
[`${prefixCls}-dot`]: isDot,
[`${prefixCls}-count`]: !isDot,
[`${prefixCls}-multiple-words`]: count && count.toString && count.toString().length > 1,
[`${prefixCls}-multiple-words`]: !isDot && count && count.toString && count.toString().length > 1,
[`${prefixCls}-status-${status}`]: !!status,
});
const badgeCls = classNames(className, prefixCls, {

View File

@@ -27,7 +27,7 @@ title: Badge
| --- | --- | --- | --- |
| count | 展示的数字,大于 overflowCount 时显示为 `${overflowCount}+`,为 0 时隐藏 | number\|ReactNode | |
| dot | 不展示数字,只有一个小红点 | boolean | false |
| offset | 设置状态点的位置偏移,格式为 [x, y] | [number, number] | - |
| offset | 设置状态点的位置偏移,格式为 `[x, y]` | `[number, number]` | - |
| overflowCount | 展示封顶的数字值 | number | 99 |
| showZero | 当数值为 0 时,是否展示 Badge | boolean | false |
| status | 设置 Badge 为状态点 | Enum{ 'success', 'processing, 'default', 'error', 'warning' } | '' |

View File

@@ -24,6 +24,7 @@
text-align: center;
padding: 0 6px;
font-size: @badge-font-size;
font-weight: @badge-font-weight;
white-space: nowrap;
transform-origin: -10% center;
box-shadow: 0 0 0 1px #fff;

View File

@@ -47,6 +47,8 @@ export interface ButtonProps {
onClick?: React.FormEventHandler<any>;
onMouseUp?: React.FormEventHandler<any>;
onMouseDown?: React.FormEventHandler<any>;
onKeyPress?: React.KeyboardEventHandler<any>;
onKeyDown?: React.KeyboardEventHandler<any>;
tabIndex?: number;
loading?: boolean | { delay?: number };
disabled?: boolean;

View File

@@ -36,7 +36,8 @@ To get a customized button, just set `type`/`shape`/`size`/`loading`/`disabled`.
margin-right: 8px;
margin-bottom: 12px;
}
[id^=components-button-demo-] .ant-btn-group > .ant-btn {
[id^=components-button-demo-] .ant-btn-group > .ant-btn,
[id^=components-button-demo-] .ant-btn-group > span > .ant-btn {
margin-right: 0;
}
</style>

View File

@@ -108,6 +108,7 @@
display: inline-block;
> .@{btnClassName} {
position: relative;
line-height: @btn-height-base - 2px;
&:hover,
&:focus,
@@ -124,10 +125,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;
}
@@ -198,7 +201,7 @@
&:focus,
&:active,
&.active {
background: #fff;
background: @btn-default-bg;
}
}
@@ -241,6 +244,8 @@
.@{btnClassName} + .@{btnClassName},
.@{btnClassName} + &,
span + .@{btnClassName},
.@{btnClassName} + span,
& + .@{btnClassName},
& + & {
margin-left: -1px;
@@ -250,15 +255,19 @@
border-radius: 0;
}
> .@{btnClassName}:first-child {
> .@{btnClassName}:first-child,
> span:first-child > .@{btnClassName} {
margin-left: 0;
&:not(:last-child) {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
}
}
> .@{btnClassName}:last-child:not(:first-child) {
> .@{btnClassName}:first-child:not(:last-child),
> span:first-child:not(:last-child) > .@{btnClassName} {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
}
> .@{btnClassName}:last-child:not(:first-child),
> span:last-child:not(:first-child) > .@{btnClassName} {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
}

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;
@@ -192,7 +206,7 @@ export default class Card extends React.Component<CardProps, {}> {
<div {...divProps} className={classString} ref={this.saveRef}>
{head}
{coverDom}
{children ? body : null}
{body}
{actionDom}
</div>
);

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

@@ -16,13 +16,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 +65,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 +74,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 +83,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 +92,7 @@ exports[`renders ./components/carousel/demo/autoplay.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="7"
tabindex="-1"
>
<h3>
4
@@ -115,13 +120,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 +169,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 +178,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 +187,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 +196,7 @@ exports[`renders ./components/carousel/demo/basic.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="7"
tabindex="-1"
>
<h3>
4
@@ -212,9 +222,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 +234,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 +244,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 +254,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>
@@ -273,13 +283,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 +332,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 +341,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 +350,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 +359,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

@@ -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,26 +5,39 @@ 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>;
onKeyDown?: React.KeyboardEventHandler<any>;
value?: any;
tabIndex?: number;
name?: string;
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: [],
};
@@ -157,6 +157,9 @@ export default class RangePicker extends React.Component<any, RangePickerState>
}
handleCalendarInputSelect = (value: RangePickerValue) => {
if (!value[0]) {
return;
}
this.setState(({ showDate }) => ({
value,
showDate: getShowDateFromValue(value) || showDate,

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(new Date('2016-11-22'));
});
afterEach(() => {

View File

@@ -3,6 +3,7 @@ import { mount, render } from 'enzyme';
import moment from 'moment';
import DatePicker from '../';
import { setMockDate, resetMockDate } from '../../../tests/utils';
import { selectDate } from './utils';
import focusTest from '../../../tests/shared/focusTest';
const { RangePicker } = DatePicker;
@@ -202,4 +203,16 @@ describe('RangePicker', () => {
wrapper.find('.ant-calendar-range-quick-selector a').simulate('click');
expect(handleOk).toBeCalledWith(range);
});
// https://github.com/ant-design/ant-design/issues/9267
it('invali end date not throw error', () => {
const wrapper = mount(<RangePicker />);
wrapper.find('.ant-calendar-picker-input').simulate('click');
selectDate(wrapper, moment('2017-09-18'), 0);
selectDate(wrapper, moment('2017-10-18'), 1);
wrapper.find('.ant-calendar-picker-input').simulate('click');
expect(() =>
wrapper.find('.ant-calendar-input').at(1).simulate('change', { target: { value: '2016-01-01' } })
).not.toThrow();
});
});

View File

@@ -1,8 +1,8 @@
/* eslint-disable import/prefer-default-export */
export function selectDate(wrapper, date, index) {
let calendar = wrapper;
if (index) {
calendar = wrapper.find('.ant-calendar-range-part')[index];
if (index !== undefined) {
calendar = wrapper.find('.ant-calendar-range-part').at(index);
}
calendar.find({ title: date.format('LL'), role: 'gridcell' }).simulate('click');
}

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

@@ -126,7 +126,6 @@
.@{calendar-prefix-cls}-footer {
position: relative;
height: auto;
line-height: auto;
&-btn {
text-align: right;

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

@@ -54,6 +54,7 @@
&-submenu-popup {
position: absolute;
z-index: @zindex-dropdown;
}
&-item,

View File

@@ -117,10 +117,10 @@ export type Diff<T extends string, U extends string> =
({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T];
export type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;
export interface ComponentDecorator<TOwnProps> {
export interface ComponentDecorator {
<P extends FormComponentProps>(
component: React.ComponentClass<P> | React.SFC<P>,
): React.ComponentClass<Omit<P, keyof FormComponentProps> & TOwnProps>;
): React.ComponentClass<Omit<P, keyof FormComponentProps>>;
}
export default class Form extends React.Component<FormProps, any> {
@@ -149,7 +149,7 @@ export default class Form extends React.Component<FormProps, any> {
static createFormField = createFormField;
static create = function<TOwnProps>(options: FormCreateOption<TOwnProps> = {}): ComponentDecorator<TOwnProps> {
static create = function<TOwnProps>(options: FormCreateOption<TOwnProps> = {}): ComponentDecorator {
return createDOMForm({
fieldNameProp: 'id',
...options,

View File

@@ -186,7 +186,8 @@ export default class FormItem extends React.Component<FormItemProps, any> {
}
return (
<div className={classes}>
{c1}{c2}{c3}
<span className={`${this.props.prefixCls}-item-children`}>{c1}</span>
{c2}{c3}
</div>
);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
/* tslint:disable */
import * as React from 'react';
import Form, { FormComponentProps } from '../Form';
import Form, { FormComponentProps, FormCreateOption } from '../Form';
// test Form.create on component without own props
class WithoutOwnProps extends React.Component<any, any> {
@@ -34,3 +34,28 @@ class WithOwnProps extends React.Component<WithOwnPropsProps, any> {
const WithOwnPropsForm = Form.create()(WithOwnProps);
<WithOwnPropsForm name="foo" />;
// test Form.create with options
interface WithCreateOptionsProps extends FormComponentProps {
username: string;
}
class WithCreateOptions extends React.Component<WithCreateOptionsProps, {}> {
render() {
return <div>foo</div>;
}
}
const mapPropsToFields = (props: WithCreateOptionsProps) => {
const { username } = props;
return {
username: Form.createFormField({ value: username })
};
};
const formOptions: FormCreateOption<WithCreateOptionsProps> = { mapPropsToFields };
const WithCreateOptionsForm = Form.create(formOptions)(WithCreateOptions);
<WithCreateOptionsForm username="foo" />

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

@@ -87,6 +87,10 @@ input[type="checkbox"] {
.clearfix;
}
&-children {
position: relative;
}
&-with-help {
margin-bottom: @form-item-margin-bottom - @font-size-base * @line-height-base - @form-help-margin-top;
transition: none;
@@ -233,8 +237,8 @@ form {
margin-left: 0;
}
.@{ant-prefix}-input-number {
margin-right: 8px;
.@{ant-prefix}-input-number + .@{form-prefix-cls}-text {
margin-left: 8px;
}
.@{ant-prefix}-select,
@@ -396,15 +400,16 @@ form {
.has-warning,
.has-error,
.is-validating {
&.has-feedback:after {
&.has-feedback .@{form-prefix-cls}-item-children:after {
position: absolute;
top: 0;
top: 50%;
right: 0;
visibility: visible;
pointer-events: none;
width: @form-component-height;
height: @form-component-max-height;
line-height: @form-component-max-height;
height: 20px;
line-height: 20px;
margin-top: -10px;
text-align: center;
font-size: @form-feedback-icon-size;
animation: zoomIn .3s @ease-out-back;
@@ -414,7 +419,7 @@ form {
}
.has-success {
&.has-feedback:after {
&.has-feedback .@{form-prefix-cls}-item-children:after {
animation-name: diffZoomIn1 !important;
content: '\e630';
color: @success-color;
@@ -424,7 +429,7 @@ form {
.has-warning {
.form-control-validation(@warning-color; @warning-color;);
&.has-feedback:after {
&.has-feedback .@{form-prefix-cls}-item-children:after {
content: '\e62c';
color: @warning-color;
animation-name: diffZoomIn3 !important;
@@ -471,7 +476,7 @@ form {
.has-error {
.form-control-validation(@error-color; @error-color;);
&.has-feedback:after {
&.has-feedback .@{form-prefix-cls}-item-children:after {
content: '\e62e';
color: @error-color;
animation-name: diffZoomIn2 !important;
@@ -541,7 +546,7 @@ form {
}
.is-validating {
&.has-feedback:after {
&.has-feedback .@{form-prefix-cls}-item-children:after {
display: inline-block;
animation: loadingCircle 1s infinite linear;
content: "\e64d";

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

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

@@ -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;
@@ -212,7 +210,7 @@ export default class Sider extends React.Component<SiderProps, SliderState> {
};
const siderCls = classNames(className, prefixCls, {
[`${prefixCls}-collapsed`]: !!this.state.collapsed,
[`${prefixCls}-has-trigger`]: !!trigger,
[`${prefixCls}-has-trigger`]: collapsible && trigger !== null && !zeroWidthTrigger,
[`${prefixCls}-below`]: !!this.state.below,
[`${prefixCls}-zero-width`]: siderWidth === 0 || siderWidth === '0' || siderWidth === '0px',
});

View File

@@ -688,7 +688,7 @@ exports[`renders ./components/layout/demo/side.md correctly 1`] = `
style="min-height:100vh"
>
<div
class="ant-layout-sider"
class="ant-layout-sider ant-layout-sider-has-trigger"
style="flex:0 0 200px;max-width:200px;min-width:200px;width:200px"
>
<div

View File

@@ -24,4 +24,14 @@ describe('Layout', () => {
);
expect(wrapper.find('.ant-layout').hasClass('ant-layout-has-sider')).toBe(true);
});
it('detect ant-layout-sider-has-trigger class in sider when ant-layout-sider-trigger div tag exists', async () => {
const wrapper = mount(
<Layout>
<div><Sider collapsible>Sider</Sider></div>
<Content>Content</Content>
</Layout>
);
expect(wrapper.find('.ant-layout-sider').hasClass('ant-layout-sider-has-trigger')).toBe(true);
});
});

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

@@ -364,7 +364,7 @@ exports[`renders ./components/list/demo/infinite-virtualized-load.md correctly 1
class="ant-spin"
>
<span
class="ant-spin-dot"
class="ant-spin-dot ant-spin-dot-spin"
>
<i />
<i />
@@ -389,7 +389,7 @@ exports[`renders ./components/list/demo/loadmore.md correctly 1`] = `
class="ant-spin ant-spin-spinning"
>
<span
class="ant-spin-dot"
class="ant-spin-dot ant-spin-dot-spin"
>
<i />
<i />

View File

@@ -1506,7 +1506,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name

View File

@@ -5703,6 +5703,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 +5790,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"
@@ -6869,7 +6871,7 @@ exports[`Locale Provider should display the text as ar 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -10299,6 +10301,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 +10388,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"
@@ -11465,7 +11469,7 @@ exports[`Locale Provider should display the text as bg 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -14895,6 +14899,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 +14986,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"
@@ -16061,7 +16067,7 @@ exports[`Locale Provider should display the text as ca 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -19491,6 +19497,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 +19584,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"
@@ -20657,7 +20665,7 @@ exports[`Locale Provider should display the text as cs 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -24087,6 +24095,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 +24182,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"
@@ -25253,7 +25263,7 @@ exports[`Locale Provider should display the text as de 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -28683,6 +28693,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 +28780,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"
@@ -29849,7 +29861,7 @@ exports[`Locale Provider should display the text as el 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -33279,6 +33291,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 +33378,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"
@@ -34445,7 +34459,7 @@ exports[`Locale Provider should display the text as en 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -37875,6 +37889,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 +37976,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"
@@ -39041,7 +39057,7 @@ exports[`Locale Provider should display the text as en-gb 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -42471,6 +42487,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 +42574,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"
@@ -43637,7 +43655,7 @@ exports[`Locale Provider should display the text as es 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -47067,6 +47085,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 +47172,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"
@@ -48233,7 +48253,7 @@ exports[`Locale Provider should display the text as et 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -51663,6 +51683,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 +51770,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"
@@ -52829,7 +52851,7 @@ exports[`Locale Provider should display the text as fa 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -56259,6 +56281,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 +56368,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"
@@ -57425,7 +57449,7 @@ exports[`Locale Provider should display the text as fi 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -60855,6 +60879,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 +60966,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"
@@ -62021,7 +62047,7 @@ exports[`Locale Provider should display the text as fr 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -65451,6 +65477,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 +65564,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"
@@ -66617,7 +66645,7 @@ exports[`Locale Provider should display the text as fr 2`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -70047,6 +70075,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 +70162,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"
@@ -71213,7 +71243,7 @@ exports[`Locale Provider should display the text as is 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -74643,6 +74673,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 +74760,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"
@@ -75809,7 +75841,7 @@ exports[`Locale Provider should display the text as it 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -79239,6 +79271,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 +79358,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"
@@ -80405,7 +80439,7 @@ exports[`Locale Provider should display the text as ja 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -83835,6 +83869,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 +83956,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"
@@ -85001,7 +85037,7 @@ exports[`Locale Provider should display the text as ko 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -88431,6 +88467,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 +88554,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"
@@ -89597,7 +89635,7 @@ exports[`Locale Provider should display the text as ku-iq 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -93027,6 +93065,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 +93152,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"
@@ -94193,7 +94233,7 @@ exports[`Locale Provider should display the text as nb 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -97623,6 +97663,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 +97750,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"
@@ -98789,7 +98831,7 @@ exports[`Locale Provider should display the text as nl 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -102219,6 +102261,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 +102348,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"
@@ -103385,7 +103429,7 @@ exports[`Locale Provider should display the text as nl-be 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -106815,6 +106859,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 +106946,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"
@@ -107981,7 +108027,7 @@ exports[`Locale Provider should display the text as pl 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -111411,6 +111457,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 +111544,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"
@@ -112577,7 +112625,7 @@ exports[`Locale Provider should display the text as pt 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -116007,6 +116055,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 +116142,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"
@@ -117173,7 +117223,7 @@ exports[`Locale Provider should display the text as pt-br 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -120603,6 +120653,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 +120740,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"
@@ -121769,7 +121821,7 @@ exports[`Locale Provider should display the text as ru 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -125199,6 +125251,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 +125338,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"
@@ -126365,7 +126419,7 @@ exports[`Locale Provider should display the text as sk 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -129795,6 +129849,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 +129936,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"
@@ -130961,7 +131017,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -134391,6 +134447,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 +134534,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"
@@ -135557,7 +135615,7 @@ exports[`Locale Provider should display the text as sv 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -138987,6 +139045,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 +139132,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"
@@ -140153,7 +140213,7 @@ exports[`Locale Provider should display the text as th 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -140459,7 +140519,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 +140534,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 +140547,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 +141253,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 +142119,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 +142132,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 +142857,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 +143643,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 +143730,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 +143868,7 @@ exports[`Locale Provider should display the text as tr 1`] = `
/>
</span>
<span>
Month
Ay
</span>
</label>
<label
@@ -143825,7 +143887,7 @@ exports[`Locale Provider should display the text as tr 1`] = `
/>
</span>
<span>
Year
Yıl
</span>
</label>
</div>
@@ -144749,7 +144811,7 @@ exports[`Locale Provider should display the text as tr 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -148179,6 +148241,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 +148328,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"
@@ -149345,7 +149409,7 @@ exports[`Locale Provider should display the text as uk 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -152775,6 +152839,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 +152926,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"
@@ -153941,7 +154007,7 @@ exports[`Locale Provider should display the text as vi 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -157371,6 +157437,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 +157524,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"
@@ -158537,7 +158605,7 @@ exports[`Locale Provider should display the text as zh-cn 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name
@@ -161967,6 +162035,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 +162122,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"
@@ -163133,7 +163203,7 @@ exports[`Locale Provider should display the text as zh-tw 1`] = `
>
<tr>
<th
class=""
class="ant-table-column-has-filters"
>
<span>
Name

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

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

@@ -13,6 +13,8 @@
.@{mention-prefix-cls}-editor {
.input;
min-height: @input-height-base;
height: auto; // To override height in .input mixin
line-height: @line-height-base;
padding: 0;
display: block;
@@ -29,6 +31,7 @@
}
.public-DraftEditorPlaceholder-root {
position: absolute;
pointer-events: none;
.public-DraftEditorPlaceholder-inner {
color: @input-placeholder-color;
opacity: 1;

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

@@ -45,7 +45,7 @@
border: @border-width-base @border-style-base @border-color-base;
background-color: @component-background;
margin-right: 8px;
font-family: Arial;
font-family: @pagination-font-family;
outline: 0;
a {
@@ -134,7 +134,7 @@
&-next,
&-jump-prev,
&-jump-next {
font-family: Arial;
font-family: @pagination-font-family;
cursor: pointer;
color: @text-color;
border-radius: @border-radius-base;

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 @@ 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,12 +37,13 @@ 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` |
| 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 |
| size | Size of Select input. `default` `large` `small` | string | default |
| tokenSeparators | Separator used to tokenize on tag/multiple mode | string\[] | |
| value | Current selected option. | string\|number\|string\[]\|number\[] | - |

View File

@@ -38,11 +38,12 @@ export interface SelectProps extends AbstractSelectProps {
defaultValue?: SelectValue;
mode?: 'default' | 'multiple' | 'tags' | 'combobox';
optionLabelProp?: string;
onChange?: (value: SelectValue) => void;
onSelect?: (value: SelectValue, option: Object) => any;
onChange?: (value: SelectValue, option: React.ReactElement<any> | React.ReactElement<any>[]) => void;
onSelect?: (value: SelectValue, option: React.ReactElement<any>) => any;
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

@@ -46,6 +46,7 @@ title: Select
| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` combobox 模式下为 `value` |
| placeholder | 选择框默认文字 | string | - |
| showSearch | 使单选模式可搜索 | boolean | false |
| showArrow | 是否显示下拉小箭头 | boolean | true |
| size | 选择框大小,可选 `large` `small` | string | default |
| tags | 可以把随意输入的条目作为 tag输入项不需要与下拉选项匹配2.9 之后废弃,请使用 `mode` | boolean | false |
| tokenSeparators | 在 tags 和 multiple 模式下自动分词的分隔符 | string\[] | |

View File

@@ -58,10 +58,10 @@
top: 50%;
right: @control-padding-horizontal - 1px;
line-height: 1;
transform: translateY(-50%);
margin-top: -@font-size-sm / 2;
transform-origin: 50% 50%;
color: @disabled-color;
font-size: 12px;
font-size: @font-size-sm;
* {
display: none;
@@ -69,7 +69,7 @@
&:before {
content: '\e61d';
transition: transform 0.2s ease;
transition: transform .3s;
}
}
@@ -376,11 +376,8 @@
}
&-open {
.@{select-prefix-cls}-arrow {
-ms-transform: rotate(180deg);
&:before {
transform: rotate(180deg);
}
.@{select-prefix-cls}-arrow:before {
transform: rotate(180deg);
}
.@{select-prefix-cls}-selection {
.active();
@@ -456,6 +453,7 @@
padding-left: 0; // Override default ul/ol
list-style: none;
max-height: 250px;
overflow: auto;
&-item-group-list {
margin: 0;
@@ -491,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

@@ -5,7 +5,7 @@ exports[`renders ./components/spin/demo/basic.md correctly 1`] = `
class="ant-spin ant-spin-spinning"
>
<span
class="ant-spin-dot"
class="ant-spin-dot ant-spin-dot-spin"
>
<i />
<i />
@@ -20,7 +20,7 @@ exports[`renders ./components/spin/demo/custom-indicator.md correctly 1`] = `
class="ant-spin ant-spin-spinning"
>
<i
class="anticon anticon-spin anticon-loading"
class="anticon anticon-spin anticon-loading ant-spin-dot"
style="font-size:24px"
/>
</div>
@@ -75,7 +75,7 @@ exports[`renders ./components/spin/demo/inside.md correctly 1`] = `
class="ant-spin ant-spin-spinning"
>
<span
class="ant-spin-dot"
class="ant-spin-dot ant-spin-dot-spin"
>
<i />
<i />
@@ -133,7 +133,7 @@ exports[`renders ./components/spin/demo/size.md correctly 1`] = `
class="ant-spin ant-spin-sm ant-spin-spinning"
>
<span
class="ant-spin-dot"
class="ant-spin-dot ant-spin-dot-spin"
>
<i />
<i />
@@ -145,7 +145,7 @@ exports[`renders ./components/spin/demo/size.md correctly 1`] = `
class="ant-spin ant-spin-spinning"
>
<span
class="ant-spin-dot"
class="ant-spin-dot ant-spin-dot-spin"
>
<i />
<i />
@@ -157,7 +157,7 @@ exports[`renders ./components/spin/demo/size.md correctly 1`] = `
class="ant-spin ant-spin-lg ant-spin-spinning"
>
<span
class="ant-spin-dot"
class="ant-spin-dot ant-spin-dot-spin"
>
<i />
<i />
@@ -177,7 +177,7 @@ exports[`renders ./components/spin/demo/tip.md correctly 1`] = `
class="ant-spin ant-spin-spinning ant-spin-show-text"
>
<span
class="ant-spin-dot"
class="ant-spin-dot ant-spin-dot-spin"
>
<i />
<i />

View File

@@ -0,0 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Spin should render custom indicator when it's set 1`] = `
<div
class="ant-spin ant-spin-spinning"
>
<div
class="custom-indicator ant-spin-dot"
/>
</div>
`;

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { shallow } from 'enzyme';
import { shallow, render } from 'enzyme';
import Spin from '..';
describe('Spin', () => {
@@ -15,9 +15,9 @@ describe('Spin', () => {
it('should render custom indicator when it\'s set', () => {
const customIndicator = <div className="custom-indicator" />;
const wrapper = shallow(
const wrapper = render(
<Spin indicator={customIndicator} />
);
expect(wrapper.contains(customIndicator)).toEqual(true);
expect(wrapper).toMatchSnapshot();
});
});

View File

@@ -15,7 +15,7 @@ When part of the page is waiting for asynchronous data or during a rendering pro
| Property | Description | Type | Default Value |
| -------- | ----------- | ---- | ------------- |
| delay | specifies a delay in milliseconds for loading state (prevent flush) | number (milliseconds) | - |
| indicator | React node of the spinning indicator | ReactNode | - |
| indicator | React node of the spinning indicator | ReactElement | - |
| size | size of Spin, options: `small`, `default` and `large` | string | `default` |
| spinning | whether Spin is spinning | boolean | true |
| tip | customize description content when Spin has children | string | - |

View File

@@ -5,6 +5,8 @@ import Animate from 'rc-animate';
import isCssAnimationSupported from '../_util/isCssAnimationSupported';
import omit from 'omit.js';
export type SpinIndicator = React.ReactElement<any>;
export interface SpinProps {
prefixCls?: string;
className?: string;
@@ -14,7 +16,7 @@ export interface SpinProps {
tip?: string;
delay?: number;
wrapperClassName?: string;
indicator?: React.ReactNode;
indicator?: SpinIndicator;
}
export interface SpinState {
@@ -96,8 +98,27 @@ export default class Spin extends React.Component<SpinProps, SpinState> {
}
}
}
renderIndicator() {
const { prefixCls, indicator } = this.props;
const dotClassName = `${prefixCls}-dot`;
if (React.isValidElement(indicator)) {
return React.cloneElement((indicator as SpinIndicator), {
className: classNames((indicator as SpinIndicator).props.className, dotClassName),
});
}
return (
<span className={classNames(dotClassName, `${prefixCls}-dot-spin`)}>
<i />
<i />
<i />
<i />
</span>
);
}
render() {
const { className, size, prefixCls, tip, wrapperClassName, indicator, ...restProps } = this.props;
const { className, size, prefixCls, tip, wrapperClassName, ...restProps } = this.props;
const { spinning, notCssAnimationSupported } = this.state;
const spinClassName = classNames(prefixCls, {
@@ -111,20 +132,12 @@ export default class Spin extends React.Component<SpinProps, SpinState> {
const divProps = omit(restProps, [
'spinning',
'delay',
'indicator',
]);
const spinIndicator = indicator ? indicator : (
<span className={`${prefixCls}-dot`}>
<i />
<i />
<i />
<i />
</span>
);
const spinElement = (
<div {...divProps} className={spinClassName} >
{spinIndicator}
{this.renderIndicator()}
{tip ? <div className={`${prefixCls}-text`}>{tip}</div> : null}
</div>
);

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