Compare commits

...

719 Commits

Author SHA1 Message Date
偏右
f0234375d9 Add changelog for 3.0.2 (#8643)
* Add changelog for 3.0.2

* Fix 2.x changelog links

* fix typo

* lock react-virtualized for ssr test
2017-12-18 10:51:43 +08:00
afc163
7baa81ced1 Fix input number handler disabled style 2017-12-18 09:55:56 +08:00
afc163
80686df38e update snapshot 2017-12-18 09:48:43 +08:00
afc163
a827553604 upgrade deps 2017-12-17 22:03:47 +08:00
afc163
7d082c1dc5 Fix submenu popup issue when specified unexisted defaultOpenKeys
close #8475
2017-12-17 19:11:56 +08:00
afc163
0ecb6ad45f Fix prop locale not working in DatePicker/RangePicker
close #8635
2017-12-17 17:11:54 +08:00
afc163
9cdae0053d Fix css priority, close #8559 2017-12-17 16:47:11 +08:00
afc163
f64ddef4ff tweak pagination style 2017-12-17 16:44:26 +08:00
afc163
705f568f6c update doc 2017-12-17 14:51:52 +08:00
Wei Zhu
6b38d2b6e9 Add Chinese version link 2017-12-16 23:19:08 +08:00
Wei Zhu
f688e732f5 Add Chinese version contributing guide 2017-12-16 23:15:40 +08:00
afc163
7a98f6236f Fix ts error 2017-12-16 21:10:15 +08:00
afc163
b49c0ac35c Fix snapshot test 2017-12-16 18:54:51 +08:00
afc163
202230356a Fix notification width in small screen, close #8631 2017-12-16 18:25:08 +08:00
afc163
028dcea5ec site: fix repsonsive style 2017-12-16 18:22:15 +08:00
afc163
3af6464db4 Fix Card Meta title text overflow, close #8597 2017-12-16 18:11:22 +08:00
afc163
404677a68a site: fix extra # in location 2017-12-16 17:35:28 +08:00
afc163
9b2ca4b1aa Fix List pagination margin, close #8562 2017-12-16 17:31:41 +08:00
afc163
f005974c56 refactor list less code 2017-12-16 17:29:49 +08:00
afc163
754d330bae Hide menu when collapsedWidth is 0, close #8587 2017-12-15 15:15:30 +08:00
afc163
7521348606 breakpoints of Layout.Sider should be same as Grid
close #8620
2017-12-15 14:37:36 +08:00
afc163
f54d73617f Fix switch demo 2017-12-15 13:47:46 +08:00
Wei Zhu
7d58589cf5 Revise contributing document (#8550) 2017-12-14 21:31:51 -06:00
Wei Zhu
3cb0e2e7e1 Fix typo 2017-12-15 10:32:19 +08:00
afc163
b84bf85526 update pagination active item design 2017-12-15 10:30:19 +08:00
Wei Zhu
e71b68dd1d Add antd-migration-helper to CHANGELOG 2017-12-15 10:25:41 +08:00
Benjy Cui
df1c56ee18 docs: update docs 2017-12-15 10:00:28 +08:00
GauravV-02
fffde2d836 Resolved type name collisions (#8605) 2017-12-13 20:49:44 -06:00
afc163
a9797ac4ce Fix IE startsWith 2017-12-13 21:36:19 +08:00
afc163
336c3613e8 site: fix navigator.language undefined 2017-12-13 20:04:09 +08:00
Dane David
e496fffbb5 Docs fix for Tree Select (#8589) 2017-12-13 18:49:11 +08:00
Wang Jun
d825e27667 fix loading (#8571) 2017-12-13 18:49:00 +08:00
afc163
8f1fd4d68b Fix notFoundContent not working in AutoComplete, close #8553 2017-12-13 17:05:36 +08:00
afc163
0eac8aa1c6 Fix table title/footer/size style, close #8577 2017-12-13 11:19:52 +08:00
afc163
cd5761ffe6 update form doc 2017-12-13 10:50:03 +08:00
afc163
d6e429cd70 Tweak RangePicker align 2017-12-12 10:14:38 +08:00
afc163
3e0df406f1 Fix unexpected scrollTop change 2017-12-11 20:34:11 +08:00
Wei Zhu
d1568c959c Lock babel-eslint version
https://travis-ci.org/ant-design/ant-design/jobs/314603504
2017-12-11 16:28:24 +08:00
afc163
d7dcb56dfc upgrade react-slick, close #8455 2017-12-11 16:19:41 +08:00
afc163
45559c84be Fix arrow position of Popover, close #8548 2017-12-11 16:02:53 +08:00
afc163
1db952b575 clear unused popover style code, close #8549 2017-12-11 15:28:44 +08:00
JaePil Jung
68d4e34a10 fixed typo error. (#8542) 2017-12-11 13:45:10 +08:00
Benjy Cui
1a0301bc08 bump 3.0.1 2017-12-11 10:04:59 +08:00
Benjy Cui
107949be01 docs: add change log for 3.0.1 (#8510) 2017-12-11 10:02:53 +08:00
afc163
1ec68e7ba6 Improve 3.0 changelog, close #8445 2017-12-10 16:59:21 +08:00
afc163
31a0654ef9 Avoid affix element is higher than view port 2017-12-10 16:50:39 +08:00
afc163
e13c6d87fa Fix mini Pagination background color 2017-12-10 16:42:40 +08:00
afc163
913daa2668 Tweak table head icons style 2017-12-10 16:36:59 +08:00
afc163
a3271d9a03 update demo code style 2017-12-10 16:20:31 +08:00
afc163
eae1a0044c Fix nested Table size style, close #8525 2017-12-10 16:20:02 +08:00
GauravV-02
b5f13b49ae Fixed typo in documentation (#8534) 2017-12-10 11:23:45 +08:00
afc163
edd592cb9d Fix broken animation of Menu and Collapse 2017-12-08 22:25:50 +08:00
ddcat1115
f780759f91 fix large size formItem vertical align (#8495)
* - fix large size input with prefix/suffix vertical align
- fix large size button vertical align

* use large size for formItem default line-height

* improve
2017-12-08 20:57:30 +08:00
Wei Zhu
68c1da8045 site: update generateColorLess.js 2017-12-08 17:09:17 +08:00
Dane David
e8d3be5dc2 Make Table props optional (#8515) 2017-12-08 15:36:32 +08:00
afc163
accf92336d Fix color palette generator, close #8512 2017-12-08 14:44:24 +08:00
Dane David
687b058dc0 Add missing type definitions for table #8507 (#8511) 2017-12-08 14:24:34 +08:00
Wei Zhu
18723a37ee Update snapshot 2017-12-08 11:36:43 +08:00
Leo Yin
7a50248477 docs(complex-table): translation for en-US (#8460)
* feat(complex-table): translation for en-US

* fix(complex-tables.md): multiple issues.
2017-12-08 10:50:24 +08:00
Chuang Yu
36831c7f1d Add style prop for Divider (#8504) 2017-12-07 23:16:25 +08:00
wangxiaolei
d7475f47cb Fix menu doc in english version. (#8503) 2017-12-07 21:39:27 +08:00
Wei Zhu
9bbfe534b2 docs: remove redundant quote 2017-12-07 15:42:47 +08:00
Wei Zhu
43628b9848 docs: document Table[expandRowByClick] 2017-12-07 15:14:41 +08:00
Dane David
a1ada4f4f6 Add expandRowByClick API to Table docs (#8490) 2017-12-07 15:11:39 +08:00
konakona
b77adb352f Fix wrong translate (#8488) 2017-12-07 11:28:53 +08:00
Taylor Sabell
0589b23693 docs: fixed grammatical error (#8484) 2017-12-07 09:24:09 +08:00
afc163
b84cb4ba45 Fix typo 2017-12-06 23:23:11 +08:00
afc163
61ab3a4a9e update switch demo 2017-12-06 20:20:32 +08:00
afc163
dd3f7f2da1 Revert table responsive code, close #8465 2017-12-06 19:58:21 +08:00
Nidhi Agarwal
6d0b488d7f Select - Moving defaultActiveFirstOption to AbstractSelectProps (#8383)
defaultActiveFirstOption Prop should be exposed to components which are extending AbstractSelectProps, even according the documentation of auto-complete.
2017-12-06 15:37:12 +08:00
afc163
0402e0333d Fix Notification less compile error, close #8437 2017-12-06 10:19:50 +08:00
Kamron Batman
3eb91cef47 docs: update start-end.md (#8462)
Fixes english and spelling in start-end.md.
2017-12-06 09:35:34 +08:00
Wei Zhu
1b2a9550d9 ListItemMetaProps's description and title should be optional 2017-12-05 16:28:12 +08:00
Wei Zhu
e27061ea5b ListItemProps.extra should be optional 2017-12-05 16:16:09 +08:00
偏右
693d3cec9c Fix typo 2017-12-05 15:52:34 +08:00
偏右
28f8e03ecf Add 3.0 medium link 2017-12-05 15:44:54 +08:00
Wei Zhu
4d74d5c22e Update snapshot for 2e45074 2017-12-05 15:27:26 +08:00
Wei Zhu
bf27b99947 v2-compatible-reset.css only exists in lib/style 2017-12-05 15:25:18 +08:00
Wei Zhu
9bcb8b8eec Fix typo 2017-12-05 15:21:20 +08:00
Wei Zhu
427be4cff5 Remove unused style property 2017-12-05 15:16:14 +08:00
Wei Zhu
28d13e2539 Add missing v2-compatible-reset.less 2017-12-05 15:12:14 +08:00
afc163
2e45074fab Remove extra wrapper of Card 2017-12-05 13:36:52 +08:00
Wei Zhu
ed44dfaeb8 site: Add diff 2017-12-05 10:24:49 +08:00
Wei Zhu
12b6fceb37 site: document dist/antd.js
Close #8442
2017-12-05 10:18:41 +08:00
Wei Zhu
4d7ce541cd docs: TableColumnConfig has been renamed to ColumnProps
Close #8438
2017-12-05 09:50:23 +08:00
afc163
3162dd3b51 site: improve changelog style 2017-12-04 23:43:44 +08:00
Wei Zhu
b541fad312 Update CHANGELOG.en-US.md 2017-12-04 23:30:00 +08:00
Wei Zhu
cc5fb7bf2d Update CHANGELOG.zh-CN.md 2017-12-04 23:29:43 +08:00
afc163
58b018a06e Fix changelog 2017-12-04 23:22:55 +08:00
陆离
99cf727c01 fix invalid compatible-reset css dir in changelog (#8432) 2017-12-04 23:19:55 +08:00
afc163
b02aa7bddc site: tweak logo text 2017-12-04 23:18:53 +08:00
afc163
2713870460 change primary color, #8430 2017-12-04 22:29:23 +08:00
Wei Zhu
4bd06af002 site: Add daybreak blue translation 2017-12-04 22:14:05 +08:00
Wei Zhu
e022eac717 site: Add blog link 2017-12-04 22:05:42 +08:00
Wei Zhu
6b3daed369 site: 例子 => Demo 2017-12-04 21:53:45 +08:00
Wei Zhu
6ed30ada37 site: indent code block 2017-12-04 21:51:04 +08:00
afc163
6836487e18 Fix changelog style 2017-12-04 21:48:42 +08:00
Wei Zhu
44b529b0d5 Omit loading for Switch 2017-12-04 20:45:09 +08:00
liangfei
cd1af8b903 fix typo (#8428)
Saleforce => Salesforce
2017-12-04 20:38:32 +08:00
Wei Zhu
9d7fec97c1 metion 2.x maintainning 2017-12-04 20:17:42 +08:00
Wei Zhu
49e036e9a6 Bump 3.0.0 2017-12-04 19:55:39 +08:00
Wei Zhu
e73349e7d3 site: update release message 2017-12-04 19:54:21 +08:00
Wei Zhu
342f7c4a63 Add 3.0 changelog (#8364) 2017-12-04 19:53:07 +08:00
afc163
ed41ca0dbb site: add emojis 2017-12-04 18:17:16 +08:00
afc163
86ebc32250 update translation 2017-12-04 18:15:38 +08:00
afc163
c9b2efc9e8 Add more test cases for Upload 2017-12-04 15:59:39 +08:00
Wei Zhu
6172f773ac docs: Add import on demand link. 2017-12-04 14:58:36 +08:00
afc163
5f35a69858 update steps demo 2017-12-04 14:51:51 +08:00
Wei Zhu
329da9e55f site: update upgrade message 2017-12-04 14:51:03 +08:00
Wei Zhu
b8e6a5fb9e Update less color script 2017-12-04 14:51:03 +08:00
ddcat1115
1f0ee08574 Form item vertical align (#8415)
* fix formItem vertical align

* fix formItem vertical align

* rebase master
2017-12-04 14:00:15 +08:00
afc163
ebcf7b43e8 site: update ant design logo 2017-12-04 11:47:03 +08:00
Wei Zhu
aa81956603 site: Add 2.x doc link 2017-12-04 11:29:39 +08:00
afc163
cc43bd3f12 Improve advanced form style, close #8339 2017-12-04 10:47:01 +08:00
afc163
4dc310c331 site: fix logo wrap in IE11 2017-12-04 09:59:22 +08:00
afc163
554d27e725 Improve switch style 2017-12-03 23:36:19 +08:00
afc163
59cb320a7b Fix searchInput undefined in demo 2017-12-03 19:10:18 +08:00
afc163
81472aaf3b Fix custom filter dropdown focus issue, close #8411 2017-12-03 19:09:39 +08:00
afc163
6bb368083b site: fix banner button link 2017-12-03 18:09:34 +08:00
afc163
76b4afb752 Fix ssr build and scroller not working when location changed 2017-12-03 17:19:59 +08:00
afc163
85416ce577 site: highlight anchor of article 2017-12-03 16:13:04 +08:00
Wei Zhu
45815d1148 Refactor confirm (#8409)
* Refactor confirm

* Add okCancel test

* Only test React 16

* Upgrade rc-dialog
2017-12-02 22:10:27 +08:00
afc163
bbbdb9911d Tweak popover arrow style 2017-12-02 17:13:21 +08:00
Graeme Yeates
1e47a6c518 Control checkbox button size with btn-height base instead of input-height-base (#8340) 2017-12-02 16:05:51 +08:00
afc163
f26261de31 Support Switch[loading] 2017-12-02 16:00:27 +08:00
afc163
90736521bc Fix locale switch button 2017-12-01 20:37:14 +08:00
afc163
bba0fd4220 Merge branch 'antd-3.0' 2017-12-01 20:32:56 +08:00
afc163
5e48badbb7 Improve home page style 2017-12-01 20:27:44 +08:00
Wei Zhu
2299ad41aa Add focus() and blur() to Input.Search 2017-12-01 19:39:32 +08:00
Wei Zhu
e613dc9050 Remove debug flag 2017-12-01 19:29:51 +08:00
Wei Zhu
d2dc88c470 Add focus() and blur() document
Close #3790
2017-12-01 19:28:41 +08:00
Wei Zhu
25f51cdd64 Add focus() and blur() for Slider 2017-12-01 18:01:14 +08:00
Wei Zhu
ee93047bad Update rc-slider 2017-12-01 17:18:57 +08:00
Wei Zhu
1b9b92f67d Update lint-staged 2017-12-01 16:17:10 +08:00
ddcat1115
c6f4b38471 new pub notification 2017-12-01 15:42:54 +08:00
ddcat1115
0b31c256e3 tweak home style 2017-12-01 14:43:56 +08:00
Wei Zhu
7fa0599695 Merge branch 'antd-3.0' 2017-12-01 13:19:38 +08:00
Wei Zhu
01f4b4e713 Merge branch 'master' into antd-3.0 2017-12-01 11:50:07 +08:00
ddcat1115
5458c6a40c fix style and favicon 2017-12-01 11:25:13 +08:00
Flynn
071149cfbb feature:add onCalendarChange for RangePicker (#8355)
* feature:add onCalendarChange for RangePicker

The event trigger when start time or end time is changing, which is useful for districting range user can select.

* Update index.zh-CN.md

update doc

* Update index.zh-CN.md

* Update index.zh-CN.md
2017-12-01 10:50:25 +08:00
Mathew
6f37caefe7 Update de_DE.tsx to support Upload component (#8394)
- Added german translations
2017-12-01 10:30:31 +08:00
Nathan Griffin
51b6e4904a Adding missing type properties (#8395) 2017-12-01 10:29:48 +08:00
afc163
dfc6ca49a6 Fix npm run site 2017-11-30 22:07:21 +08:00
afc163
f7a8d02f09 update home page style, close #8238 2017-11-30 21:38:48 +08:00
Sam Maxwell
378084376a update moment package number (#8388) 2017-11-30 20:06:00 +08:00
Benjy Cui
57dcc78989 fix: should not override default footer, close: #8379 2017-11-30 17:24:51 +08:00
Wei Zhu
b44a0c93cd Add focus() blur() and autoFocus to DatePicker (#8345) 2017-11-30 09:54:31 +08:00
Wei Zhu
4aeb811b72 Remove deprecations (#8351) 2017-11-30 09:53:32 +08:00
afc163
b8b591c593 bump 3.0.0-rc.4 2017-11-29 21:25:05 +08:00
afc163
5871691e77 update introduce text 2017-11-29 21:23:33 +08:00
afc163
927853a1f1 seperate dark style of menu 2017-11-29 21:08:44 +08:00
afc163
05200385ee improve form demo 2017-11-29 21:04:45 +08:00
偏右
b531de3fee Upgrade dev deps and fix lints (#8358)
* upgrade devDeps and fix lint

* Fix stylelint problems
2017-11-29 21:00:16 +08:00
Wei Zhu
179528af50 Don't change fileList when beforeUpload returns false (#8299)
Close #8036
2017-11-29 20:28:19 +08:00
Wei Zhu
16b69312db Revise docs (#8368) 2017-11-29 20:27:52 +08:00
ddcat1115
44c52561e5 fix page jumper style 2017-11-29 15:29:35 +08:00
ddcat1115
eeb642e2bd fix menu style 2017-11-29 14:39:56 +08:00
niko
be1cbd4eae upgrade rc-calendar dependency to 9.3.0 (#8353) 2017-11-29 11:23:15 +08:00
ddcat1115
91fc059c9d fix input with addon(in form) vertical align issue (#8325) 2017-11-29 11:20:38 +08:00
偏右
250eed0fc9 Link button (#8343)
* support link button

* Fix type
2017-11-29 11:20:22 +08:00
ddcat1115
2aedc275d4 improve footer style 2017-11-29 00:08:48 +08:00
afc163
c08e486e1a Fix typo 2017-11-28 19:02:16 +08:00
ddcat1115
0710f826f3 fix menu text color 2017-11-28 17:59:28 +08:00
ddcat1115
49a49adae3 change lang-button pos & improve footer responsive 2017-11-28 17:01:41 +08:00
ddcat1115
721a5621c8 reset text-color and etc. 2017-11-28 16:16:37 +08:00
afc163
bd9fba9f45 Better responsive style of Table 2017-11-28 14:35:46 +08:00
ddcat1115
04a00e6e14 update logo 2017-11-28 11:18:18 +08:00
Wei Zhu
6f312a716b Update snapshot 2017-11-28 11:12:51 +08:00
Wei Zhu
57d80c0c70 Upgrade rc-rate 2017-11-28 10:49:56 +08:00
afc163
58e742d987 Fix less path warning, close #8388 2017-11-28 10:49:04 +08:00
Wei Zhu
c8a49c45fc Upgrade rc-select 2017-11-28 09:51:29 +08:00
afc163
72741db902 Fix margin of nested FormItem, close #8320 2017-11-27 22:14:15 +08:00
Cody Chan
086ecec310 docs(transfer): append description for render property (#8335) 2017-11-27 20:48:16 +08:00
Wei Zhu
143a7232e3 site: Add replaceLib plugin to babel 2017-11-27 18:28:52 +08:00
ddcat1115
ea338eb637 Merge branch 'antd-3.0' of https://github.com/ant-design/ant-design into antd-3.0 2017-11-27 17:09:09 +08:00
ddcat1115
095acc4839 tweak style 2017-11-27 17:08:45 +08:00
afc163
b2810f2fa9 site: fix menu z-index 2017-11-27 16:51:59 +08:00
ddcat1115
daf596a898 Upgrade antd 3.0 site style (#8324)
* 3.0 site update

* update footer

* improve
2017-11-27 15:36:58 +08:00
afc163
c0b7bdb9f3 Tweak components style detail 2017-11-27 14:51:46 +08:00
afc163
bf70d30a60 no prevent label click default behavior 2017-11-27 11:02:47 +08:00
afc163
9a49a5c775 revert 61968b91 2017-11-27 11:01:06 +08:00
ChrisF
cd7a04a069 change children prop of TableProps to React.ReactNode (#8317)
* make children prop of RadioGroupProps optional

* change children prop of TableProps to React.ReactNode
2017-11-27 10:53:55 +08:00
afc163
539cca5cc4 update snapshot 2017-11-27 10:53:54 +08:00
afc163
7604495ab4 Fix RadioGroup id props 2017-11-27 10:49:17 +08:00
afc163
61968b91cf Fix link in form item label 2017-11-27 10:43:35 +08:00
afc163
892de0c609 update translation word 2017-11-27 00:09:59 +08:00
afc163
1662710acd contextMenu Dropdown, close #7232 2017-11-26 14:02:38 +08:00
ChrisF
eb5d423ca7 make children prop of RadioGroupProps optional (#8307) 2017-11-24 15:36:59 +08:00
Wei Zhu
8e907cebde Fix tree draggable demo
Close #8246
2017-11-24 15:29:36 +08:00
ddcat1115
0865824b61 fix buttonSize type
close #8304
2017-11-24 14:46:55 +08:00
afc163
e6940ad721 Fix enquire.js dep
close ant-design/ant-design-pro#280
2017-11-24 09:04:30 +08:00
Maximilian Meyer
6707824611 Update due to typo (#8288)
TYPO
2017-11-22 19:06:24 +08:00
ddcat1115
da14cba722 add 3 icons 2017-11-22 18:11:24 +08:00
afc163
c23e24b0f0 Merge branch 'master' into antd-3.0 2017-11-22 17:30:31 +08:00
afc163
1c7eb398d7 bump rc 2017-11-22 17:29:58 +08:00
afc163
dada590d2d Fix dark menu popup animation 2017-11-22 17:29:58 +08:00
Wei Zhu
a64337748a Fix table row create on every render.
Fix #8283
2017-11-22 17:27:32 +08:00
afc163
b2b60fdac4 3.0.0-rc.2 2017-11-22 16:59:43 +08:00
afc163
b90b04f3fe upgrade rc-form 2017-11-22 15:38:27 +08:00
潘晓升
8b2d7e3982 Update index.tsx (#8280)
add the “style” property for declare file
2017-11-22 14:46:40 +08:00
afc163
4a81e5584f Fix message destroy problem, close #8201 2017-11-22 14:44:06 +08:00
Wei Zhu
58fa1885fd docs: flay badge 2017-11-22 14:18:47 +08:00
Wei Zhu
462d7aa876 docs: No require skipLibCheck 2017-11-22 12:29:26 +08:00
Wei Zhu
605c685503 Enable noImplicitAny
Close #5627
2017-11-22 12:16:53 +08:00
Wei Zhu
d2b59938b8 Fix code style 2017-11-22 12:16:19 +08:00
Wei Zhu
541b9d146a Fix implicit any error for _util 2017-11-22 12:14:43 +08:00
Wei Zhu
b8a08f6e1d Fix implicit any error for Affix 2017-11-22 11:49:35 +08:00
Wei Zhu
c0a42480ae Fix implicit any error for Anchor 2017-11-22 11:34:46 +08:00
Wei Zhu
c27d4deb72 Fix implicit any error for AutoComplete 2017-11-22 11:26:04 +08:00
Wei Zhu
db560bb10d Fix implicit any error for Badge 2017-11-22 11:25:05 +08:00
Wei Zhu
de340a83ba Fix implicit any error for Breadcrumb 2017-11-22 11:10:33 +08:00
Wei Zhu
ebce4b3599 Fix implicit any error for Card 2017-11-22 11:07:19 +08:00
Wei Zhu
f4dc69f5f0 Fix implicit any error for Calendar 2017-11-22 11:05:19 +08:00
Wei Zhu
50f85480d1 Fix implicit any error for Carousel 2017-11-22 10:54:27 +08:00
afc163
669b3c5b2e update doc, close #8272 2017-11-22 10:50:39 +08:00
Wei Zhu
ecaf3a0883 Fix implicit any error for Cascader 2017-11-22 10:11:16 +08:00
Wei Zhu
2fe2e35a52 Fix implicit any error for Checkbox 2017-11-22 10:08:28 +08:00
Wei Zhu
9fd3588ac4 Fix implicit any error for DatePicker 2017-11-21 21:09:24 +08:00
Wei Zhu
93fcbdf334 Fix implicit any error for Divider 2017-11-21 20:48:22 +08:00
Wei Zhu
ad21c9837f Fix implicit any error for Form 2017-11-21 20:45:24 +08:00
Wei Zhu
bebc57978d Fix implicit any error for Grid 2017-11-21 20:38:30 +08:00
Wei Zhu
05c702838d Fix implicit any error for Input 2017-11-21 20:38:30 +08:00
Wei Zhu
bcbdd12ce1 Fix implicit any error for LocalProvider 2017-11-21 20:38:30 +08:00
Wei Zhu
f14d57dc14 Fix implicit any error for Mention 2017-11-21 20:38:30 +08:00
Wei Zhu
dc322a6a9c Fix implicit any error for Layout 2017-11-21 20:38:30 +08:00
Wei Zhu
e7042ae541 Fix implicit any error for List 2017-11-21 20:38:30 +08:00
afc163
084b444252 Fix home page style 2017-11-21 19:10:01 +08:00
afc163
b075aa606e fix register of undefined, #8249 2017-11-21 19:06:03 +08:00
Wei Zhu
b6c6ee8f3e Fix implicit any error for Modal and Menu 2017-11-21 17:38:51 +08:00
Wei Zhu
d8f6c3bd8c Fix implicit any error for Modal and Message 2017-11-21 17:20:25 +08:00
afc163
446977b916 fix lint 2017-11-21 17:05:44 +08:00
afc163
7ef169dbdc Add bisheng build in travis test 2017-11-21 17:01:38 +08:00
afc163
3646d0f9bc Fix ssr site build, ref #8249 2017-11-21 16:50:40 +08:00
afc163
a8e5690805 Merge branch 'master' into antd-3.0 2017-11-21 15:59:48 +08:00
slientcloud
499b81f79d fix(tooltip): support defaultVisible for tooltip, close #8257 (#8258) 2017-11-21 15:53:03 +08:00
afc163
1e1baf01f6 remove react extenals 2017-11-21 15:49:17 +08:00
Wei Zhu
8292808292 Fix implicit any error for Notification 2017-11-21 15:48:53 +08:00
Wei Zhu
c4c3e74149 Fix implicit any error for Pagination PopConfirm Popover Progress 2017-11-21 15:37:39 +08:00
Wei Zhu
9b5a16ba93 Fix implicit any for Radio 2017-11-21 15:22:27 +08:00
Wei Zhu
b647078baa Fix implicit any for Select Slider Spin Switch 2017-11-21 14:58:08 +08:00
Wei Zhu
5cb5a2ae9d Fix implicit any error for Table 2017-11-21 14:22:35 +08:00
jiang
8260e32d1d fix mobile menu (#8252) 2017-11-21 11:18:31 +08:00
Nokecy
08d27b92ee inputNumber 添加onKeyDown属性声明 (#8253) 2017-11-21 11:15:38 +08:00
afc163
6db2630e90 site: fix code demo box style in IE11 2017-11-21 11:12:20 +08:00
afc163
81fc6d613c Merge branch 'master' into antd-3.0 2017-11-21 10:19:39 +08:00
afc163
9dd858cc62 Fix selector priority, close #8245 2017-11-21 10:19:11 +08:00
Benjy Cui
00ff041d16 fix: submenu should work fine in dropdown, close: #8248 2017-11-21 10:06:26 +08:00
Wei Zhu
5e9daf08d7 Fix implicit any error for Tabs. 2017-11-20 22:06:01 +08:00
Wei Zhu
2cf3414d69 Improve TimePicker type definitions 2017-11-20 18:27:36 +08:00
Wei Zhu
ac7212eba8 Improve Tooltip type definitions 2017-11-20 18:20:16 +08:00
Wei Zhu
54b1715d2a Improve Transfer type definitions. 2017-11-20 17:54:19 +08:00
Wei Zhu
6837aedf69 Imporve tree and tree-select type definitions 2017-11-20 17:11:13 +08:00
Wei Zhu
cbaf54415e style: Use single quote 2017-11-20 16:53:56 +08:00
Wei Zhu
03e4411589 Improve upload type definition 2017-11-20 16:43:25 +08:00
Wei Zhu
45135e4ec8 Improve upload type definition. 2017-11-20 16:31:41 +08:00
Benjy Cui
e8b4892a70 site: fix demo, close: #8227 2017-11-20 15:19:43 +08:00
Wei Zhu
814f9a72de Set work-break explicitly form progress text 2017-11-20 14:59:13 +08:00
afc163
3406c6598a Fix submenu z-index 2017-11-20 14:58:03 +08:00
afc163
7049a45d8e Fix submenu width, close #8236 2017-11-20 14:37:14 +08:00
Wei Zhu
c37b1e8425 site: exclude palatte color
fix #8161
2017-11-20 12:25:45 +08:00
afc163
8e6e91b932 Fix menu active style
close ant-design/ant-design-pro#222
2017-11-20 10:56:56 +08:00
Benjy Cui
09fd564af9 feat: upgrade rc-menu (#8235) 2017-11-20 10:33:34 +08:00
Wei Zhu
5e0dd59e5c Bump 3.0.0-rc.1 2017-11-19 22:03:31 +08:00
Wei Zhu
2de0a6a522 Add use in TypeScript instruction (#8230) 2017-11-19 22:00:44 +08:00
Wei Zhu
cd67045e11 Update rc-time-picker 2017-11-19 21:35:46 +08:00
Wei Zhu
09aaa56243 Update snapshot 2017-11-19 21:07:08 +08:00
Wei Zhu
ca44eb9cd9 Remove react@0.14 and react@15 from peerDependencies 2017-11-19 20:39:35 +08:00
Wei Zhu
5d38ccf892 Oops. 2017-11-19 20:38:05 +08:00
Wei Zhu
4a97ed4bf0 Update rc-scroll-anim 2017-11-19 20:33:59 +08:00
Wei Zhu
409959e7c7 Update rc-scroll-admin 2017-11-19 20:25:59 +08:00
Wei Zhu
bf4ad93f2c Update rc-select 2017-11-19 20:14:53 +08:00
Wei Zhu
076c40ac31 Update rc-rate 2017-11-19 20:00:12 +08:00
Wei Zhu
816226ff92 Update rc-input-number 2017-11-19 19:59:26 +08:00
Wei Zhu
d5b56e522e Merge branch 'master' into antd-3.0 2017-11-19 14:26:05 +08:00
Wei Zhu
9fb590fe9d Stick eslint-plugin-react to 7.4.0
https://github.com/yannickcr/eslint-plugin-react/issues/1543
2017-11-19 14:25:17 +08:00
Wei Zhu
9678d3fcfd Focus && blur support (#8204)
* Add test for select

* Add focus() and blur() for AutoComplete

* Add focus() and blur() to Cascader

* Add focus test for input

* Add focus() and blur() for Checkbox

* Add focus() and blur() for Radio

* Add focus() and blur() for Switch

* Add blur() for TimePicker

* Add focus() and blur() to TreeSelect
2017-11-19 01:41:40 +08:00
Wei Zhu
22e5c0d954 Allow fix table selection column (#8195) 2017-11-18 23:46:24 +08:00
afc163
a4213c22af bump beta 2017-11-18 17:53:06 +08:00
afc163
0627d9a3a0 Fix MenuItem margin 2017-11-18 17:49:33 +08:00
afc163
797754d3fd Fix message cannot hide bug, close #8201 2017-11-18 15:26:02 +08:00
afc163
8ca9c9513d Merge branch 'master' into antd-3.0 2017-11-18 14:29:56 +08:00
afc163
5cca35cab9 update doc 2017-11-18 13:53:57 +08:00
David Tsai
b3b3ee043e Update Select component documentation (#8229)
Providing clarity through reworking the description(s) on usage.
2017-11-18 13:13:55 +08:00
afc163
32d96e366b Refator to allow set color of Rate easily
now we can use `<Rate style={{ color: '#00c' }}>`

close #8197
2017-11-18 01:10:46 +08:00
Wei Zhu
633708fee9 export BodyRowClass 2017-11-18 00:54:54 +08:00
Wei Zhu
67336fca7b Rename TableRow to BodyRow 2017-11-18 00:36:22 +08:00
Wei Zhu
5970dbb1ec Fix table row selected className
Close #8074 #8075
2017-11-18 00:03:30 +08:00
Benjy Cui
ac463a10f2 deps: upgrade form to 2.0.0 (#8207) 2017-11-17 21:19:10 +08:00
jiang
a5bf187271 update menu responsive, ref #4682 (#8226)
* update menu responsive, ref #4682

* update popover menu style
2017-11-17 19:17:37 +08:00
Wei Zhu
f78d33ed59 Update rc-table (#8187)
* Update rc-table

* Add table drag sorting demo
2017-11-17 18:53:07 +08:00
Wei Zhu
b39c5cc569 Fix footer nav 2017-11-17 18:30:17 +08:00
Wei Zhu
ca171f2a20 Add source-map 2017-11-17 17:23:48 +08:00
Wei Zhu
8fcb214100 3.0.0-beta.8 2017-11-17 14:50:18 +08:00
Wei Zhu
4f1da98045 Merge branch 'master' into antd-3.0 2017-11-17 14:39:53 +08:00
Wei Zhu
479a5cb743 Remove allowSyntheticDefaultImports (#8218) 2017-11-17 14:38:54 +08:00
afc163
b77e7ed554 Fix extra 0.5px height in chrome
close #8220
2017-11-17 12:13:07 +08:00
nikogu
fdf0c11ec7 Fixed List snapshots 2017-11-17 11:31:54 +08:00
niko
f6a730e2fe List empty style (#8190) 2017-11-17 11:25:29 +08:00
afc163
1e1c6d1c72 Merge branch 'master' into antd-3.0 2017-11-16 19:58:20 +08:00
afc163
46d1296045 Fix async test cases 2017-11-16 17:12:36 +08:00
Benjy Cui
06a1b6ed23 fix: should not throw error when keydown in menu, close: #8089 (#8211) 2017-11-16 16:08:30 +08:00
afc163
9a9196ca10 Fix doc 2017-11-15 17:02:49 +08:00
afc163
11a3ce4cc6 multiple emails 2017-11-15 17:01:19 +08:00
afc163
9b552087cd Fix tag test case 2017-11-15 15:00:29 +08:00
afc163
1117de7c6f site: fix version select width 2017-11-15 13:32:13 +08:00
afc163
e0be248847 Add antue 2017-11-14 23:05:51 +08:00
afc163
4535800fa3 update 2017-11-14 22:42:47 +08:00
Oleksandr Kovalchuk
fce6862696 Feature: uk_UA locale (#8169)
* Add uk-UA localization

Ukrainian localization for the following components:

- locale-provider
- DatePicker
- TimePicker
- Calendar

* Add uk_UA locale to test suite

* Add uk_UA locale to tests snapshot

Tests on CI are failing because there are no snapshot for uk_UA locale.
Generate a snapshot with `npm test -u` command and add it to the test
suite.
2017-11-14 16:10:54 +08:00
Wei Zhu
fbafe9eac1 Add table filter test 2017-11-13 22:36:50 +08:00
afc163
bf36ebdf5e Merge branch 'master' into antd-3.0 2017-11-13 21:24:32 +08:00
afc163
e3da638b53 bump 2017-11-13 21:15:32 +08:00
偏右
716c49c55f Update work-with-us.md 2017-11-13 15:48:19 +08:00
Wei Zhu
645be586f3 Run jest.useFakeTimers in beforeAll 2017-11-13 10:46:54 +08:00
Benjy Cui
16133aac65 docs: add validateMessage for createForm, close: #965 2017-11-13 10:36:16 +08:00
afc163
a4faaad810 Merge branch 'master' into antd-3.0 2017-11-13 10:24:58 +08:00
Arnaud Benhamdine
5402dfe66e Improve changelog english wording (#8173) 2017-11-12 19:17:15 +08:00
afc163
65b5769abd bump 2.13.10 2017-11-12 15:22:12 +08:00
afc163
cad769af91 No more __ANT_LAYOUT_SIDER in favor of #8077 2017-11-12 15:22:02 +08:00
afc163
2ecb52cd7c Add emoji for changelog 2017-11-12 15:02:15 +08:00
afc163
3c648820a0 Fix badge style 2017-11-12 14:10:41 +08:00
afc163
09af43c314 Allow Badge[status] usage with Badge[children], close #8164 2017-11-12 13:58:12 +08:00
Graeme Yeates
b46cb4b740 Add a variable to control processing colors (#8166) 2017-11-11 14:15:16 +08:00
Wei Zhu
55c85f77a1 Update dependendies (#8150)
* deps: upgrade rc-menu, and close: #2837

* test: update snapshots

* Update rc-calendar

* Update rc-cascader

* Update rc-dialog

* Update dropdown

* Update rc-select@7.1.0

* Update rc-slider

* Update rc-time-picker

* Update rc-tooltip

* Update rc-tree-select

* Mock rc-trigger and Portal

* Fix animation warning when inlineCollapsed changes

* fix: should use SubMenu[popupClassName]

* Fix typescript error

* Fix lint

* fix: style for menu

* Mock rc-trigger for React 15

* Remvoe allow_failures
2017-11-11 00:07:03 +08:00
Benjy Cui
fe7386746c site: clean cached before start, close: benjycui/bisheng#113 2017-11-10 17:47:48 +08:00
afc163
4999a60643 update form demo 2017-11-10 17:19:47 +08:00
afc163
58e3743c6d Tweak cascader arrow style 2017-11-10 17:15:02 +08:00
afc163
2e126c1323 Fix Rate style under form item 2017-11-10 17:09:35 +08:00
Wei Zhu
0c7ce9db17 Use props
Related #7706
2017-11-10 09:48:07 +08:00
Zach Guo
c1ce2cd82c docs: fix pattern/form invalid tag error (#8159) 2017-11-10 09:35:27 +08:00
afc163
b53e76cbd5 Merge branch 'master' into antd-3.0 2017-11-09 20:37:30 +08:00
afc163
54188b8e97 Reset timer in test 2017-11-09 20:33:25 +08:00
afc163
148e5bd887 Fix super argument 2017-11-09 20:17:03 +08:00
afc163
ea185fe288 Fix code style 2017-11-09 20:14:51 +08:00
afc163
0eca38ba2f Add has sider test case, ref #8077 2017-11-09 20:13:59 +08:00
Yasin Uslu
b3e1192482 Detect Sider even if it's not first child of layout (#8077)
* Fix typo in layout

* Detect Sider even if it's not first child of layout
2017-11-09 20:04:34 +08:00
afc163
4022374f33 Fix snapshot 2017-11-09 19:49:40 +08:00
afc163
855e0ff78d Fix super argument 2017-11-09 19:45:55 +08:00
afc163
856ecd4ae3 Merge branch 'master' into antd-3.0 2017-11-09 19:45:06 +08:00
afc163
97a889da00 Fix snapshot 2017-11-09 19:38:04 +08:00
afc163
d30e398859 Fix upload.test.js 2017-11-09 19:34:48 +08:00
Graeme Yeates
8395de01a2 Add support for column defaultSortOrder (#6449) (#8111)
Fixes #6449
2017-11-09 19:30:24 +08:00
Lyndon001
dd531b8428 Update work-with-us.md 2017-11-09 03:36:55 -06:00
afc163
1b45a2c005 update footer 2017-11-09 16:53:05 +08:00
afc163
9ffd545b24 fix order 2017-11-09 16:50:29 +08:00
afc163
23033cb9c1 Add work-with-us 2017-11-09 16:49:04 +08:00
chaofeis
c168a92f18 docs: add missing key prop for controlled tag demo (#1) (#8147) 2017-11-08 23:46:24 -06:00
afc163
72aa5e0763 Fix input group align bug in Chrome 62
close ant-design/ant-design-pro#139
2017-11-08 19:53:03 +08:00
D & R
10ab3f5187 fix flattenTree in Cascader (#8130) (#8136) 2017-11-08 15:56:58 +08:00
afc163
00227e8688 test node 8 in travis 2017-11-08 15:47:12 +08:00
afc163
198d033e21 upgrade @types/react to 16 2017-11-08 15:42:57 +08:00
afc163
4790f84657 Fix AutoComplete and Input affix style conflict, close #8081 2017-11-08 15:11:57 +08:00
afc163
2d17d8a768 refactor edit-row demo, close #8026 2017-11-07 21:03:14 +08:00
Wei Zhu
e5a57ff60a Improve Select type definition
Close #8128
2017-11-07 17:33:09 +08:00
afc163
b740d86bbf update feedback.md 2017-11-07 14:58:36 +08:00
afc163
a99c8c7175 Fix snapshot 2017-11-07 11:12:10 +08:00
Wei Zhu
11f91bd451 Fix test_node 2017-11-07 10:55:19 +08:00
Wei Zhu
67fee48c6a Run test against multiple react versions 2017-11-07 10:51:25 +08:00
afc163
42e219389d Fix key warning 2017-11-07 10:48:05 +08:00
afc163
f02cd9cd52 use development react in dev 2017-11-07 10:43:49 +08:00
afc163
5e7c735935 Fix ts compile error 2017-11-06 22:20:54 +08:00
afc163
1338c4f4f8 bump new beta 2017-11-06 21:29:21 +08:00
偏右
bdceb5f083 Review fix (#8125)
* Fix style

* Fix style

* fix lint

* Fix more styles

* Fix more styles

* update snap
2017-11-06 21:28:51 +08:00
afc163
2f0197599f Merge branch 'master' into antd-3.0 2017-11-06 21:19:44 +08:00
afc163
ac96bad478 Improve demo details and update snapshot 2017-11-06 21:14:40 +08:00
Wei Zhu
d6ace6663b Update snapshot 2017-11-06 19:00:36 +08:00
afc163
714b4ae06a Merge branch 'master' into antd-3.0 2017-11-06 10:35:41 +08:00
Benjy Cui
6bedfb6a5c bump 2.13.9 2017-11-06 10:18:53 +08:00
Benjy Cui
be38298f8e docs: add changelog for 2.13.9 (#8105) 2017-11-05 20:16:46 -06:00
Benjy Cui
ffe36725d6 docs: remove duplicated APIs 2017-11-06 10:01:39 +08:00
kossel
92aa34c1b5 Feature antd 3.0/spinning indicator (#7977)
* Added indicator props to Spin component

* Added indicator props to Spin component

* update snapshots

* fix defautl props

* revert some snapshot files
2017-11-04 12:05:25 +08:00
afc163
32b2c21145 site: fix header button style 2017-11-03 15:29:25 +08:00
afc163
5fc64a8433 Add emoji-mart into recommandation 2017-11-03 15:07:42 +08:00
Benjy Cui
de0493d82b docs: translate, ref: #8100 2017-11-03 15:02:26 +08:00
Josué
c00a2aabe2 docs: add missed time picker props (#8100)
* Add missed time-picker props

* Update time picker docs for missed props
2017-11-03 01:55:06 -05:00
afc163
59db56e953 Fix popupVisible of Cascader not working, close #8088 2017-11-03 13:03:54 +08:00
afc163
ca1b79ad34 Add Badge[offset] 2017-11-03 11:37:35 +08:00
Kyle Kelley
43864988e3 correct spelling of progress (#8101)
`@process-default-color` --> `@progress-default-color`
2017-11-03 09:43:02 +08:00
David Schneider
a5c3a6c930 In SliderProps type definition, replace void types with null. (#8102)
With TypeScript compiler option ‘strictNullChecks’ enabled, the value `null` cannot be assigned to type `void`. This means, for instance, that it’s impossible to pass a `null` value for prop `step`. I don’t expect that substituting `null` for `void` in these type definitions should cause anyone difficulty; because these are optional props, a consumer of this component should be able to pass `null` or `undefined` safely, whether or not the compiler is using strict null checks.
2017-11-03 09:40:56 +08:00
afc163
1af37103f3 use ghost 2017-11-02 11:18:32 +08:00
afc163
9b2c40cdd7 avoid triggering unmatch when unregister 2017-11-01 22:10:11 +08:00
afc163
05c56553a2 Fix gutter PropTypes 2017-11-01 21:40:47 +08:00
afc163
3cef86ece5 bump 2017-11-01 20:31:54 +08:00
afc163
b4bd906bf0 Fix responsive grid gutter 2017-11-01 20:31:26 +08:00
afc163
dd8b6347c7 Fix enquire in server render 2017-11-01 19:08:16 +08:00
Andreas Cederström
a3610603bf Upgrade documentation of use with create-react-app (#8085)
https://github.com/timarney/react-app-rewired have new compose protocol.

Check: https://github.com/timarney/react-app-rewired/tree/master/packages/react-app-rewire-less
2017-11-01 18:53:20 +08:00
afc163
09c2df4093 Fix test case 2017-11-01 18:51:55 +08:00
afc163
cfb871cf58 bump 2017-11-01 18:34:32 +08:00
afc163
692efefe31 Support responsively grid gutter 2017-11-01 18:33:41 +08:00
afc163
1c8fbb8899 update code style 2017-11-01 15:46:41 +08:00
afc163
bf82b4c49b Fix suffix of Input.Search
close #7970
2017-11-01 12:12:16 +08:00
Benjy Cui
51785aa6eb deps: upgrade TypeScript to 2.6, close #8018 2017-11-01 11:47:22 +08:00
afc163
9583bb4c85 Add Ant Design Pro 2017-11-01 10:50:27 +08:00
afc163
36df1c5f83 site: target should be _blank 2017-10-31 21:58:41 +08:00
afc163
dbe451a199 bump 2017-10-31 19:40:21 +08:00
afc163
81cf43905d Fix Alert backgroun and border color 2017-10-31 19:39:55 +08:00
afc163
3072aff31f Merge branch 'master' into antd-3.0 2017-10-31 18:47:39 +08:00
afc163
cc305209c0 Fix badge in header 2017-10-31 18:07:37 +08:00
afc163
3e7ade8d4e Fix link color 2017-10-31 17:51:35 +08:00
afc163
2075b056f7 Fix link color 2017-10-31 17:44:44 +08:00
afc163
ace590273a Add pro link 2017-10-31 16:32:09 +08:00
afc163
0c44489cb3 bump 2017-10-31 15:15:51 +08:00
afc163
296dfc7375 vertical progressDot Steps style 2017-10-31 15:15:51 +08:00
afc163
4c20b49db3 bump beta 2017-10-31 15:15:51 +08:00
Benjy Cui
b38c9c11a8 test: simplify snapshots for LocaleProvider 2017-10-31 14:55:53 +08:00
Wei Zhu
8c904de7d4 Add form wrappedComponentRef test 2017-10-31 01:33:56 -05:00
Benjy Cui
7ff7519207 fix: upgrade rc-form and refactor to be compatible with react@16 2017-10-31 01:33:56 -05:00
afc163
2a14b4667d Fix progress dot step style 2017-10-31 14:04:07 +08:00
afc163
7cc3e2c1cd Fix input checkbox or radio disappeared, ref #7974 2017-10-31 13:57:45 +08:00
翁润雨
58fe3277d8 add the 'selectable' attribute (#8048) 2017-10-31 13:57:45 +08:00
niko
a617a9593a 2.13.8 change log review (#8041)
bump 2.13.8
2017-10-31 13:57:28 +08:00
afc163
f72ff080f2 Remove modao 2017-10-31 13:57:28 +08:00
afc163
80b7b57eae Add china mirror link in footer 2017-10-31 13:57:28 +08:00
afc163
7c3a483190 Fix input checkbox or radio disappeared, ref #7974 2017-10-30 13:19:53 +08:00
Benjy Cui
70291d5514 chore: update size props order, ref: d12f247 2017-10-30 10:52:05 +08:00
afc163
d12f247e63 Fix api order 2017-10-29 15:40:50 +08:00
afc163
b61cb8f99e update select group title style 2017-10-29 14:21:00 +08:00
翁润雨
f64e24af8c add the 'selectable' attribute (#8048) 2017-10-28 19:39:33 +08:00
afc163
39f0b67b0d update iconfont zip url 2017-10-28 17:47:16 +08:00
afc163
25a013a84b Fix snapshot 2017-10-28 15:23:46 +08:00
afc163
7537aa11d0 Fix input shadow in iOS safari, ref #7974 2017-10-28 15:08:39 +08:00
afc163
0908293c42 update TimePicker demo snapshot 2017-10-28 15:02:33 +08:00
afc163
23caba1b65 Upgrade rc-time-picker to 3.0.0
Add `hourStep` `minuteStep` `secondStep`
2017-10-28 15:01:54 +08:00
afc163
d96284c798 Merge branch 'master' into antd-3.0 2017-10-27 20:22:17 +08:00
ddcat1115
b7a7758f37 try to fix ci 2017-10-27 16:33:24 +08:00
ddcat1115
978a0cbc64 bump 2017-10-27 15:37:15 +08:00
nikogu
5db04b6d4b update list grid padding bottom 2017-10-27 15:24:11 +08:00
ddcat1115
7acf29bc9c tweak Card style 2017-10-27 15:08:10 +08:00
afc163
fce4860243 Add Divider[dashed] prop 2017-10-26 21:00:20 +08:00
afc163
091b84008f update demo 2017-10-26 20:39:58 +08:00
afc163
3729304166 bump 2017-10-26 19:40:26 +08:00
afc163
099d5a0822 Tweak select arrow style 2017-10-26 19:39:04 +08:00
afc163
8f50324a94 Merge branch 'master' into antd-3.0 2017-10-26 19:34:11 +08:00
Benjy Cui
53906a2f0b deps: upgrade deps 2017-10-26 17:25:33 +08:00
afc163
11c3abb3aa Fix list border 2017-10-26 15:36:48 +08:00
afc163
c44f9528be Tweak list style 2017-10-26 15:07:01 +08:00
afc163
ec30f15dc6 bump 2017-10-26 13:38:39 +08:00
afc163
cbcc073aca Fix menu style 2017-10-26 13:38:18 +08:00
afc163
a5074bf475 Merge branch 'master' into antd-3.0 2017-10-26 12:58:59 +08:00
afc163
ed41f697e3 bump 2017-10-26 11:59:37 +08:00
afc163
0e5155567c Fix menu active border 2017-10-26 11:59:18 +08:00
afc163
e2bff100bd Fix upload style 2017-10-26 11:59:18 +08:00
Benjy Cui
e5699aff68 fix: should not import moment while useless, close: #8013 2017-10-26 10:50:18 +08:00
Benjy Cui
e641638c33 deps: upgrade bisheng (#7985) 2017-10-24 22:05:32 -05:00
Wei Zhu
bbb1a3a828 Merge branch 'master' into antd-3.0 2017-10-25 10:27:38 +08:00
Wei Zhu
7776cf62a7 Merge branch 'master' into antd-3.0 2017-10-25 10:25:02 +08:00
afc163
35f1bf5f94 Fix mini size pagination style 2017-10-24 20:39:38 +08:00
afc163
89a3b22791 Fix menu style 2017-10-24 15:56:28 +08:00
afc163
d8c9b77468 fix snapshot 2017-10-24 15:44:11 +08:00
afc163
695bd8a6c0 bump 2017-10-24 15:29:35 +08:00
afc163
2ef2925c8e update card and tabs style 2017-10-24 15:29:10 +08:00
Benjy Cui
67be1eafa9 test: fix CI 2017-10-24 14:08:39 +08:00
afc163
9181db8a01 Fix autoprefix warning 2017-10-23 20:52:41 +08:00
afc163
43f5ed30ac Fix snapshot 2017-10-23 20:43:31 +08:00
afc163
c472ed27f8 Merge branch 'master' into antd-3.0 2017-10-23 19:40:14 +08:00
afc163
3f57d5f56d Merge branch 'master' into antd-3.0 2017-10-23 10:41:51 +08:00
afc163
529f9fa933 use @heading-color again 2017-10-20 15:49:28 +08:00
afc163
ef443ad047 Merge branch 'master' into antd-3.0 2017-10-20 15:47:42 +08:00
Benjy Cui
7ea572bfc8 refactor: extract common locale logic (#7915) 2017-10-20 14:54:38 +08:00
Wei Zhu
e6ec022fc4 Oops. 2017-10-19 21:15:48 +08:00
afc163
a5aba1fc51 Tweak style 2017-10-19 20:58:16 +08:00
afc163
f18c8a4ecf bump 2017-10-19 20:35:55 +08:00
afc163
3bf9c8c4c5 fix tabs style 2017-10-19 20:33:22 +08:00
Wei Zhu
4431c5d70d Upgrade antd-tools 2017-10-19 19:10:03 +08:00
afc163
839703bb55 bump 2017-10-19 17:09:57 +08:00
afc163
856ae3e291 update gray color 2017-10-19 17:09:33 +08:00
afc163
7ef4771ddf update style 2017-10-19 16:38:12 +08:00
afc163
43bf7c5595 update dark menu color 2017-10-19 16:07:39 +08:00
afc163
7c8702ec61 Tweak popover arrow style 2017-10-19 16:00:24 +08:00
afc163
ca3835bf58 Tweak progress dot step style 2017-10-19 14:52:11 +08:00
afc163
b2e2a83662 rollback popconfirm padding 2017-10-19 11:45:56 +08:00
afc163
a68dd71cff Tweak card background 2017-10-19 10:01:59 +08:00
afc163
91b2d9ab9a bump 2017-10-18 21:36:50 +08:00
afc163
4ab7c648ce Fix upload loading 2017-10-18 21:30:48 +08:00
afc163
b51bc4a63a update card demo 2017-10-18 21:20:11 +08:00
afc163
ca0504da35 Add size="large" Tabs 2017-10-18 21:17:18 +08:00
afc163
91ffaea060 fix tag radius 2017-10-18 21:01:09 +08:00
afc163
009ba523d7 update @layout-body-background 2017-10-18 20:59:48 +08:00
afc163
f55c66d0a1 Merge branch 'master' into antd-3.0 2017-10-18 20:55:18 +08:00
afc163
f87a64316a update style 2017-10-18 19:41:44 +08:00
afc163
90e82f1cff Tweak timeline style 2017-10-18 17:42:00 +08:00
afc163
914fec9ac4 Tweak badge padding 2017-10-18 17:19:42 +08:00
偏右
ffffd0f4c5 Fix styles (#7924)
* update demo

* Fix styles

* fix snap

* Fix back-top ci
2017-10-18 17:16:14 +08:00
Benjy Cui
d0b08cd2ea test: fix CI 2017-10-18 16:55:12 +08:00
afc163
a9073988ec Merge branch 'master' into antd-3.0 2017-10-18 14:07:53 +08:00
niko
70491fe4ad fixed https://github.com/ant-design/ant-design/pull/7733 (#7914) 2017-10-18 00:05:10 +08:00
afc163
ad4d5ce18a Fix dragger background 2017-10-17 20:56:29 +08:00
afc163
0b5f770fec fix card loading margin style 2017-10-17 17:01:26 +08:00
afc163
825e088d45 Fix switch text font size 2017-10-17 15:22:53 +08:00
afc163
f74252b9de Fix input height in AutoComplete 2017-10-17 15:21:35 +08:00
afc163
c5ffc3b4f0 Fix upload and badge styles 2017-10-17 15:01:21 +08:00
afc163
274985d320 fix button margin inside 2017-10-17 15:01:21 +08:00
afc163
31132d1b5b Tweak checkbox margin 2017-10-17 15:01:21 +08:00
afc163
5f37d9df24 doc: fix expandedRowRender type, close #7901 2017-10-17 15:01:21 +08:00
henryv0
cad6be884c Updates Pattern docs (English) (#7902)
* Makes grammatical and typo fixes to the React Docs.

* Fixes some spelling and grammar in Pattern docs.

* Fixes merge conflict. Updates Pattern docs.
2017-10-17 15:01:21 +08:00
nikogu
f8f3e0f936 list update pagination margin top 2017-10-17 14:17:20 +08:00
afc163
b80d705a2d Add @timepicker-item-height 2017-10-16 21:52:15 +08:00
afc163
161f0800d3 fix ci 2017-10-16 21:38:14 +08:00
afc163
dfb3b4136b Fix snap 2017-10-16 21:15:53 +08:00
afc163
91a64d0567 Tweak styles 2017-10-16 21:12:49 +08:00
afc163
00bfa49031 Merge branch 'master' into antd-3.0 2017-10-16 20:45:25 +08:00
afc163
9dfde961f3 Fix time-picker demo 2017-10-16 20:29:49 +08:00
afc163
19324e3360 update calendar demo 2017-10-16 20:12:21 +08:00
afc163
26e416c364 Tweak style 2017-10-16 19:56:04 +08:00
afc163
fe44e33689 Tweak tag styles 2017-10-16 16:13:35 +08:00
afc163
e2c4ad3ba7 More preseted colors of tag 2017-10-16 15:38:34 +08:00
afc163
14a58c9960 Tweak input addon background 2017-10-16 14:49:32 +08:00
afc163
11ff9e0d6a Add snapshot for new locale 2017-10-14 14:49:44 +08:00
Mohamed Seada
fa315e9f6d Add new locale (ar-EG: Arabic Egypt) #3 (#7888)
* Add new locale (ar-EG: Arabic Egypt)

* resolve snapshot testing problem

* Add new locale (ar-EG: Arabic Egypt) to docs
2017-10-14 14:30:54 +08:00
Kiho · Cham
31d1ce91f7 feat: duration argument is optional (#7874) 2017-10-14 14:28:57 +08:00
afc163
e4e54a66d6 upgrade color palettes style 2017-10-13 20:27:22 +08:00
niko
58089c7832 [WIP] List: update english docs (#7880)
List: update english docs
2017-10-12 22:40:49 -05:00
afc163
6e78ffd0a6 Fix react externals 2017-10-12 20:29:12 +08:00
afc163
94c6c910ff Merge branch 'master' into antd-3.0 2017-10-12 20:07:31 +08:00
afc163
05c211d0b7 fix react externals 2017-10-12 19:33:51 +08:00
afc163
6b609aa5da bump 3.0.0-alpha.15 2017-10-12 18:14:47 +08:00
afc163
9ddbad1088 Unify menu item height 2017-10-12 18:14:23 +08:00
niko
57d5038d1c fixed: https://github.com/ant-design/ant-design/issues/4905#issuecomment-335710078 (#7875) 2017-10-12 05:09:37 -05:00
niko
48847e14e0 fixed react-virtualized demo scroll position when other demo element has changed (#7866) 2017-10-12 14:09:38 +08:00
afc163
efe0f3480a Merge branch 'master' into antd-3.0 2017-10-11 18:13:39 +08:00
afc163
1ef4cc277b Fix select item padding 2017-10-11 16:56:52 +08:00
afc163
9a96e9f9d1 new primary colors 2017-10-11 16:21:55 +08:00
Benjy Cui
0bce5c83f9 deps: upgrade rc-notification to support react@16 (#7844) 2017-10-11 12:03:19 +08:00
偏右
9053192ae9 Fix component style (#7848)
* fix components style

* fix snapshot

* update travis node version

* change upload action in ci
2017-10-11 12:01:27 +08:00
afc163
b0381a6ce4 fix icons, ref #7854 2017-10-11 10:44:26 +08:00
afc163
b174331be4 Fix hasFeedback icon overlap
close #7854
2017-10-11 10:44:26 +08:00
niko
b4ed4e6d3f Improve List Component
fixed: https://github.com/ant-design/ant-design/issues/4905#issuecomment-332442843
 (#7853)
2017-10-11 10:29:45 +08:00
afc163
278ae9b9c7 Fix upload ci 2017-10-11 10:18:02 +08:00
afc163
064afd9b85 fix upload ci 2017-10-11 09:54:13 +08:00
afc163
163366deeb Merge branch 'master' into antd-3.0 2017-10-10 21:52:48 +08:00
afc163
43a2ae2905 update color spec doc 2017-10-10 20:23:21 +08:00
afc163
244a2fd2da update locale-provider snap 2017-10-10 20:15:41 +08:00
afc163
fd7c90fb5a update upload snap file 2017-10-10 20:02:35 +08:00
afc163
6aa4138c00 Fix test warning 2017-10-10 20:01:23 +08:00
afc163
8feaf83003 fix upload test 2017-10-10 19:54:52 +08:00
afc163
190bebd65f Fix upload snapshot 2017-10-10 19:54:38 +08:00
afc163
87ec78ce2e Merge branch 'master' into antd-3.0 2017-10-10 17:11:26 +08:00
Benjy Cui
e5edb4ac0f test: update snapshot 2017-10-10 16:06:49 +08:00
afc163
d3b98d311a Merge branch 'master' into antd-3.0 2017-10-10 14:09:03 +08:00
Wei Zhu
9f0091dcd3 Expose slick methods (#7759)
https://github.com/ant-design/ant-design/issues/7484
2017-10-10 13:41:04 +08:00
Benjy Cui
91fc781b6c chore: update docs and code style, ref: #7553#issuecomment-335009581 2017-10-10 10:04:03 +08:00
Wei Zhu
a3c3ec8070 Fix types and lint 2017-10-09 21:03:00 +08:00
Wei Zhu
c5487ad1eb React 16 + Enzyme 3 2017-10-09 19:18:04 +08:00
afc163
802bd98f16 update color doc 2017-10-09 19:15:30 +08:00
afc163
c775311d11 update color doc 2017-10-09 19:09:09 +08:00
afc163
154773e5ce update color doc 2017-10-09 19:08:11 +08:00
afc163
89c507c4ba pink => magenta 2017-10-09 18:26:11 +08:00
afc163
934c4c0de1 finish whole color pallate 2017-10-09 18:24:12 +08:00
afc163
af5c8e8b1a updat colors page style 2017-10-09 16:45:12 +08:00
afc163
a1c17f3006 update colors 2017-10-09 16:17:30 +08:00
afc163
172a9ede10 bump alpha 2017-10-09 13:48:22 +08:00
afc163
9c3c88d3cc Fix focused cascader error style 2017-10-09 13:47:24 +08:00
afc163
b544e3aef8 update snapshot 2017-10-09 13:37:45 +08:00
afc163
4eb9d5ef56 Merge branch 'master' into antd-3.0 2017-10-09 13:33:59 +08:00
afc163
8c0875239e update form demo 2017-10-09 11:13:03 +08:00
afc163
c9768e1099 tweak form item margin 2017-10-09 11:09:25 +08:00
afc163
054444f619 Merge branch 'master' into antd-3.0 2017-10-07 15:34:19 +08:00
afc163
7a8a1a8ee3 Merge branch 'master' into antd-3.0 2017-09-30 21:31:29 +08:00
afc163
25771bed77 Tweak radio style 2017-09-29 11:45:01 +08:00
nikogu
02b69f482d bump 3.0.0-alpha.13 2017-09-28 17:57:07 +08:00
nikogu
09addde73c Merge branch 'master' into antd-3.0 2017-09-28 17:56:36 +08:00
ddcat1115
70ff604b81 swap unicode of menu-fold and menu-unfold 2017-09-28 15:00:37 +08:00
nikogu
1f2425615e bump alpha.12 2017-09-28 09:55:06 +08:00
nikogu
901ceb2507 Merge branch 'master' into antd-3.0 2017-09-28 09:54:29 +08:00
偏右
2bced36f0c New component styles (#7731)
* Tweak button padding

* upgrade input and button size

* update form controls size

* update components size

* Add lemon color and update rate color

* Add new icons

* update layout style

* breadcrumb and dropdown

* update menu arrow width

* update layout and menu

* update steps

* fix var name

* update cascasder style

* Update DatePicker

* update InputNumber and Mention

* radio and switch

* select and transfer

* TimePicker & Upload

* more components

* calendar and list

* Tree Timeline Popover Tag

* divider modal popover

* update search input

* update card style

* update switch disabled opacity

* update shoadow and mask

* Add v2-compatible-reset.less

* Fix undefined className

* update snahshotssssssssssssssssss 👻
2017-09-27 22:32:49 +08:00
afc163
b4bf7198e7 Card noHovering => hoverable 2017-09-27 21:57:55 +08:00
afc163
cfec43f5eb Merge branch 'master' into antd-3.0 2017-09-27 20:21:56 +08:00
afc163
a3c7d6611c Merge branch 'master' into antd-3.0 2017-09-27 20:13:44 +08:00
nikogu
7899dcf299 update snapshots 2017-09-27 15:03:22 +08:00
nikogu
83533660db bump 3.0.0-alpha.11 2017-09-27 14:48:37 +08:00
nikogu
ec59996ba6 Merge branch 'master' into antd-3.0 2017-09-27 14:36:49 +08:00
delesseps
2730344ff7 Add maxLength attribute to Input (#7744) 2017-09-27 09:56:30 +08:00
afc163
7bfe6878dd fix snapshot 2017-09-27 09:56:03 +08:00
Benjy Cui
829b5f87bf feat: make default locale to enUS (#7553)
* feat: make default locale to enUS

* test: fix CI

* docs: update getting started
2017-09-26 23:12:47 +08:00
afc163
4719309bd7 Merge branch 'master' into antd-3.0 2017-09-26 16:29:57 +08:00
niko
c64f46c217 List optimize (#7736)
* add split props
* add size props
* add footer & header props
2017-09-26 16:11:35 +08:00
转二
73000a226b Merge branch 'antd-3.0' of github.com:ant-design/ant-design into antd-3.0 2017-09-25 23:42:47 +08:00
转二
60feaebd54 docs: Update 's document. 2017-09-25 23:42:31 +08:00
afc163
8127d3b579 Fix Duplicated Animate 2017-09-25 23:12:16 +08:00
afc163
f9754c8a25 Merge branch 'master' into antd-3.0 2017-09-25 23:10:42 +08:00
afc163
420c2666a9 docs: add chinese description for dateRender 2017-09-25 22:16:30 +08:00
ChaXinyu
14e2a56b75 export components interface (#7654)
* export components interface

* export specific props

* fix formItem missed import
2017-09-25 22:14:49 +08:00
Henri Normak
36a54a8a8c Expose renderDate function for DatePicker (#7710)
* Expose renderDate function for Calendar dates

* Use the original prop name
2017-09-25 22:10:26 +08:00
afc163
b7aee09758 Fix dropdown menu group title style 2017-09-25 21:35:56 +08:00
afc163
ca8ff1c27a Fix column sorter icons style 2017-09-25 21:35:56 +08:00
转二
42fc8bc2a5 Merge branch 'antd-3.0' of github.com:ant-design/ant-design into antd-3.0 2017-09-25 21:13:35 +08:00
转二
20dae8f33e feat: Add option for component: 'mention' 2017-09-25 21:12:43 +08:00
afc163
2ebf70013b Merge branch 'master' into antd-3.0 2017-09-25 20:03:40 +08:00
afc163
7cc386df52 Merge branch 'master' into antd-3.0 2017-09-25 17:01:02 +08:00
niko
91b97d7b25 List virtualized (#7692)
* add virtualized & infinite demo
* change `children render` to `renderItem`
2017-09-25 15:24:16 +08:00
afc163
ca06211494 Fix small steps font size 2017-09-25 11:27:49 +08:00
afc163
306a5699a7 Better responsive Steps 2017-09-25 11:25:57 +08:00
afc163
7a7b18032c use @screen-md 2017-09-25 11:18:26 +08:00
afc163
40e43a80e7 Merge branch 'master' into antd-3.0 2017-09-25 11:14:46 +08:00
afc163
3eb4937fd4 Remove unused code 2017-09-25 11:12:38 +08:00
afc163
6507aefd8e Merge branch 'master' into antd-3.0 2017-09-25 10:54:49 +08:00
afc163
c9069dfdf6 Merge branch 'master' into antd-3.0 2017-09-23 16:50:14 +08:00
afc163
f111855b8c fix tslint 2017-09-23 15:21:11 +08:00
afc163
6ad3fe5200 fix rc-animate 2017-09-23 15:11:02 +08:00
afc163
3bd0b94228 Merge branch 'master' into antd-3.0 2017-09-22 21:53:39 +08:00
afc163
2170b401bf fix form animation 2017-09-22 21:50:14 +08:00
afc163
31ca08c2b4 Remove extra update 2017-09-22 21:48:31 +08:00
afc163
af7f0c3777 Merge branch 'master' into antd-3.0 2017-09-22 20:36:13 +08:00
afc163
412d7eebba Merge branch 'master' into antd-3.0 2017-09-22 18:37:08 +08:00
afc163
e7ccdfef74 Improve card variables 2017-09-22 18:34:31 +08:00
偏右
8b3ef51c4f New colors (#7661)
* New colors

* use yellow color for rate

* change font colors

* use non-transparent color
2017-09-22 18:33:43 +08:00
偏右
759b0bb821 seperate reset styles (#7682)
* seperate reset styles

* not reset ul/ol/p/heading

* revert reset.less idea

* move label style into ant-form-item, #5851

* revert reset.less idea

* update base.less

* Better typography from bootstrap@4

use reboot replace normalize

ref:
b4d84b9cdf/scss/_reboot.scss

close #6162
2017-09-22 18:33:29 +08:00
delesseps
bb411517cf Remove autoComplete restriction to allow more complex auto-filling behaviour (#7699) 2017-09-22 13:31:48 +08:00
afc163
df69320fc2 Fix arrow position 2017-09-21 20:43:13 +08:00
afc163
3cdb06fe70 Fix Tree showLine style 2017-09-21 18:16:53 +08:00
afc163
acc4061eeb Tweak align problems 2017-09-21 18:13:36 +08:00
afc163
f8c5849bfa update snapshot 2017-09-21 14:57:50 +08:00
afc163
b7632c3ee7 Merge branch 'master' into antd-3.0 2017-09-21 14:18:53 +08:00
afc163
00973fdb72 Fix card tabs wrap bug 2017-09-20 21:56:56 +08:00
afc163
2f7b75562c Merge branch 'master' into antd-3.0 2017-09-20 17:13:32 +08:00
afc163
1b7b172f44 Tweak button font-weight and text size 2017-09-19 20:24:47 +08:00
afc163
fe7c85fece Merge branch 'master' into antd-3.0 2017-09-19 16:12:18 +08:00
nikogu
d1bb0b3634 Change List Spin size. 2017-09-18 17:37:13 +08:00
Benjy Cui
72845f55ec deps: upgrade rc-steps 2017-09-18 16:12:55 +08:00
nikogu
61dcdae271 merge master 2017-09-18 10:49:28 +08:00
nikogu
abf18b9ec4 merge master 2017-09-18 10:13:48 +08:00
Wei Zhu
047f62e9b4 Mark refs to private (#7600) 2017-09-17 15:48:44 +08:00
afc163
b59d776554 Merge branch 'antd-3.0' of github.com:ant-design/ant-design into antd-3.0 2017-09-15 22:53:43 +08:00
afc163
0a3f6822f6 Fix zIndex types, ref #7624 2017-09-15 22:51:55 +08:00
afc163
823e07bc75 Merge branch 'master' into antd-3.0 2017-09-15 21:44:39 +08:00
偏右
dab6f43c02 Feat search enter button (#7620)
* Add enterButton for Input.Search

close #7596

* update snapshot
2017-09-15 17:03:43 +08:00
delesseps
174c98cdca Add focus and blur support to InputNumber (#7615)
* Add focus support to InputNumber

* Convert string ref to private ref

* Added blur method and fixed linting
2017-09-15 15:47:06 +08:00
afc163
ea5ccce90d Merge branch 'master' into antd-3.0 2017-09-15 11:16:19 +08:00
Wei Zhu
579becd894 Update snapshot 2017-09-15 10:03:46 +08:00
afc163
2e8e9ccf61 Merge branch 'master' into antd-3.0 2017-09-13 14:29:01 +08:00
jiang
2570ba8fe6 Menu anim (#7567)
* update menu icon animate

* add padding !important, restore menu retraction animate

* update dropdown arrow
2017-09-12 16:46:33 +08:00
afc163
b24483545c Merge branch 'master' into antd-3.0 2017-09-12 09:41:51 +08:00
Stefan Paunovic
0ac7ccaa8f feat: add is_IS locale (#7561) 2017-09-12 09:10:42 +08:00
afc163
7bee69a9df Merge from master 2017-09-08 16:49:58 +08:00
afc163
f7cc779c5d Hide pagination options when screen is small 2017-09-08 15:32:10 +08:00
afc163
13a11d6fc3 update default font-size 2017-09-08 15:32:10 +08:00
Benjy Cui
070b2696ba chore: remove hacks for IE8-, close: #7447 (#7512) 2017-09-08 13:08:46 +08:00
Wei Zhu
8c0c6ecf6e refactor: upload string refs to callback (#7496) 2017-09-08 09:46:22 +08:00
Wei Zhu
5a474709ff refactor: tooltip string refs to callback (#7493) 2017-09-08 09:45:34 +08:00
Wei Zhu
a85447f993 refactor: popover string refs to callback (#7492) 2017-09-08 09:44:29 +08:00
Wei Zhu
5c766b1f99 refactor: popconfirm string refs to callback (#7491) 2017-09-08 09:44:05 +08:00
Wei Zhu
4664e36fa4 refactor: input string refs to callback (#7489) 2017-09-08 09:43:21 +08:00
Wei Zhu
32b7a3f752 refactor: carousel ref strings to callback (#7486) 2017-09-08 09:41:14 +08:00
Wei Zhu
825a3d5e95 refactor: anchor string refs to callback (#7483) 2017-09-08 09:37:20 +08:00
Wei Zhu
581ddb2b49 refactor: affix string refs to callback (#7482) 2017-09-08 09:31:07 +08:00
afc163
3195cc182c Fix steps styles 2017-09-07 11:00:36 +08:00
afc163
fe12d8d579 Merge branch 'master' into antd-3.0 2017-09-06 21:44:47 +08:00
afc163
5724a55c7b Merge branch 'master' into antd-3.0 2017-09-06 20:22:55 +08:00
nikogu
025ea8ede9 bump 3.0.0-alpha.9 2017-09-06 16:05:23 +08:00
nikogu
290ccd68ee Merge remote-tracking branch 'origin' into antd-3.0 2017-09-06 15:57:16 +08:00
niko
bceb15c4e6 List:add infinite & detail optimize (#7445)
* List:add infinite & detail optimize

* React.children.map -> context

* update snapshots & demo order

* remove Item.Action _id

* update List demo

* List:add infinite & detail optimize

* React.children.map -> context

* 更新 snap

* update snapshots
2017-09-06 15:53:25 +08:00
afc163
78f2b0aa5d update snapshot 2017-09-06 14:29:10 +08:00
afc163
abdf14c8a3 bump 2017-09-06 14:15:38 +08:00
afc163
dac447a57d Merge branch 'master' into antd-3.0 2017-09-06 14:15:09 +08:00
afc163
78c1bebd7a Merge branch 'master' into antd-3.0 2017-09-06 13:43:00 +08:00
afc163
053054bc65 bump 2017-09-06 13:19:09 +08:00
afc163
ab6620f1f1 Fix WeekPicker style, #3825 2017-09-06 13:18:43 +08:00
afc163
68ff1b6ff0 fix progressDot Steps style 2017-09-06 13:15:47 +08:00
afc163
c0df7f4142 bump 2017-09-05 20:03:21 +08:00
偏右
a933961aae upgrade rc-steps to 3.0 (#7473)
* upgrade rc-steps to 3.0

* update snapshot
2017-09-05 19:57:59 +08:00
afc163
68139cdbda Add some icons 2017-09-05 17:13:46 +08:00
afc163
cdac7cd28a fix demo snapshot 2017-09-05 16:35:05 +08:00
afc163
dca17bcc12 Fix package.json 2017-09-05 16:29:25 +08:00
afc163
0f778d2a4a Merge from master 2017-09-05 16:19:34 +08:00
afc163
8d517a9647 Fix submenu hover style 2017-09-05 11:34:13 +08:00
偏右
f3911b3707 Feat week picker (#7404)
* New Component WeekPicker

close #212

* Add WeexPicker in API doc

* update snapshot

* Add test cases

* update snapshot
2017-08-31 20:44:22 +08:00
niko
75518241d6 List optimize (#7391)
* change spin size to large

* fixed list loading
2017-08-30 15:16:48 +08:00
nikogu
e4860bfac0 update snapshots again 2017-08-30 13:51:27 +08:00
nikogu
0a9e28226b update snapshots 2017-08-30 11:53:46 +08:00
nikogu
33c41e97f7 List: change padding bottom 2017-08-30 11:45:47 +08:00
niko
44f63ae010 change list border color (#7390) 2017-08-30 10:30:23 +08:00
afc163
f2fe374a18 Improve spin transition delay 2017-08-29 16:40:28 +08:00
afc163
429cdb448d Fix RangePicker text overlap 2017-08-29 15:08:55 +08:00
afc163
9c477bf8fd fix conflict 2017-08-27 19:32:45 +08:00
afc163
5a971b24ad Merge from master 2017-08-27 19:32:02 +08:00
afc163
8f6c0d8fc9 Fix snapshot 2017-08-27 14:12:42 +08:00
ddcat1115
7714926be5 bump 3.0.0-alpha.5 2017-08-24 11:48:03 +08:00
ddcat1115
aa9f97dfda Merge remote-tracking branch 'origin/master' into antd-3.0 2017-08-24 10:45:02 +08:00
ddcat1115
b10f7726c3 Merge remote-tracking branch 'origin/master' into antd-3.0 2017-08-23 23:12:38 +08:00
ddcat1115
e2d6488f1c bump 3.0.0-alpha.4 2017-08-23 19:25:12 +08:00
ddcat1115
0d4baf302d 调整卡片样式 (#7286)
* 调整卡片样式

* improve
2017-08-23 19:02:27 +08:00
afc163
94709bf968 Merge branch 'master' into antd-3.0 2017-08-22 18:37:51 +08:00
ddcat1115
2666eef671 fix package.json 2017-08-22 15:27:45 +08:00
Benjy Cui
2620318172 feat: support controlled panels for DatePicker and RangePicker, close: #5190 (#7049) 2017-08-21 21:15:44 +08:00
niko
56f0716b03 List: support responsive (#7272)
* List: support responsive

* change grid api for responsive & use card responsive function

* abstract getGrid

* update snapshots

* defind grid columns number

* defind grid columns number

* add ListGridType
2017-08-21 21:14:20 +08:00
afc163
2d9b374a76 Merge branch 'antd-3.0' of github.com:ant-design/ant-design into antd-3.0 2017-08-21 21:05:41 +08:00
afc163
dc7dfd38c6 Merge from master 2017-08-21 21:02:57 +08:00
偏右
3b59a03c00 New component divider (#7261)
* Add Divider

* use Divider in table demos

* update demo instruction

* upgrade snapshots
2017-08-19 12:39:11 +08:00
afc163
c28c2f6b1e Merge branch 'master' into antd-3.0 2017-08-18 19:18:26 +08:00
afc163
fc11c69d3f Make Input with addons same default width 100% with Input 2017-08-17 18:13:06 +08:00
afc163
b84b17d981 Merge branch 'master' into antd-3.0 2017-08-17 18:03:28 +08:00
偏右
2dedc5ec7f Upgrade grid break points (#7230)
close #5122
2017-08-16 20:19:41 +08:00
afc163
b0da6adf8c Improve responsive of Steps 2017-08-16 16:07:57 +08:00
afc163
9c925d7c9b fix snap 2017-08-15 23:09:45 +08:00
afc163
2318cd47a4 Merge from master 2017-08-15 22:50:00 +08:00
nikogu
4e68750777 List: remove noHovering prop 2017-08-15 19:57:44 +08:00
nikogu
8ed6883d70 List: change noHovering default true 2017-08-15 17:36:51 +08:00
nikogu
3c5e0d4fb8 bump 3.0.0-alpha.2 2017-08-15 17:27:56 +08:00
nikogu
ecef5887b6 merge master 2017-08-15 17:26:56 +08:00
niko
600d589617 fixed some list style bug (#7177)
* fixed some list style bug

* add cursor:pointer to hover style

* fixed hover style
2017-08-15 17:25:14 +08:00
乐仪
314c095fbf Merge remote-tracking branch 'origin/master' into antd-3.0 2017-08-15 00:13:40 +08:00
乐仪
cd6b017ce5 fix ts error 2017-08-14 22:25:17 +08:00
乐仪
6e49d02a07 bump 3.0.0-alpha.2 2017-08-14 21:54:37 +08:00
ddcat1115
1c518c3d97 Card improve & bugfix (#7204)
* Card improve & bugfix

* update snap
2017-08-14 21:43:32 +08:00
nikogu
0034d0529c add list grid 2017-08-14 11:09:22 +08:00
偏右
a59bcf7e90 change noHovering to true defaultly (#7178) 2017-08-14 09:52:16 +08:00
jiang
22ef7d1147 add form explain animate (#7172) 2017-08-11 17:05:25 +08:00
nikogu
33e822b0c8 revert to 3.0.0-alpha.1 & bump 3.0.0-alpha.1 2017-08-11 09:37:24 +08:00
afc163
af1e862aef Merge branch 'master' into antd-3.0 2017-08-10 21:45:49 +08:00
nikogu
bd1e9a0182 bump 3.0.0-alpha.2 2017-08-10 18:53:03 +08:00
nikogu
bab429d838 bump 3.0.0-alpha.1 2017-08-10 18:10:40 +08:00
nikogu
fab125d741 fixed List Components Props 2017-08-10 18:00:40 +08:00
afc163
b48f749e26 Merge branch 'feature-2.13' into antd-3.0 2017-08-10 16:33:18 +08:00
afc163
d324b28e1a Merge branch 'master' into antd-3.0 2017-08-10 16:32:37 +08:00
niko
5836a49899 remove List.Item.Content & change List.Item.Action to List actions props (#7159) 2017-08-09 21:46:48 +08:00
乐仪
5b85d7019c bump 3.0.0-alpha.0 2017-08-09 16:47:12 +08:00
乐仪
bf7814452f bump 3.0.0-alpha0 2017-08-09 16:09:57 +08:00
乐仪
f8f34fc1f4 Merge remote-tracking branch 'origin/master' into antd-3.0 2017-08-09 15:59:29 +08:00
niko
12bbe3776c Feature list component (#7150)
* add list component

* fixed the demo syntax

* update list snapshots
2017-08-09 15:45:08 +08:00
ddcat1115
2b1bed42c9 Card new feat (#7120)
* inner style Card

* support `cover` `actions` `avatar` `description` and `extraContent`

* improve

* refactor
2017-08-09 14:34:10 +08:00
653 changed files with 72701 additions and 12398 deletions

View File

@@ -1,58 +1,66 @@
# Contributing to Ant Design
[中文版](./CONTRIBUTING.zh-CN.md)
The following is a set of guidelines for contributing to Ant Design. Please spend several minutes in reading these guidelines before you create an issue or pull request.
Anyway, these are just guidelines, not rules, use your best judgment and feel free to propose changes to this document in a pull request.
## Code of Conduct
We have adopted a [Code of Conduct](../CODE_OF_CONDUCT.md) that we expect project participants to adhere to. Please read the full text so that you can understand what actions will and will not be tolerated.
## Do your homework before asking a question
## Open Development
It's a great idea to read Eric Steven Raymond's [How To Ask Questions The Smart Way](http://www.catb.org/esr/faqs/smart-questions.html) twice before asking a question. But if you are busy now, I recommend to read [Don't post homework questions](http://www.catb.org/esr/faqs/smart-questions.html#homework) first.
All work on Ant Design happens directly on [GitHub](https://github.com/ant-design). Both core team members and external contributors send pull requests which go through the same review process.
The following guidelines are about *How to avoid Homework Questions*.
## Branch Organization
### 1. Read the documentation.
According to our [release schedule](../CHANGELOG.md#release-schedule), we'll cut a `feature` branch (e.g. `feature-3.1` for 3.1 release) from `master` every month. If you send a bugfix pull request, please do it against the `master` branch, if it's a feature pull request, please do it against the `feature` branch.
It sad but true that someone just glance(not read) [Ant Design's documentation](http://ant.design/). Please read the documentation closely. What's more, you can modify and run our demo with [CodePen](http://codepen.io/benjycui/pen/KgPZrE?editors=001). It's helpful to understand our documentation.
## Bugs
Tips: choose the corresponding documentation with versions selector which in the bottom-right corner.
We are using [GitHub Issues](https://github.com/ant-design/ant-design/issues) for bug tracing. The best way to get your bug fixed is using our [issue helper](http://new-issue.ant.design) and provide a reprduction with this [template](https://u.ant.design/codesandbox-repro).
### 2. Make sure that your question is about Ant Design, not React
Before you reporting a bug, please make sure you've searched exists issues, and read our [FAQ](https://github.com/ant-design/ant-design/wiki/FAQ).
Someone may think all of the questions that he/she meets in developing are about Ant Design, but it's not true. So, please read [React's documentation](http://facebook.github.io/react/docs/getting-started.html) or just Google (not Baidu, seriously) your questions with keyword *React* first. If you are sure that your question is about Ant Design, go ahead.
## Proposing a Change
### 3. Read the FAQ and search the issues list of Ant Design
If you intend to change the public API or introduce new feature, we also recommend use our [issue helper](http://new-issue.ant.design) to create a feature request issue.
Your questions may be asked and solved by others. So please spend several minutes on searching. Remember [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), both code and questions.
## Your First Pull Request
P.S.
Working on your first Pull Request? You can learn how from this free video series:
1. [FAQ](https://github.com/ant-design/ant-design/wiki/FAQ)
1. [Issues list](https://github.com/ant-design/ant-design/issues)
[How to Contribute to an Open Source Project on GitHub](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github)
## Close your issue if it's solved
To help you get your feet wet and get you familiar with our contribution process, we have a list of [good first issues](https://github.com/ant-design/ant-design/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) that contain bugs or small features that have a relatively limited scope. This is a great place to get started.
It is a good habit which will save maintainers' time. Thank you!
If you decide to fix an issue, please be sure to check the comment thread in case somebody is already working on a fix. If nobody is working on it at the moment, please leave a comment stating that you intend to work on it so other people dont accidentally duplicate your effort.
## Providing a demo while reporting a bug
If somebody claims an issue but doesnt follow up for more than two weeks, its fine to take over it but you should still leave a comment.
It would be helpful to provide a demo which can re-produce the bug 100%. Please fork this [CodePen](http://codepen.io/benjycui/pen/KgPZrE?editors=001) and re-produce the bug you met. Then, create an issue. The most important thing is: double check before claiming that you have found a bug.
## Sending a Pull Request
The core team is monitoring for pull requests. We will review your pull request and either merge it, request changes to it, or close it with an explanation.
## Tips about Feature Request
**Before submitting a pull request**, please make sure the following is done:
If you believe that Ant Design should provide some features, but it does not. You could create an issue to discuss. However, Ant Design is not Swiss Army Knife, there are some features which Ant Design will not support:
1. Fork the repository and create your branch from [proper branch](./CONTRIBUTING.md#branch-organization).
1. Run `npm install` in the repository root.
1. If youve fixed a bug or added code that should be tested, add tests!
1. Ensure the test suite passes (npm run test). Tip: `npm test -- --watch TestName` is helpful in development.
1. Run `npm test -- -u` to update [jest snapshot](http://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest) and commit these changes as well (if has).
1. Make sure your code lints (npm run lint). Tip: Lint runs automatically when you `git commit`.
1. Request or operate data
Sending a Pull Request to [react-component](https://github.com/react-component/):
Since antd's components are based on react-component, sometimes you may need to send pull request to the corresponding react-component repository. If it's a bugfix pull request, after it's merged, the core team will release a patch release for that component as soon as possible, then you only need to do is reinstalling antd in your project to get the latest patch release. If it's a feature pull request, after it's merged, the core team will release a minor release, then you need raise another pull request to [Ant Design](https://github.com/ant-design/ant-design/) to update dependencies, document and TypeScript interfaces (if needed).
## Tips about Pull Request
## Development Workflow
**Working on your first Pull Request?** You can learn how from this *free* series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)
After cloning antd, run `npm install` to fetch its dependencies. Then, you can run several commands:
It's welcomed to pull request. And there are some tips about that:
1. It is a good habit to create a feature request issue to discuss whether the feature is necessary before you implement it. However, it's unnecessary to create an issue to claim that you found a typo or improved the readability of documentation, just create a pull request.
1. Run `npm run lint` and fix those errors before committing in order to keep consistent code style.
1. Rebase before creating a PR to keep commit history clear.
1. Add some descriptions and refer relative issues for you PR.
1. `npm start` runs Ant Design website locally.
1. `npm run lint` checks the code style.
1. `npm test` runs the complete test suite.
1. `npm run compile` compiles TypeScript code to the `lib` and `es` directory.
1. `npm run dist` creates UMD build of antd.

64
.github/CONTRIBUTING.zh-CN.md vendored Normal file
View File

@@ -0,0 +1,64 @@
# 贡献指南
这篇指南会指导你如何为 Ant Design 贡献一份自己的力量,请在你要提 issue 或者 pull request 之前花几分钟来阅读一遍这篇指南。
## 行为准则
我们有一份[行为准则](../CODE_OF_CONDUCT.md),希望所有的贡献者都能遵守,请花时间阅读一遍全文以确保你能明白哪些是可以做的,哪些是不可以做的。
## 透明的开发
我们所有的工作都会放在 [GitHub](https://github.com/ant-design) 上。不管是核心团队的成员还是外部贡献者的 pull request 都需要进过同样流程的 review。
## 分支管理
基于我们的[发布周期](../CHANGELOG.zh-CN.md#release-schedule), 我们每个月都会从 `master` 分支切一个 `feature` 分支出来(比如 `features-3.1` 分支用来发布 3.1 版本)。 如果你要修一个 bug那么请发 pull request 到 `master`;如果你要提一个增加新功能的 pull request那么请基于 `feature` 分支来做。
## Bugs
我们使用 [GitHub Issues](https://github.com/ant-design/ant-design/issues) 来做 bug 追踪。 如果你想要你发现的 bug 被快速解决,最好的办法就是通过我们提供的 [issue 小助手](http://new-issue.ant.design) 来提 issue。 并且能使用这个[模板](https://u.ant.design/codesandbox-repro)来提供重现。
在你报告一个 bug 之前,请先确保已经搜索过已有的 issue 和阅读了我们的[常见问题](https://github.com/ant-design/ant-design/wiki/FAQ)。
## 新增功能
如果你有改进我们的 API 或者新增功能的想法, 我们同样推荐你使用我们提供的[issue 小助手](http://new-issue.ant.design)来新建一个添加新功能的 issue。
## 第一次贡献
如果你还不清楚怎么在 GitHub 上提 Pull Request ,可以阅读下面这篇文章来学习:
[如何优雅地在 GitHub 上贡献代码](https://segmentfault.com/a/1190000000736629)
为了能帮助你开始你的第一次尝试,我们用 [good first issues](https://github.com/ant-design/ant-design/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) 标记了一些比较比较容易修复的 bug 和小功能。这些 issue 可以很好地做为你的首次尝试。
如果你打算开始处理一个 issue请先检查一下 issue 下面的留言以确保没有别人正在处理这个 issue。如果当前没有人在处理的话你可以留言告知其他人你将会处理这个 issue以免别人重复劳动。
如果之前有人留言说会处理这个 issue 但是一两个星期都没有动静,那么你也可以接手处理这个 issue当然还是需要留言告知其他人。
## Pull Request
Ant Design 团队会关注所有的 pull request我们会 review 以及合并你的代码,也有可能要求你做一些修改或者告诉你我们为什么不能接受这样的修改。
**在你发送 Pull Request 之前**,请确认你是按照下面的步骤来做的:
1. 基于[正确的分支](./CONTRIBUTING.zh-CN.md#branch-organization)来做修改。
1. 在项目根目录下运行了 `npm install`
1. 如果你修复了一个 bug 或者新增了一个功能,请确保写了相应的测试, 这很重要。
1. 确认所有的测试都是通过的 `npm run test`。 小贴士:开发过程中可以用 `npm test -- --watch TestName` 来运行指定的测试。
1. 运行 `npm test -- -u` 来更新 [jest snapshot](http://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest) 并且把这些更新也提交上来(如果有的话)。
1. 确保你的代码通过了 lint 检查 `npm run lint`. 小贴士: Lint 会在你 `git commit` 的时候自动运行。
给 [react-component](https://github.com/react-component/) 发送 pull request
由于 antd 的大部分组件都是基于 react-component 的,所以有时候你可能需要给相应的 react-component 仓库发送 pull request。如果你是修复了某个 bug那么我们在合并你的修改后会尽快发布一个 patch 版本,然后你只要重新安装你的依赖就可以使用新发布的版本了。如果你的 pull request 是新增了某个功能,那么在你的修改合并并且发布版本后,你还需要发送一个 pull request 到 [Ant Design](https://github.com/ant-design/ant-design/) 来升级相应的依赖、文档以及 TypeScript 的类型定义。
## 开发流程
在你 clone 了 antd 的代码并且使用 `npm install` 安装完依赖后,你还可以运行下面几个常用的命令:
1. `npm start` 在本地运行 Ant Design 的网站。
1. `npm run lint` 检查代码风格。
1. `npm test` 运行测试。
1. `npm run compile` 编译 TypeScript 代码到 lib 和 es 目录。
1. `npm run dist` 构建 antd 的 UMD 版本到 dist 目录。

View File

@@ -42,4 +42,9 @@ module.exports = {
snapshotSerializers: [
'enzyme-to-json/serializer',
],
globals: {
'ts-jest': {
tsConfigFile: './tsconfig.test.json',
}
},
};

View File

@@ -18,4 +18,9 @@ module.exports = {
snapshotSerializers: [
'enzyme-to-json/serializer'
],
globals: {
'ts-jest': {
tsConfigFile: './tsconfig.test.json',
}
},
};

View File

@@ -16,6 +16,8 @@
"selector-list-comma-newline-after": null,
"selector-pseudo-element-colon-notation": null,
"unit-no-unknown": null,
"value-list-max-empty-lines": null
"value-list-max-empty-lines": null,
"font-family-no-missing-generic-family-keyword": null,
"no-descending-specificity": null
}
}

View File

@@ -3,35 +3,26 @@ sudo: false
language: node_js
node_js:
- "8.5"
- 8
env:
matrix:
- TEST_TYPE=lint
- TEST_TYPE=test:dist
- TEST_TYPE=test:lib
- TEST_TYPE=test:es
- TEST_TYPE=test:dom
- TEST_TYPE=test:node
matrix:
fast_finish: true
include:
- env: TEST_TYPE=lint
- env: REACT=16 TEST_TYPE=test:dist
- env: REACT=16 TEST_TYPE=test:lib
- env: REACT=16 TEST_TYPE=test:es
- env: REACT=16 TEST_TYPE=test:dom
- env: REACT=16 TEST_TYPE=test:node
- env: REACT=15 TEST_TYPE=test:dist
- env: REACT=15 TEST_TYPE=test:lib
- env: REACT=15 TEST_TYPE=test:es
- env: REACT=15 TEST_TYPE=test:dom
- env: REACT=15 TEST_TYPE=test:node
- env: REACT=16 TEST_TYPE=bisheng:build
before_script:
- scripts/install-react.sh
script:
- |
if [ "$TEST_TYPE" = lint ]; then
npm run lint
elif [ "$TEST_TYPE" = test:dist ]; then
npm run dist && \
node ./tests/dekko/dist.test.js && \
LIB_DIR=dist npm test -- -w 2
elif [ "$TEST_TYPE" = test:lib ]; then
npm run compile && \
node ./tests/dekko/lib.test.js && \
LIB_DIR=lib npm test -- -w 2
elif [ "$TEST_TYPE" = test:es ]; then
npm run compile && \
LIB_DIR=es npm test -- -w 2
elif [ "$TEST_TYPE" = test:dom ]; then
npm test -- --coverage -w 2 && \
bash <(curl -s https://codecov.io/bash)
elif [ "$TEST_TYPE" = test:node ]; then
npm run test-node -- -w 2
fi
- scripts/travis-script.sh

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
<p align="center">
<a href="http://ant.design">
<img width="320" src="https://t.alipayobjects.com/images/rmsweb/T1B9hfXcdvXXXXXXXX.svg">
<img width="230" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg">
</a>
</p>
@@ -40,7 +40,7 @@
## 安装
```bash
npm install antd
npm install antd --save
```
## 示例
@@ -56,36 +56,22 @@ ReactDOM.render(<DatePicker />, mountNode);
import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
```
按需加载可通过此写法 `import DatePicker from 'antd/lib/date-picker'` 或使用 Babel 插件 [babel-plugin-import](https://github.com/ant-design/babel-plugin-import),或使用 TypeScript 插件 [ts-import-plugin](https://github.com/Brooooooklyn/ts-import-plugin)。
你也可以[按需加载组件](https://ant.design/docs/react/getting-started-cn#按需加载)。
## TypeScript
```js
// tsconfig.json
{
"compilerOptions": {
"moduleResolution": "node",
"jsx": "preserve",
"allowSyntheticDefaultImports": true
}
}
```
> 注意:
> - 设置 `allowSyntheticDefaultImports` 避免 `error TS1192: Module 'react' has no default export` 的错误。
> - 不要使用 @types/antd, antd 已经自带了 TypeScript 定义。
参考 [在 TypeScript 中使用](https://ant.design/docs/react/use-in-typescript-cn)
## 国际化
参考 [国际化文档](http://ant.design/docs/react/i18n)。
参考 [国际化文档](http://ant.design/docs/react/i18n-cn)。
## 链接
- [首页](http://ant.design/index-cn)
- [UI 组件库](http://ant.design/docs/react/introduce-cn)
- [首页](http://ant.design/)
- [组件库](http://ant.design/docs/react/introduce)
- [Ant Design Pro](http://pro.ant.design/)
- [更新日志](CHANGELOG.en-US.md)
- [官方脚手架](https://github.com/dvajs/dva-cli)
- [开发工具文档](http://ant-tool.github.io/)
- [脚手架市场](http://scaffold.ant.design)
- [React 底层基础组件](http://react-component.github.io/)
- [移动端组件](http://mobile.ant.design)
@@ -94,7 +80,7 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
- [开发者说明](https://github.com/ant-design/ant-design/wiki/Development)
- [版本发布规则](https://github.com/ant-design/ant-design/wiki/%E8%BD%AE%E5%80%BC%E8%A7%84%E5%88%99%E5%92%8C%E7%89%88%E6%9C%AC%E5%8F%91%E5%B8%83%E6%B5%81%E7%A8%8B)
- [常见问题](https://github.com/ant-design/ant-design/wiki/FAQ)
- [CodePen 模板](http://codepen.io/benjycui/pen/KgPZrE?editors=001) for bug reports
- [CodeSandbox 模板](https://u.ant.design/codesandbox-repro) for bug reports
- [Awesome Ant Design](https://github.com/websemantics/awesome-ant-design)
- [定制主题](http://ant.design/docs/react/customize-theme-cn)
@@ -110,7 +96,7 @@ $ npm start
## 如何贡献
在任何形式的参与前,请先阅读 [贡献者文档](https://github.com/ant-design/ant-design/blob/master/.github/CONTRIBUTING.md)。如果你希望参与贡献,欢迎 [Pull Request](https://github.com/ant-design/ant-design/pulls),或给我们 [报告 Bug](http://new-issue.ant.design/)。
阅读我们的[贡献指南](./.github/CONTRIBUTING.md).
> 强烈推荐阅读 [《提问的智慧》](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way)、[《如何向开源社区提问题》](https://github.com/seajs/seajs/issues/545) 和 [《如何有效地报告 Bug》](http://www.chiark.greenend.org.uk/%7Esgtatham/bugs-cn.html)、[《如何向开源项目提交无法解答的问题》](https://zhuanlan.zhihu.com/p/25795393),更好的问题更容易获得帮助。

View File

@@ -1,6 +1,6 @@
<p align="center">
<a href="http://ant.design">
<img width="320" src="https://t.alipayobjects.com/images/rmsweb/T1B9hfXcdvXXXXXXXX.svg">
<img width="230" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg">
</a>
</p>
@@ -20,6 +20,10 @@ An enterprise-class UI design language and React-based implementation.
[中文 README](README-zh_CN.md)
## 3.0 Released Now! :tada::tada::tada:
[Announcing Ant Design 3.0](https://medium.com/ant-design/announcing-ant-design-3-0-70e3e65eca0c)
## Features
- An enterprise-class UI design language for web applications.
@@ -35,12 +39,12 @@ An enterprise-class UI design language and React-based implementation.
## Let's build a better antd together [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
`antd` is an open source project; improvements are welcomed. If you are interested in contributing to `antd`, you can watch this repository, join in [discussion](https://github.com/ant-design/ant-design/issues?q=is%3Aopen+is%3Aissue+label%3ADiscussion), or try to implement some [features which have been accepted](https://github.com/ant-design/ant-design/issues?q=is%3Aopen+is%3Aissue+label%3A%22PR+welcome%22). Actually, there are [many ways](https://opensource.guide/how-to-contribute/) to contribute. And we are always happy to [offer collaborator permission](https://github.com/ant-design/ant-design/issues/3222) for some active contributors.
Read our [contributing guide](./.github/CONTRIBUTING.md).
## Install
```bash
npm install antd
npm install antd --save
```
## Usage
@@ -56,63 +60,12 @@ And import style manually:
import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
```
### Use modularized antd
- Manually import
```jsx
import DatePicker from 'antd/lib/date-picker'; // for js
import 'antd/lib/date-picker/style/css'; // for css
// import 'antd/lib/date-picker/style'; // that will import less
```
- Use [babel-plugin-import](https://github.com/ant-design/babel-plugin-import)
```js
// .babelrc or babel-loader option
{
"plugins": [
["import", { libraryName: "antd", style: "css" }] // `style: true` for less
]
}
```
Then you can import components from antd, equivalent to import manually below.
```jsx
// import js and css modularly, parsed by babel-plugin-import
import { DatePicker } from 'antd';
```
Or [import components on demand](https://ant.design/docs/react/getting-started#Import-on-Demand)
### TypeScript
```js
// tsconfig.json
{
"compilerOptions": {
"moduleResolution": "node",
"jsx": "preserve",
"allowSyntheticDefaultImports": true
}
}
```
See [Use in TypeScript](https://ant.design/docs/react/use-in-typescript)
> Note:
> - set `allowSyntheticDefaultImports` to prevent `error TS1192: Module 'react' has no default export`.
> - Don't use @types/antd, antd provide a built-in ts definition already.
#### Use [ts-import-plugin](https://github.com/Brooooooklyn/ts-import-plugin) with modularized antd
```js
{
loader: "ts-loader", // or awesome-typescript-loader
options {
getCustomTransformers: () => ({
before: [ tsImportPluginFactory({ libraryName: "antd", style: "css" }) ]
})
}
}
```
## Internationalization
@@ -121,10 +74,9 @@ See [i18n](http://ant.design/docs/react/i18n).
## Links
- [Home page](http://ant.design/)
- [UI library](http://ant.design/docs/react/introduce)
- [Components](http://ant.design/docs/react/introduce)
- [Ant Design Pro](http://pro.ant.design/)
- [Change Log](CHANGELOG.en-US.md)
- [Official Scaffold Tool](https://github.com/dvajs/dva-cli/)
- [Development Tool](http://ant-tool.github.io/)
- [Scaffold Market](http://scaffold.ant.design)
- [rc-components](http://react-component.github.io/)
- [Mobile UI](http://mobile.ant.design)
@@ -132,7 +84,7 @@ See [i18n](http://ant.design/docs/react/i18n).
- [Developer Instruction](https://github.com/ant-design/ant-design/wiki/Development)
- [Versioning Release Note](https://github.com/ant-design/ant-design/wiki/%E8%BD%AE%E5%80%BC%E8%A7%84%E5%88%99%E5%92%8C%E7%89%88%E6%9C%AC%E5%8F%91%E5%B8%83%E6%B5%81%E7%A8%8B)
- [FAQ](https://github.com/ant-design/ant-design/wiki/FAQ)
- [CodePen boilerplate](http://codepen.io/benjycui/pen/KgPZrE?editors=001) for bug reports
- [CodeSandbox Template](https://u.ant.design/codesandbox-repro) for bug reports
- [Awesome Ant Design](https://github.com/websemantics/awesome-ant-design)
- [Customize Theme](http://ant.design/docs/react/customize-theme)

View File

@@ -19,12 +19,14 @@ Array [
"Checkbox",
"Col",
"DatePicker",
"Divider",
"Dropdown",
"Form",
"Icon",
"Input",
"InputNumber",
"Layout",
"List",
"LocaleProvider",
"message",
"Menu",

View File

@@ -1,8 +1,14 @@
import throttleByAnimationFrame from '../throttleByAnimationFrame';
jest.useFakeTimers();
describe('Test utils function', () => {
beforeAll(() => {
jest.useFakeTimers();
});
afterAll(() => {
jest.useRealTimers();
});
it('throttle function should work', () => {
const callback = jest.fn();
const throttled = throttleByAnimationFrame(callback);

View File

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

View File

@@ -1,30 +0,0 @@
export function getComponentLocale(props, context, componentName, getDefaultLocale) {
let locale: any = {};
if (context && context.antLocale && context.antLocale[componentName]) {
locale = context.antLocale[componentName];
} else {
const defaultLocale = getDefaultLocale();
// TODO: make default lang of antd be English
// https://github.com/ant-design/ant-design/issues/6334
locale = defaultLocale.default || defaultLocale;
}
const result = {
...locale,
...props.locale,
};
result.lang = {
...locale.lang,
...props.locale.lang,
};
return result;
}
export function getLocaleCode(context) {
const localeCode = context.antLocale && context.antLocale.locale;
// Had use LocaleProvide but didn't set locale
if (context.antLocale && context.antLocale.exist && !localeCode) {
return 'zh-cn';
}
return localeCode;
}

View File

@@ -2,7 +2,7 @@ const availablePrefixs = ['moz', 'ms', 'webkit'];
function requestAnimationFramePolyfill() {
let lastTime = 0;
return function(callback) {
return function(callback: (n: number) => void) {
const currTime = new Date().getTime();
const timeToCall = Math.max(0, 16 - (currTime - lastTime));
const id = window.setTimeout(function() { callback(currTime + timeToCall); }, timeToCall);
@@ -23,11 +23,11 @@ export default function getRequestAnimationFrame() {
const prefix = availablePrefixs.filter(key => `${key}RequestAnimationFrame` in window)[0];
return prefix
? window[`${prefix}RequestAnimationFrame`]
? (window as any)[`${prefix}RequestAnimationFrame`]
: requestAnimationFramePolyfill();
}
export function cancelRequestAnimationFrame(id) {
export function cancelRequestAnimationFrame(id: number) {
if (typeof window === 'undefined') {
return null;
}
@@ -39,6 +39,8 @@ export function cancelRequestAnimationFrame(id) {
)[0];
return prefix ?
(window[`${prefix}CancelAnimationFrame`] || window[`${prefix}CancelRequestAnimationFrame`]).call(this, id)
: clearTimeout(id);
(
(window as any)[`${prefix}CancelAnimationFrame`] ||
(window as any)[`${prefix}CancelRequestAnimationFrame`]
).call(this, id) : clearTimeout(id);
}

View File

@@ -1,4 +1,4 @@
export default function getScroll(target, top): number {
export default function getScroll(target: any, top: boolean): number {
if (typeof window === 'undefined') {
return 0;
}

View File

@@ -1,4 +1,4 @@
let animation;
let animation: boolean;
function isCssAnimationSupported() {
if (animation !== undefined) {
@@ -11,7 +11,7 @@ function isCssAnimationSupported() {
}
if (animation !== undefined) {
for (let i = 0; i < domPrefixes.length; i++) {
if (elm.style[`${domPrefixes[i]}AnimationName`] !== undefined) {
if ((elm.style as any)[`${domPrefixes[i]}AnimationName`] !== undefined) {
animation = true;
break;
}

View File

@@ -3,18 +3,18 @@ import getRequestAnimationFrame, { cancelRequestAnimationFrame } from './getRequ
const reqAnimFrame = getRequestAnimationFrame();
function animate(node, show, done) {
let height;
let requestAnimationFrameId;
function animate(node: HTMLElement, show: boolean, done: () => void) {
let height: number;
let requestAnimationFrameId: number;
return cssAnimation(node, 'ant-motion-collapse', {
start() {
if (!show) {
node.style.height = `${node.offsetHeight}px`;
node.style.opacity = 1;
node.style.opacity = '1';
} else {
height = node.offsetHeight;
node.style.height = 0;
node.style.opacity = 0;
node.style.height = '0px';
node.style.opacity = '0';
}
},
active() {
@@ -23,7 +23,7 @@ function animate(node, show, done) {
}
requestAnimationFrameId = reqAnimFrame(() => {
node.style.height = `${show ? height : 0}px`;
node.style.opacity = show ? 1 : 0;
node.style.opacity = show ? '1' : '0';
});
},
end() {
@@ -38,13 +38,13 @@ function animate(node, show, done) {
}
const animation = {
enter(node, done) {
enter(node: HTMLElement, done: () => void) {
return animate(node, true, done);
},
leave(node, done) {
leave(node: HTMLElement, done: () => void) {
return animate(node, false, done);
},
appear(node, done) {
appear(node: HTMLElement, done: () => void) {
return animate(node, true, done);
},
};

View File

@@ -2,27 +2,27 @@ import getRequestAnimationFrame, { cancelRequestAnimationFrame } from '../_util/
const reqAnimFrame = getRequestAnimationFrame();
export default function throttleByAnimationFrame(fn) {
let requestId;
export default function throttleByAnimationFrame(fn: () => void) {
let requestId: number | null;
const later = args => () => {
const later = (args: any[]) => () => {
requestId = null;
fn(...args);
};
const throttled = (...args) => {
const throttled = (...args: any[]) => {
if (requestId == null) {
requestId = reqAnimFrame(later(args));
}
};
(throttled as any).cancel = () => cancelRequestAnimationFrame(requestId);
(throttled as any).cancel = () => cancelRequestAnimationFrame(requestId!);
return throttled;
}
export function throttleByAnimationFrameDecorator() {
return function(target, key, descriptor) {
return function(target: any, key: string, descriptor: any) {
let fn = descriptor.value;
let definingProperty = false;
return {

View File

@@ -1,4 +1,4 @@
export default function triggerEvent(el, type) {
export default function triggerEvent(el: Element, type: string) {
if ('createEvent' in document) {
// modern browsers, IE9+
const e = document.createEvent('HTMLEvents');

View File

@@ -3,8 +3,6 @@ import { mount } from 'enzyme';
import Affix from '..';
import Button from '../../button';
jest.useFakeTimers();
const events = {};
class AffixMounter extends React.Component {
@@ -48,13 +46,21 @@ class AffixMounter extends React.Component {
}
describe('Affix Render', () => {
beforeAll(() => {
jest.useFakeTimers();
});
afterAll(() => {
jest.useRealTimers();
});
it('Anchor render perfectly', () => {
document.body.innerHTML = '<div id="mounter" />';
const wrapper = mount(<AffixMounter />, { attachTo: document.getElementById('mounter') });
jest.runAllTimers();
wrapper.node.affix.refs.fixedNode.parentNode.getBoundingClientRect = jest.fn(() => {
wrapper.instance().affix.fixedNode.parentNode.getBoundingClientRect = jest.fn(() => {
return {
bottom: 100, height: 28, left: 0, right: 0, top: -50, width: 195,
};
@@ -65,6 +71,6 @@ describe('Affix Render', () => {
});
jest.runAllTimers();
expect(wrapper.node.affix.state.affixStyle).not.toBe(null);
expect(wrapper.instance().affix.state.affixStyle).not.toBe(null);
});
});

View File

@@ -1,5 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import addEventListener from 'rc-util/lib/Dom/addEventListener';
import classNames from 'classnames';
@@ -8,13 +8,13 @@ import omit from 'omit.js';
import getScroll from '../_util/getScroll';
import { throttleByAnimationFrameDecorator } from '../_util/throttleByAnimationFrame';
function getTargetRect(target): ClientRect {
function getTargetRect(target: HTMLElement | Window | null): ClientRect {
return target !== window ?
target.getBoundingClientRect() :
{ top: 0, left: 0, bottom: 0 };
(target as HTMLElement).getBoundingClientRect() :
{ top: 0, left: 0, bottom: 0 } as ClientRect;
}
function getOffset(element: HTMLElement, target) {
function getOffset(element: HTMLElement, target: HTMLElement | Window | null) {
const elemRect = element.getBoundingClientRect();
const targetRect = getTargetRect(target);
@@ -55,11 +55,16 @@ export interface AffixProps {
/** 固定状态改变时触发的回调函数 */
onChange?: (affixed?: boolean) => void;
/** 设置 Affix 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 */
target?: () => Window | HTMLElement;
target?: () => Window | HTMLElement | null;
prefixCls?: string;
}
export default class Affix extends React.Component<AffixProps, any> {
export interface AffixState {
affixStyle: React.CSSProperties | undefined;
placeholderStyle: React.CSSProperties | undefined;
}
export default class Affix extends React.Component<AffixProps, AffixState> {
static propTypes = {
offsetTop: PropTypes.number,
offsetBottom: PropTypes.number,
@@ -69,9 +74,6 @@ export default class Affix extends React.Component<AffixProps, any> {
scrollEvent: any;
resizeEvent: any;
timeout: any;
refs: {
fixedNode: HTMLElement;
};
events = [
'resize',
@@ -83,17 +85,18 @@ export default class Affix extends React.Component<AffixProps, any> {
'load',
];
eventHandlers = {};
eventHandlers: {
[key: string]: any;
} = {};
constructor(props) {
super(props);
this.state = {
affixStyle: null,
placeholderStyle: null,
};
}
state: AffixState = {
affixStyle: undefined,
placeholderStyle: undefined,
};
setAffixStyle(e, affixStyle) {
private fixedNode: HTMLElement;
setAffixStyle(e: any, affixStyle: React.CSSProperties | null) {
const { onChange = noop, target = getDefaultTarget } = this.props;
const originalAffixStyle = this.state.affixStyle;
const isWindow = target() === window;
@@ -103,7 +106,7 @@ export default class Affix extends React.Component<AffixProps, any> {
if (shallowequal(affixStyle, originalAffixStyle)) {
return;
}
this.setState({ affixStyle }, () => {
this.setState({ affixStyle: affixStyle as React.CSSProperties }, () => {
const affixed = !!this.state.affixStyle;
if ((affixStyle && !originalAffixStyle) ||
(!affixStyle && originalAffixStyle)) {
@@ -112,16 +115,16 @@ export default class Affix extends React.Component<AffixProps, any> {
});
}
setPlaceholderStyle(placeholderStyle) {
setPlaceholderStyle(placeholderStyle: React.CSSProperties | null) {
const originalPlaceholderStyle = this.state.placeholderStyle;
if (shallowequal(placeholderStyle, originalPlaceholderStyle)) {
return;
}
this.setState({ placeholderStyle });
this.setState({ placeholderStyle: placeholderStyle as React.CSSProperties });
}
@throttleByAnimationFrameDecorator()
updatePosition(e) {
updatePosition(e: any) {
let { offsetTop, offsetBottom, offset, target = getDefaultTarget } = this.props;
const targetNode = target();
@@ -131,8 +134,8 @@ export default class Affix extends React.Component<AffixProps, any> {
const affixNode = ReactDOM.findDOMNode(this) as HTMLElement;
const elemOffset = getOffset(affixNode, targetNode);
const elemSize = {
width: this.refs.fixedNode.offsetWidth,
height: this.refs.fixedNode.offsetHeight,
width: this.fixedNode.offsetWidth,
height: this.fixedNode.offsetHeight,
};
const offsetMode = {
@@ -154,10 +157,12 @@ export default class Affix extends React.Component<AffixProps, any> {
if (scrollTop > elemOffset.top - (offsetTop as number) && offsetMode.top) {
// Fixed Top
const width = elemOffset.width;
const top = targetRect.top + (offsetTop as number);
this.setAffixStyle(e, {
position: 'fixed',
top: targetRect.top + (offsetTop as number),
top,
left: targetRect.left + elemOffset.left,
maxHeight: `calc(100vh - ${top}px)`,
width,
});
this.setPlaceholderStyle({
@@ -200,10 +205,10 @@ export default class Affix extends React.Component<AffixProps, any> {
});
}
componentWillReceiveProps(nextProps) {
componentWillReceiveProps(nextProps: AffixProps) {
if (this.props.target !== nextProps.target) {
this.clearEventListeners();
this.setTargetEventListeners(nextProps.target);
this.setTargetEventListeners(nextProps.target!);
// Mock Event object.
this.updatePosition({});
@@ -216,7 +221,7 @@ export default class Affix extends React.Component<AffixProps, any> {
(this.updatePosition as any).cancel();
}
setTargetEventListeners(getTarget) {
setTargetEventListeners(getTarget: () => HTMLElement | Window | null) {
const target = getTarget();
if (!target) {
return;
@@ -237,6 +242,10 @@ export default class Affix extends React.Component<AffixProps, any> {
});
}
saveFixedNode = (node: HTMLDivElement) => {
this.fixedNode = node;
}
render() {
const className = classNames({
[this.props.prefixCls || 'ant-affix']: this.state.affixStyle,
@@ -246,7 +255,7 @@ export default class Affix extends React.Component<AffixProps, any> {
const placeholderStyle = { ...this.state.placeholderStyle, ...this.props.style };
return (
<div {...props} style={placeholderStyle}>
<div className={className} ref="fixedNode" style={this.state.affixStyle}>
<div className={className} ref={this.saveFixedNode} style={this.state.affixStyle}>
{this.props.children}
</div>
</div>

View File

@@ -3,4 +3,5 @@
.@{ant-prefix}-affix {
position: fixed;
z-index: @zindex-affix;
overflow: auto;
}

View File

@@ -1,5 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import Animate from 'rc-animate';
import Icon from '../icon';
import classNames from 'classnames';

View File

@@ -1,4 +1,5 @@
@import "../../style/themes/default";
@import "../../style/mixins/index";
@alert-prefix-cls: ~"@{ant-prefix}-alert";
@@ -6,75 +7,71 @@
@alert-text-color: @text-color;
.@{alert-prefix-cls} {
.reset-component;
position: relative;
padding: 8px 48px 8px 38px;
padding: 8px 15px 8px 37px;
border-radius: @border-radius-base;
color: @alert-text-color;
font-size: @font-size-base;
line-height: @line-height-base;
&&-no-icon {
padding: 8px 48px 8px 16px;
padding: 8px 15px;
}
&-icon {
font-size: @font-size-lg;
top: 8px + @font-size-base * @line-height-base / 2 - @font-size-lg / 2;
top: 8px + @font-size-base * @line-height-base / 2 - @font-size-base / 2 + 1px;
left: 16px;
position: absolute;
}
&-description {
font-size: @font-size-base;
line-height: 21px;
line-height: 22px;
display: none;
}
&-success {
border: @border-width-base @border-style-base @green-2;
background-color: @green-1;
border: @border-width-base @border-style-base ~`colorPalette("@{success-color}", 3)`;
background-color: ~`colorPalette("@{success-color}", 1)`;
.@{alert-prefix-cls}-icon {
color: @success-color;
}
}
&-info {
border: @border-width-base @border-style-base @primary-2;
background-color: @primary-1;
border: @border-width-base @border-style-base ~`colorPalette("@{info-color}", 3)`;
background-color: ~`colorPalette("@{info-color}", 1)`;
.@{alert-prefix-cls}-icon {
color: @info-color;
}
}
&-warning {
border: @border-width-base @border-style-base @yellow-2;
background-color: @yellow-1;
border: @border-width-base @border-style-base ~`colorPalette("@{warning-color}", 3)`;
background-color: ~`colorPalette("@{warning-color}", 1)`;
.@{alert-prefix-cls}-icon {
color: @warning-color;
}
}
&-error {
border: @border-width-base @border-style-base @red-2;
background-color: @red-1;
border: @border-width-base @border-style-base ~`colorPalette("@{error-color}", 3)`;
background-color: ~`colorPalette("@{error-color}", 1)`;
.@{alert-prefix-cls}-icon {
color: @error-color;
}
}
&-close-icon {
font-size: @font-size-base;
font-size: @font-size-sm;
position: absolute;
right: 16px;
top: 10px;
height: 12px;
line-height: 12px;
top: 8px;
line-height: 22px;
overflow: hidden;
cursor: pointer;
.@{iconfont-css-prefix}-cross {
color: @text-color-secondary;
transition: color .3s ease;
transition: color .3s;
&:hover {
color: #404040;
}
@@ -87,21 +84,21 @@
}
&-with-description {
padding: 16px 16px 16px 60px;
padding: 15px 15px 15px 64px;
position: relative;
border-radius: @border-radius-base;
color: @text-color;
line-height: 1.5;
line-height: @line-height-base;
}
&-with-description&-no-icon {
padding: 16px;
padding: 15px;
}
&-with-description &-icon {
position: absolute;
top: 16px;
left: 20px;
left: 24px;
font-size: 24px;
}

View File

@@ -1,5 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import addEventListener from 'rc-util/lib/Dom/addEventListener';
@@ -42,7 +42,7 @@ function easeInOutCubic(t: number, b: number, c: number, d: number) {
}
const reqAnimFrame = getRequestAnimationFrame();
function scrollTo(href: string, offsetTop = 0, target, callback = () => { }) {
function scrollTo(href: string, offsetTop = 0, target: () => Window | HTMLElement, callback = () => { }) {
const scrollTop = getScroll(target(), true);
const targetElement = document.getElementById(href.substring(1));
if (!targetElement) {
@@ -95,9 +95,7 @@ export default class Anchor extends React.Component<AnchorProps, any> {
antAnchor: PropTypes.object,
};
refs: {
ink?: any;
};
private inkNode: HTMLSpanElement;
private links: String[];
private scrollEvent: any;
@@ -157,7 +155,7 @@ export default class Anchor extends React.Component<AnchorProps, any> {
});
}
handleScrollTo = (link) => {
handleScrollTo = (link: string) => {
const { offsetTop, target = getDefaultTarget } = this.props;
this.animating = true;
this.setState({ activeLink: link });
@@ -198,10 +196,14 @@ export default class Anchor extends React.Component<AnchorProps, any> {
const { prefixCls } = this.props;
const linkNode = ReactDOM.findDOMNode(this as any).getElementsByClassName(`${prefixCls}-link-title-active`)[0];
if (linkNode) {
this.refs.ink.style.top = `${(linkNode as any).offsetTop + linkNode.clientHeight / 2 - 4.5}px`;
this.inkNode.style.top = `${(linkNode as any).offsetTop + linkNode.clientHeight / 2 - 4.5}px`;
}
}
saveInkNode = (node: HTMLSpanElement) => {
this.inkNode = node;
}
render() {
const {
prefixCls,
@@ -228,7 +230,7 @@ export default class Anchor extends React.Component<AnchorProps, any> {
<div className={wrapperClass} style={style}>
<div className={anchorClass}>
<div className={`${prefixCls}-ink`} >
<span className={inkClass} ref="ink" />
<span className={inkClass} ref={this.saveInkNode} />
</div>
{children}
</div>

View File

@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

View File

@@ -14,7 +14,7 @@ describe('Anchor Render', () => {
wrapper.find('a[href="#API"]').simulate('click');
wrapper.node.handleScroll();
expect(wrapper.node.state).not.toBe(null);
wrapper.instance().handleScroll();
expect(wrapper.instance().state).not.toBe(null);
});
});

View File

@@ -79,7 +79,7 @@ exports[`renders ./components/anchor/demo/basic.md correctly 1`] = `
</div>
`;
exports[`renders ./components/anchor/demo/fixed.md correctly 1`] = `
exports[`renders ./components/anchor/demo/static.md correctly 1`] = `
<div
class="ant-anchor-wrapper"
>

View File

@@ -1,8 +1,8 @@
---
order: 2
title:
zh-CN: 固定
en-US: Fixed Anchor
zh-CN: 静态位置
en-US: Static Anchor
---
## zh-CN

View File

@@ -1,5 +1,8 @@
import Anchor from './Anchor';
import AnchorLink from './AnchorLink';
export { AnchorProps } from './Anchor';
export { AnchorLinkProps } from './AnchorLink';
Anchor.Link = AnchorLink;
export default Anchor;

View File

@@ -1,7 +1,12 @@
@import "../../style/themes/default";
@import "../../style/mixins/index";
@anchor-border-width: 2px;
.@{ant-prefix}-anchor {
.reset-component;
position: relative;
padding-left: @anchor-border-width;
&-wrapper {
background-color: @component-background;
}
@@ -14,7 +19,7 @@
&:before {
content: ' ';
position: relative;
width: 2px;
width: @anchor-border-width;
height: 100%;
display: block;
background-color: @border-color-split;
@@ -23,10 +28,10 @@
&-ball {
display: none;
position: absolute;
width: 9px;
height: 9px;
border-radius: 9px;
border: 3px solid @primary-color;
width: 8px;
height: 8px;
border-radius: 8px;
border: 2px solid @primary-color;
background-color: @component-background;
left: 50%;
transition: top .3s ease-in-out;
@@ -42,7 +47,7 @@
}
&-link {
padding: 8px 0 8px 18px;
padding: 8px 0 8px 16px;
line-height: 1;
&-title {

View File

@@ -1,18 +1,22 @@
import React from 'react';
import { findDOMNode } from 'react-dom';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
export default class InputElement extends React.Component<any, any> {
export interface InputElementProps {
children: React.ReactElement<any>;
}
export default class InputElement extends React.Component<InputElementProps, any> {
private ele: HTMLInputElement;
focus = () => {
this.ele.focus ? this.ele.focus() : (findDOMNode(this.ele) as HTMLInputElement).focus();
this.ele.focus ? this.ele.focus() : (ReactDOM.findDOMNode(this.ele) as HTMLInputElement).focus();
}
blur = () => {
this.ele.blur ? this.ele.blur() : (findDOMNode(this.ele) as HTMLInputElement).blur();
this.ele.blur ? this.ele.blur() : (ReactDOM.findDOMNode(this.ele) as HTMLInputElement).blur();
}
saveRef = (ele: HTMLInputElement) => {
this.ele = ele;
const childRef = this.props.children.ref;
const { ref: childRef } = this.props.children as any;
if (typeof childRef === 'function') {
childRef(ele);
}

View File

@@ -3,7 +3,7 @@
exports[`renders ./components/auto-complete/demo/basic.md correctly 1`] = `
<div
class="ant-select-show-search ant-select-auto-complete ant-select ant-select-combobox ant-select-enabled"
style="width:200px;"
style="width:200px"
>
<div
aria-autocomplete="list"
@@ -18,7 +18,7 @@ exports[`renders ./components/auto-complete/demo/basic.md correctly 1`] = `
>
<div
class="ant-select-selection__placeholder"
style="display:block;user-select:none;-webkit-user-select:none;"
style="display:block;user-select:none;-webkit-user-select:none"
unselectable="unselectable"
>
input here
@@ -46,7 +46,7 @@ exports[`renders ./components/auto-complete/demo/basic.md correctly 1`] = `
</div>
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none;"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
>
<b />
@@ -58,11 +58,11 @@ exports[`renders ./components/auto-complete/demo/basic.md correctly 1`] = `
exports[`renders ./components/auto-complete/demo/certain-category.md correctly 1`] = `
<div
class="certain-category-search-wrapper"
style="width:250px;"
style="width:250px"
>
<div
class="ant-select-lg ant-select-lg certain-category-search ant-select-show-search ant-select-auto-complete ant-select ant-select-combobox ant-select-enabled"
style="width:100%;"
style="width:100%"
>
<div
aria-autocomplete="list"
@@ -77,7 +77,7 @@ exports[`renders ./components/auto-complete/demo/certain-category.md correctly 1
>
<div
class="ant-select-selection__placeholder"
style="display:block;user-select:none;-webkit-user-select:none;"
style="display:block;user-select:none;-webkit-user-select:none"
unselectable="unselectable"
>
input here
@@ -116,7 +116,7 @@ exports[`renders ./components/auto-complete/demo/certain-category.md correctly 1
</div>
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none;"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
>
<b />
@@ -129,7 +129,7 @@ exports[`renders ./components/auto-complete/demo/certain-category.md correctly 1
exports[`renders ./components/auto-complete/demo/custom.md correctly 1`] = `
<div
class="ant-select-show-search ant-select-auto-complete ant-select ant-select-combobox ant-select-enabled"
style="width:200px;"
style="width:200px"
>
<div
aria-autocomplete="list"
@@ -152,7 +152,7 @@ exports[`renders ./components/auto-complete/demo/custom.md correctly 1`] = `
<textarea
class="ant-input custom ant-select-search__field"
placeholder="input here"
style="height:50px;"
style="height:50px"
/>
<span
class="ant-select-search__field__mirror"
@@ -165,7 +165,7 @@ exports[`renders ./components/auto-complete/demo/custom.md correctly 1`] = `
</div>
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none;"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
>
<b />
@@ -177,7 +177,7 @@ exports[`renders ./components/auto-complete/demo/custom.md correctly 1`] = `
exports[`renders ./components/auto-complete/demo/non-case-sensitive.md correctly 1`] = `
<div
class="ant-select-show-search ant-select-auto-complete ant-select ant-select-combobox ant-select-enabled"
style="width:200px;"
style="width:200px"
>
<div
aria-autocomplete="list"
@@ -192,7 +192,7 @@ exports[`renders ./components/auto-complete/demo/non-case-sensitive.md correctly
>
<div
class="ant-select-selection__placeholder"
style="display:block;user-select:none;-webkit-user-select:none;"
style="display:block;user-select:none;-webkit-user-select:none"
unselectable="unselectable"
>
try to type \`b\`
@@ -220,7 +220,7 @@ exports[`renders ./components/auto-complete/demo/non-case-sensitive.md correctly
</div>
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none;"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
>
<b />
@@ -232,7 +232,7 @@ exports[`renders ./components/auto-complete/demo/non-case-sensitive.md correctly
exports[`renders ./components/auto-complete/demo/options.md correctly 1`] = `
<div
class="ant-select-show-search ant-select-auto-complete ant-select ant-select-combobox ant-select-enabled"
style="width:200px;"
style="width:200px"
>
<div
aria-autocomplete="list"
@@ -247,7 +247,7 @@ exports[`renders ./components/auto-complete/demo/options.md correctly 1`] = `
>
<div
class="ant-select-selection__placeholder"
style="display:block;user-select:none;-webkit-user-select:none;"
style="display:block;user-select:none;-webkit-user-select:none"
unselectable="unselectable"
>
input here
@@ -275,7 +275,7 @@ exports[`renders ./components/auto-complete/demo/options.md correctly 1`] = `
</div>
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none;"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
>
<b />
@@ -287,11 +287,11 @@ exports[`renders ./components/auto-complete/demo/options.md correctly 1`] = `
exports[`renders ./components/auto-complete/demo/uncertain-category.md correctly 1`] = `
<div
class="global-search-wrapper"
style="width:300px;"
style="width:300px"
>
<div
class="ant-select-lg ant-select-lg global-search ant-select-show-search ant-select-auto-complete ant-select ant-select-combobox ant-select-enabled"
style="width:100%;"
style="width:100%"
>
<div
aria-autocomplete="list"
@@ -306,7 +306,7 @@ exports[`renders ./components/auto-complete/demo/uncertain-category.md correctly
>
<div
class="ant-select-selection__placeholder"
style="display:block;user-select:none;-webkit-user-select:none;"
style="display:block;user-select:none;-webkit-user-select:none"
unselectable="unselectable"
>
input here
@@ -350,7 +350,7 @@ exports[`renders ./components/auto-complete/demo/uncertain-category.md correctly
</div>
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none;"
style="user-select:none;-webkit-user-select:none"
unselectable="unselectable"
>
<b />

View File

@@ -1,8 +1,11 @@
import React from 'react';
import { mount } from 'enzyme';
import AutoComplete from '..';
import focusTest from '../../../tests/shared/focusTest';
describe('AutoComplete with Custom Input Element Render', () => {
focusTest(AutoComplete);
it('AutoComplete with custom Input render perfectly', () => {
const wrapper = mount(
<AutoComplete dataSource={['12345', '23456', '34567']}>
@@ -12,7 +15,7 @@ describe('AutoComplete with Custom Input Element Render', () => {
expect(wrapper.find('textarea').length).toBe(1);
wrapper.find('textarea').simulate('change', { target: { value: '123' } });
const dropdownWrapper = mount(wrapper.find('Trigger').node.getComponent());
const dropdownWrapper = mount(wrapper.find('Trigger').instance().getComponent());
// should not filter data source defaultly
expect(dropdownWrapper.find('MenuItem').length).toBe(3);

View File

@@ -21,6 +21,7 @@ const dataSource = ['12345', '23456', '34567'];
| Property | Description | Type | Default |
| -------- | ----------- | ---- | ------- |
| allowClear | Show clear button, effective in multiple mode only. | boolean | false |
| autoFocus | get focus when component mounted | boolean | false |
| backfill | backfill selected item the input when using keyboard | boolean | false |
| children (for customize input element) | customize input element | HTMLInputElement / HTMLTextAreaElement / React.ReactElement<InputProps> | `<Input />` |
| children (for dataSource) | Data source for autocomplet | React.ReactElement<OptionProps> / Array&lt;React.ReactElement<OptionProps>> | - |
@@ -35,3 +36,10 @@ const dataSource = ['12345', '23456', '34567'];
| onChange | Called when select an option or input value change, or value of input is changed | function(value, label) | - |
| onSearch | Called when searching items. | function(value) | - |
| onSelect | Called when a option is selected. param is option's value and option instance. | function(value, option) | - |
## Methods
| Name | Description |
| ---- | ----------- |
| focus() | get focus |
| blur() | remove focus |

View File

@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import { Option, OptGroup } from 'rc-select';
import classNames from 'classnames';
import Select, { AbstractSelectProps, SelectValue, OptionProps, OptGroupProps } from '../select';
@@ -8,7 +8,7 @@ import InputElement from './InputElement';
export interface DataSourceItemObject { value: string; text: string; }
export type DataSourceItemType = string | DataSourceItemObject;
export interface InputProps {
export interface AutoCompleteInputProps {
onChange?: React.FormEventHandler<any>;
value: any;
}
@@ -16,7 +16,7 @@ export interface InputProps {
export type ValidInputElement =
HTMLInputElement |
HTMLTextAreaElement |
React.ReactElement<InputProps>;
React.ReactElement<AutoCompleteInputProps>;
export interface AutoCompleteProps extends AbstractSelectProps {
value?: SelectValue;
@@ -34,7 +34,7 @@ function isSelectOptionOrSelectOptGroup(child: any): Boolean {
return child && child.type && (child.type.isSelectOption || child.type.isSelectOptGroup);
}
export default class AutoComplete extends React.Component<AutoCompleteProps, any> {
export default class AutoComplete extends React.Component<AutoCompleteProps, {}> {
static Option = Option as React.ClassicComponentClass<OptionProps>;
static OptGroup = OptGroup as React.ClassicComponentClass<OptGroupProps>;
@@ -47,6 +47,8 @@ export default class AutoComplete extends React.Component<AutoCompleteProps, any
filterOption: false,
};
private select: any;
getInputElement = () => {
const { children } = this.props;
const element = children && React.isValidElement(children) && children.type !== Option ?
@@ -59,6 +61,18 @@ export default class AutoComplete extends React.Component<AutoCompleteProps, any
);
}
focus() {
this.select.focus();
}
blur() {
this.select.blur();
}
saveSelect = (node: any) => {
this.select = node;
}
render() {
let {
size, className = '', notFoundContent, prefixCls, optionLabelProp, dataSource, children,
@@ -106,6 +120,7 @@ export default class AutoComplete extends React.Component<AutoCompleteProps, any
optionLabelProp={optionLabelProp}
getInputElement={this.getInputElement}
notFoundContent={notFoundContent}
ref={this.saveSelect}
>
{options}
</Select>

View File

@@ -22,6 +22,7 @@ const dataSource = ['12345', '23456', '34567'];
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| allowClear | 支持清除, 单选模式有效 | boolean | false |
| autoFocus | 自动获取焦点 | boolean | false |
| backfill | 使用键盘选择选项的时候把选中项回填到输入框中 | boolean | false |
| children (自动完成的数据源) | 自动完成的数据源 | React.ReactElement<OptionProps> / Array&lt;React.ReactElement<OptionProps>> | - |
| children (自定义输入框) | 自定义输入框 | HTMLInputElement / HTMLTextAreaElement / React.ReactElement<InputProps> | `<Input />` |
@@ -36,3 +37,10 @@ const dataSource = ['12345', '23456', '34567'];
| onChange | 选中 option或 input 的 value 变化时,调用此函数 | function(value) | 无 |
| onSearch | 搜索补全项的时候调用 | function(value) | 无 |
| onSelect | 被选中时调用,参数为选中项的 value 值 | function(value, option) | 无 |
## 方法
| 名称 | 描述 |
| ---- | ----------- |
| focus() | 获取焦点 |
| blur() | 移除焦点 |

View File

@@ -7,6 +7,8 @@
@autocomplete-prefix-cls: ~"@{select-prefix-cls}-auto-complete";
.@{autocomplete-prefix-cls} {
.reset-component;
&.@{select-prefix-cls} {
.@{select-prefix-cls} {
&-selection {
@@ -57,7 +59,9 @@
line-height: @input-height-lg;
}
.@{input-prefix-cls} {
.input-lg();
padding-top: @input-padding-vertical-lg;
padding-bottom: @input-padding-vertical-lg;
height: @input-height-lg;
}
}
@@ -66,7 +70,9 @@
line-height: @input-height-sm;
}
.@{input-prefix-cls} {
.input-sm();
padding-top: @input-padding-vertical-sm;
padding-bottom: @input-padding-vertical-sm;
height: @input-height-sm;
}
}
}

View File

@@ -3,7 +3,7 @@
exports[`renders ./components/avatar/demo/badge.md correctly 1`] = `
<div>
<span
style="margin-right:24px;"
style="margin-right:24px"
>
<span
class="ant-badge"
@@ -22,7 +22,7 @@ exports[`renders ./components/avatar/demo/badge.md correctly 1`] = `
>
<span
class="ant-scroll-number-only"
style="transition:none;-ms-transform:translateY(-1100%);-webkit-transform:translateY(-1100%);transform:translateY(-1100%);"
style="transition:none;-ms-transform:translateY(-1100%);-webkit-transform:translateY(-1100%);transform:translateY(-1100%)"
>
<p
class=""
@@ -253,7 +253,7 @@ exports[`renders ./components/avatar/demo/dynamic.md correctly 1`] = `
<div>
<span
class="ant-avatar ant-avatar-lg ant-avatar-circle"
style="background-color:#f56a00;"
style="background-color:#f56a00;vertical-align:middle"
>
<span
class="ant-avatar-string"
@@ -263,7 +263,7 @@ exports[`renders ./components/avatar/demo/dynamic.md correctly 1`] = `
</span>
<button
class="ant-btn ant-btn-sm"
style="margin-left:16px;"
style="margin-left:16px;vertical-align:middle"
type="button"
>
<span>
@@ -309,7 +309,7 @@ exports[`renders ./components/avatar/demo/type.md correctly 1`] = `
</span>
<span
class="ant-avatar ant-avatar-circle"
style="color:#f56a00;background-color:#fde3cf;"
style="color:#f56a00;background-color:#fde3cf"
>
<span
class="ant-avatar-string"
@@ -319,7 +319,7 @@ exports[`renders ./components/avatar/demo/type.md correctly 1`] = `
</span>
<span
class="ant-avatar ant-avatar-circle ant-avatar-icon"
style="background-color:#87d068;"
style="background-color:#87d068"
>
<i
class="anticon anticon-user"

View File

@@ -37,8 +37,12 @@ class Autoset extends React.Component {
render() {
return (
<div>
<Avatar style={{ backgroundColor: this.state.color }} size="large">{this.state.user}</Avatar>
<Button size="small" style={{ marginLeft: 16 }} onClick={this.changeUser}>Change</Button>
<Avatar style={{ backgroundColor: this.state.color, verticalAlign: 'middle' }} size="large">
{this.state.user}
</Avatar>
<Button size="small" style={{ marginLeft: 16, verticalAlign: 'middle' }} onClick={this.changeUser}>
Change
</Button>
</div>
);
}

View File

@@ -1,5 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import Icon from '../icon';
import classNames from 'classnames';

View File

@@ -1,8 +1,10 @@
@import "../../style/themes/default";
@import "../../style/mixins/index";
@avatar-prefix-cls: ~"@{ant-prefix}-avatar";
.@{avatar-prefix-cls} {
.reset-component;
display: inline-block;
text-align: center;
background: @avatar-bg;

View File

@@ -4,7 +4,7 @@ exports[`renders ./components/back-top/demo/basic.md correctly 1`] = `
<div>
Scroll down to see the bottom-right
<strong
style="color:rgba(64, 64, 64, 0.6);"
style="color:rgba(64, 64, 64, 0.6)"
>
gray
</strong>
@@ -16,7 +16,7 @@ exports[`renders ./components/back-top/demo/custom.md correctly 1`] = `
<div>
Scroll down to see the bottom-right
<strong
style="color:#1088e9;"
style="color:#1088e9"
>
blue
</strong>

View File

@@ -2,17 +2,23 @@ import React from 'react';
import { mount } from 'enzyme';
import BackTop from '..';
const delay = timeout => new Promise(resolve => setTimeout(resolve, timeout));
describe('BackTop', () => {
it('should scroll to top after click it', async () => {
beforeAll(() => {
jest.useFakeTimers();
});
afterAll(() => {
jest.useRealTimers();
});
it('should scroll to top after click it', () => {
const wrapper = mount(<BackTop visibilityHeight={-1} />);
document.documentElement.scrollTop = 400;
// trigger scroll manually
wrapper.node.handleScroll();
await delay(500);
wrapper.instance().handleScroll();
jest.runAllTimers();
wrapper.find('.ant-back-top').simulate('click');
await delay(500);
jest.runAllTimers();
expect(Math.round(document.documentElement.scrollTop)).toBe(0);
});
});

View File

@@ -1,9 +1,8 @@
import React from 'react';
import * as React from 'react';
import Animate from 'rc-animate';
import addEventListener from 'rc-util/lib/Dom/addEventListener';
import classNames from 'classnames';
import omit from 'omit.js';
import Icon from '../icon';
import getScroll from '../_util/getScroll';
import getRequestAnimationFrame from '../_util/getRequestAnimationFrame';
@@ -109,7 +108,7 @@ export default class BackTop extends React.Component<BackTopProps, any> {
const defaultElement = (
<div className={`${prefixCls}-content`}>
<Icon className={`${prefixCls}-icon`} type="to-top" />
<div className={`${prefixCls}-icon`} />
</div>
);

View File

@@ -1,8 +1,10 @@
@import "../../style/themes/default";
@import "../../style/mixins/index";
@backtop-prefix-cls: ~"@{ant-prefix}-back-top";
.@{backtop-prefix-cls} {
.reset-component;
z-index: @zindex-back-top;
position: fixed;
right: 100px;
@@ -19,6 +21,7 @@
color: @back-top-color;
text-align: center;
transition: all .3s @ease-in-out;
overflow: hidden;
&:hover {
background-color: @back-top-hover-bg;
@@ -27,7 +30,9 @@
}
&-icon {
font-size: 20px;
margin-top: 10px;
margin: 12px auto;
width: 14px;
height: 16px;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAoCAYAAACWwljjAAAABGdBTUEAALGPC/xhBQAAAbtJREFUWAntmMtKw0AUhhMvS5cuxILgQlRUpIggIoKIIoigG1eC+AA+jo+i6FIXBfeuXIgoeKVeitVWJX5HWhhDksnUpp3FDPyZk3Nm5nycmZKkXhAEOXSA3lG7muTeRzmfy6HneUvIhnYkQK+Q9NhAA0Opg0vBEhjBKHiyb8iGMyQMOYuK41BcBSypAL+MYXSKjtFAW7EAGEO3qN4uMQbbAkXiSfRQJ1H6a+yhlkKRcAoVFYiweYNjtCVQJJpBz2GCiPt7fBOZQpFgDpUikse5HgnkM4Fi4QX0Fpc5wf9EbLqpUCy4jMoJSXWhFwbMNgWKhVbRhy5jirhs9fy/oFhgHVVTJEs7RLZ8sSEoJm6iz7SZDMbJ+/OKERQTttCXQRLToRUmrKWCYuA2+jbN0MB4OQobYShfdTCgn/sL1K36M7TLrN3n+758aPy2rrpR6+/od5E8tf/A1uLS9aId5T7J3CNYihkQ4D9PiMdMC7mp4rjB9kjFjZp8BlnVHJBuO1yFXIV0FdDF3RlyFdJVQBdv5AxVdIsq8apiZ2PyYO1EVykesGfZEESsCkweyR8MUW+V8uJ1gkYipmpdP1pm2aJVPEGzAAAAAElFTkSuQmCC) ~"100%/100%" no-repeat;
}
}

View File

@@ -1,9 +1,9 @@
import React from 'react';
import * as React from 'react';
import { createElement, Component } from 'react';
import omit from 'omit.js';
import classNames from 'classnames';
function getNumberArray(num) {
function getNumberArray(num: string | number | undefined) {
return num ?
num.toString()
.split('')
@@ -21,7 +21,12 @@ export interface ScrollNumberProps {
title?: string | number;
}
export default class ScrollNumber extends Component<ScrollNumberProps, any> {
export interface ScrollNumberState {
animateStarted?: boolean;
count?: string | number;
}
export default class ScrollNumber extends Component<ScrollNumberProps, ScrollNumberState> {
static defaultProps = {
prefixCls: 'ant-scroll-number',
count: null,
@@ -31,7 +36,7 @@ export default class ScrollNumber extends Component<ScrollNumberProps, any> {
lastCount: any;
constructor(props) {
constructor(props: ScrollNumberProps) {
super(props);
this.state = {
animateStarted: true,
@@ -39,14 +44,14 @@ export default class ScrollNumber extends Component<ScrollNumberProps, any> {
};
}
getPositionByNum(num, i) {
getPositionByNum(num: number, i: number) {
if (this.state.animateStarted) {
return 10 + num;
}
const currentDigit = getNumberArray(this.state.count)[i];
const lastDigit = getNumberArray(this.lastCount)[i];
// 同方向则在同一侧切换数字
if (this.state.count > this.lastCount) {
if (this.state.count! > this.lastCount) {
if (currentDigit >= lastDigit) {
return 10 + num;
}
@@ -58,7 +63,7 @@ export default class ScrollNumber extends Component<ScrollNumberProps, any> {
return num;
}
componentWillReceiveProps(nextProps) {
componentWillReceiveProps(nextProps: ScrollNumberProps) {
if ('count' in nextProps) {
if (this.state.count === nextProps.count) {
return;
@@ -85,7 +90,7 @@ export default class ScrollNumber extends Component<ScrollNumberProps, any> {
}
}
renderNumberList(position) {
renderNumberList(position: number) {
const childrenToReturn: React.ReactElement<any>[] = [];
for (let i = 0; i < 30; i++) {
const currentClassName = (position === i) ? 'current' : '';
@@ -94,7 +99,7 @@ export default class ScrollNumber extends Component<ScrollNumberProps, any> {
return childrenToReturn;
}
renderCurrentNumber(num, i) {
renderCurrentNumber(num: number, i: number) {
const position = this.getPositionByNum(num, i);
const removeTransition = this.state.animateStarted ||
(getNumberArray(this.lastCount)[i] === undefined);
@@ -112,7 +117,7 @@ export default class ScrollNumber extends Component<ScrollNumberProps, any> {
renderNumberElement() {
const state = this.state;
if (!state.count || isNaN(state.count)) {
if (!state.count || isNaN(state.count as number)) {
return state.count;
}
return getNumberArray(state.count)

View File

@@ -16,7 +16,7 @@ exports[`renders ./components/badge/demo/basic.md correctly 1`] = `
>
<span
class="ant-scroll-number-only"
style="transition:none;-ms-transform:translateY(-1500%);-webkit-transform:translateY(-1500%);transform:translateY(-1500%);"
style="transition:none;-ms-transform:translateY(-1500%);-webkit-transform:translateY(-1500%);transform:translateY(-1500%)"
>
<p
class=""
@@ -206,7 +206,7 @@ exports[`renders ./components/badge/demo/change.md correctly 1`] = `
>
<span
class="ant-scroll-number-only"
style="transition:none;-ms-transform:translateY(-1500%);-webkit-transform:translateY(-1500%);transform:translateY(-1500%);"
style="transition:none;-ms-transform:translateY(-1500%);-webkit-transform:translateY(-1500%);transform:translateY(-1500%)"
>
<p
class=""
@@ -383,7 +383,7 @@ exports[`renders ./components/badge/demo/change.md correctly 1`] = `
</div>
</div>
<div
style="margin-top:10px;"
style="margin-top:10px"
>
<span
class="ant-badge"
@@ -456,7 +456,7 @@ exports[`renders ./components/badge/demo/link.md correctly 1`] = `
>
<span
class="ant-scroll-number-only"
style="transition:none;-ms-transform:translateY(-1500%);-webkit-transform:translateY(-1500%);transform:translateY(-1500%);"
style="transition:none;-ms-transform:translateY(-1500%);-webkit-transform:translateY(-1500%);transform:translateY(-1500%)"
>
<p
class=""
@@ -620,13 +620,13 @@ exports[`renders ./components/badge/demo/no-wrapper.md correctly 1`] = `
class="ant-badge ant-badge-not-a-wrapper"
>
<sup
class="ant-scroll-number ant-badge-count"
class="ant-scroll-number ant-badge-count ant-badge-multiple-words"
data-show="true"
title="25"
>
<span
class="ant-scroll-number-only"
style="transition:none;-ms-transform:translateY(-1200%);-webkit-transform:translateY(-1200%);transform:translateY(-1200%);"
style="transition:none;-ms-transform:translateY(-1200%);-webkit-transform:translateY(-1200%);transform:translateY(-1200%)"
>
<p
class=""
@@ -781,7 +781,7 @@ exports[`renders ./components/badge/demo/no-wrapper.md correctly 1`] = `
</span>
<span
class="ant-scroll-number-only"
style="transition:none;-ms-transform:translateY(-1500%);-webkit-transform:translateY(-1500%);transform:translateY(-1500%);"
style="transition:none;-ms-transform:translateY(-1500%);-webkit-transform:translateY(-1500%);transform:translateY(-1500%)"
>
<p
class=""
@@ -942,12 +942,12 @@ exports[`renders ./components/badge/demo/no-wrapper.md correctly 1`] = `
<sup
class="ant-scroll-number ant-badge-count"
data-show="true"
style="background-color:#fff;color:#999;box-shadow:0 0 0 1px #d9d9d9 inset;"
style="background-color:#fff;color:#999;box-shadow:0 0 0 1px #d9d9d9 inset"
title="4"
>
<span
class="ant-scroll-number-only"
style="transition:none;-ms-transform:translateY(-1400%);-webkit-transform:translateY(-1400%);transform:translateY(-1400%);"
style="transition:none;-ms-transform:translateY(-1400%);-webkit-transform:translateY(-1400%);transform:translateY(-1400%)"
>
<p
class=""
@@ -1106,9 +1106,9 @@ exports[`renders ./components/badge/demo/no-wrapper.md correctly 1`] = `
class="ant-badge ant-badge-not-a-wrapper"
>
<sup
class="ant-scroll-number ant-badge-count"
class="ant-scroll-number ant-badge-count ant-badge-multiple-words"
data-show="true"
style="background-color:#87d068;"
style="background-color:#52c41a"
title="109"
>
99+
@@ -1127,13 +1127,13 @@ exports[`renders ./components/badge/demo/overflow.md correctly 1`] = `
href="#"
/>
<sup
class="ant-scroll-number ant-badge-count"
class="ant-scroll-number ant-badge-count ant-badge-multiple-words"
data-show="true"
title="99"
>
<span
class="ant-scroll-number-only"
style="transition:none;-ms-transform:translateY(-1900%);-webkit-transform:translateY(-1900%);transform:translateY(-1900%);"
style="transition:none;-ms-transform:translateY(-1900%);-webkit-transform:translateY(-1900%);transform:translateY(-1900%)"
>
<p
class=""
@@ -1288,7 +1288,7 @@ exports[`renders ./components/badge/demo/overflow.md correctly 1`] = `
</span>
<span
class="ant-scroll-number-only"
style="transition:none;-ms-transform:translateY(-1900%);-webkit-transform:translateY(-1900%);transform:translateY(-1900%);"
style="transition:none;-ms-transform:translateY(-1900%);-webkit-transform:translateY(-1900%);transform:translateY(-1900%)"
>
<p
class=""
@@ -1451,7 +1451,7 @@ exports[`renders ./components/badge/demo/overflow.md correctly 1`] = `
href="#"
/>
<sup
class="ant-scroll-number ant-badge-count"
class="ant-scroll-number ant-badge-count ant-badge-multiple-words"
data-show="true"
title="100"
>
@@ -1466,7 +1466,7 @@ exports[`renders ./components/badge/demo/overflow.md correctly 1`] = `
href="#"
/>
<sup
class="ant-scroll-number ant-badge-count"
class="ant-scroll-number ant-badge-count ant-badge-multiple-words"
data-show="true"
title="99"
>
@@ -1481,7 +1481,7 @@ exports[`renders ./components/badge/demo/overflow.md correctly 1`] = `
href="#"
/>
<sup
class="ant-scroll-number ant-badge-count"
class="ant-scroll-number ant-badge-count ant-badge-multiple-words"
data-show="true"
title="1000"
>

View File

@@ -30,12 +30,12 @@ ReactDOM.render(
<style>
.ant-badge:not(.ant-badge-status) {
margin-right: 16px;
margin-right: 20px;
}
.head-example {
width: 42px;
height: 42px;
border-radius: 6px;
border-radius: 4px;
background: #eee;
display: inline-block;
}

View File

@@ -22,7 +22,7 @@ ReactDOM.render(
<div>
<Badge count={25} />
<Badge count={4} style={{ backgroundColor: '#fff', color: '#999', boxShadow: '0 0 0 1px #d9d9d9 inset' }} />
<Badge count={109} style={{ backgroundColor: '#87d068' }} />
<Badge count={109} style={{ backgroundColor: '#52c41a' }} />
</div>
, mountNode);
````

View File

@@ -30,3 +30,4 @@ Badge normally appears in proximity to notifications or user avatars with eye-ca
| showZero | Whether to show badge when `count` is zero | boolean | `false` |
| status | Set Badge as a status dot | `success` \| `processing` \| `default` \| `error` \| `warning` | `''` |
| text | If `status` is set, `text` sets the display text of the status `dot` | string | `''` |
| offset | set offset of the badge dot, like [x, y] | [number, number] | - |

View File

@@ -1,9 +1,10 @@
import React from 'react';
import * as React from 'react';
import PropTypes from 'prop-types';
import Animate from 'rc-animate';
import ScrollNumber from './ScrollNumber';
import classNames from 'classnames';
import warning from '../_util/warning';
export { ScrollNumberProps } from './ScrollNumber';
export interface BadgeProps {
/** Number to show in badge */
@@ -19,6 +20,7 @@ export interface BadgeProps {
className?: string;
status?: 'success' | 'processing' | 'default' | 'error' | 'warning';
text?: string;
offset?: [number | string, number | string];
}
export default class Badge extends React.Component<BadgeProps, any> {
@@ -54,6 +56,7 @@ export default class Badge extends React.Component<BadgeProps, any> {
dot,
status,
text,
offset,
...restProps,
} = this.props;
const isDot = dot || status;
@@ -66,27 +69,29 @@ export default class Badge extends React.Component<BadgeProps, any> {
const isZero = displayCount === '0' || displayCount === 0;
const isEmpty = displayCount === null || displayCount === undefined || displayCount === '';
const hidden = (isEmpty || (isZero && !showZero)) && !isDot;
const statusCls = classNames({
[`${prefixCls}-status-dot`]: !!status,
[`${prefixCls}-status-${status}`]: !!status,
});
const scrollNumberCls = classNames({
[`${prefixCls}-dot`]: isDot,
[`${prefixCls}-count`]: !isDot,
[`${prefixCls}-multiple-words`]: count && count.toString && count.toString().length > 1,
[`${prefixCls}-status-${status}`]: !!status,
});
const badgeCls = classNames(className, prefixCls, {
[`${prefixCls}-status`]: !!status,
[`${prefixCls}-not-a-wrapper`]: !children,
});
warning(
!(children && status),
'`Badge[children]` and `Badge[status]` cannot be used at the same time.',
);
const styleWithOffset = offset ? {
marginTop: offset[0],
marginLeft: offset[1],
...style,
} : style;
// <Badge status="success" />
if (!children && status) {
const statusCls = classNames({
[`${prefixCls}-status-dot`]: !!status,
[`${prefixCls}-status-${status}`]: true,
});
return (
<span className={badgeCls}>
<span className={badgeCls} style={styleWithOffset}>
<span className={statusCls} />
<span className={`${prefixCls}-status-text`}>{text}</span>
</span>
@@ -100,7 +105,7 @@ export default class Badge extends React.Component<BadgeProps, any> {
className={scrollNumberCls}
count={displayCount}
title={count}
style={style}
style={styleWithOffset}
/>
);

View File

@@ -31,3 +31,4 @@ title: Badge
| showZero | 当数值为 0 时,是否展示 Badge | boolean | false |
| status | 设置 Badge 为状态点 | Enum{ 'success', 'processing, 'default', 'error', 'warning' } | '' |
| text | 在设置了 `status` 的前提下有效,设置状态点的文本 | string | '' |
| offset | 设置状态点的位置偏移,格式为 [x, y] | [number, number] | - |

View File

@@ -1,9 +1,11 @@
@import "../../style/themes/default";
@import "../../style/mixins/index";
@badge-prefix-cls: ~"@{ant-prefix}-badge";
@number-prefix-cls: ~"@{ant-prefix}-scroll-number";
.@{badge-prefix-cls} {
.reset-component;
position: relative;
display: inline-block;
line-height: 1;
@@ -24,13 +26,17 @@
font-size: @badge-font-size;
white-space: nowrap;
transform-origin: -10% center;
font-family: tahoma;
box-shadow: 0 0 0 1px #fff;
a,
a:hover {
color: #fff;
}
}
&-multiple-words {
padding: 0 8px;
}
&-dot {
position: absolute;
transform: translateX(-50%);
@@ -49,16 +55,19 @@
vertical-align: baseline;
&-dot {
width: 8px;
height: 8px;
width: @badge-status-size;
height: @badge-status-size;
display: inline-block;
border-radius: 50%;
vertical-align: middle;
position: relative;
top: -1px;
}
&-success {
background-color: @success-color;
}
&-processing {
background-color: @primary-color;
background-color: @processing-color;
position: relative;
&:after {
position: absolute;
@@ -67,7 +76,7 @@
width: 100%;
height: 100%;
border-radius: 50%;
border: 1px solid @primary-color;
border: 1px solid @processing-color;
content: '';
animation: antStatusProcessing 1.2s infinite ease-in-out;
}
@@ -99,7 +108,7 @@
animation-fill-mode: both;
}
&-not-a-wrapper &-count {
&-not-a-wrapper .@{ant-prefix}-scroll-number {
top: auto;
display: block;
position: relative;
@@ -126,6 +135,7 @@
height: @badge-height;
> p {
height: @badge-height;
margin: 0;
}
}
}

View File

@@ -1,21 +1,26 @@
import React from 'react';
import * as React from 'react';
import PropTypes from 'prop-types';
import { cloneElement } from 'react';
import warning from '../_util/warning';
import BreadcrumbItem from './BreadcrumbItem';
import classNames from 'classnames';
export interface Route {
path: string;
breadcrumbName: string;
}
export interface BreadcrumbProps {
prefixCls?: string;
routes?: Array<any>;
params?: Object;
routes?: Route[];
params?: any;
separator?: React.ReactNode;
itemRender?: (route: any, params: any, routes: Array<any>, paths: Array<string>) => React.ReactNode;
style?: React.CSSProperties;
className?: string;
}
function getBreadcrumbName(route, params) {
function getBreadcrumbName(route: Route, params: any) {
if (!route.breadcrumbName) {
return null;
}
@@ -27,7 +32,7 @@ function getBreadcrumbName(route, params) {
return name;
}
function defaultItemRender(route, params, routes, paths) {
function defaultItemRender(route: Route, params: any, routes: Route[], paths: string[]) {
const isLastItem = routes.indexOf(route) === routes.length - 1;
const name = getBreadcrumbName(route, params);
return isLastItem

View File

@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import PropTypes from 'prop-types';
export interface BreadcrumbItemProps {

View File

@@ -1,11 +1,3 @@
import { render } from 'enzyme';
import demoTest from '../../../tests/shared/demoTest';
import routerDemo from '../demo/router.md';
demoTest('breadcrumb', { skip: ['router.md', 'router-4.md'] });
const testMethod = typeof window !== 'undefined' ? test : test.skip;
testMethod('renders ./components/breadcrumb/demo/router.md correctly', () => {
const wrapper = render(routerDemo);
expect(wrapper).toMatchSnapshot();
});

View File

@@ -1,5 +1,8 @@
import Breadcrumb from './Breadcrumb';
import BreadcrumbItem from './BreadcrumbItem';
export { BreadcrumbProps } from './Breadcrumb';
export { BreadcrumbItemProps } from './BreadcrumbItem';
Breadcrumb.Item = BreadcrumbItem;
export default Breadcrumb;

View File

@@ -1,13 +1,18 @@
@import "../../style/themes/default";
@import "../../style/mixins/index";
@breadcrumb-prefix-cls: ~"@{ant-prefix}-breadcrumb";
.@{breadcrumb-prefix-cls} {
color: @text-color;
font-size: @font-size-base;
.reset-component;
color: @text-color-secondary;
.@{iconfont-css-prefix} {
font-size: @font-size-sm;
}
a {
color: @text-color;
color: @text-color-secondary;
transition: color .3s;
&:hover {
color: @primary-5;
@@ -15,7 +20,6 @@
}
& > span:last-child {
font-weight: 500;
color: @text-color;
}
@@ -24,8 +28,8 @@
}
&-separator {
margin: 0 8px;
color: rgba(0, 0, 0, 0.3);
margin: 0 @padding-xs;
color: @text-color-secondary;
}
&-link {

View File

@@ -54,7 +54,7 @@ exports[`renders ./components/button/demo/button-group.md correctly 1`] = `
</span>
</button>
<button
class="ant-btn ant-btn-primary"
class="ant-btn"
type="button"
>
<span>
@@ -97,7 +97,7 @@ exports[`renders ./components/button/demo/button-group.md correctly 1`] = `
class="ant-btn-group"
>
<button
class="ant-btn ant-btn-primary"
class="ant-btn"
type="button"
>
<span>
@@ -115,14 +115,6 @@ exports[`renders ./components/button/demo/button-group.md correctly 1`] = `
<button
class="ant-btn"
type="button"
>
<span>
M
</span>
</button>
<button
class="ant-btn ant-btn-dashed"
type="button"
>
<span>
R
@@ -259,7 +251,7 @@ exports[`renders ./components/button/demo/disabled.md correctly 1`] = `
exports[`renders ./components/button/demo/ghost.md correctly 1`] = `
<div
style="background:rgb(190, 200, 200);padding:26px 16px 16px;"
style="background:rgb(190, 200, 200);padding:26px 16px 16px"
>
<button
class="ant-btn ant-btn-primary ant-btn-background-ghost"
@@ -465,7 +457,7 @@ exports[`renders ./components/button/demo/multiple.md correctly 1`] = `
type="button"
>
<span>
more
Actions
</span>
<i
class="anticon anticon-down"

View File

@@ -49,3 +49,15 @@ exports[`Button renders correctly 1`] = `
</span>
</button>
`;
exports[`Button should support link button 1`] = `
<a
class="ant-btn"
href="http://ant.design"
target="_blank"
>
<span>
link button
</span>
</a>
`;

View File

@@ -52,7 +52,7 @@ describe('Button', () => {
<DefaultButton />
);
wrapper.simulate('click');
expect(wrapper.hasClass('ant-btn-loading')).toBe(true);
expect(wrapper.find('.ant-btn-loading').length).toBe(1);
});
it('should change loading state with delay', () => {
@@ -74,4 +74,11 @@ describe('Button', () => {
wrapper.simulate('click');
expect(wrapper.hasClass('ant-btn-loading')).toBe(false);
});
it('should support link button', () => {
const wrapper = mount(
<Button target="_blank" href="http://ant.design">link button</Button>
);
expect(wrapper.render()).toMatchSnapshot();
});
});

View File

@@ -1,7 +1,6 @@
import React from 'react';
import * as React from 'react';
import classNames from 'classnames';
export type ButtonSize = 'small' | 'large';
import { ButtonSize } from './button';
export interface ButtonGroupProps {
size?: ButtonSize;

View File

@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import omit from 'omit.js';
@@ -35,7 +35,7 @@ function insertSpace(child: React.ReactChild, needInserted: boolean) {
export type ButtonType = 'primary' | 'ghost' | 'dashed' | 'danger';
export type ButtonShape = 'circle' | 'circle-outline';
export type ButtonSize = 'small' | 'large';
export type ButtonSize = 'small' | 'default' | 'large';
export interface ButtonProps {
type?: ButtonType;
@@ -52,6 +52,9 @@ export interface ButtonProps {
prefixCls?: string;
className?: string;
ghost?: boolean;
target?: string;
href?: string;
download?: string;
}
export default class Button extends React.Component<ButtonProps, any> {
@@ -95,7 +98,7 @@ export default class Button extends React.Component<ButtonProps, any> {
}
if (typeof loading !== 'boolean' && loading && loading.delay) {
this.delayTimeout = setTimeout(() => this.setState({ loading }), loading.delay);
this.delayTimeout = window.setTimeout(() => this.setState({ loading }), loading.delay);
} else {
this.setState({ loading });
}
@@ -114,7 +117,7 @@ export default class Button extends React.Component<ButtonProps, any> {
// Add click effect
this.setState({ clicked: true });
clearTimeout(this.timeout);
this.timeout = setTimeout(() => this.setState({ clicked: false }), 500);
this.timeout = window.setTimeout(() => this.setState({ clicked: false }), 500);
const onClick = this.props.onClick;
if (onClick) {
@@ -142,6 +145,8 @@ export default class Button extends React.Component<ButtonProps, any> {
break;
}
const ComponentProp = others.href ? 'a' : 'button';
const classes = classNames(prefixCls, className, {
[`${prefixCls}-${type}`]: type,
[`${prefixCls}-${shape}`]: shape,
@@ -155,17 +160,17 @@ export default class Button extends React.Component<ButtonProps, any> {
const iconType = loading ? 'loading' : icon;
const iconNode = iconType ? <Icon type={iconType} /> : null;
const needInserted = React.Children.count(children) === 1 && (!iconType || iconType === 'loading');
const kids = React.Children.map(children, child => insertSpace(child, needInserted));
const kids = children ? React.Children.map(children, child => insertSpace(child, needInserted)) : null;
return (
<button
<ComponentProp
{...omit(others, ['loading'])}
type={htmlType || 'button'}
type={others.href ? undefined : (htmlType || 'button')}
className={classes}
onClick={this.handleClick}
>
{iconNode}{kids}
</button>
</ComponentProp>
);
}
}

View File

@@ -26,7 +26,7 @@ ReactDOM.render(
<h4>Basic</h4>
<ButtonGroup>
<Button>Cancel</Button>
<Button type="primary">OK</Button>
<Button>OK</Button>
</ButtonGroup>
<ButtonGroup>
<Button disabled>L</Button>
@@ -34,10 +34,9 @@ ReactDOM.render(
<Button disabled>R</Button>
</ButtonGroup>
<ButtonGroup>
<Button type="primary">L</Button>
<Button>L</Button>
<Button>M</Button>
<Button>M</Button>
<Button type="dashed">R</Button>
<Button>R</Button>
</ButtonGroup>
<h4>With Icon</h4>

View File

@@ -35,7 +35,7 @@ ReactDOM.render(
<Button>secondary</Button>
<Dropdown overlay={menu}>
<Button>
more <Icon type="down" />
Actions <Icon type="down" />
</Button>
</Dropdown>
</div>,

View File

@@ -24,9 +24,13 @@ To get a customized button, just set `type`/`shape`/`size`/`loading`/`disabled`.
| size | can be set to `small` `large` or omitted | string | `default` |
| type | can be set to `primary` `ghost` `dashed` `danger`(added in 2.7) or omitted (meaning `default`) | string | `default` |
| onClick | set the handler to handle `click` event | function | - |
| href | redirect url of link button | string | - |
| target | same as target attribute of a, works when href is specified | string | - |
`<Button>Hello world!</Button>` will be rendered into `<button><span>Hello world!</span></button>`, and all the properties which are not listed above will be transferred to the `<button>` tag.
`<Button href="http://example.com">Hello world!</Button>` will be rendered into `<a href="http://example.com"><span>Hello world!</span></a>`.
<style>
[id^=components-button-demo-] .ant-btn {
margin-right: 8px;

View File

@@ -1,5 +1,8 @@
import Button from './button';
import ButtonGroup from './button-group';
export { ButtonProps, ButtonShape, ButtonSize, ButtonType } from './button';
export { ButtonGroupProps } from './button-group';
Button.Group = ButtonGroup;
export default Button;

View File

@@ -27,9 +27,14 @@ subtitle: 按钮
| size | 设置按钮大小,可选值为 `small` `large` 或者不设 | string | `default` |
| type | 设置按钮类型,可选值为 `primary` `dashed` `danger`(版本 2.7 中增加) 或者不设 | string | - |
| onClick | `click` 事件的 handler | function | - |
| href | 点击跳转的地址,指定此属性 button 的行为和 a 链接一致 | string | - |
| target | 相当于 a 链接的 target 属性href 存在时生效 | string | - |
`<Button>Hello world!</Button>` 最终会被渲染为 `<button><span>Hello world!</span></button>`,并且除了上表中的属性,其它属性都会直接传到 `<button></button>`
`<Button href="http://example.com">Hello world!</Button>` 则会渲染为 `<a href="http://example.com"><span>Hello world!</span></a>`
<style>
[id^="components-button-demo-"] .ant-btn {
margin-right: 8px;

View File

@@ -12,6 +12,7 @@
// Button styles
// -----------------------------
.@{btn-prefix-cls} {
.reset-component;
.btn;
.btn-default;
@@ -127,7 +128,7 @@
// To ensure that a space will be placed between character and `Icon`.
> .@{iconfont-css-prefix} + span,
> span + .@{iconfont-css-prefix} {
margin-left: 0.5em;
margin-left: 8px;
}
&-clicked:after {
@@ -173,3 +174,13 @@
border-width: 6px;
}
}
a.@{btn-prefix-cls} {
line-height: @btn-height-base - 2px;
&-lg {
line-height: @btn-height-lg - 2px;
}
&-sm {
line-height: @btn-height-sm - 2px;
}
}

View File

@@ -40,7 +40,7 @@
&:hover,
&:focus {
.button-color(@primary-color; @background; @primary-color);
.button-color(@primary-5; @background; @primary-5);
}
&:active,
@@ -56,12 +56,12 @@
&:hover,
&:focus {
.button-color(@btn-primary-color; @color; @color;);
.button-color(@btn-primary-color; ~`colorPalette("@{color}", 5)`; ~`colorPalette("@{color}", 5)`);
}
&:active,
&.active {
.button-color(@btn-primary-color; ~`colorPalette("@{color}", 7)`; ~`colorPalette("@{color}", 7)`;);
.button-color(@btn-primary-color; ~`colorPalette("@{color}", 7)`; ~`colorPalette("@{color}", 7)`);
}
.button-disabled();
@@ -185,7 +185,7 @@
}
&-sm {
.button-size(@btn-height-sm; @btn-padding-sm; @font-size-base; @btn-border-radius-sm);
.button-size(@btn-height-sm; @btn-padding-sm; @btn-font-size-sm; @btn-border-radius-sm);
}
}
@@ -251,8 +251,6 @@
.@{btnClassName}:not(:first-child):not(:last-child) {
border-radius: 0;
padding-left: 8px;
padding-right: 8px;
}
> .@{btnClassName}:first-child {
@@ -260,14 +258,12 @@
&:not(:last-child) {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
padding-right: 8px;
}
}
> .@{btnClassName}:last-child:not(:first-child) {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
padding-left: 8px;
}
& > & {

View File

@@ -1,5 +1,5 @@
import React from 'react';
import moment from 'moment';
import * as React from 'react';
import * as moment from 'moment';
import { PREFIX_CLS } from './Constants';
import Select from '../select';
import { Group, Button } from '../radio';
@@ -12,7 +12,7 @@ export interface HeaderProps {
yearSelectOffset?: number;
yearSelectTotal?: number;
type?: string;
onValueChange?: (value) => void;
onValueChange?: (value: moment.Moment) => void;
onTypeChange?: (type: string) => void;
value: any;
}
@@ -24,9 +24,9 @@ export default class Header extends React.Component<HeaderProps, any> {
yearSelectTotal: 20,
};
calenderHeaderNode: any;
private calenderHeaderNode: HTMLDivElement;
getYearSelectElement(year) {
getYearSelectElement(year: number) {
const { yearSelectOffset, yearSelectTotal, locale, prefixCls, fullscreen } = this.props;
const start = year - (yearSelectOffset as number);
const end = start + (yearSelectTotal as number);
@@ -61,7 +61,7 @@ export default class Header extends React.Component<HeaderProps, any> {
return months;
}
getMonthSelectElement(month, months) {
getMonthSelectElement(month: number, months: number[]) {
const props = this.props;
const { prefixCls, fullscreen } = props;
const options: React.ReactElement<any>[] = [];
@@ -84,7 +84,7 @@ export default class Header extends React.Component<HeaderProps, any> {
);
}
onYearChange = (year) => {
onYearChange = (year: string) => {
const newValue = this.props.value.clone();
newValue.year(parseInt(year, 10));
@@ -94,7 +94,7 @@ export default class Header extends React.Component<HeaderProps, any> {
}
}
onMonthChange = (month) => {
onMonthChange = (month: string) => {
const newValue = this.props.value.clone();
newValue.month(parseInt(month, 10));
const onValueChange = this.props.onValueChange;
@@ -103,14 +103,14 @@ export default class Header extends React.Component<HeaderProps, any> {
}
}
onTypeChange = (e) => {
onTypeChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const onTypeChange = this.props.onTypeChange;
if (onTypeChange) {
onTypeChange(e.target.value);
}
}
getCalenderHeaderNode = (node) => {
getCalenderHeaderNode = (node: HTMLDivElement) => {
this.calenderHeaderNode = node;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
---
order: 2
title:
title:
zh-CN: 卡片模式
en-US: Card
---
@@ -21,7 +21,7 @@ function onPanelChange(value, mode) {
}
ReactDOM.render(
<div style={{ width: 290, border: '1px solid #d9d9d9', borderRadius: 4 }}>
<div style={{ width: 300, border: '1px solid #d9d9d9', borderRadius: 4 }}>
<Calendar fullscreen={false} onPanelChange={onPanelChange} />
</div>
, mountNode);

View File

@@ -14,7 +14,7 @@ title:
This component can be rendered by using `dateCellRender` and `monthCellRender` with the data you need.
````jsx
import { Calendar } from 'antd';
import { Calendar, Badge } from 'antd';
function getListData(value) {
let listData;
@@ -22,18 +22,18 @@ function getListData(value) {
case 8:
listData = [
{ type: 'warning', content: 'This is warning event.' },
{ type: 'normal', content: 'This is usual event.' },
{ type: 'success', content: 'This is usual event.' },
]; break;
case 10:
listData = [
{ type: 'warning', content: 'This is warning event.' },
{ type: 'normal', content: 'This is usual event.' },
{ type: 'success', content: 'This is usual event.' },
{ type: 'error', content: 'This is error event.' },
]; break;
case 15:
listData = [
{ type: 'warning', content: 'This is warning event' },
{ type: 'normal', content: 'This is very long usual event。。....' },
{ type: 'success', content: 'This is very long usual event。。....' },
{ type: 'error', content: 'This is error event 1.' },
{ type: 'error', content: 'This is error event 2.' },
{ type: 'error', content: 'This is error event 3.' },
@@ -51,8 +51,7 @@ function dateCellRender(value) {
{
listData.map(item => (
<li key={item.content}>
<span className={`event-${item.type}`}>●</span>
{item.content}
<Badge status={item.type} text={item.content} />
</li>
))
}
@@ -83,42 +82,20 @@ ReactDOM.render(
````css
.events {
line-height: 24px;
list-style: none;
margin: 0;
padding: 0;
}
.events li {
color: #999;
.events .ant-badge-status {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 100%;
text-overflow: ellipsis;
font-size: 12px;
}
.events li span {
vertical-align: middle;
}
.events li span:first-child {
font-size: 9px;
margin-right: 4px;
}
.event-warning {
color: #fac450;
}
.event-normal {
color: #108ee9;
}
.event-error {
color: #f50;
}
.notes-month {
text-align: center;
font-size: 28px;
}
.notes-month section {
font-size: 28px;

View File

@@ -16,11 +16,10 @@ When data is in the form of dates, such as schedules, timetables, prices calenda
**Note:** Part of the Calendar's locale is read from `value`. So, please set the locale of `moment` correctly.
```jsx
import moment from 'moment';
// It's recommended to set locale in entry file globaly.
import 'moment/locale/zh-cn';
moment.locale('zh-cn');
// The default locale is en-US, if you want to use other locale, just set locale in entry file globaly.
// import moment from 'moment';
// import 'moment/locale/zh-cn';
// moment.locale('zh-cn');
<Calendar
dateCellRender={dateCellRender}

View File

@@ -1,27 +1,25 @@
import React from 'react';
import * as React from 'react';
import PropTypes from 'prop-types';
import moment from 'moment';
import * as moment from 'moment';
import FullCalendar from 'rc-calendar/lib/FullCalendar';
import LocaleReceiver from '../locale-provider/LocaleReceiver';
import { PREFIX_CLS } from './Constants';
import Header from './Header';
import { getComponentLocale, getLocaleCode } from '../_util/getLocale';
import callMoment from '../_util/callMoment';
declare const require: Function;
export { HeaderProps } from './Header';
function noop() { return null; }
function zerofixed(v) {
function zerofixed(v: number) {
if (v < 10) {
return `0${v}`;
}
return `${v}`;
}
export interface CalendarContext {
antLocale?: {
Calendar?: any,
};
}
export type CalendarMode = 'month' | 'year';
export interface CalendarProps {
@@ -43,7 +41,7 @@ export interface CalendarProps {
}
export interface CalendarState {
value?: moment.Moment;
value: moment.Moment;
mode?: CalendarMode;
}
@@ -72,18 +70,10 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
onSelect: PropTypes.func,
};
static contextTypes = {
antLocale: PropTypes.object,
};
constructor(props: CalendarProps) {
super(props);
context: CalendarContext;
constructor(props, context) {
super(props, context);
// Make sure that moment locale had be set correctly.
getComponentLocale(props, context, 'Calendar', () => require('./locale/zh_CN'));
const value = props.value || props.defaultValue || moment();
const value = props.value || props.defaultValue || callMoment(moment);
if (!moment.isMoment(value)) {
throw new Error(
'The value/defaultValue of Calendar must be a moment object after `antd@2.0`, ' +
@@ -99,12 +89,12 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
componentWillReceiveProps(nextProps: CalendarProps) {
if ('value' in nextProps) {
this.setState({
value: nextProps.value,
value: nextProps.value!,
});
}
}
monthCellRender = (value) => {
monthCellRender = (value: moment.Moment) => {
const { prefixCls, monthCellRender = noop as Function } = this.props;
return (
<div className={`${prefixCls}-month`}>
@@ -118,7 +108,7 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
);
}
dateCellRender = (value) => {
dateCellRender = (value: moment.Moment) => {
const { prefixCls, dateCellRender = noop as Function } = this.props;
return (
<div className={`${prefixCls}-date`}>
@@ -132,7 +122,12 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
);
}
setValue = (value, way: 'select' | 'changePanel') => {
getDefaultLocale() {
const locale = require('./locale/en_US');
return locale.default || locale;
}
setValue = (value: moment.Moment, way: 'select' | 'changePanel') => {
if (!('value' in this.props)) {
this.setState({ value });
}
@@ -145,7 +140,7 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
}
}
setType = (type) => {
setType = (type: string) => {
const mode = (type === 'date') ? 'month' : 'year';
if (this.state.mode !== mode) {
this.setState({ mode });
@@ -153,35 +148,33 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
}
}
onHeaderValueChange = (value) => {
onHeaderValueChange = (value: moment.Moment) => {
this.setValue(value, 'changePanel');
}
onHeaderTypeChange = (type) => {
onHeaderTypeChange = (type: string) => {
this.setType(type);
}
onPanelChange(value, mode) {
onPanelChange(value: moment.Moment, mode: CalendarMode | undefined) {
const { onPanelChange } = this.props;
if (onPanelChange) {
onPanelChange(value, mode);
}
}
onSelect = (value) => {
onSelect = (value: moment.Moment) => {
this.setValue(value, 'select');
}
render() {
const { state, props, context } = this;
renderCalendar = (locale: any, localeCode: string) => {
const { state, props } = this;
const { value, mode } = state;
const localeCode = getLocaleCode(context);
if (value && localeCode) {
value.locale(localeCode);
}
const { prefixCls, style, className, fullscreen, dateFullCellRender, monthFullCellRender } = props;
const type = (mode === 'year') ? 'month' : 'date';
const locale = getComponentLocale(props, context, 'Calendar', () => require('./locale/zh_CN'));
let cls = className || '';
if (fullscreen) {
@@ -217,4 +210,15 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
</div>
);
}
render() {
return (
<LocaleReceiver
componentName="Calendar"
defaultLocale={this.getDefaultLocale}
>
{this.renderCalendar}
</LocaleReceiver>
);
}
}

View File

@@ -17,11 +17,10 @@ title: Calendar
**注意:**Calendar 部分 locale 是从 value 中读取,所以请先正确设置 moment 的 locale。
```jsx
import moment from 'moment';
// 推荐在入口文件全局设置 locale
import 'moment/locale/zh-cn';
moment.locale('zh-cn');
// 默认语言为 en-US所以如果需要使用其他语言推荐在入口文件全局设置 locale
// import moment from 'moment';
// import 'moment/locale/zh-cn';
// moment.locale('zh-cn');
<Calendar
dateCellRender={dateCellRender}

View File

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

View File

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

View File

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

View File

@@ -1,10 +1,10 @@
@import "../../style/themes/default";
@import "../../style/mixins/index";
@full-calendar-prefix-cls: ~"@{ant-prefix}-fullcalendar";
.@{full-calendar-prefix-cls} {
font-size: @font-size-base;
line-height: @line-height-base;
.reset-component;
outline: none;
border-top: @border-width-base @border-style-base @border-color-base;
@@ -38,7 +38,7 @@
}
&-calendar-body {
padding: 8px 8px 14px;
padding: 8px 12px;
}
table {
@@ -46,7 +46,7 @@
max-width: 100%;
background-color: transparent;
width: 100%;
height: 246px;
height: 256px;
}
table,
@@ -91,12 +91,12 @@
display: block;
margin: 0 auto;
color: @text-color;
border-radius: @border-radius-base;
width: 22px;
height: 22px;
border-radius: @border-radius-sm;
width: 24px;
height: 24px;
padding: 0;
background: transparent;
line-height: 22px;
line-height: 24px;
transition: all .3s;
&:hover {
@@ -116,7 +116,7 @@
&-today &-value,
&-month-panel-current-cell &-value {
box-shadow: 0 0 0 1px @primary-color;
box-shadow: 0 0 0 1px @primary-color inset;
}
&-selected-day &-value,

View File

@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import classNames from 'classnames';
export interface CardGridProps {

31
components/card/Meta.tsx Normal file
View File

@@ -0,0 +1,31 @@
import * as React from 'react';
import classNames from 'classnames';
export interface CardMetaProps {
prefixCls?: string;
style?: React.CSSProperties;
className?: string;
avatar?: React.ReactNode;
title?: React.ReactNode;
description?: React.ReactNode;
}
export default (props: CardMetaProps) => {
const { prefixCls = 'ant-card', className, avatar, title, description, ...others } = props;
const classString = classNames(`${prefixCls}-meta`, className);
const avatarDom = avatar ? <div className={`${prefixCls}-meta-avatar`}>{avatar}</div> : null;
const titleDom = title ? <div className={`${prefixCls}-meta-title`}>{title}</div> : null;
const descriptionDom = description ?
<div className={`${prefixCls}-meta-description`}>{description}</div> : null;
const MetaDetail = titleDom || descriptionDom ?
<div className={`${prefixCls}-meta-detail`}>
{titleDom}
{descriptionDom}
</div> : null;
return (
<div {...others} className={classString}>
{avatarDom}
{MetaDetail}
</div>
);
};

View File

@@ -3,71 +3,123 @@
exports[`renders ./components/card/demo/basic.md correctly 1`] = `
<div
class="ant-card ant-card-bordered"
style="width:300px;"
style="width:300px"
>
<div
class="ant-card-head"
>
<div
class="ant-card-head-title"
>
Card title
</div>
<div
class="ant-card-extra"
>
<a
href="#"
>
More
</a>
</div>
</div>
<div
class="ant-card-body"
>
<p>
Card content
</p>
<p>
Card content
</p>
<p>
Card content
</p>
</div>
</div>
`;
exports[`renders ./components/card/demo/border-less.md correctly 1`] = `
<div
style="background:#ECECEC;padding:30px;"
>
<div
class="ant-card"
style="width:300px;"
>
<div
class="ant-card-head"
class="ant-card-head-wrapper"
>
<div
class="ant-card-head-title"
>
Card title
</div>
<div
class="ant-card-extra"
>
<a
href="#"
>
More
</a>
</div>
</div>
</div>
<div
class="ant-card-body"
>
<div>
<p>
Card content
</p>
<p>
Card content
</p>
<p>
Card content
</p>
</div>
</div>
</div>
`;
exports[`renders ./components/card/demo/border-less.md correctly 1`] = `
<div
style="background:#ECECEC;padding:30px"
>
<div
class="ant-card"
style="width:300px"
>
<div
class="ant-card-head"
>
<div
class="ant-card-head-wrapper"
>
<div
class="ant-card-head-title"
>
Card title
</div>
</div>
</div>
<div
class="ant-card-body"
>
<p>
Card content
</p>
<p>
Card content
</p>
<p>
Card content
</p>
<div>
<p>
Card content
</p>
<p>
Card content
</p>
<p>
Card content
</p>
</div>
</div>
</div>
</div>
`;
exports[`renders ./components/card/demo/flexible-content.md correctly 1`] = `
<div
class="ant-card ant-card-bordered ant-card-hoverable"
style="width:240px"
>
<div
class="ant-card-cover"
>
<img
alt="example"
src="https://os.alipayobjects.com/rmsportal/QBnOOoLaAfKPirc.png"
/>
</div>
<div
class="ant-card-body"
>
<div>
<div
class="ant-card-meta"
>
<div
class="ant-card-meta-detail"
>
<div
class="ant-card-meta-title"
>
Europe Street beat
</div>
<div
class="ant-card-meta-description"
>
www.instagram.com
</div>
</div>
</div>
</div>
</div>
</div>
@@ -75,61 +127,67 @@ exports[`renders ./components/card/demo/border-less.md correctly 1`] = `
exports[`renders ./components/card/demo/grid-card.md correctly 1`] = `
<div
class="ant-card ant-card-bordered ant-card-no-hovering ant-card-contain-grid"
class="ant-card ant-card-bordered ant-card-contain-grid"
>
<div
class="ant-card-head"
>
<div
class="ant-card-head-title"
class="ant-card-head-wrapper"
>
Card Title
<div
class="ant-card-head-title"
>
Card Title
</div>
</div>
</div>
<div
class="ant-card-body"
>
<div
class="ant-card-grid"
style="width:25%;text-align:center;"
>
Content
</div>
<div
class="ant-card-grid"
style="width:25%;text-align:center;"
>
Content
</div>
<div
class="ant-card-grid"
style="width:25%;text-align:center;"
>
Content
</div>
<div
class="ant-card-grid"
style="width:25%;text-align:center;"
>
Content
</div>
<div
class="ant-card-grid"
style="width:25%;text-align:center;"
>
Content
</div>
<div
class="ant-card-grid"
style="width:25%;text-align:center;"
>
Content
</div>
<div
class="ant-card-grid"
style="width:25%;text-align:center;"
>
Content
<div>
<div
class="ant-card-grid"
style="width:25%;text-align:center"
>
Content
</div>
<div
class="ant-card-grid"
style="width:25%;text-align:center"
>
Content
</div>
<div
class="ant-card-grid"
style="width:25%;text-align:center"
>
Content
</div>
<div
class="ant-card-grid"
style="width:25%;text-align:center"
>
Content
</div>
<div
class="ant-card-grid"
style="width:25%;text-align:center"
>
Content
</div>
<div
class="ant-card-grid"
style="width:25%;text-align:center"
>
Content
</div>
<div
class="ant-card-grid"
style="width:25%;text-align:center"
>
Content
</div>
</div>
</div>
</div>
@@ -137,15 +195,15 @@ exports[`renders ./components/card/demo/grid-card.md correctly 1`] = `
exports[`renders ./components/card/demo/in-column.md correctly 1`] = `
<div
style="background:#ECECEC;padding:30px;"
style="background:#ECECEC;padding:30px"
>
<div
class="ant-row"
style="margin-left:-8px;margin-right:-8px;"
style="margin-left:-8px;margin-right:-8px"
>
<div
class="ant-col-8"
style="padding-left:8px;padding-right:8px;"
style="padding-left:8px;padding-right:8px"
>
<div
class="ant-card"
@@ -154,21 +212,27 @@ exports[`renders ./components/card/demo/in-column.md correctly 1`] = `
class="ant-card-head"
>
<div
class="ant-card-head-title"
class="ant-card-head-wrapper"
>
Card title
<div
class="ant-card-head-title"
>
Card title
</div>
</div>
</div>
<div
class="ant-card-body"
>
Card content
<div>
Card content
</div>
</div>
</div>
</div>
<div
class="ant-col-8"
style="padding-left:8px;padding-right:8px;"
style="padding-left:8px;padding-right:8px"
>
<div
class="ant-card"
@@ -177,21 +241,27 @@ exports[`renders ./components/card/demo/in-column.md correctly 1`] = `
class="ant-card-head"
>
<div
class="ant-card-head-title"
class="ant-card-head-wrapper"
>
Card title
<div
class="ant-card-head-title"
>
Card title
</div>
</div>
</div>
<div
class="ant-card-body"
>
Card content
<div>
Card content
</div>
</div>
</div>
</div>
<div
class="ant-col-8"
style="padding-left:8px;padding-right:8px;"
style="padding-left:8px;padding-right:8px"
>
<div
class="ant-card"
@@ -200,15 +270,119 @@ exports[`renders ./components/card/demo/in-column.md correctly 1`] = `
class="ant-card-head"
>
<div
class="ant-card-head-title"
class="ant-card-head-wrapper"
>
Card title
<div
class="ant-card-head-title"
>
Card title
</div>
</div>
</div>
<div
class="ant-card-body"
>
Card content
<div>
Card content
</div>
</div>
</div>
</div>
</div>
</div>
`;
exports[`renders ./components/card/demo/inner.md correctly 1`] = `
<div
class="ant-card ant-card-bordered"
>
<div
class="ant-card-head"
>
<div
class="ant-card-head-wrapper"
>
<div
class="ant-card-head-title"
>
Card title
</div>
</div>
</div>
<div
class="ant-card-body"
>
<div>
<p
style="font-size:14px;color:rgba(0, 0, 0, 0.85);margin-bottom:16px;font-weight:500"
>
Group title
</p>
<div
class="ant-card ant-card-bordered ant-card-type-inner"
>
<div
class="ant-card-head"
>
<div
class="ant-card-head-wrapper"
>
<div
class="ant-card-head-title"
>
Inner Card title
</div>
<div
class="ant-card-extra"
>
<a
href="#"
>
More
</a>
</div>
</div>
</div>
<div
class="ant-card-body"
>
<div>
Inner Card content
</div>
</div>
</div>
<div
class="ant-card ant-card-bordered ant-card-type-inner"
style="margin-top:16px"
>
<div
class="ant-card-head"
>
<div
class="ant-card-head-wrapper"
>
<div
class="ant-card-head-title"
>
Inner Card title
</div>
<div
class="ant-card-extra"
>
<a
href="#"
>
More
</a>
</div>
</div>
</div>
<div
class="ant-card-body"
>
<div>
Inner Card content
</div>
</div>
</div>
</div>
@@ -219,15 +393,19 @@ exports[`renders ./components/card/demo/in-column.md correctly 1`] = `
exports[`renders ./components/card/demo/loading.md correctly 1`] = `
<div
class="ant-card ant-card-loading ant-card-bordered"
style="width:34%;"
style="width:34%"
>
<div
class="ant-card-head"
>
<div
class="ant-card-head-title"
class="ant-card-head-wrapper"
>
Card title
<div
class="ant-card-head-title"
>
Card title
</div>
</div>
</div>
<div
@@ -238,50 +416,50 @@ exports[`renders ./components/card/demo/loading.md correctly 1`] = `
>
<p
class="ant-card-loading-block"
style="width:94%;"
style="width:94%"
/>
<p>
<span
class="ant-card-loading-block"
style="width:28%;"
style="width:28%"
/>
<span
class="ant-card-loading-block"
style="width:62%;"
style="width:62%"
/>
</p>
<p>
<span
class="ant-card-loading-block"
style="width:22%;"
style="width:22%"
/>
<span
class="ant-card-loading-block"
style="width:66%;"
style="width:66%"
/>
</p>
<p>
<span
class="ant-card-loading-block"
style="width:56%;"
style="width:56%"
/>
<span
class="ant-card-loading-block"
style="width:39%;"
style="width:39%"
/>
</p>
<p>
<span
class="ant-card-loading-block"
style="width:21%;"
style="width:21%"
/>
<span
class="ant-card-loading-block"
style="width:15%;"
style="width:15%"
/>
<span
class="ant-card-loading-block"
style="width:40%;"
style="width:40%"
/>
</p>
</div>
@@ -289,55 +467,336 @@ exports[`renders ./components/card/demo/loading.md correctly 1`] = `
</div>
`;
exports[`renders ./components/card/demo/no-padding.md correctly 1`] = `
exports[`renders ./components/card/demo/meta.md correctly 1`] = `
<div
class="ant-card ant-card-bordered"
style="width:240px;"
style="width:300px"
>
<div
class="ant-card-body"
style="padding:0;"
class="ant-card-cover"
>
<div
class="custom-image"
>
<img
alt="example"
src="https://os.alipayobjects.com/rmsportal/QBnOOoLaAfKPirc.png"
width="100%"
/>
</div>
<div
class="custom-card"
>
<h3>
Europe Street beat
</h3>
<p>
www.instagram.com
</p>
<img
alt="example"
src="https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png"
/>
</div>
<div
class="ant-card-body"
>
<div>
<div
class="ant-card-meta"
>
<div
class="ant-card-meta-avatar"
>
<span
class="ant-avatar ant-avatar-circle ant-avatar-image"
>
<img
src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
/>
</span>
</div>
<div
class="ant-card-meta-detail"
>
<div
class="ant-card-meta-title"
>
Card title
</div>
<div
class="ant-card-meta-description"
>
This is the description
</div>
</div>
</div>
</div>
</div>
<ul
class="ant-card-actions"
>
<li
style="width:33.333333333333336%"
>
<span>
<i
class="anticon anticon-setting"
/>
</span>
</li>
<li
style="width:33.333333333333336%"
>
<span>
<i
class="anticon anticon-edit"
/>
</span>
</li>
<li
style="width:33.333333333333336%"
>
<span>
<i
class="anticon anticon-ellipsis"
/>
</span>
</li>
</ul>
</div>
`;
exports[`renders ./components/card/demo/simple.md correctly 1`] = `
<div
class="ant-card ant-card-bordered"
style="width:300px;"
style="width:300px"
>
<div
class="ant-card-body"
>
<p>
Card content
</p>
<p>
Card content
</p>
<p>
Card content
</p>
<div>
<p>
Card content
</p>
<p>
Card content
</p>
<p>
Card content
</p>
</div>
</div>
</div>
`;
exports[`renders ./components/card/demo/tabs.md correctly 1`] = `
<div>
<div
class="ant-card ant-card-bordered ant-card-contain-tabs"
style="width:100%"
>
<div
class="ant-card-head"
>
<div
class="ant-card-head-wrapper"
>
<div
class="ant-card-head-title"
>
Card title
</div>
<div
class="ant-card-extra"
>
<a
href="#"
>
More
</a>
</div>
</div>
<div
class="ant-tabs ant-tabs-top ant-card-head-tabs ant-tabs-large ant-tabs-line"
>
<div
class="ant-tabs-bar"
role="tablist"
tabindex="0"
>
<div
class="ant-tabs-nav-container"
>
<span
class="ant-tabs-tab-prev ant-tabs-tab-btn-disabled"
unselectable="unselectable"
>
<span
class="ant-tabs-tab-prev-icon"
/>
</span>
<span
class="ant-tabs-tab-next ant-tabs-tab-btn-disabled"
unselectable="unselectable"
>
<span
class="ant-tabs-tab-next-icon"
/>
</span>
<div
class="ant-tabs-nav-wrap"
>
<div
class="ant-tabs-nav-scroll"
>
<div
class="ant-tabs-nav ant-tabs-nav-animated"
>
<div
class="ant-tabs-ink-bar ant-tabs-ink-bar-animated"
/>
<div
aria-disabled="false"
aria-selected="true"
class="ant-tabs-tab-active ant-tabs-tab"
role="tab"
>
tab1
</div>
<div
aria-disabled="false"
aria-selected="false"
class=" ant-tabs-tab"
role="tab"
>
tab2
</div>
</div>
</div>
</div>
</div>
</div>
<div
class="ant-tabs-content ant-tabs-content-animated"
style="margin-left:0%"
>
<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>
</div>
</div>
<div
class="ant-card-body"
>
<div>
<p>
content1
</p>
</div>
</div>
</div>
<br />
<br />
<div
class="ant-card ant-card-bordered ant-card-contain-tabs"
style="width:100%"
>
<div
class="ant-card-head"
>
<div
class="ant-card-head-wrapper"
/>
<div
class="ant-tabs ant-tabs-top ant-card-head-tabs ant-tabs-large ant-tabs-line"
>
<div
class="ant-tabs-bar"
role="tablist"
tabindex="0"
>
<div
class="ant-tabs-nav-container"
>
<span
class="ant-tabs-tab-prev ant-tabs-tab-btn-disabled"
unselectable="unselectable"
>
<span
class="ant-tabs-tab-prev-icon"
/>
</span>
<span
class="ant-tabs-tab-next ant-tabs-tab-btn-disabled"
unselectable="unselectable"
>
<span
class="ant-tabs-tab-next-icon"
/>
</span>
<div
class="ant-tabs-nav-wrap"
>
<div
class="ant-tabs-nav-scroll"
>
<div
class="ant-tabs-nav ant-tabs-nav-animated"
>
<div
class="ant-tabs-ink-bar ant-tabs-ink-bar-animated"
/>
<div
aria-disabled="false"
aria-selected="true"
class="ant-tabs-tab-active ant-tabs-tab"
role="tab"
>
article
</div>
<div
aria-disabled="false"
aria-selected="false"
class=" ant-tabs-tab"
role="tab"
>
app
</div>
<div
aria-disabled="false"
aria-selected="false"
class=" ant-tabs-tab"
role="tab"
>
project
</div>
</div>
</div>
</div>
</div>
</div>
<div
class="ant-tabs-content ant-tabs-content-animated"
style="margin-left:0%"
>
<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="true"
class="ant-tabs-tabpane ant-tabs-tabpane-inactive"
role="tabpanel"
/>
</div>
</div>
</div>
<div
class="ant-card-body"
>
<div>
<p>
article content
</p>
</div>
</div>
</div>
</div>
`;

View File

@@ -2,12 +2,19 @@ import React from 'react';
import { mount } from 'enzyme';
import Card from '../index';
const delay = timeout => new Promise(resolve => setTimeout(resolve, timeout));
const testMethod = typeof window !== 'undefined' ? it : xit;
describe('Card', () => {
beforeAll(() => {
jest.useFakeTimers();
});
afterAll(() => {
jest.useRealTimers();
});
function fakeResizeWindowTo(wrapper, width) {
Object.defineProperties(wrapper.node.container, {
Object.defineProperties(wrapper.instance().container, {
offsetWidth: {
get() { return width; },
configurable: true,
@@ -16,13 +23,15 @@ describe('Card', () => {
window.resizeTo(width);
}
testMethod('resize card will trigger different padding', async () => {
testMethod('resize card will trigger different padding', () => {
const wrapper = mount(<Card title="xxx">xxx</Card>);
fakeResizeWindowTo(wrapper, 1000);
await delay(0);
expect(wrapper.hasClass('ant-card-wider-padding')).toBe(true);
jest.runAllTimers();
wrapper.update();
expect(wrapper.find('.ant-card-wider-padding').length).toBe(1);
fakeResizeWindowTo(wrapper, 800);
await delay(0);
expect(wrapper.hasClass('ant-card-wider-padding')).toBe(false);
jest.runAllTimers();
wrapper.update();
expect(wrapper.find('.ant-card-wider-padding').length).toBe(0);
});
});

View File

@@ -24,3 +24,9 @@ ReactDOM.render(
</Card>
, mountNode);
````
<style>
.code-box-demo p {
margin: 0;
}
</style>

View File

@@ -0,0 +1,33 @@
---
order: 3
title:
zh-CN: 更灵活的内容展示
en-US: Customized content
---
## zh-CN
可以利用 `Card.Meta` 支持更灵活的内容。
## en-US
You can use `Card.Meta` to support more flexible content.
````jsx
import { Card } from 'antd';
const { Meta } = Card;
ReactDOM.render(
<Card
hoverable
style={{ width: 240 }}
cover={<img alt="example" src="https://os.alipayobjects.com/rmsportal/QBnOOoLaAfKPirc.png" />}
>
<Meta
title="Europe Street beat"
description="www.instagram.com"
/>
</Card>
, mountNode);
````

View File

@@ -22,7 +22,7 @@ const gridStyle = {
};
ReactDOM.render(
<Card title="Card Title" noHovering>
<Card title="Card Title">
<Card.Grid style={gridStyle}>Content</Card.Grid>
<Card.Grid style={gridStyle}>Content</Card.Grid>
<Card.Grid style={gridStyle}>Content</Card.Grid>

View File

@@ -0,0 +1,48 @@
---
order: 7
title:
zh-CN: 内部卡片
en-US: Inner card
---
## zh-CN
可以放在普通卡片内部,展示多层级结构的信息。
## en-US
It can be placed inside the ordinary card to display the information of the multilevel structure.
````jsx
import { Card } from 'antd';
ReactDOM.render(
<Card title="Card title">
<p
style={{
fontSize: 14,
color: 'rgba(0, 0, 0, 0.85)',
marginBottom: 16,
fontWeight: 500,
}}
>
Group title
</p>
<Card
type="inner"
title="Inner Card title"
extra={<a href="#">More</a>}
>
Inner Card content
</Card>
<Card
style={{ marginTop: 16 }}
type="inner"
title="Inner Card title"
extra={<a href="#">More</a>}
>
Inner Card content
</Card>
</Card>
, mountNode);
````

View File

@@ -0,0 +1,33 @@
---
order: 9
title:
zh-CN: 支持更多内容配置
en-US: Support more content configuration
---
## zh-CN
一种支持封面、头像、标题和描述信息的卡片。
## en-US
A Card that supports `cover`, `avatar`, `title` and `description`.
````jsx
import { Card, Icon, Avatar } from 'antd';
const { Meta } = Card;
ReactDOM.render(
<Card
style={{ width: 300 }}
cover={<img alt="example" src="https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png" />}
actions={[<Icon type="setting" />, <Icon type="edit" />, <Icon type="ellipsis" />]}
>
<Meta
avatar={<Avatar src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" />}
title="Card title"
description="This is the description"
/>
</Card>
, mountNode);
````

View File

@@ -1,43 +0,0 @@
---
order: 3
title:
zh-CN: 更灵活的内容展示
en-US: Customized content
---
## zh-CN
可以调整默认边距,设定宽度。
## en-US
Customizing default width and margin.
````jsx
import { Card } from 'antd';
ReactDOM.render(
<Card style={{ width: 240 }} bodyStyle={{ padding: 0 }}>
<div className="custom-image">
<img alt="example" width="100%" src="https://os.alipayobjects.com/rmsportal/QBnOOoLaAfKPirc.png" />
</div>
<div className="custom-card">
<h3>Europe Street beat</h3>
<p>www.instagram.com</p>
</div>
</Card>
, mountNode);
````
````css
.custom-image img {
display: block;
}
.custom-card {
padding: 10px 16px;
}
.custom-card p {
color: #999;
}
````

View File

@@ -0,0 +1,86 @@
---
order: 8
title:
zh-CN: 带页签的卡片
en-US: With tabs
---
## zh-CN
可承载更多内容。
## en-US
More content can be hosted.
````jsx
import { Card } from 'antd';
const tabList = [{
key: 'tab1',
tab: 'tab1',
}, {
key: 'tab2',
tab: 'tab2',
}];
const contentList = {
tab1: <p>content1</p>,
tab2: <p>content2</p>,
};
const tabListNoTitle = [{
key: 'article',
tab: 'article',
}, {
key: 'app',
tab: 'app',
}, {
key: 'project',
tab: 'project',
}];
const contentListNoTitle = {
article: <p>article content</p>,
app: <p>app content</p>,
project: <p>project content</p>,
};
class TabsCard extends React.Component {
state = {
key: 'tab1',
noTitleKey: 'article',
}
onTabChange = (key, type) => {
console.log(key, type);
this.setState({ [type]: key });
}
render() {
return (
<div>
<Card
style={{ width: '100%' }}
title="Card title"
extra={<a href="#">More</a>}
tabList={tabList}
onTabChange={(key) => { this.onTabChange(key, 'key'); }}
>
{contentList[this.state.key]}
</Card>
<br /><br />
<Card
style={{ width: '100%' }}
tabList={tabListNoTitle}
onTabChange={(key) => { this.onTabChange(key, 'noTitleKey'); }}
>
{contentListNoTitle[this.state.noTitleKey]}
</Card>
</div>
);
}
}
ReactDOM.render(
<TabsCard />
, mountNode);
````

View File

@@ -21,12 +21,17 @@ A card can be used to display content related to a single subject. The content c
| Property | Description | Type | Default |
| -------- | ----------- | ---- | ------- |
| actions | The action list, shows at the bottom of the Card. | Array<ReactNode> | - |
| bodyStyle | Inline style to apply to the card content | object | - |
| bordered | Toggles rendering of the border around the card | boolean | `true` |
| cover | Card cover | ReactNode | - |
| extra | Content to render in the top-right corner of the card | string\|ReactNode | - |
| loading | Shows a loading indicator while the contents of the card are being fetched | boolean | `false` |
| noHovering | Whether to disable hover effect on mouse over | boolean | `false` |
| 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}> | - |
| 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 | - |
### Card.Grid
@@ -34,3 +39,13 @@ A card can be used to display content related to a single subject. The content c
| -------- | ----------- | ---- | ------- |
| className | className of container | string | - |
| style | style object of container | object | - |
### Card.Meta
| Property | Description | Type | Default |
| -------- | ----------- | ---- | ------- |
| avatar | avatar or icon | ReactNode | - |
| className | className of container | string | - |
| description | description content | ReactNode | - |
| style | style object of container | object | - |
| title | title content | ReactNode | - |

View File

@@ -1,8 +1,22 @@
import React, { Component, Children } from 'react';
import * as React from 'react';
import classNames from 'classnames';
import addEventListener from 'rc-util/lib/Dom/addEventListener';
import omit from 'omit.js';
import Grid from './Grid';
import Meta from './Meta';
import Tabs from '../tabs';
import { throttleByAnimationFrameDecorator } from '../_util/throttleByAnimationFrame';
import warning from '../_util/warning';
export { CardGridProps } from './Grid';
export { CardMetaProps } from './Meta';
export type CardType = 'inner';
export interface CardTabListType {
key: string;
tab: React.ReactNode;
}
export interface CardProps {
prefixCls?: string;
@@ -13,22 +27,37 @@ export interface CardProps {
style?: React.CSSProperties;
loading?: boolean;
noHovering?: boolean;
hoverable?: boolean;
children?: React.ReactNode;
id?: string;
className?: string;
type?: CardType;
cover?: React.ReactNode;
actions?: Array<React.ReactNode>;
tabList?: CardTabListType[];
onTabChange?: (key: string) => void;
}
export default class Card extends Component<CardProps, {}> {
export default class Card extends React.Component<CardProps, {}> {
static Grid: typeof Grid = Grid;
container: HTMLDivElement;
static Meta: typeof Meta = Meta;
resizeEvent: any;
updateWiderPaddingCalled: boolean;
state = {
widerPadding: false,
};
private container: HTMLDivElement;
componentDidMount() {
this.updateWiderPadding();
this.resizeEvent = addEventListener(window, 'resize', this.updateWiderPadding);
if ('noHovering' in this.props) {
warning(
!this.props.noHovering,
'`noHovering` of Card is deperated, you can remove it safely or use `hoverable` instead.',
);
warning(!!this.props.noHovering, '`noHovering={false}` of Card is deperated, use `hoverable` instead.');
}
}
componentWillUnmount() {
if (this.resizeEvent) {
@@ -54,73 +83,117 @@ export default class Card extends Component<CardProps, {}> {
});
}
}
onTabChange = (key: string) => {
if (this.props.onTabChange) {
this.props.onTabChange(key);
}
}
saveRef = (node: HTMLDivElement) => {
this.container = node;
}
isContainGrid() {
let containGrid;
Children.forEach(this.props.children, (element: JSX.Element) => {
React.Children.forEach(this.props.children, (element: JSX.Element) => {
if (element && element.type && element.type === Grid) {
containGrid = true;
}
});
return containGrid;
}
getAction(actions: React.ReactNode[]) {
if (!actions || !actions.length) {
return null;
}
const actionList = actions.map((action, index) => (
<li style={{ width: `${100 / actions.length}%` }} key={`action-${index}`}>
<span>{action}</span>
</li>
),
);
return actionList;
}
// For 2.x compatible
getCompatibleHoverable() {
const { noHovering, hoverable } = this.props;
if ('noHovering' in this.props) {
return !noHovering || hoverable;
}
return !!hoverable;
}
render() {
const {
prefixCls = 'ant-card', className, extra, bodyStyle, noHovering,
title, loading, bordered = true, ...others,
prefixCls = 'ant-card', className, extra, bodyStyle, noHovering, hoverable, title, loading,
bordered = true, type, cover, actions, tabList, children, ...others,
} = this.props;
let children = this.props.children;
const classString = classNames(prefixCls, className, {
[`${prefixCls}-loading`]: loading,
[`${prefixCls}-bordered`]: bordered,
[`${prefixCls}-no-hovering`]: noHovering,
[`${prefixCls}-hoverable`]: this.getCompatibleHoverable(),
[`${prefixCls}-wider-padding`]: this.state.widerPadding,
[`${prefixCls}-padding-transition`]: this.updateWiderPaddingCalled,
[`${prefixCls}-contain-grid`]: this.isContainGrid(),
[`${prefixCls}-contain-tabs`]: tabList && tabList.length,
[`${prefixCls}-type-${type}`]: !!type,
});
if (loading) {
children = (
<div className={`${prefixCls}-loading-content`}>
<p className={`${prefixCls}-loading-block`} style={{ width: '94%' }} />
<p>
<span className={`${prefixCls}-loading-block`} style={{ width: '28%' }} />
<span className={`${prefixCls}-loading-block`} style={{ width: '62%' }} />
</p>
<p>
<span className={`${prefixCls}-loading-block`} style={{ width: '22%' }} />
<span className={`${prefixCls}-loading-block`} style={{ width: '66%' }} />
</p>
<p>
<span className={`${prefixCls}-loading-block`} style={{ width: '56%' }} />
<span className={`${prefixCls}-loading-block`} style={{ width: '39%' }} />
</p>
<p>
<span className={`${prefixCls}-loading-block`} style={{ width: '21%' }} />
<span className={`${prefixCls}-loading-block`} style={{ width: '15%' }} />
<span className={`${prefixCls}-loading-block`} style={{ width: '40%' }} />
</p>
</div>
);
}
const loadingBlock = (
<div className={`${prefixCls}-loading-content`}>
<p className={`${prefixCls}-loading-block`} style={{ width: '94%' }} />
<p>
<span className={`${prefixCls}-loading-block`} style={{ width: '28%' }} />
<span className={`${prefixCls}-loading-block`} style={{ width: '62%' }} />
</p>
<p>
<span className={`${prefixCls}-loading-block`} style={{ width: '22%' }} />
<span className={`${prefixCls}-loading-block`} style={{ width: '66%' }} />
</p>
<p>
<span className={`${prefixCls}-loading-block`} style={{ width: '56%' }} />
<span className={`${prefixCls}-loading-block`} style={{ width: '39%' }} />
</p>
<p>
<span className={`${prefixCls}-loading-block`} style={{ width: '21%' }} />
<span className={`${prefixCls}-loading-block`} style={{ width: '15%' }} />
<span className={`${prefixCls}-loading-block`} style={{ width: '40%' }} />
</p>
</div>
);
let head;
if (title || extra) {
const tabs = tabList && tabList.length ? (
<Tabs className={`${prefixCls}-head-tabs`} size="large" onChange={this.onTabChange}>
{tabList.map(item => <Tabs.TabPane tab={item.tab} key={item.key} />)}
</Tabs>
) : null;
if (title || extra || tabs) {
head = (
<div className={`${prefixCls}-head`}>
{title ? <div className={`${prefixCls}-head-title`}>{title}</div> : null}
{extra ? <div className={`${prefixCls}-extra`}>{extra}</div> : null}
<div className={`${prefixCls}-head-wrapper`}>
{title && <div className={`${prefixCls}-head-title`}>{title}</div>}
{extra && <div className={`${prefixCls}-extra`}>{extra}</div>}
</div>
{tabs}
</div>
);
}
const coverDom = cover ? <div className={`${prefixCls}-cover`}>{cover}</div> : null;
const body = (
<div className={`${prefixCls}-body`} style={bodyStyle}>
{loading ? loadingBlock : <div>{children}</div>}
</div>
);
const actionDom = actions && actions.length ?
<ul className={`${prefixCls}-actions`}>{this.getAction(actions)}</ul> : null;
const divProps = omit(others, [
'onTabChange',
]);
return (
<div {...others} className={classString} ref={this.saveRef}>
<div {...divProps} className={classString} ref={this.saveRef}>
{head}
<div className={`${prefixCls}-body`} style={bodyStyle}>{children}</div>
{coverDom}
{children ? body : null}
{actionDom}
</div>
);
}

View File

@@ -22,12 +22,17 @@ cols: 1
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| actions | 卡片操作组,位置在卡片底部 | Array<ReactNode> | - |
| bodyStyle | 内容区域自定义样式 | object | - |
| bordered | 是否有边框 | boolean | true |
| cover | 卡片封面 | ReactNode | - |
| extra | 卡片右上角的操作区域 | string\|ReactNode | - |
| hoverable | 鼠标移过时可浮起 | boolean | false |
| loading | 当卡片内容还在加载中时,可以用 loading 展示一个占位 | boolean | false |
| noHovering | 取消鼠标移过浮起 | boolean | false |
| tabList | 页签标题列表 | Array&lt;{key: string, tab: ReactNode}> | - |
| title | 卡片标题 | string\|ReactNode | - |
| type | 卡片类型,可设置为 `inner` 或 不设置 | string | - |
| onTabChange | 页签切换的回调 | (key) => void | - |
### Card.Grid
@@ -35,3 +40,13 @@ cols: 1
| -------- | ----------- | ---- | ------- |
| className | 网格容器类名 | string | - |
| style | 定义网格容器类名的样式 | object | - |
### Card.Meta
| Property | Description | Type | Default |
| -------- | ----------- | ---- | ------- |
| avatar | 头像/图标 | ReactNode | - |
| className | 容器类名 | string | - |
| description | 描述内容 | ReactNode | - |
| style | 定义容器类名的样式 | object | - |
| title | 标题内容 | ReactNode | - |

View File

@@ -2,19 +2,21 @@
@import "../../style/mixins/index";
@card-prefix-cls: ~"@{ant-prefix}-card";
@card-padding-base: 24px;
@card-padding-wider: 32px;
@card-head-height: 48px;
.@{card-prefix-cls} {
.reset-component;
background: @component-background;
border-radius: @border-radius-sm;
font-size: @font-size-base;
position: relative;
transition: all .3s;
&:not(&-no-hovering):hover {
box-shadow: @box-shadow-base;
border-color: @shadow-color;
&-hoverable {
cursor: pointer;
&:hover {
box-shadow: @card-shadow;
border-color: rgba(0, 0, 0, 0.09);
}
}
&-bordered {
@@ -22,20 +24,22 @@
}
&-head {
height: @card-head-height;
line-height: @card-head-height;
background: @card-head-background;
border-bottom: @border-width-base @border-style-base @border-color-split;
padding: 0 @card-padding-base;
border-radius: @border-radius-sm @border-radius-sm 0 0;
.clearfix;
margin-bottom: -1px; // Fix card grid overflow bug: https://gw.alipayobjects.com/zos/rmsportal/XonYxBikwpgbqIQBeuhk.png
display: flex;
min-height: @card-head-height;
&-wrapper {
display: flex;
}
&-title {
font-size: @font-size-lg;
padding: @card-head-padding 0;
text-overflow: ellipsis;
max-width: 100%;
overflow: hidden;
white-space: nowrap;
color: @card-head-color;
@@ -43,10 +47,20 @@
display: inline-block;
flex: 1;
}
.@{ant-prefix}-tabs {
margin-bottom: -17px;
clear: both;
&-bar {
border-bottom: @border-width-base @border-style-base @border-color-split;
}
}
}
&-extra {
float: right;
padding: @card-head-padding + 1.5px 0;
text-align: right;
// https://stackoverflow.com/a/22429853/3040605
margin-left: auto;
@@ -77,6 +91,66 @@
}
}
&-contain-tabs &-head-title {
padding-bottom: 0;
min-height: @card-head-height - @card-head-padding;
}
&-contain-tabs &-extra {
padding-bottom: 0;
}
&-cover > * {
width: 100%;
display: block;
}
&-actions {
border-top: @border-width-base @border-style-base @border-color-split;
background: @card-actions-background;
.clearfix;
list-style: none;
margin: 0;
padding: 0;
& > li {
float: left;
text-align: center;
margin: 12px 0;
color: @text-color-secondary;
& > span {
display: inline-block;
font-size: 14px;
cursor: pointer;
line-height: 22px;
min-width: 32px;
position: relative;
&:hover {
color: @primary-color;
transition: color .3s;
}
& > .anticon {
font-size: 16px;
}
a {
color: @text-color-secondary;
&:hover {
color: @primary-color;
}
}
}
&:not(:last-child) {
border-right: @border-width-base @border-style-base @border-color-split;
}
}
}
&-wider-padding &-head {
padding: 0 @card-padding-wider;
}
@@ -85,10 +159,6 @@
padding: @card-padding-base @card-padding-wider;
}
&-wider-padding &-extra {
right: @card-padding-wider;
}
&-padding-transition &-head,
&-padding-transition &-body {
transition: padding .3s;
@@ -98,6 +168,54 @@
transition: right .3s;
}
&-type-inner &-head {
padding: 0 @card-padding-base;
background: @background-color-light;
&-title {
padding: @card-inner-head-padding 0;
font-size: @font-size-base;
}
}
&-type-inner &-body {
padding: 16px @card-padding-base;
}
&-type-inner &-extra {
padding: @card-inner-head-padding + 1.5px 0;
}
&-meta {
margin: -4px 0;
.clearfix;
&-avatar {
padding-right: 16px;
float: left;
}
&-detail {
overflow: hidden;
> div:not(:last-child) {
margin-bottom: 8px;
}
}
&-title {
font-size: @font-size-lg;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
color: @card-head-color;
font-weight: 500;
}
&-description {
color: @text-color-secondary;
}
}
&-loading &-body {
user-select: none;
padding: 0;
@@ -105,11 +223,14 @@
&-loading-content {
padding: @card-padding-base;
p {
margin: 0;
}
}
&-loading-block {
display: inline-block;
margin: 5px 1% 0;
margin: 5px 2% 0 0;
height: 14px;
border-radius: @border-radius-sm;
background: linear-gradient(90deg, rgba(207, 216, 220, .2), rgba(207, 216, 220, .4), rgba(207, 216, 220, .2));

View File

@@ -1,2 +1,5 @@
import '../../style/index.less';
import './index.less';
// style dependencies
import '../../tabs/style';

View File

@@ -24,7 +24,7 @@ exports[`renders ./components/carousel/demo/autoplay.md correctly 1`] = `
<div
class="slick-slide slick-active slick-cloned"
data-index="0"
style="outline:none;"
style="outline:none"
tabindex="-1"
>
<h3>
@@ -34,7 +34,7 @@ exports[`renders ./components/carousel/demo/autoplay.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="1"
style="outline:none;"
style="outline:none"
tabindex="-1"
>
<h3>
@@ -44,7 +44,7 @@ exports[`renders ./components/carousel/demo/autoplay.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="2"
style="outline:none;"
style="outline:none"
tabindex="-1"
>
<h3>
@@ -54,7 +54,7 @@ exports[`renders ./components/carousel/demo/autoplay.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="3"
style="outline:none;"
style="outline:none"
tabindex="-1"
>
<h3>
@@ -99,7 +99,7 @@ exports[`renders ./components/carousel/demo/basic.md correctly 1`] = `
<div
class="slick-slide slick-active slick-cloned"
data-index="0"
style="outline:none;"
style="outline:none"
tabindex="-1"
>
<h3>
@@ -109,7 +109,7 @@ exports[`renders ./components/carousel/demo/basic.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="1"
style="outline:none;"
style="outline:none"
tabindex="-1"
>
<h3>
@@ -119,7 +119,7 @@ exports[`renders ./components/carousel/demo/basic.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="2"
style="outline:none;"
style="outline:none"
tabindex="-1"
>
<h3>
@@ -129,7 +129,7 @@ exports[`renders ./components/carousel/demo/basic.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="3"
style="outline:none;"
style="outline:none"
tabindex="-1"
>
<h3>
@@ -166,7 +166,7 @@ exports[`renders ./components/carousel/demo/fade.md correctly 1`] = `
<div
class="slick-slide slick-active slick-cloned"
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;-webkit-transition:opacity 500ms ease"
tabindex="-1"
>
<h3>
@@ -176,7 +176,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;-webkit-transition:opacity 500ms ease"
tabindex="-1"
>
<h3>
@@ -186,7 +186,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;-webkit-transition:opacity 500ms ease"
tabindex="-1"
>
<h3>
@@ -196,7 +196,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;-webkit-transition:opacity 500ms ease"
tabindex="-1"
>
<h3>
@@ -233,7 +233,7 @@ exports[`renders ./components/carousel/demo/vertical.md correctly 1`] = `
<div
class="slick-slide slick-active slick-cloned"
data-index="0"
style="outline:none;"
style="outline:none"
tabindex="-1"
>
<h3>
@@ -243,7 +243,7 @@ exports[`renders ./components/carousel/demo/vertical.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="1"
style="outline:none;"
style="outline:none"
tabindex="-1"
>
<h3>
@@ -253,7 +253,7 @@ exports[`renders ./components/carousel/demo/vertical.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="2"
style="outline:none;"
style="outline:none"
tabindex="-1"
>
<h3>
@@ -263,7 +263,7 @@ exports[`renders ./components/carousel/demo/vertical.md correctly 1`] = `
<div
class="slick-slide slick-cloned"
data-index="3"
style="outline:none;"
style="outline:none"
tabindex="-1"
>
<h3>

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