Compare commits

...

242 Commits
2.7.1 ... 2.7.4

Author SHA1 Message Date
afc163
fd547ebffe bump 2.7.4 2017-02-28 22:03:54 +08:00
陆离
61ad3c6a73 typo stopPreventDefault -> stopPropagation (#5093)
* typo stopPreventDefault -> stopPropagation

* remove
2017-02-28 21:53:30 +08:00
afc163
25f2ac13fc fix cascader style selector priority, close #5078 2017-02-28 21:53:22 +08:00
afc163
64034de87d fix upload error item name color 2017-02-28 21:52:56 +08:00
afc163
b60fbdf84a Fix tree-select not show bug, close #5092 2017-02-28 21:52:22 +08:00
afc163
222003bdec revert 5b20a5f and fix #5091 2017-02-28 21:52:03 +08:00
afc163
d4036d3cae fix button unknown prop 2017-02-27 11:18:48 +08:00
偏右
a60eec0e35 Add changelog for 2.7.3 (#5049) 2017-02-27 11:10:55 +08:00
Benjy Cui
1763fa168c docs: update link, close: #5051 2017-02-27 10:43:13 +08:00
Benjy Cui
8b539c4971 chore: update type definition 2017-02-27 10:20:46 +08:00
afc163
40b30d8ef9 site: fix markdown list style 2017-02-26 22:56:58 +08:00
afc163
d99778b605 Fix clicked effect when switch loading state 2017-02-26 19:21:22 +08:00
afc163
00fac07d9e refactor requestAnimationFrame 2017-02-26 19:08:36 +08:00
afc163
a9599b802c when labelCol is 24, it is a vertical form 2017-02-26 18:09:41 +08:00
afc163
3818f59a97 fix test case 2017-02-26 17:52:26 +08:00
afc163
30f2a1ed94 Add popup node snapshot test for Cascader 2017-02-26 16:48:42 +08:00
afc163
05b20c6a9f fix stylelint problems of site 2017-02-26 15:41:50 +08:00
afc163
c31ebaad90 site: fix responsive design 2017-02-26 15:25:26 +08:00
afc163
0f6d1db614 fix lint 2017-02-26 15:20:12 +08:00
afc163
d44a0ece3f site: improve styles 2017-02-26 15:09:52 +08:00
YuyingWu
e8cf22ad0e site: fix locale switch
* antD首页从英文切换到中文时,replace导致链接错误

首页从英文转到中文,点击header上的“中文”时,链接会跳到 https://ant.design/index-cn/ant.design/ (Chrome)或者 https://index-cn/ant.design/ (Safari)

bug来自handleLangChange函数下,最后对location.href.replace操作时出错,原因来自replace匹配到location.href的第一个/
('https://ant.design/').replace('/', '/index-cn') 的运行结果是 https:/index-cn/ant.design/ 

为了避免replace匹配到location.href的第一个/,我建议的方案是使用 location.origin + location.pathname.replace

最后,感谢antD团队开发出那么棒的UI~

* 英转中,url替换(带hash、query)

英转中URL问题,上一版使用了location.origin + location.pathname,会丢失query和hash。此版本原理还是用location.href做replace,鉴于首页pathname可能是/会在替换中匹配到https:后的第一个/,所以先把href的protocol部分提取出来,再做replace,最后再拼回去做跳转。
2017-02-26 14:50:12 +08:00
afc163
14d380f0f9 use old button animation 2017-02-26 02:18:20 +08:00
偏右
4650d20abf Update colorPalette.less 2017-02-26 00:35:02 +08:00
afc163
cf4ad5ddb8 fix test case 2017-02-26 00:23:46 +08:00
YuyingWu
a5f136f334 antD首页从英文切换到中文时,replace导致链接错误 (#5050)
首页从英文转到中文,点击header上的“中文”时,链接会跳到 https://ant.design/index-cn/ant.design/ (Chrome)或者 https://index-cn/ant.design/ (Safari)

bug来自handleLangChange函数下,最后对location.href.replace操作时出错,原因来自replace匹配到location.href的第一个/
('https://ant.design/').replace('/', '/index-cn') 的运行结果是 https:/index-cn/ant.design/ 

为了避免replace匹配到location.href的第一个/,我建议的方案是使用 location.origin + location.pathname.replace

最后,感谢antD团队开发出那么棒的UI~
2017-02-26 00:23:04 +08:00
afc163
917ec5606e Tweak tree style 2017-02-25 19:17:54 +08:00
afc163
511db23fcd Add default title for form item label 2017-02-25 18:48:44 +08:00
afc163
68fde63ef7 refactor renderLabel 2017-02-25 18:47:40 +08:00
afc163
d2e178d215 update doc 2017-02-25 18:37:25 +08:00
afc163
c78d3032f5 site: fix aside menu 2017-02-25 15:10:23 +08:00
afc163
f6715df3b5 closest => dom-closest, fix ssr 2017-02-25 02:09:18 +08:00
afc163
6ea75c4d85 Filter dropdown menu inside scroll body should never be shown, close #5010 2017-02-25 01:36:45 +08:00
afc163
5076b6045c fix snap 2017-02-25 00:17:44 +08:00
afc163
139d95022c prefer stateless function 2017-02-24 20:29:24 +08:00
tianli.zhao
85ca5ed5ea [WIP] filter the disabled options (#4981)
filter the disabled options
2017-02-24 19:08:02 +08:00
afc163
0cbe319839 Add copied message 2017-02-24 19:05:26 +08:00
afc163
2bf6e22653 fix documentation for onOk, close #5044 2017-02-24 18:08:35 +08:00
ddcat1115
d0db3ce426 fix menu icon not centered in Layout.Sidere (#5039) 2017-02-24 18:04:16 +08:00
afc163
4bde2917d2 fix internal links 2017-02-24 18:02:47 +08:00
afc163
c163232deb fix snap 2017-02-24 17:43:40 +08:00
afc163
9c3268dcbc continue to fix #4935 2017-02-24 17:36:16 +08:00
乐仪
55fca5cee4 Merge branch 'master' of https://github.com/ant-design/ant-design 2017-02-24 16:36:02 +08:00
乐仪
70ec413537 fix Layout demo, update documentation. 2017-02-24 16:34:10 +08:00
afc163
edaad09b67 update grid document for media queries rule, close #5030 2017-02-24 16:25:27 +08:00
Benjy Cui
3aac9adc40 docs: remove some demo 2017-02-24 16:17:52 +08:00
ddcat1115
e07cdf5387 add left out event parameters for Modal[onOk] Popconfirm[onConfirm] Popconfirm[onCancel] (#5042) 2017-02-24 16:07:39 +08:00
feng zhi hao
88100a29a3 chore: fix ts definition of Upload (#5041) 2017-02-24 16:06:57 +08:00
偏右
6df92ce16f Fix staged lint (#5037)
* revert lint-staged

* remove git add

* fix lint-staged:demo typo

* fix: cnpm can not find tslint error
2017-02-24 12:54:13 +08:00
Benjy Cui
e72d93edfe site: add copy button to demo, close: #4563 2017-02-24 11:55:24 +08:00
Graeme Yeates
19c11dd173 chore: RangePicker TimePicker component locking background to white (#5031) 2017-02-24 10:42:45 +08:00
Benjy Cui
4e59e9e769 docs: recommend to use LocaleProvider, ref: #5017 2017-02-24 10:22:21 +08:00
afc163
7deab1beec do not autofix lint when commit, ref #4941 2017-02-23 22:28:21 +08:00
411f352690 [WIP] Refactor lint-flow (#5014)
* refactor: lint-flow #4941

* chore: rename lint to lint-all #4941

* Revert "chore: rename lint to lint-all #4941"

This reverts commit 8e4e2b6da3289b62fa85354bee3068fe35836f3d.
2017-02-23 22:12:52 +08:00
afc163
f53d0b7646 upgrade rc-input-number for #5012 2017-02-23 21:15:32 +08:00
Benjy Cui
1f844c1048 fix: Slider's Tooltip should not blink, close: #5003 2017-02-23 17:03:18 +08:00
Benjy Cui
1c837963e2 chore: add warning for deprecated API 2017-02-23 16:04:27 +08:00
Benjy Cui
ce0d4c39f2 docs: add missing info in Calendar, close: #5017 2017-02-23 15:58:02 +08:00
afc163
dded4bcde4 fix snap for rc-table@5.2.12 2017-02-23 14:57:48 +08:00
afc163
6fdb39038b Fix selected style of Dropdown menu, close #5013 2017-02-23 13:48:38 +08:00
afc163
9d0a06b657 add snap file 2017-02-23 13:45:16 +08:00
afc163
9c6a6d6175 Fix Breadcrumb falsy children, close #5015 2017-02-23 13:43:50 +08:00
afc163
5068343b0c fix tslint 2017-02-23 13:18:06 +08:00
afc163
a7c6c027ce Fix ts definition of Table & RangePicker
close https://segmentfault.com/q/1010000008423156
2017-02-23 12:51:40 +08:00
afc163
0f46eed370 fix lint 2017-02-23 11:45:48 +08:00
afc163
922a57dfde fix snap for react-component/table#125 2017-02-23 11:30:54 +08:00
Benjy Cui
29ebf22529 docs: update docs for AutoComplete, close: #5006 2017-02-23 10:02:10 +08:00
偏右
ec9fed3f04 Update ISSUE_TEMPLATE.md 2017-02-23 01:04:22 +08:00
afc163
52bfb8069a site: fix link 2017-02-23 00:36:02 +08:00
afc163
5fbc007ff7 site: fix link 2017-02-23 00:35:16 +08:00
afc163
27717483a7 should be only working on input ref, #4987 2017-02-22 21:28:53 +08:00
afc163
d8fb282088 Adjust checkbox and radio vertical, close #5001 2017-02-22 21:22:42 +08:00
afc163
9228e7a01b update snap 2017-02-22 19:34:44 +08:00
afc163
39fd6b6a36 Define circle progress theme by css, close #5002 2017-02-22 19:33:15 +08:00
afc163
ff2d69ad21 update progress demo 2017-02-22 19:31:50 +08:00
afc163
1c4407b60c fix popup menu z-index problem 2017-02-22 18:30:50 +08:00
afc163
cdf786676c Fix popconfirm missing button styles 2017-02-22 18:10:02 +08:00
afc163
5b20a5fc3e Fix slight vertical position difference in chrome, close #4987 2017-02-22 17:48:58 +08:00
afc163
7181e3c9e8 revert d9ec4bf and ef0b708, close #4997 2017-02-22 16:50:24 +08:00
afc163
61a3d66a02 Add test case for upload 2017-02-22 16:07:31 +08:00
Benjy Cui
e4d9e5af54 test: update snapshot 2017-02-22 15:52:43 +08:00
Benjy Cui
d9ec4bf732 fix: RangePicker style 2017-02-22 15:33:21 +08:00
afc163
fbeccb7be5 fix inline submenu open style 2017-02-22 14:47:01 +08:00
afc163
c2217f666c site: fix infinte redirect loop 2017-02-22 14:26:48 +08:00
afc163
32150a15a4 update document 2017-02-22 14:04:40 +08:00
afc163
90699b0c42 clean up document 2017-02-22 12:33:23 +08:00
Benjy Cui
0caefc8137 docs: update migration guides 2017-02-22 11:31:13 +08:00
afc163
ef0b7087f6 Fix slight difference placeholder between Input and Select
close #4987
2017-02-21 23:34:23 +08:00
afc163
9bb7e3d10c site: improve responsive layout 2017-02-21 23:26:10 +08:00
afc163
f0a4afd388 Fix slight difference placeholder between Input and Select
close #4987
2017-02-21 22:45:56 +08:00
陆离
7d982ddfd4 Calc width of Affix using getBoundingClientRect (#4989)
+ close #4986
2017-02-21 22:17:48 +08:00
afc163
79f222b86c fix snap, seems to be a jsdom bugfix 2017-02-21 22:17:35 +08:00
afc163
2fb0fb08d9 Fix Carousel autoplay not working after resizing, close #4984 & #2550 2017-02-21 22:12:11 +08:00
乔奕轩
030127e93c fix: Affix should not pass onChange to div (#4982) 2017-02-21 18:07:58 +08:00
afc163
9fff177bbc update table fixed column demo description 2017-02-21 17:11:30 +08:00
afc163
54dde4f5bc Hide yellow tag for no compatible with WCAG 2.0 on contrast ratio 2017-02-21 16:19:56 +08:00
afc163
fbb6cb007f max-height should not work on submenu filter, close #4975, ref #4916 2017-02-21 15:54:14 +08:00
afc163
7f404f1e20 Fix styoe of spin inside spin, close #4971 2017-02-21 15:15:30 +08:00
afc163
68f3641a90 update less code style 2017-02-21 15:15:29 +08:00
Benjy Cui
760a5ffc90 fix: add .focus for TimePicker, ref: #3790 2017-02-21 15:10:28 +08:00
陆离
21a0779692 Better loading of Button (#4964)
*  Better loading of Button

 + close #4925
 + add a default delay timer (200ms)

* update snapshot

* escape
2017-02-21 14:44:08 +08:00
afc163
205ace69ba Fix bug of switch language in iOS 2017-02-21 13:36:17 +08:00
afc163
c3748a60f4 site: improve responsive design 2017-02-21 12:07:28 +08:00
afc163
921f71a8bc revert fix ant-col-xx-0 not disappear as expected 2017-02-21 11:56:51 +08:00
afc163
c4a67a1bf5 fix ant-col-xx-0 not disappear as expected 2017-02-21 11:51:17 +08:00
afc163
b839c624e8 fix slider demo 2017-02-20 22:31:43 +08:00
afc163
d19453c4c3 fix lint 2017-02-20 22:21:14 +08:00
afc163
c30878d38f rewrite Slider demos to es6 component, #4878 2017-02-20 22:19:59 +08:00
afc163
580389ac15 rewrite Spin demos to es6 component, #4878 2017-02-20 22:16:57 +08:00
afc163
d576abc7b0 rewrite Switch demos to es6 component, #4878 2017-02-20 22:15:52 +08:00
afc163
6455bdf6e1 rewrite Pagination demos to es6 component, #4878 2017-02-20 22:14:47 +08:00
afc163
e68b54f902 rewrite Popconfirm demos to es6 component, #4878 2017-02-20 22:13:19 +08:00
afc163
176b9f9083 fix typo 2017-02-20 22:11:39 +08:00
afc163
c28020708f fix typo 2017-02-20 22:09:13 +08:00
afc163
a6547a392b rewrite Progress demos to es6 component, #4878 2017-02-20 22:07:45 +08:00
afc163
f27041342d rewrite Popover demos to es6 component, #4878 2017-02-20 22:06:12 +08:00
afc163
c8e49995cb rewrite Rate demos to es6 component, #4878 2017-02-20 22:05:06 +08:00
afc163
18203972a1 rewrite Radio demos to es6 component, #4878 2017-02-20 22:04:17 +08:00
afc163
5e0f5e1902 rewrite Modal demos to es6 component, #4878 2017-02-20 22:02:12 +08:00
afc163
3884ee3c5a rewrite Select demos to es6 component, #4878 2017-02-20 21:54:23 +08:00
afc163
c440a4d2b2 rewrite Menu demos to es6 component, #4878 2017-02-20 21:51:23 +08:00
afc163
f2d12306bd improve demo es6 class code style 2017-02-20 21:47:57 +08:00
afc163
2da59c3679 fix mention demo 2017-02-20 21:40:24 +08:00
afc163
ce877707bd rewrite LocaleProvider and Mention demos to es6 component, #4878 2017-02-20 21:39:07 +08:00
afc163
d7694d4c3b prefer es6 class code in demo 2017-02-20 21:21:54 +08:00
afc163
6b4ca79359 update documentation 2017-02-20 20:29:30 +08:00
afc163
23cb11fef3 update document, ref #4965 2017-02-20 17:58:51 +08:00
陆离
01086d56e5 shoud not have border around button (#4967) 2017-02-20 17:47:26 +08:00
afc163
6c5ae559b3 Add typescript as devDeps 2017-02-20 17:33:42 +08:00
afc163
254bbcd6a5 use tsc replace compile to speed up lint check, #4941 2017-02-20 17:04:10 +08:00
afc163
38c8360d1f Improve Menu[inline] and Collapse animation, ref #4898 2017-02-20 15:34:16 +08:00
afc163
3485529307 adjust message disappear animation setting 2017-02-20 14:44:27 +08:00
Benjy Cui
ec34c2b351 docs: update README.md 2017-02-20 14:19:51 +08:00
feng zhi hao
5303bd0a38 docs: rewrite Table demos to ES6 component (#4954) 2017-02-20 14:04:36 +08:00
feng zhi hao
47dc4a81e4 docs: rewrite InputNumber demos to ES6 component (#4950) 2017-02-20 12:27:13 +08:00
feng zhi hao
62e80928d5 docs: rewrite Form demos to ES6 component (#4949) 2017-02-20 11:50:57 +08:00
afc163
3308bce9b9 fix snapshot test 2017-02-20 11:36:57 +08:00
afc163
c1f3b58b28 Fix table wrapper float layout, close #4945 2017-02-20 11:36:56 +08:00
afc163
626e0c9d1e Fix DatePicker default width, close #4947, ref #4920 2017-02-20 11:36:19 +08:00
Benjy Cui
b7519a65c0 fix: should clear float, close: #4945 2017-02-20 11:31:51 +08:00
feng zhi hao
e85c8a25f6 docs: rewrite Dropdown demos to ES6 component (#4946) 2017-02-20 10:35:47 +08:00
偏右
1c2c93fa81 fix: show muliple messages in vertical direction, close #3543 (#4939) 2017-02-20 10:30:24 +08:00
feng zhi hao
6eca407711 docs: rewrite Checkbox demos to ES6 component (#4944) 2017-02-20 10:09:37 +08:00
feng zhi hao
0d2da7ad3b docs: Rewrite Cascader demos to ES6 component (#4943) 2017-02-20 09:45:23 +08:00
陆离
7a4080ec40 Fix some problems of AutoCompelete demo (#4942)
+ close #4912
2017-02-20 00:09:07 +08:00
bang
b90237ee6f fix: Tabs snapshot tests 2017-02-19 21:23:31 +07:00
bang
6bcd88f5c0 docs: Rewrite Tabs demos to ES6 component 2017-02-19 21:07:45 +07:00
bang
a4acf1f66e docs: Rewrite Upload demos to ES6 component 2017-02-19 20:50:06 +07:00
bang
c10b051a92 docs: Rewrite TreeSelect demos to ES6 component 2017-02-19 20:41:54 +07:00
bang
eabe261648 docs: Rewrite Tree demos to ES6 component 2017-02-19 20:23:38 +07:00
Wei Zhu
a69a52f8b8 docs: Rewrite Button demos to ES6 component 2017-02-19 21:03:44 +08:00
bang
c9064fc494 Merge branches 'master' and 'master' of github.com:ant-design/ant-design
* 'master' of github.com:ant-design/ant-design:
  docs: Rewrite Badge demos to ES6 component

* 'master' of github.com:ant-design/ant-design:
  docs: Rewrite Badge demos to ES6 component
2017-02-19 19:54:32 +07:00
bang
fcf9bafb18 docs: Rewrite Transfer demos to ES6 component 2017-02-19 19:51:40 +07:00
Wei Zhu
1fc8990531 docs: Rewrite Badge demos to ES6 component 2017-02-19 20:27:06 +08:00
Wei Zhu
eb29fdada3 docs: Rewrite AutoComplete demos to ES6 component 2017-02-19 20:12:41 +08:00
afc163
ae67f5cc20 update doc 2017-02-19 18:20:56 +08:00
afc163
18ec5933b7 fix old react documentation links 2017-02-19 17:02:58 +08:00
afc163
173b8c46ad Fix input demo tooltip 2017-02-19 15:21:46 +08:00
afc163
f5b0536d42 improve demo code style 2017-02-19 15:06:37 +08:00
afc163
e289ce8b31 Fix Table fixed column z-index issue, close #4937 2017-02-19 14:26:30 +08:00
afc163
673969d0ba fix table snapshot for react-component/table#121 2017-02-19 14:04:22 +08:00
afc163
6e4fae0e29 remove onChange functions in Table.onChange(pagination) 2017-02-19 13:55:36 +08:00
afc163
b34557ef17 Fix Table pagination.onChange arguments
react-component/pagination#58
2017-02-19 13:50:20 +08:00
afc163
b427adec21 docs: add instrunction about footer={null} 2017-02-19 01:42:58 +08:00
afc163
90daeb9a2b Adjust upload demo 2017-02-19 01:39:41 +08:00
afc163
e71807b732 Improve pagination demo 2017-02-18 18:12:38 +08:00
afc163
2512e6b5b5 site: update toc width 2017-02-18 17:19:17 +08:00
afc163
8194793f9b Update demo documentation 2017-02-18 16:49:34 +08:00
afc163
86981114a7 give up #4637 and fix #4936 2017-02-18 15:50:42 +08:00
afc163
8283a36b2e Fix version definition error, close #4935 2017-02-18 15:29:56 +08:00
afc163
ddcc284b43 Fix dark theme menu style of Dropdown, close #4903 2017-02-18 15:24:25 +08:00
afc163
bd6bc70302 Rollback #4869 for better loading animation, close #4934 2017-02-18 14:58:47 +08:00
afc163
8dc73f4601 Fix shake bug fo Button loading with icon, close #4913 2017-02-18 00:22:38 +08:00
Benjy Cui
cad31bd499 bump 2.7.2 2017-02-17 18:02:58 +08:00
Benjy Cui
3d9d2e508e docs: add change log for 2.7.2 (#4922)
* docs: add change log for 2.7.2

* deps: upgrade bisheng-plugin-antd
2017-02-17 18:02:06 +08:00
afc163
2d02792da7 Add max-height for table filter dropdown menu, close #4916 2017-02-17 17:41:23 +08:00
afc163
28dbdd17ed fix for #4920 2017-02-17 14:11:10 +08:00
Benjy Cui
56995e2089 test: update snapshot 2017-02-17 13:59:13 +08:00
Benjy Cui
89d77b2354 deps: upgrade rc-slider, ref: #4719 2017-02-17 13:59:13 +08:00
afc163
bed59cf658 fix lint 2017-02-17 13:58:24 +08:00
afc163
a87016ce54 Make sure DatePicker style.width can be effective, close #4920 2017-02-17 12:05:22 +08:00
afc163
bc988f486b fix css rule should not be prefixed, close #4915 2017-02-17 11:32:02 +08:00
ddcat1115
7d3cbfd9d9 fix: menu[mode='vertical'] can not show submenu in Layout.Sider (#4904)
* fix menu[mode='vertical'] can not show submenu in Layout.Sider
close #4890

improve Layout demo

* del useless css
2017-02-17 11:12:52 +08:00
Chikara Chan
5ff8723a9f docs: fix import style error due to duplicated identifier (#4917)
* fix render unuse className when type is undefined

* docs: fix import style error due to duplicated identifier
2017-02-17 11:11:42 +08:00
Wei Zhu
58afe5f729 fix: build dist with locales (#4910) 2017-02-17 09:36:42 +08:00
afc163
df3617dded docs: improve API table layout 2017-02-17 00:59:11 +08:00
偏右
bace209d52 Update CHANGELOG.zh-CN.md 2017-02-17 00:06:00 +08:00
afc163
94e8138639 adjust spin style 2017-02-16 21:55:03 +08:00
afc163
989792ed9b simplify less code 2017-02-16 21:24:17 +08:00
afc163
74028f6e48 Fix pop menu padding 2017-02-16 17:56:27 +08:00
Benjy Cui
8cfdf68f75 deps: upgrade bisheng-plugin-react 2017-02-16 17:32:06 +08:00
afc163
477e150075 Fix some SubMenu style bug, close #4906 2017-02-16 17:31:08 +08:00
afc163
49b050ccc1 Improve button and badge[status] with pulse animation 2017-02-16 17:08:15 +08:00
Benjy Cui
c4ac919067 fix: Menu.Item border width should not show animation 2017-02-16 16:32:03 +08:00
afc163
6002a3351e update docs 2017-02-16 16:26:53 +08:00
afc163
d1678711a7 docs: update footer 2017-02-16 16:25:42 +08:00
afc163
d22ce9cd50 Improve menu and collapse style details 2017-02-16 15:38:24 +08:00
afc163
144393c48a demo: update menu sider demo 2017-02-16 15:38:24 +08:00
偏右
4c0af2ba1f refactor: reduce table nested level (#4869)
* reduce table nested level, #4868

* update table snapshot
2017-02-16 15:36:34 +08:00
陆离
1c24600f8f fix: tree DragOver Gap fix (#4867)
*  Tree DragOver Gap fix

 + close #4858

* rewrite
2017-02-16 15:35:22 +08:00
偏右
f5d697988a fix: Tooltip should work with disabled button (#4865)
* Fix Tooltip won't hide at disabled button

close react-component/tooltip#18

* change button text in test case

* Add comments for display attribute

* correct test case
2017-02-16 14:03:05 +08:00
afc163
af62254597 fix #4637 again 2017-02-16 13:27:43 +08:00
afc163
8941990e74 revert 1490a40, ref #4637, close #4899 2017-02-16 12:00:00 +08:00
Wei Zhu
0cb6645038 site: Link to edit page directly (#4895) 2017-02-16 10:18:41 +08:00
Wei Zhu
2258f41f6b docs: add nested Table demo (#4887)
* Remove Table pagination demo

* Add nested table
2017-02-16 10:04:55 +08:00
HQidea
7471780ffe fix: fix Radio children === 0 (#4882) 2017-02-16 10:00:00 +08:00
Cordaro
168c576d4a docs: fix getFieldDecorator param (#4896)
close #4894
2017-02-15 22:58:24 +08:00
afc163
3ee7871a6e update .eslintignore 2017-02-15 21:01:16 +08:00
afc163
5603fa0088 Fix upload error file style, close #4810 2017-02-15 20:58:40 +08:00
afc163
d8403718f9 Add test case for #4876 2017-02-15 18:00:20 +08:00
afc163
32e10784e1 Fix submenu active style in controlled mode 2017-02-15 17:14:40 +08:00
afc163
e801cd022e fix snapshot 2017-02-15 16:40:26 +08:00
afc163
ec81fe4f1c update MonthPicker demo 2017-02-15 16:32:20 +08:00
afc163
4cbcc05b02 Fix openKeys is not working when mode is switched, close #4876 2017-02-15 16:24:56 +08:00
afc163
9fede4a5cd site: adjust component select style 2017-02-15 15:55:35 +08:00
afc163
588dd3033f docs: update for customizing validation 2017-02-15 14:41:16 +08:00
afc163
658922e796 Update link 2017-02-15 14:41:16 +08:00
Wei Zhu
972c2cfa95 fix: empty table placehoder style (#4851)
* Remove redundant border

* Fix empty table placehoder style
2017-02-15 12:08:17 +08:00
afc163
5327a49161 Fix Button[shape="circle"] loading style, close #4875 2017-02-15 11:55:08 +08:00
afc163
94ec19570e Make InputNumber & RadioButton height style more flexible 2017-02-15 11:47:22 +08:00
afc163
c86d9f1abc Make form control height follow large input height 2017-02-15 11:19:16 +08:00
afc163
c296d1a918 remove unused ant-select-show-search className, close #4859 2017-02-14 20:29:00 +08:00
Benjy Cui
a0c1d22d92 deps: upgrade bisheng 2017-02-14 18:03:47 +08:00
afc163
e18a330fbd Fix danger button click effect 2017-02-14 18:01:36 +08:00
zilong
597e020a45 chore: add class ant-form-item-control-wrapper for formItem wrapper (#4856) 2017-02-14 10:46:54 +08:00
zollero
e7cb0aa95d docs: fix typo (#4855)
修改一个错别字:“通” --》 “同”
2017-02-14 10:43:11 +08:00
Benjy Cui
184c4f5af7 docs: update docs for Form, ref: #4093 2017-02-14 10:29:06 +08:00
afc163
1490a40fc6 Fix #4637 webkit only 2017-02-13 18:32:05 +08:00
afc163
e2c46b78bf revert commit fb421f1 in #4637, close #4850 2017-02-13 17:56:36 +08:00
afc163
df1e30d9f8 Tweak radio vertical align 2017-02-13 16:38:31 +08:00
陆离
135fd52afb docs: AutoComplete document and demo improvement (#4840)
*  AutoComplete document and demo improvement

 + add a non-case-sensitive demo, close #4834.
 + remove confusing descriptions from document, close #4805.

* add snapshot
2017-02-13 15:45:49 +08:00
afc163
e5ccc1d4ba fix for stylelint 2017-02-13 15:01:02 +08:00
afc163
aaa939cf87 refactor version import 2017-02-13 14:57:04 +08:00
afc163
8726e8581b New animation for Badge[status="processing"] 2017-02-13 14:49:03 +08:00
偏右
dd589a4366 fix: change way to add package.version (#4842)
* Change way to add package.version

* replace content than create new content
2017-02-13 14:27:12 +08:00
Benjy Cui
1f223d8e4c fix: disabled option are not selectable, close: #4699 2017-02-13 11:55:12 +08:00
Benjy Cui
200b88246f docs: update docs format 2017-02-13 10:55:53 +08:00
Benjy Cui
eee34f1829 fix: footer button should align with cross button 2017-02-13 10:23:55 +08:00
乐仪
07c2d67e9f Merge branch 'master' of https://github.com/ant-design/ant-design 2017-02-10 23:53:17 +08:00
乐仪
4ecceeca41 remove duplicate changelog 2017-02-10 23:49:48 +08:00
乐仪
ff658c17f6 - update CHANGLOG
- update Pagination docs
2017-02-10 22:59:46 +08:00
陆离
49bbb2225f Add Demo of Uncertain Category (#4828)
*  Add Demo of Uncertain Category

 + close #4736

* add class prefix and cut lines
2017-02-10 22:59:28 +08:00
Erwann Mest
af7dafe0b8 Update LocaleProvider doc to be clearer. (#4833)
* Update LocaleProvider doc to be clearer.

* Update index.en-US.md
2017-02-10 22:59:16 +08:00
492 changed files with 10397 additions and 10373 deletions

View File

@@ -3,4 +3,3 @@ components/**/*.jsx
!.eslintrc.js
!components/*/__tests__/*
!components/*/demo/*
!components/*/style/*

View File

@@ -36,7 +36,6 @@ const eslintrc = {
'consistent-return': 0,
'no-redeclare': 0,
'react/require-extension': 0,
'react/jsx-indent': 0,
'jsx-a11y/no-static-element-interactions': 0,
'jsx-a11y/anchor-has-content': 0,
'react/no-danger': 0,
@@ -57,7 +56,6 @@ if (process.env.RUN_ENV === 'DEMO') {
'eol-last': 0,
'prefer-rest-params': 0,
'react/no-multi-comp': 0,
'react/prefer-es6-class': 0,
'jsx-a11y/href-no-hash': 0,
'import/newline-after-import': 0,
});

View File

@@ -1,12 +1,12 @@
<!-- Issue Template -->
<!--
antd 的用法咨询,建议通过以下渠道,官方 issues 目前没有足够精力提供此类咨询服务
亲爱的中文用户请注意
1. [Stack Overflow](http://stackoverflow.com/questions/tagged/antd)
2. [Segment Fault](https://segmentfault.com/t/antd)(中文)
如果是报告 bug请按照下列格式书写并务必提供复现步骤否则恕难解决感谢您的支持。
1. 官方 issue 用于报告 bug 和讨论需求。用法咨询类问题建议到 https://segmentfault.com/t/antd 上提问,目前社区没有足够精力提供此类服务,感谢您的理解。
2. 建议使用英文进行提问,这样你的问题可以被更多的人阅读和回答。如果表达上较复杂,英文标题加中文描述也是可选的方案。
3. 报告 BUG 时请务必按照下列格式书写并尽可能提供源代码、复现步骤、复现演示、GIF 演示等。我们和你一样都希望尽快解决问题,请不要浪费时间在互相追问上。
4. 如果需要粘贴源码,尽量避免截图并注意代码格式。关于如何在 Markdown 中书写代码可以参考https://segmentfault.com/markdown
-->
#### Environment(required)

View File

@@ -3,6 +3,7 @@
"rules": {
"at-rule-empty-line-before": null,
"at-rule-name-space-after": null,
"comment-empty-line-before": null,
"declaration-bang-space-before": null,
"declaration-empty-line-before": null,
"function-comma-newline-after": null,

View File

@@ -17,6 +17,79 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi
---
## 2.7.4
`2017-02-28`
- Fix TreeSelect cannot display bug. [#5092](https://github.com/ant-design/ant-design/issues/5092)
- Fix Anchor `e.stopPreventDefault is not a function` error. [#5080](https://github.com/ant-design/ant-design/issues/5080)
- Fix some detail styles of Input, Cascader, Upload.
## 2.7.3
`2017-02-25`
- Unify demo code to ES6 class. [#4878](https://github.com/ant-design/ant-design/issues/4878)
- TypeScript
- Fix that `Cannot find module '../../package.json'` error. [#4935](https://github.com/ant-design/ant-design/issues/4935)
- Fix definitions of Table, RangePicker and Upload.
- Fix lack of event argument for Modal `onOk` `afterClose` and Popconfirm `onConfirm` `onCancel`. [#4787](https://github.com/ant-design/ant-design/issues/4787)
- Improve animation of Menu[inline] and Collapse.
- Improve Checkbox and Radio vertical align style.
- Table
- Fix misplace header when fix column. [#4936](https://github.com/ant-design/ant-design/issues/4936)
- Fix not clearing float issue. [#4945](https://github.com/ant-design/ant-design/issues/4945)
- Fix submenu of filter. [#4975](https://github.com/ant-design/ant-design/issues/4975)
- Fix that filterDropdown of fixed column cannot be interacted with. [#5010](https://github.com/ant-design/ant-design/issues/5010)
- Fix that arguments of `pagination.onChange` do not match Pagination `onChange`.
- Fix that table loading animation is not smoothing. [#4934](https://github.com/ant-design/ant-design/issues/4934)
- Improve multiple message display. [#3543](https://github.com/ant-design/ant-design/issues/3543)
- Fix Carousel autoplay not working after resize window. [#2550](https://github.com/ant-design/ant-design/issues/2550)
- Fix that controlled InputNumber cannot input number like `1.01` `1.001`. [#5012](https://github.com/ant-design/ant-design/issues/5012)
- Improve Button loading switching.[#4913](https://github.com/ant-design/ant-design/issues/4913)
- Fix Dropdown selected menu style and `Menu[theme="dark"]` style. [#5013](https://github.com/ant-design/ant-design/issues/5013) [#4903](https://github.com/ant-design/ant-design/issues/4903)
- Fix Menu submenu `z-index` issue. [#4937](https://github.com/ant-design/ant-design/issues/4937)
- Fix that DatePicker and RangePicker width cannot be reset below `300px` issue. [#4920](https://github.com/ant-design/ant-design/issues/4920)
- Fix style of Spin nested in Spin. [#4971](https://github.com/ant-design/ant-design/issues/4971)
- Fix that lack of Button style when import Popconfirm by babel-plugin-import.
- Fix that less variables cannot work on circle Progress. [#5002](https://github.com/ant-design/ant-design/issues/5002)
- Fix falsy children of Breadcrumb. [#5015](https://github.com/ant-design/ant-design/issues/5015)
- Fix blinking tooltip of Slider. [#5003](https://github.com/ant-design/ant-design/issues/5003)
- Fix that Transfer disabled option can be moved. [#4981](https://github.com/ant-design/ant-design/pull/4981) [@tianlizhao](https://github.com/tianlizhao)
- Documentation
- Fix and improve site for mobile devices.
- Improve 1.x to 2.x compatibility instruction.
## 2.7.2
`2017-02-17`
- Fix that `antd.version` doesn't work as expected. [#4844](https://github.com/ant-design/ant-design/issues/4844)
- Fix that dist files don't include locales. [#4910](https://github.com/ant-design/ant-design/pull/4910)
- Fix that disabled option is selectable in search mode of Cascader. [#4699](https://github.com/ant-design/ant-design/issues/4699)
- **Button**
- Fix click animation of `Button[type=danger]`.
- Fix broken style with `loading`. [#4875](https://github.com/ant-design/ant-design/issues/4875)
- **Menu**
- Fix that `openKeys` should be controlled property in `vertical` mode. [#4876](https://github.com/ant-design/ant-design/issues/4876)
- Fix selected animation of Menu.Item.
- Fix broken style of Menu.SubMenu. [#4906](https://github.com/ant-design/ant-design/issues/4906)
- **Table**
- Fix broken style of table which use small size and fixed header. [#4850](https://github.com/ant-design/ant-design/issues/4850)
- Fix placeholder style. [#4851](https://github.com/ant-design/ant-design/pull/4851)
- Simplify DOM structure. [#4868](https://github.com/ant-design/ant-design/issues/4868)
- Fix that Radio should support number `0` as children. [#4874](https://github.com/ant-design/ant-design/issues/4874) [@HQidea](https://github.com/HQidea)
- Fix that RangePicker should work with `style.width` which is small than 300. [#4920](https://github.com/ant-design/ant-design/issues/4920)
- Fix CSS compile error caused by Spin. [#4915](https://github.com/ant-design/ant-design/issues/4915)
- Fix that Tooltip should work with disabled button in Chrome. [#4865](https://github.com/ant-design/ant-design/pull/4865)
- Fix UX of Tree while dragging. [#4858](https://github.com/ant-design/ant-design/issues/4858)
- Fix failed style of Upload. [#4810](https://github.com/ant-design/ant-design/issues/4810)
- Fix that `Menu[vertical]`'s SubMenu cannot popup in Layout.Sider. [#4890](https://github.com/ant-design/ant-design/issues/4890)
- Improve animation of Button and `Badge[status=processing]`.
![Badge animation](https://camo.githubusercontent.com/6874b2333f2fac3fac346404c6e70684e4dafc1a/68747470733a2f2f7a6f732e616c697061796f626a656374732e636f6d2f726d73706f7274616c2f73516b72756c716346734b4e54785158615971512e676966)
![Button animation](https://camo.githubusercontent.com/3963d12b45de4f522c2799361dbc3177e7bd93d1/68747470733a2f2f7a6f732e616c697061796f626a656374732e636f6d2f726d73706f7274616c2f46624b776d636f766d795364666c557468494e522e676966)
## 2.7.1
`2017-02-10`
@@ -30,23 +103,20 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi
- Fix the wrong size. [#4766](https://github.com/ant-design/ant-design/issues/4766)
- Fix adding error character automatically. [#4778](https://github.com/ant-design/ant-design/issues/4778)
- **Dropdown** Add the documentation and demo about positioning of Dropdown menus. [#4811](https://github.com/ant-design/ant-design/issues/4811)
- **Grid** Delete the useless class in non-flex mode. [#4784](https://github.com/ant-design/ant-design/pull/4784) [@chikara-chan](https://github.com/chikara-chan)
- **Icon** Unified naming style(original names remain valid while new names been added). [#4758](https://github.com/ant-design/ant-design/issues/4758)
- **Layout** Improve Sider's animation effect. [#4752](https://github.com/ant-design/ant-design/issues/4752)
- **LocaleProvider** Fix issues with the new Swedish locale provider. [pull-4762](https://github.com/ant-design/ant-design/pull/4762) [@JesperWe](https://github.com/JesperWe)
- **RangePicker** Fix the overlapping problem about the date icon. [#4783](https://github.com/ant-design/ant-design/issues/4783) [@zhenzong](https://github.com/zhenzong)
- **Table**
- Support `size='middle'`[#4819](https://github.com/ant-design/ant-design/pull/4819) [@warrenseymour](https://github.com/warrenseymour)
- Add the missing value 'middle' for size definition. [#4819](https://github.com/ant-design/ant-design/pull/4819) [@warrenseymour](https://github.com/warrenseymour)
- Fix controlled filter does not work with JSX style. [#4759](https://github.com/ant-design/ant-design/issues/4759)
- Fix switch pagination problem. [#4779](https://github.com/ant-design/ant-design/issues/4779)
- Fix performance issues under IE11. [#4522](https://github.com/ant-design/ant-design/issues/4522)
- **Tabs** Fix content missing problem since the second tab pane. [#4795](https://github.com/ant-design/ant-design/issues/4795)
- **rc-pagination** Upgrade to ~1.7.0, support showLessItems, and add pageSize as onChange's second argument.
- **Tabs** Fix content missing problem since the second tab pane under IE9. [#4795](https://github.com/ant-design/ant-design/issues/4795)
- **rc-pagination** Upgrade to ~1.7.0, add pageSize as onChange's second argument.
- **Global optimization**
- Make some bugfixes and optimizations about documentation、link and style.
- Use stylelint instead of lesslint, and fix some lint issues. [#2179](https://github.com/ant-design/ant-design/issues/2179)
- Unify border radius to 4px. [#4772](https://github.com/ant-design/ant-design/issues/4772)
- Support `import { version } from 'antd'` . [#4751](https://github.com/ant-design/ant-design/pull/4751)
- Support `import { version } from 'antd'`. [#4751](https://github.com/ant-design/ant-design/pull/4751)
- **Site**
- Add default locale looking-up in Home Page. [#4552](https://github.com/ant-design/ant-design/issues/4552)
- Can search with Google. [#4814](https://github.com/ant-design/ant-design/issues/4814)

View File

@@ -10,13 +10,86 @@ timeline: true
#### 发布周期
* patch 版本:每周末会进行日常 bugfix 更新。(如果有紧急的 bugfix则任何时候都可发布
* minor 版本:每月发布一个带有新特性的版本。
* minor 版本:每月发布一个带有新特性的向下兼容的版本。
* 大版本号:含有破坏性更新和新特性,不在发布周期内。
如果需要查看 `2.0.0` 之前的更新日志,请移步 [GitHub](https://github.com/ant-design/ant-design/blob/1.x-stable/CHANGELOG.md)。
---
## 2.7.4
`2017-02-28`
- 修复 TreeSelect 多选框无法展现的问题。[#5092](https://github.com/ant-design/ant-design/issues/5092)
- 修复 Anchor 的 `e.stopPreventDefault is not a function` 的报错。[#5080](https://github.com/ant-design/ant-design/issues/5080)
- 修复 Input、Cascader、Upload 的一些样式细节。
## 2.7.3
`2017-02-25`
- 演示代码统一为 ES6 class 的写法。[#4878](https://github.com/ant-design/ant-design/issues/4878)
- TypeScript
- 修复 `Cannot find module '../../package.json'` 的问题。[#4935](https://github.com/ant-design/ant-design/issues/4935)
- 补充了 Table、RangePicker 和 Upload 的部分属性定义。
- 修复了 Modal `onOk` `afterClose` 和 Popconfirm `onConfirm` `onCancel` 缺少点击 event 参数的问题。 [#4787](https://github.com/ant-design/ant-design/issues/4787)
- 优化 Menu[inline] 和 Collapse 的折叠动画效果。
- 优化了 Checkbox 和 Radio 的垂直对齐样式。
- Table
- 修复固定列时列头样式错位的问题。[#4936](https://github.com/ant-design/ant-design/issues/4936)
- 修复未清除浮动导致排版错位的问题。[#4945](https://github.com/ant-design/ant-design/issues/4945)
- 修复筛选子菜单无法显示的问题。[#4975](https://github.com/ant-design/ant-design/issues/4975)
- 修复固定列上的自定义筛选菜单无法交互的问题。[#5010](https://github.com/ant-design/ant-design/issues/5010)
- 修正 `pagination.onChange` 和 Pagination 的 `onChange` 参数不一致的问题。
- 修复加载状态切换不柔和的问题。[#4934](https://github.com/ant-design/ant-design/issues/4934)
- 优化多个 message 展示重叠的问题。[#3543](https://github.com/ant-design/ant-design/issues/3543)
- 修复 Carousel 在改变浏览器窗口大小后 autoplay 会失效的问题。[#2550](https://github.com/ant-design/ant-design/issues/2550)
- 修复了 InputNumber 在受控模式Form 表单内)无法输入 `1.01` `1.001` 等数字的问题。[#5012](https://github.com/ant-design/ant-design/issues/5012)
- 优化 Button 加载状态切换时的宽度抖动问题。[#4913](https://github.com/ant-design/ant-design/issues/4913)
- 修复 Dropdown 的菜单选中样式和 `Menu[theme="dark"]` 样式无效的问题。[#5013](https://github.com/ant-design/ant-design/issues/5013) [#4903](https://github.com/ant-design/ant-design/issues/4903)
- 修复 Menu 的弹出菜单的 `z-index` 问题。[#4937](https://github.com/ant-design/ant-design/issues/4937)
- 修复 DatePicker 和 RangePicker 无法设置小于 300px 的宽度的问题。[#4920](https://github.com/ant-design/ant-design/issues/4920)
- 修复 Spin 内嵌 Spin 的样式问题。[#4971](https://github.com/ant-design/ant-design/issues/4971)
- 修复了使用 babel-plugin-import 引入 Popconfirm 时,未引入 Button 样式的问题。
- 修复了样式变量在 Progress `type="circle"` 上未生效的问题。[#5002](https://github.com/ant-design/ant-design/issues/5002)
- 修复了 Breadcrumb 的 chilren 为 `null``undefined` 时报错的问题。[#5015](https://github.com/ant-design/ant-design/issues/5015)
- 修复 Slider 的 tooltip 闪烁的问题。[#5003](https://github.com/ant-design/ant-design/issues/5003)
- 修复了 Transfer 中 disabled 选项仍然可以被移动的问题。[#4981](https://github.com/ant-design/ant-design/pull/4981) [@tianlizhao](https://github.com/tianlizhao)
- 文档
- 修复和优化了移动端的展现。
- 优化了 1.x 升级到 2.x 的不兼容改动文档。
## 2.7.2
`2017-02-17`
- 修复 `antd.version` 无法正常使用的问题。 [#4844](https://github.com/ant-design/ant-design/issues/4844)
- 修复 dist 文件没有 locales 的问题。 [#4910](https://github.com/ant-design/ant-design/pull/4910)
- 修复 Cascader 搜索模式下可以选择已禁用选项的问题。 [#4699](https://github.com/ant-design/ant-design/issues/4699)
- **Button**
- 修复 `Button[type=danger]` 的点击动画。
- 修复设置 `loading` 时的样式问题。 [#4875](https://github.com/ant-design/ant-design/issues/4875)
- **Menu**
- 修复 `vertical` 模式下 `openKeys` 为受控属性。 [#4876](https://github.com/ant-design/ant-design/issues/4876)
- 修复 Menu.Item 选中时的动画问题。
- 修复 Menu.SubMenu 的样式问题。 [#4906](https://github.com/ant-design/ant-design/issues/4906)
- **Table**
- 修复在混合使用固定表头和小尺寸时的样式问题。 [#4850](https://github.com/ant-design/ant-design/issues/4850)
- 修复无数据时的占位符样式问题。 [#4851](https://github.com/ant-design/ant-design/pull/4851)
- 精简了 DOM 结构。 [#4868](https://github.com/ant-design/ant-design/issues/4868)
- 修复 Radio 组件 children 无法为数字 `0` 的问题。 [#4874](https://github.com/ant-design/ant-design/issues/4874) [@HQidea](https://github.com/HQidea)
- 修复 RangePicker `style.width` 无法小于 300 的问题。 [#4920](https://github.com/ant-design/ant-design/issues/4920)
- 修复 Spin 样式在打包时会导致编译错误的问题。 [#4915](https://github.com/ant-design/ant-design/issues/4915)
- 修复 Chrome 下 Tooltip 无法在 disabled 的按钮上使用的问题。 [#4865](https://github.com/ant-design/ant-design/pull/4865)
- 修复 Tree 节点在拖动时会导致整棵树抖动的问题。 [#4858](https://github.com/ant-design/ant-design/issues/4858)
- 修复 Upload 上传失败的样式问题。 [#4810](https://github.com/ant-design/ant-design/issues/4810)
- 修复 `Menu[vertical]` 和 Layout.Sider 配合使用时二级菜单无法弹出的问题。 [#4890](https://github.com/ant-design/ant-design/issues/4890)
- 优化 Button、`Badge[status=processing]` 的动画。
![Badge animation](https://camo.githubusercontent.com/6874b2333f2fac3fac346404c6e70684e4dafc1a/68747470733a2f2f7a6f732e616c697061796f626a656374732e636f6d2f726d73706f7274616c2f73516b72756c716346734b4e54785158615971512e676966)
![Button animation](https://camo.githubusercontent.com/3963d12b45de4f522c2799361dbc3177e7bd93d1/68747470733a2f2f7a6f732e616c697061796f626a656374732e636f6d2f726d73706f7274616c2f46624b776d636f766d795364666c557468494e522e676966)
## 2.7.1
`2017-02-10`
@@ -30,23 +103,20 @@ timeline: true
- 修复了 size 问题。[#4766](https://github.com/ant-design/ant-design/issues/4766)
- 修复了自动加入其他字符的问题。[#4778](https://github.com/ant-design/ant-design/issues/4778)
- **Dropdown** 补充了之前缺失的弹出框位置设定相关的文档及示例。[#4811](https://github.com/ant-design/ant-design/issues/4811)
- **Grid** 去掉了非 flex 模式下栅格的无用 class。[#4784](https://github.com/ant-design/ant-design/pull/4784) [@chikara-chan](https://github.com/chikara-chan)
- **Icon** 统一了命名风格(添加了别名,原有命名依然有效)。[#4758](https://github.com/ant-design/ant-design/issues/4758)
- **Layout** 修复了侧边布局动效不平滑的问题。[#4752](https://github.com/ant-design/ant-design/issues/4752)
- **LocaleProvider** 修复了瑞典语相关问题。[pull-4762](https://github.com/ant-design/ant-design/pull/4762) [@JesperWe](https://github.com/JesperWe)
- **RangePicker** 修复了图标与表单校验反馈图标重叠的问题。[#4783](https://github.com/ant-design/ant-design/issues/4783) [@zhenzong](https://github.com/zhenzong)
- **Table**
- 支持 `size='middle'` 。[#4819](https://github.com/ant-design/ant-design/pull/4819) [@warrenseymour](https://github.com/warrenseymour)
- 修复了 size 定义里没有 'middle' 的问题。[#4819](https://github.com/ant-design/ant-design/pull/4819) [@warrenseymour](https://github.com/warrenseymour)
- 修复过滤功能在 JSX 模式下不生效的问题。[#4759](https://github.com/ant-design/ant-design/issues/4759)
- 修复分页跳转问题。[#4779](https://github.com/ant-design/ant-design/issues/4779)
- 修复IE11下的性能问题。[#4522](https://github.com/ant-design/ant-design/issues/4522)
- **Tabs** 修复了在 IE9 中从第二个标签页起都显示空白的问题。[#4795](https://github.com/ant-design/ant-design/issues/4795)
- **rc-pagination** 升级至 ~1.7.0支持 showLessItemsonChange 增加 pageSize 参数。
- **rc-pagination** 升级至 ~1.7.0onChange 增加 pageSize 参数。
- **全局性优化**
- 修复或优化了一些了文档,链接,样式细节。
- 接入 stylelint 以替代 lesslint修复一些 lint 问题。[#2179](https://github.com/ant-design/ant-design/issues/2179)
- border-radius 统一为 4px。[#4772](https://github.com/ant-design/ant-design/issues/4772)
- 支持 `import { version } from 'antd'` 。[#4751](https://github.com/ant-design/ant-design/pull/4751)
- 支持 `import { version } from 'antd'`。[#4751](https://github.com/ant-design/ant-design/pull/4751)
- **网站**
- 首页自动选择语言。[#4552](https://github.com/ant-design/ant-design/issues/4552)
- 接入 Google 作为文档的全文本搜索。[#4814](https://github.com/ant-design/ant-design/issues/4814)
@@ -112,10 +182,10 @@ timeline: true
`2017-01-14`
* 新增社区精选组件页面。[链接](/docs/react/recommendation-cn)
* 新增社区精选组件页面。[链接](/docs/react/recommendation)
* 修复一个内容过长导致 Layout 侧边布局错位的问题。[#4459](https://github.com/ant-design/ant-design/issues/4459)
* 修复 Input.Search 输入框和图标错位的问题。[#4540](https://github.com/ant-design/ant-design/issues/4540)
* 补充了一个自定义灰底样式的 Collapse 折叠面板的例子。[链接](/components/collapse-cn/#components-collapse-demo-custom)
* 补充了一个自定义灰底样式的 Collapse 折叠面板的例子。[链接](/components/collapse/#components-collapse-demo-custom)
* Table
* 调大了 Table 选择框和展开按钮的列宽度。
* 修复 `pagination` 属性切换后分页不可用的问题。[#4532](https://github.com/ant-design/ant-design/issues/4532)
@@ -471,9 +541,11 @@ timeline: true
> 建议从 `1.x` 升级时,直接升级到 `2.x` 的最新版本。
此版本有部分不兼容的改动,升级时确保修改相应的使用代码。
> 建议在升级 antd 的过程中,每做完一次合理的修改并 review 和测试之后,就 git commit 一次,这样在误操作时能随时回滚到之前的版本
* 时间类组件的 `value``defaultValue` 不再支持 `String/Date` 类型,请使用 [moment](http://momentjs.com/)
此版本有部分不兼容的改动,升级时确保修改相应的使用代码。另外由于人肉查找代码中的废弃用法过于低效,所以我们提供了 [antd-migration-helper](https://github.com/ant-design/antd-migration-helper) 用于扫描代码中的废弃用法
* 时间类组件的 `value``defaultValue` 不再支持 `String/Date` 类型,请使用 [moment](http://momentjs.com/)。需要对代码进行如下修改,可人手修改也可用我们提供的 [codemod](https://github.com/ant-design/antd-codemod#time-related-value-to-moment) 脚本自动修改类似用法,但注意脚本不能覆盖所有情况,所以在运行脚本后仍然需要 review 和测试。
```diff
- <TimePicker defaultValue="12:08:23" />
+ <TimePicker defaultValue={moment('12:08:23', 'HH:mm:ss')} />
@@ -484,9 +556,16 @@ timeline: true
- <Calendar defaultValue={new Date('2010-10-10')} />
+ <Calendar defaultValue={moment('2010-10-10', 'YYYY-MM-DD')} />
```
* 时间类组件的 `onChange` 和 `onPanelChange` 及其他回调函数中为 `Date/GregorianCalendar` 类型的参数,均修改为 moment 类型,两者 API 有所不同,但功能基本一致,请对照 [moment 的 API 文档](http://momentjs.com/docs/) 和 [gregorian-calendar 的文档](https://github.com/yiminghe/gregorian-calendar) 进行修改。你也可以参考这个 [commit](https://github.com/ant-design/ant-design/commit/4026221d451b246956983bb42140142d4a48b7d7) 来进行修改。
由于 `JSON.stringify(date: moment)` 返回的值会丢失时区设置,所以要先使用 `.format` 把日期转成字符串,相关 issue 见 [#3082](https://github.com/ant-design/ant-design/issues/3082)
* 时间类组件的 `onChange` 和 `onPanelChange` 及其他回调函数中为 `Date/GregorianCalendar` 类型的参数,均修改为 moment 类型,两者 API 有所不同,但功能基本一致,请对照 [moment 的 API 文档](http://momentjs.com/docs/) 和 [gregorian-calendar 的文档](https://github.com/yiminghe/gregorian-calendar) 进行修改。
1. 也可以参考这个 [commit](https://github.com/ant-design/ant-design/commit/4026221d451b246956983bb42140142d4a48b7d7) 来进行修改。
1. 也可用我们提供的 [codemod](https://github.com/ant-design/antd-codemod#gergoriancalendar-to-moment) 脚本自动修改类似用法,但注意脚本不能覆盖所有情况,所以在运行脚本后仍然需要 review 和测试。
```diff
function disabledDate(date) {
- console.log(date.getTime());
+ console.log(date.valueOf());
}
```
* 由于 `JSON.stringify(date: moment)` 返回的值会丢失时区设置,所以在提交前要先使用 `.format` 把日期转成字符串,相关 issue 见 [#3082](https://github.com/ant-design/ant-design/issues/3082)
```js
handleSubmit() {
const values = this.props.form.getFieldsValue();
@@ -495,9 +574,17 @@ timeline: true
// 发送 data 到服务器
}
```
* 时间类组件与表单校验一起使用时,`type: 'date'` 改为 `type: 'object'`。
* 时间类组件的 `format` 属性也发生了变化,从 [gregorian-calendar-format 的格式](https://github.com/yiminghe/gregorian-calendar-format#api) 变化为与 [moment 的格式](http://momentjs.com/docs/#/parsing/string-format/),例如原来的 `yyyy-MM-dd` 将变为 `YYYY-MM-DD`。
```diff
getFieldDecorator('time', {
rules: [{
required: true,
- type: 'date',
+ type: 'object',
}],
})(...)
```
* 时间类组件的 `format` 属性也发生了变化,从 [gregorian-calendar-format 的格式](https://github.com/yiminghe/gregorian-calendar-format#api) 变化为与 [moment 的格式](http://momentjs.com/docs/#/parsing/string-format/),例如原来的 `yyyy-MM-dd` 将变为 `YYYY-MM-DD`。可人手修改也可用我们提供的 [codemod](https://github.com/ant-design/antd-codemod#time-related-value-to-moment) 脚本自动修改类似用法,但注意脚本不能覆盖所有情况,所以在运行脚本后仍然需要 review 和测试。
* Breadcrumb 移除 `linkRender` 和 `nameRender`,请使用 `itemRender`。
* Menu 移除 `onClose` `onOpen`,请使用 `onOpenChange`。API 差异较大,请先研究 [demo](http://beta.ant.design/components/menu/#components-menu-demo-sider-current)。
* Table 移除列分页功能,请使用 [固定列](http://ant.design/components/table/#components-table-demo-fixed-columns)。
@@ -505,7 +592,7 @@ timeline: true
以下变化升级后旧代码仍然能正常运行,但是控制台会出现警告提示,建议按提示进行修改。
* Form 废弃 `getFieldProps`,请使用 `getFieldDecorator`
* Form 废弃 `getFieldProps`,请使用 `getFieldDecorator`。可人手修改也可用我们提供的 [codemod](https://github.com/ant-design/antd-codemod#getfieldprops-to-getfielddecorator) 脚本自动修改类似用法,但注意脚本不能覆盖所有情况,所以在运行脚本后仍然需要 review 和测试。
```diff
- <Input placeholder="text" {...getFieldProps('userName', { ... })} />
@@ -525,6 +612,8 @@ timeline: true
}
```
最后,由于时间类组件修改比较复杂,可能还需要深入业务逻辑,所以在项目比较赶的情况下,可以考虑使用 [antd-adapter](https://github.com/ant-design/antd-adapter) 适配为 `antd@1.x` 里面的用法,但不建议。
### 2.x Bug 修复
* 修复 Dropdown.Button `disabled` 属性无效的问题。[#3070](https://github.com/ant-design/ant-design/issues/3070)

View File

@@ -81,7 +81,7 @@ tsconfig.json
- [React 基础组件](http://react-component.github.io/)
- [移动端组件](http://mobile.ant.design)
- [动效](https://motion.ant.design)
- [设计规范速查手册](https://os.alipayobjects.com/rmsportal/HTXUgPGkyyxEivE.png)
- [设计规范速查手册](https://github.com/ant-design/ant-design/wiki/Ant-Design-%E8%AE%BE%E8%AE%A1%E5%9F%BA%E7%A1%80%E7%AE%80%E7%89%88)
- [开发者说明](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/issues/129)

View File

@@ -28,7 +28,7 @@ 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).
`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.
## Install

View File

@@ -50,5 +50,6 @@ Array [
"Tooltip",
"Mention",
"Upload",
"version",
]
`;

View File

@@ -27,7 +27,6 @@ export default function getRequestAnimationFrame() {
}
export function cancelRequestAnimationFrame(id) {
if (typeof window === 'undefined') {
return null;
}

View File

@@ -1,21 +1,37 @@
import cssAnimation from 'css-animation';
import getRequestAnimationFrame, { cancelRequestAnimationFrame } from './getRequestAnimationFrame';
const reqAnimFrame = getRequestAnimationFrame();
function animate(node, show, done) {
let height;
let requestAnimationFrameId;
return cssAnimation(node, 'ant-motion-collapse', {
start() {
if (!show) {
node.style.height = `${node.offsetHeight}px`;
node.style.opacity = 1;
} else {
height = node.offsetHeight;
node.style.height = 0;
node.style.opacity = 0;
}
},
active() {
node.style.height = `${show ? height : 0}px`;
if (requestAnimationFrameId) {
cancelRequestAnimationFrame(requestAnimationFrameId);
}
requestAnimationFrameId = reqAnimFrame(() => {
node.style.height = `${show ? height : 0}px`;
node.style.opacity = show ? 1 : 0;
});
},
end() {
if (requestAnimationFrameId) {
cancelRequestAnimationFrame(requestAnimationFrameId);
}
node.style.height = '';
node.style.opacity = '';
done();
},
});

View File

@@ -13,7 +13,7 @@ title:
The simplest usage.
````__react
````jsx
import { Affix, Button } from 'antd';
ReactDOM.render(

View File

@@ -13,7 +13,7 @@ title:
Callback with affixed state.
````__react
````jsx
import { Affix, Button } from 'antd';
ReactDOM.render(

View File

@@ -13,7 +13,7 @@ title:
Set a `target` for 'Affix', which is listen to scroll event of target element (default is `window`).
````__react
````jsx
import { Affix, Button } from 'antd';
class Demo extends React.Component {

View File

@@ -29,6 +29,8 @@ function getOffset(element: HTMLElement, target) {
scrollTop - clientTop,
left: elemRect.left - targetRect.left +
scrollLeft - clientLeft,
width: elemRect.width,
height: elemRect.height,
};
}
@@ -138,14 +140,15 @@ export default class Affix extends React.Component<AffixProps, any> {
(targetNode as Window).innerHeight || (targetNode as HTMLElement).clientHeight;
if (scrollTop > elemOffset.top - offsetTop && offsetMode.top) {
// Fixed Top
const width = elemOffset.width;
this.setAffixStyle(e, {
position: 'fixed',
top: targetRect.top + offsetTop,
left: targetRect.left + elemOffset.left,
width: affixNode.offsetWidth,
width,
});
this.setPlaceholderStyle({
width: affixNode.offsetWidth,
width,
height: affixNode.offsetHeight,
});
} else if (
@@ -154,14 +157,15 @@ export default class Affix extends React.Component<AffixProps, any> {
) {
// Fixed Bottom
const targetBottomOffet = targetNode === window ? 0 : (window.innerHeight - targetRect.bottom);
const width = elemOffset.width;
this.setAffixStyle(e, {
position: 'fixed',
bottom: targetBottomOffet + offsetBottom,
left: targetRect.left + elemOffset.left,
width: affixNode.offsetWidth,
width,
});
this.setPlaceholderStyle({
width: affixNode.offsetWidth,
width,
height: affixNode.offsetHeight,
});
} else {
@@ -222,7 +226,7 @@ export default class Affix extends React.Component<AffixProps, any> {
[this.props.prefixCls || 'ant-affix']: this.state.affixStyle,
});
const props = omit(this.props, ['prefixCls', 'offsetTop', 'offsetBottom', 'target']);
const props = omit(this.props, ['prefixCls', 'offsetTop', 'offsetBottom', 'target', 'onChange']);
const placeholderStyle = { ...this.state.placeholderStyle, ...this.props.style };
return (
<div {...props} style={placeholderStyle}>

View File

@@ -13,7 +13,7 @@ title:
When `Alert` is used as banner, it has particular style, Icon and `type`(warning) are specified by default.
````__react
````jsx
import { Alert } from 'antd';
ReactDOM.render(

View File

@@ -13,7 +13,7 @@ title:
The simplest usage for short messages.
````__react
````jsx
import { Alert } from 'antd';
ReactDOM.render(

View File

@@ -13,7 +13,7 @@ title:
To show close button.
````__react
````jsx
import { Alert } from 'antd';
const onClose = function (e) {

View File

@@ -13,7 +13,7 @@ title:
Replace the default icon with customized text.
````__react
````jsx
import { Alert } from 'antd';
ReactDOM.render(

View File

@@ -13,7 +13,7 @@ title:
Additional description for alert message.
````__react
````jsx
import { Alert } from 'antd';
ReactDOM.render(<div>

View File

@@ -13,7 +13,7 @@ title:
Decent icon make information more clear and more friendly.
````__react
````jsx
import { Alert } from 'antd';
ReactDOM.render(<div>

View File

@@ -13,7 +13,7 @@ title:
There are 4 types of Alert: `success`, `info`, `warning`, `error`.
````__react
````jsx
import { Alert } from 'antd';
ReactDOM.render(<div>

View File

@@ -73,7 +73,6 @@ export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
if (onClick) {
onClick(href, this._component);
} else {
e.stopPreventDefault();
const scrollToFn = anchorHelper ? anchorHelper.scrollTo : scrollTo;
scrollToFn(href, this.props.offsetTop);
}

View File

@@ -13,7 +13,7 @@ title:
The simplest usage.
```__react
```jsx
import { Anchor } from 'antd';
const { Link } = Anchor;

View File

@@ -13,7 +13,7 @@ title:
Do not change state when page is scrolling.
```__react
```jsx
import { Anchor } from 'antd';
const { Link } = Anchor;

View File

@@ -85,6 +85,50 @@ exports[`test renders ./components/auto-complete/demo/basic.md correctly 1`] = `
</div>
`;
exports[`test 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;">
<div
aria-autocomplete="list"
aria-expanded="false"
aria-haspopup="true"
class="ant-select-selection
ant-select-selection--single"
role="combobox">
<div
class="ant-select-selection__rendered">
<div
class="ant-select-selection__placeholder"
style="display:block;user-select:none;-webkit-user-select:none;"
unselectable="unselectable">
try to type \`b\`
</div>
<ul>
<li
class="ant-select-search ant-select-search--inline">
<div
class="ant-select-search__field__wrap">
<input
class="ant-input ant-input ant-select-search__field"
type="text"
value="" />
<span
class="ant-select-search__field__mirror" />
</div>
</li>
</ul>
</div>
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none;"
unselectable="unselectable">
<b />
</span>
</div>
</div>
`;
exports[`test 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"
@@ -128,3 +172,63 @@ exports[`test renders ./components/auto-complete/demo/options.md correctly 1`] =
</div>
</div>
`;
exports[`test renders ./components/auto-complete/demo/uncertain-category.md correctly 1`] = `
<div
class="global-search-wrapper"
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%;">
<div
aria-autocomplete="list"
aria-expanded="false"
aria-haspopup="true"
class="ant-select-selection
ant-select-selection--single"
role="combobox">
<div
class="ant-select-selection__rendered">
<div
class="ant-select-selection__placeholder"
style="display:block;user-select:none;-webkit-user-select:none;"
unselectable="unselectable">
input here
</div>
<ul>
<li
class="ant-select-search ant-select-search--inline">
<div
class="ant-select-search__field__wrap">
<span
class="ant-input-preSuffix-wrapper">
<input
class="ant-input ant-input ant-select-search__field"
type="text"
value="" />
<span
class="ant-input-suffix">
<button
class="ant-btn ant-btn-primary ant-btn-lg search-btn"
type="button">
<i
class="anticon anticon-search" />
</button>
</span>
</span>
<span
class="ant-select-search__field__mirror" />
</div>
</li>
</ul>
</div>
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none;"
unselectable="unselectable">
<b />
</span>
</div>
</div>
</div>
`;

View File

@@ -13,20 +13,19 @@ title:
Customize Input Component
````__react
````jsx
import { AutoComplete } from 'antd';
function onSelect(value) {
console.log('onSelect', value);
}
const Complete = React.createClass({
getInitialState() {
return {
dataSource: [],
};
},
handleChange(value) {
class Complete extends React.Component {
state = {
dataSource: [],
}
handleChange = (value) => {
this.setState({
dataSource: !value ? [] : [
value,
@@ -34,10 +33,12 @@ const Complete = React.createClass({
value + value + value,
],
});
},
handleKeyPress(ev) {
}
handleKeyPress = (ev) => {
console.log('handleKeyPress', ev);
},
}
render() {
const { dataSource } = this.state;
return (
@@ -48,11 +49,11 @@ const Complete = React.createClass({
onChange={this.handleChange}
placeholder="input here"
>
<textarea onKeyPress={this.handleKeyPress} style={{ height: 50 }}/>
<textarea onKeyPress={this.handleKeyPress} style={{ height: 50 }} />
</AutoComplete>
);
},
});
}
}
ReactDOM.render(<Complete />, mountNode);
````

View File

@@ -13,20 +13,19 @@ title:
Basic Usage, set datasource of autocomplete with `dataSource` property.
````__react
````jsx
import { AutoComplete } from 'antd';
function onSelect(value) {
console.log('onSelect', value);
}
const Complete = React.createClass({
getInitialState() {
return {
dataSource: [],
};
},
handleChange(value) {
class Complete extends React.Component {
state = {
dataSource: [],
}
handleChange = (value) => {
this.setState({
dataSource: !value ? [] : [
value,
@@ -34,7 +33,8 @@ const Complete = React.createClass({
value + value + value,
],
});
},
}
render() {
const { dataSource } = this.state;
return (
@@ -46,8 +46,8 @@ const Complete = React.createClass({
placeholder="input here"
/>
);
},
});
}
}
ReactDOM.render(<Complete />, mountNode);
````

View File

@@ -0,0 +1,33 @@
---
order: 3
title:
zh-CN: 不区分大小写
en-US: Non-case-sensitive AutoComplete
---
## zh-CN
不区分大小写的 AutoComplete
## en-US
A non-case-sensitive AutoComplete
````jsx
import { AutoComplete } from 'antd';
const dataSource = ['Burns Bay Road', 'Downing Street', 'Wall Street'];
function Complete() {
return (
<AutoComplete
style={{ width: 200 }}
dataSource={dataSource}
placeholder="try to type `b`"
filterOption={(inputValue, option) => option.props.children.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1}
/>
);
}
ReactDOM.render(<Complete />, mountNode);
````

View File

@@ -13,18 +13,17 @@ title:
You could pass `AutoComplete.Option` as children of `AutoComplete`, instead of using `dataSource`
````__react
````jsx
import { AutoComplete } from 'antd';
const Option = AutoComplete.Option;
const Complete = React.createClass({
getInitialState() {
return {
result: [],
};
},
handleChange(value) {
class Complete extends React.Component {
state = {
result: [],
}
handleChange = (value) => {
let result;
if (!value || value.indexOf('@') >= 0) {
result = [];
@@ -32,7 +31,8 @@ const Complete = React.createClass({
result = ['gmail.com', '163.com', 'qq.com'].map(domain => `${value}@${domain}`);
}
this.setState({ result });
},
}
render() {
const { result } = this.state;
const children = result.map((email) => {
@@ -47,8 +47,8 @@ const Complete = React.createClass({
{children}
</AutoComplete>
);
},
});
}
}
ReactDOM.render(<Complete />, mountNode);
````

View File

@@ -0,0 +1,145 @@
---
order: 4
title:
zh-CN: 查询模式 - 不确定类目
en-US: Lookup-Patterns - Uncertain Category
---
## zh-CN
[查询模式: 不确定类目](https://ant.design/docs/spec/reaction#Lookup-Patterns) 示例。
## en-US
Demonstration of [Lookup Patterns: Uncertain Category](https://ant.design/docs/spec/reaction#Lookup-Patterns).
Basic Usage, set datasource of autocomplete with `dataSource` property.
````jsx
import { Icon, Button, Input, AutoComplete } from 'antd';
const Option = AutoComplete.Option;
function onSelect(value) {
console.log('onSelect', value);
}
function getRandomInt(max, min = 0) {
return Math.floor(Math.random() * (max - min + 1)) + min; // eslint-disable-line no-mixed-operators
}
function searchResult(query) {
return (new Array(getRandomInt(5))).join('.').split('.')
.map((item, idx) => ({
query,
category: `${query}${idx}`,
count: getRandomInt(200, 100),
}));
}
function renderOption(item) {
return (
<Option key={item.category} text={item.category}>
{item.query} 在
<a
href={`https://s.taobao.com/search?q=${item.query}`}
target="_blank"
rel="noopener noreferrer"
>
{item.category}
</a>
区块中
<span className="global-search-item-count">约 {item.count} 个结果</span>
</Option>
);
}
class Complete extends React.Component {
state = {
dataSource: [],
}
handleChange = (value) => {
if (value) {
this.setState({
dataSource: searchResult(value),
});
}
}
render() {
const { dataSource } = this.state;
return (
<div className="global-search-wrapper" style={{ width: 300 }}>
<AutoComplete
className="global-search"
size="large"
style={{ width: '100%' }}
dataSource={dataSource.map(renderOption)}
onSelect={onSelect}
onChange={this.handleChange}
placeholder="input here"
optionLabelProp="text"
>
<Input
suffix={(
<Button className="search-btn" size="large" type="primary">
<Icon type="search" />
</Button>
)}
/>
</AutoComplete>
</div>
);
}
}
ReactDOM.render(<Complete />, mountNode);
````
````css
.global-search-wrapper {
padding-right: 50px;
}
.global-search {
width: 100%;
}
.global-search.ant-select-auto-complete .ant-input {
height: 40px;
padding: 11px 12px;
}
.global-search.ant-select-auto-complete .ant-select-selection__placeholder {
top: 20px;
margin-left: 12px;
margin-right: 12px;
}
.global-search .search-btn {
font-size: 18px;
}
.global-search.ant-select-auto-complete .ant-select-selection--single {
margin-right: -50px;
}
.global-search.ant-select-auto-complete .ant-input-preSuffix-wrapper .ant-input:not(:last-child) {
padding-right: 62px;
}
.global-search.ant-select-auto-complete .ant-input-preSuffix-wrapper .ant-input-suffix {
right: 0;
}
.global-search.ant-select-auto-complete .ant-input-preSuffix-wrapper .ant-input-suffix button {
padding-top: 5px;
padding-bottom: 6px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.global-search-item-count {
position: absolute;
right: 16px;
}
````

View File

@@ -1,7 +1,7 @@
---
category: Components
type: Data Entry
cols: 1
cols: 2
title: AutoComplete
---
@@ -17,7 +17,6 @@ When there is a need for autocomplete functionality.
const dataSource = ['12345', '23456', '34567'];
<AutoComplete dataSource={dataSource} />
```
Since `AutoComplete` is based on `Select`, so besides the following API, `AutoComplete` has the same API as `Select`.
| Property | Description | Type | Default |
|----------------|----------------------------------|------------|--------|
@@ -28,6 +27,8 @@ Since `AutoComplete` is based on `Select`, so besides the following API, `AutoCo
| onChange | Called when select an option or input value change, or value of input is changed | function(value, label) | - |
| onSelect | Called when a option is selected. param is option's value and option instance. | function(value, option) | - |
| disabled | Whether disabled select | boolean | false |
| defaultActiveFirstOption | Whether active first option by default | boolean | true |
| placeholder | placeholder of input | string | - |
| children (for dataSource) | Data source for autocomplet | React.ReactElement<OptionProps> / Array<React.ReactElement<OptionProps>> | - |
| children (for customize input element) | customize input element | HTMLInputElement / HTMLTextAreaElement / React.ReactElement<InputProps> | `<Input />` |
| filterOption | If true, filter options by input, if function, filter options against it. The function will receive two arguments, `inputValue` and `option`, if the function returns `true`, the option will be included in the filtered set; Otherwise, it will be excluded. | boolean or function(inputValue, option) | true |

View File

@@ -39,17 +39,18 @@ export interface AutoCompleteProps extends AbstractSelectProps {
}
class InputElement extends React.Component<any, any> {
private ele: Element;
private ele: HTMLInputElement;
focus = () => {
(findDOMNode(this.ele) as HTMLInputElement).focus();
this.ele.focus ? this.ele.focus() : (findDOMNode(this.ele) as HTMLInputElement).focus();
}
blur = () => {
(findDOMNode(this.ele) as HTMLInputElement).blur();
this.ele.blur ? this.ele.blur() : (findDOMNode(this.ele) as HTMLInputElement).blur();
}
render() {
return React.cloneElement(this.props.children, {
...this.props,
ref: ele => this.ele = ele,
ref: ele => this.ele = (ele as HTMLInputElement),
}, null);
}
}

View File

@@ -2,7 +2,7 @@
category: Components
subtitle: 自动完成
type: Data Entry
cols: 1
cols: 2
title: AutoComplete
---
@@ -18,7 +18,6 @@ title: AutoComplete
const dataSource = ['12345', '23456', '34567'];
<AutoComplete dataSource={dataSource} />
```
因为 `AutoComplete` 是基于 `Select` 封装的,所以除了以下 API 外,`AutoComplete``Select` 拥有一样的 API。
| 参数 | 说明 | 类型 | 默认值 |
|----------------|----------------------------------|------------|---------|
@@ -29,7 +28,9 @@ const dataSource = ['12345', '23456', '34567'];
| onChange | 选中 option或 input 的 value 变化时,调用此函数 | function(value) | 无 |
| onSelect | 被选中时调用,参数为选中项的 value 值 | function(value, option) | 无 |
| disabled | 是否禁用 | boolean | false |
| defaultActiveFirstOption | 是否默认高亮第一个选项。 | boolean | true
| placeholder | 输入框提示 | string | - |
| children (自动完成的数据源) | 自动完成的数据源 | React.ReactElement<OptionProps> / Array<React.ReactElement<OptionProps>> | - |
| children (自定义输入框) | 自定义输入框 | HTMLInputElement / HTMLTextAreaElement / React.ReactElement<InputProps> | `<Input />` |
| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` |
| filterOption | 是否根据输入项进行筛选。当其为一个函数时,会接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 `true`,反之则返回 `false`。 | boolean or function(inputValue, option) | true |

View File

@@ -13,7 +13,7 @@ title:
The most basic usage.
````__react
````jsx
import { BackTop } from 'antd';
ReactDOM.render(

View File

@@ -14,7 +14,7 @@ title:
You can customize the style of the button, just note the size limit: no more than `40px * 40px`.
````__react
````jsx
import { BackTop } from 'antd';
ReactDOM.render(

View File

@@ -13,7 +13,7 @@ title:
Simplest Usage.
````__react
````jsx
import { Badge } from 'antd';
ReactDOM.render(

View File

@@ -13,31 +13,33 @@ title:
The count will be animated as it changes.
````__react
````jsx
import { Badge, Button, Icon, Switch } from 'antd';
const ButtonGroup = Button.Group;
const Test = React.createClass({
getInitialState() {
return {
count: 5,
show: true,
};
},
increase() {
class Demo extends React.Component {
state = {
count: 5,
show: true,
}
increase = () => {
const count = this.state.count + 1;
this.setState({ count });
},
decline() {
}
decline = () => {
let count = this.state.count - 1;
if (count < 0) {
count = 0;
}
this.setState({ count });
},
onChange(show) {
}
onChange = (show) => {
this.setState({ show });
},
}
render() {
return (
<div>
@@ -62,8 +64,8 @@ const Test = React.createClass({
</div>
</div>
);
},
});
}
}
ReactDOM.render(<Test />, mountNode);
ReactDOM.render(<Demo />, mountNode);
````

View File

@@ -13,17 +13,19 @@ title:
This will simply display a red badge, without a specific count.
````__react
````jsx
import { Badge, Icon } from 'antd';
ReactDOM.render(<div>
<Badge dot>
<Icon type="notification" />
</Badge>
<Badge dot>
<a href="#">Link something</a>
</Badge>
</div>, mountNode);
ReactDOM.render(
<div>
<Badge dot>
<Icon type="notification" />
</Badge>
<Badge dot>
<a href="#">Link something</a>
</Badge>
</div>
, mountNode);
````
<style>

View File

@@ -13,7 +13,7 @@ title:
The badge can be wrapped with `a` tag to make it linkable.
````__react
````jsx
import { Badge } from 'antd';
ReactDOM.render(

View File

@@ -15,12 +15,14 @@ title:
Used in standalone when children is empty.
````__react
````jsx
import { Badge } from 'antd';
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' }} />
</div>, mountNode);
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' }} />
</div>
, mountNode);
````

View File

@@ -13,21 +13,23 @@ title:
`${overflowCount}+` is displayed when count is larger than `overflowCount`. The default value of `overflowCount` is `99`.
````__react
````jsx
import { Badge } from 'antd';
ReactDOM.render(<div>
<Badge count={99}>
<a href="#" className="head-example" />
</Badge>
<Badge count={100}>
<a href="#" className="head-example" />
</Badge>
<Badge count={99} overflowCount={10}>
<a href="#" className="head-example" />
</Badge>
<Badge count={1000} overflowCount={999}>
<a href="#" className="head-example" />
</Badge>
</div>, mountNode);
ReactDOM.render(
<div>
<Badge count={99}>
<a href="#" className="head-example" />
</Badge>
<Badge count={100}>
<a href="#" className="head-example" />
</Badge>
<Badge count={99} overflowCount={10}>
<a href="#" className="head-example" />
</Badge>
<Badge count={1000} overflowCount={999}>
<a href="#" className="head-example" />
</Badge>
</div>
, mountNode);
````

View File

@@ -13,7 +13,7 @@ title:
Standalone badge with status.
````__react
````jsx
import { Badge } from 'antd';
ReactDOM.render(

View File

@@ -60,7 +60,18 @@
}
&-processing {
background-color: @primary-color;
animation: antStatusProcessing 1.2s infinite ease-in-out;
position: relative;
&:after {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 50%;
border: 1px solid @primary-color;
content: '';
animation: antStatusProcessing 1.2s infinite ease-in-out;
}
}
&-default {
background-color: @normal-color;
@@ -98,11 +109,12 @@
}
@keyframes antStatusProcessing {
0%,
100% {
opacity: 1;
0% {
transform: scale(0.8);
opacity: 0.5;
}
50% {
100% {
transform: scale(2.4);
opacity: 0;
}
}

View File

@@ -88,8 +88,11 @@ export default class Breadcrumb extends React.Component<BreadcrumbProps, any> {
});
} else if (children) {
crumbs = React.Children.map(children, (element: any, index) => {
if (!element) {
return element;
}
warning(
element && element.type.__ANT_BREADCRUMB_ITEM,
element.type && element.type.__ANT_BREADCRUMB_ITEM,
'Breadcrumb only accetps Breadcrumb.Item as it\'s children'
);
return cloneElement(element, {

View File

@@ -1,6 +1,7 @@
import React from 'react';
import { mount } from 'enzyme';
import Breadcrumb from '../Breadcrumb';
import { mount, render } from 'enzyme';
import { renderToJson } from 'enzyme-to-json';
import Breadcrumb from '../index';
describe('Breadcrumb', () => {
it('warns on non-Breadcrumb.Item children', () => {
@@ -18,4 +19,18 @@ describe('Breadcrumb', () => {
'Breadcrumb only accetps Breadcrumb.Item as it\'s children'
);
});
// https://github.com/ant-design/ant-design/issues/5015
it('should allow Breadcrumb.Item is null or undefined', () => {
const wrapper = render(
<Breadcrumb>
{null}
<Breadcrumb.Item>Home</Breadcrumb.Item>
{undefined}
</Breadcrumb>
);
// eslint-disable-next-line
expect(console.error.calls).toBe(undefined);
expect(renderToJson(wrapper)).toMatchSnapshot();
});
});

View File

@@ -0,0 +1,15 @@
exports[`Breadcrumb should allow Breadcrumb.Item is null or undefined 1`] = `
<div
class="ant-breadcrumb">
<span>
<span
class="ant-breadcrumb-link">
Home
</span>
<span
class="ant-breadcrumb-separator">
/
</span>
</span>
</div>
`;

View File

@@ -1,6 +1,6 @@
---
order: 0
title:
title:
zh-CN: 基本
en-US: Basic Usage
---
@@ -13,7 +13,7 @@ title:
The simplest use
````__react
````jsx
import { Breadcrumb } from 'antd';
ReactDOM.render(

View File

@@ -14,7 +14,7 @@ title:
Used together with `react-router@2+`.
````__react
````jsx
import { Router, Route, Link, hashHistory } from 'react-router';
import { Breadcrumb, Alert } from 'antd';

View File

@@ -13,7 +13,7 @@ title:
The separator can be customized by setting the separator property: separator=">"
````__react
````jsx
import { Breadcrumb } from 'antd';
ReactDOM.render(

View File

@@ -13,7 +13,7 @@ title:
The icon should be placed in front of the text.
````__react
````jsx
import { Breadcrumb, Icon } from 'antd';
ReactDOM.render(

View File

@@ -351,6 +351,26 @@ exports[`test renders ./components/button/demo/loading.md correctly 1`] = `
Click me!
</span>
</button>
<button
class="ant-btn ant-btn-primary"
type="button">
<span>
Won\'t show loading
</span>
</button>
<br />
<button
class="ant-btn ant-btn-circle ant-btn-loading"
type="button">
<i
class="anticon anticon-spin anticon-loading" />
</button>
<button
class="ant-btn ant-btn-primary ant-btn-circle ant-btn-loading"
type="button">
<i
class="anticon anticon-spin anticon-loading" />
</button>
</div>
`;

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { render } from 'enzyme';
import { render, mount } from 'enzyme';
import { renderToJson } from 'enzyme-to-json';
import Button from '..';
@@ -17,4 +17,12 @@ describe('Button', () => {
);
expect(renderToJson(wrapper)).toMatchSnapshot();
});
it('have static perperty for type detecting', () => {
const wrapper = mount(
<Button>Button Text</Button>
);
// eslint-disable-next-line
expect(wrapper.type().__ANT_BUTTON).toBe(true);
});
});

View File

@@ -2,6 +2,7 @@ import React from 'react';
import classNames from 'classnames';
import { findDOMNode } from 'react-dom';
import Icon from '../icon';
import omit from 'omit.js';
const rxTwoCNChar = /^[\u4e00-\u9fa5]{2}$/;
const isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar);
@@ -46,10 +47,12 @@ export interface ButtonProps {
export default class Button extends React.Component<ButtonProps, any> {
static Group: any;
static __ANT_BUTTON = true;
static defaultProps = {
prefixCls: 'ant-btn',
loading: false,
clicked: false,
ghost: false,
};
@@ -64,29 +67,45 @@ export default class Button extends React.Component<ButtonProps, any> {
icon: React.PropTypes.string,
};
timeout: any;
clickedTimeout: any;
timeout: number;
delayTimeout: number;
componentWillUnmount() {
if (this.clickedTimeout) {
clearTimeout(this.clickedTimeout);
constructor(props) {
super(props);
this.state = {
loading: props.loading,
};
}
componentWillReceiveProps(nextProps) {
const currentLoading = this.props.loading;
const loading = nextProps.loading;
if (currentLoading) {
clearTimeout(this.delayTimeout);
}
if (this.timeout) {
clearTimeout(this.timeout);
if (loading) {
this.delayTimeout = setTimeout(() => this.setState({ loading }), 200);
} else {
this.setState({ loading });
}
}
clearButton = (button) => {
button.className = button.className.replace(` ${this.props.prefixCls}-clicked`, '');
componentWillUnmount() {
if (this.timeout) {
clearTimeout(this.timeout);
}
if (this.delayTimeout) {
clearTimeout(this.delayTimeout);
}
}
handleClick = (e) => {
// Add click effect
const buttonNode = findDOMNode(this);
this.clearButton(buttonNode);
this.clickedTimeout = setTimeout(() => buttonNode.className += ` ${this.props.prefixCls}-clicked`, 10);
this.setState({ clicked: true });
clearTimeout(this.timeout);
this.timeout = setTimeout(() => this.clearButton(buttonNode), 500);
this.timeout = setTimeout(() => this.setState({ clicked: false }), 500);
const onClick = this.props.onClick;
if (onClick) {
@@ -104,9 +123,10 @@ export default class Button extends React.Component<ButtonProps, any> {
render() {
const {
type, shape, size = '', className, htmlType, children, icon, loading, prefixCls, ghost, ...others,
type, shape, size = '', className, htmlType, children, icon, prefixCls, ghost, ...others,
} = this.props;
const { loading, clicked } = this.state;
// large => lg
// small => sm
const sizeCls = ({
@@ -120,6 +140,7 @@ export default class Button extends React.Component<ButtonProps, any> {
[`${prefixCls}-${sizeCls}`]: sizeCls,
[`${prefixCls}-icon-only`]: !children && icon,
[`${prefixCls}-loading`]: loading,
[`${prefixCls}-clicked`]: clicked,
[`${prefixCls}-background-ghost`]: ghost,
}, className);
@@ -129,7 +150,7 @@ export default class Button extends React.Component<ButtonProps, any> {
return (
<button
{...others}
{...omit(others, ['loading', 'clicked'])}
type={htmlType || 'button'}
className={classes}
onMouseUp={this.handleMouseUp}

View File

@@ -17,7 +17,7 @@ There are `primary` button, `default` button, `dashed` button and `danger` butto
> `danger` is supported after `antd@2.7`.
````__react
````jsx
import { Button } from 'antd';
ReactDOM.render(

View File

@@ -17,7 +17,7 @@ Buttons can be grouped by placing multiple `Button` components into a `Button.Gr
The `size` can be set to `large`, `small` or left unset resulting in a default size.
````__react
````jsx
import { Button, Icon } from 'antd';
const ButtonGroup = Button.Group;

View File

@@ -13,7 +13,7 @@ title:
To mark a button as disabled, add the `disabled` property to the `Button`.
````__react
````jsx
import { Button } from 'antd';
ReactDOM.render(

View File

@@ -13,7 +13,7 @@ title:
`ghost` property will make button's background transparent, it is common used in colored background.
````__react
````jsx
import { Button } from 'antd';
ReactDOM.render(

View File

@@ -17,7 +17,7 @@ title:
If you want specific control over the positioning and placement of the `Icon`, then that should be done by placing the `Icon` component within the `Button` rather than using the `icon` property.
````__react
````jsx
import { Button } from 'antd';
ReactDOM.render(

View File

@@ -13,22 +13,33 @@ title:
A loading indicator can be added to a button by setting the `loading` property on the `Button`.
````__react
````jsx
import { Button } from 'antd';
const App = React.createClass({
getInitialState() {
return {
loading: false,
iconLoading: false,
};
},
enterLoading() {
class App extends React.Component {
state = {
loading: false,
iconLoading: false,
delayLoading: false,
}
enterLoading = () => {
this.setState({ loading: true });
},
enterIconLoading() {
}
enterIconLoading = () => {
this.setState({ iconLoading: true });
},
}
delayLoading = () => {
this.setState({
delayLoading: true,
});
setTimeout(() => this.setState({
delayLoading: false,
}), 150);
}
render() {
return (
<div>
@@ -45,10 +56,16 @@ const App = React.createClass({
<Button type="primary" icon="poweroff" loading={this.state.iconLoading} onClick={this.enterIconLoading}>
Click me!
</Button>
<Button type="primary" loading={this.state.delayLoading} onClick={this.delayLoading}>
Won&apos;t show loading
</Button>
<br />
<Button shape="circle" loading />
<Button type="primary" shape="circle" loading />
</div>
);
},
});
}
}
ReactDOM.render(<App />, mountNode);
````

View File

@@ -14,7 +14,7 @@ title:
If you need several buttons, we recommend that you use 1 primary button + n secondary buttons, and if there are more than three operations, you can group some of them into `Dropdown.Button`.
````__react
````jsx
import { Button, Menu, Dropdown, Icon } from 'antd';
function handleMenuClick(e) {

View File

@@ -17,7 +17,7 @@ Ant Design supports a default button size as well as a large and small size.
If a large or small button is desired, set the `size` property to either `large` or `small` respectively. Omit the `size` property for a button with the default size.
````__react
````jsx
import { Button, Radio, Icon } from 'antd';
class ButtonSize extends React.Component {

View File

@@ -78,20 +78,24 @@
display: none;
}
&&-loading {
&&-loading:before {
display: block;
}
.@{iconfont-css-prefix} {
transition: all .3s @ease-in-out;
}
&&-loading:not(&-circle):not(&-circle-outline) {
padding-left: 29px;
pointer-events: none;
position: relative;
.@{iconfont-css-prefix} {
margin-left: -14px;
transition: all .3s @ease-in-out;
}
&:before {
display: block;
}
}
&-sm&-loading {
&-sm&-loading:not(&-circle):not(&-circle-outline) {
padding-left: 24px;
.@{iconfont-css-prefix} {
margin-left: -17px;
@@ -123,10 +127,14 @@
border-radius: inherit;
border: 0 solid @primary-color;
opacity: 0.4;
animation: buttonEffect 0.36s ease-out forwards;
animation: buttonEffect .4s;
display: block;
}
&-danger&-clicked:after {
border-color: @btn-danger-bg;
}
&-background-ghost {
background: transparent!important;
border-color: #fff;

View File

@@ -1569,790 +1569,6 @@ exports[`test renders ./components/calendar/demo/card.md correctly 1`] = `
</div>
`;
exports[`test renders ./components/calendar/demo/locale.md correctly 1`] = `
<div
class=" ant-fullcalendar-fullscreen">
<div
class="ant-fullcalendar-header">
<div
class="ant-fullcalendar-year-select ant-select ant-select-enabled">
<div
aria-autocomplete="list"
aria-expanded="false"
aria-haspopup="true"
class="ant-select-selection
ant-select-selection--single"
role="combobox"
tabindex="0">
<div
class="ant-select-selection__rendered">
<div
class="ant-select-selection-selected-value"
style="display:block;opacity:1;"
title="2016">
2016
</div>
</div>
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none;"
unselectable="unselectable">
<b />
</span>
</div>
</div>
<div
class="ant-fullcalendar-month-select ant-select ant-select-enabled">
<div
aria-autocomplete="list"
aria-expanded="false"
aria-haspopup="true"
class="ant-select-selection
ant-select-selection--single"
role="combobox"
tabindex="0">
<div
class="ant-select-selection__rendered">
<div
class="ant-select-selection-selected-value"
style="display:block;opacity:1;"
title="Nov">
Nov
</div>
</div>
<span
class="ant-select-arrow"
style="user-select:none;-webkit-user-select:none;"
unselectable="unselectable">
<b />
</span>
</div>
</div>
<div
class="ant-radio-group ant-radio-group-default">
<label
class="ant-radio-button-wrapper ant-radio-button-wrapper-checked">
<span
class="ant-radio-button ant-radio-button-checked ant-radio-button ant-radio-button-checked ant-radio-button-checked-1">
<span
class="ant-radio-button-inner" />
<input
checked=""
class="ant-radio-button-input"
type="radio" />
</span>
<span>
Month
</span>
</label>
<label
class="ant-radio-button-wrapper">
<span
class="ant-radio-button">
<span
class="ant-radio-button-inner" />
<input
class="ant-radio-button-input"
type="radio" />
</span>
<span>
Year
</span>
</label>
</div>
</div>
<div
class="ant-fullcalendar ant-fullcalendar-full ant-fullcalendar-fullscreen"
tabindex="0">
<div
class="ant-fullcalendar-calendar-body">
<table
cellspacing="0"
class="ant-fullcalendar-table"
role="grid">
<thead>
<tr
role="row">
<th
class="ant-fullcalendar-column-header"
role="columnheader"
title="Sun">
<span
class="ant-fullcalendar-column-header-inner">
Su
</span>
</th>
<th
class="ant-fullcalendar-column-header"
role="columnheader"
title="Mon">
<span
class="ant-fullcalendar-column-header-inner">
Mo
</span>
</th>
<th
class="ant-fullcalendar-column-header"
role="columnheader"
title="Tue">
<span
class="ant-fullcalendar-column-header-inner">
Tu
</span>
</th>
<th
class="ant-fullcalendar-column-header"
role="columnheader"
title="Wed">
<span
class="ant-fullcalendar-column-header-inner">
We
</span>
</th>
<th
class="ant-fullcalendar-column-header"
role="columnheader"
title="Thu">
<span
class="ant-fullcalendar-column-header-inner">
Th
</span>
</th>
<th
class="ant-fullcalendar-column-header"
role="columnheader"
title="Fri">
<span
class="ant-fullcalendar-column-header-inner">
Fr
</span>
</th>
<th
class="ant-fullcalendar-column-header"
role="columnheader"
title="Sat">
<span
class="ant-fullcalendar-column-header-inner">
Sa
</span>
</th>
</tr>
</thead>
<tbody
class="ant-fullcalendar-tbody">
<tr
role="row">
<td
class="ant-fullcalendar-cell ant-fullcalendar-last-month-cell"
role="gridcell"
title="2016-10-30">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
30
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell ant-fullcalendar-last-month-cell"
role="gridcell"
title="2016-10-31">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
31
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-1">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
01
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-2">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
02
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-3">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
03
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-4">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
04
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-5">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
05
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
</tr>
<tr
role="row">
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-6">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
06
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-7">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
07
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-8">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
08
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-9">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
09
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-10">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
10
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-11">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
11
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-12">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
12
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
</tr>
<tr
role="row">
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-13">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
13
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-14">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
14
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-15">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
15
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-16">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
16
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-17">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
17
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-18">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
18
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-19">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
19
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
</tr>
<tr
role="row">
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-20">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
20
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-21">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
21
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell ant-fullcalendar-today ant-fullcalendar-selected-day"
role="gridcell"
title="2016-11-22">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
22
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-23">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
23
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-24">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
24
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-25">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
25
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-26">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
26
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
</tr>
<tr
role="row">
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-27">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
27
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-28">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
28
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-29">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
29
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell"
role="gridcell"
title="2016-11-30">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
30
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell ant-fullcalendar-next-month-btn-day"
role="gridcell"
title="2016-12-1">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
01
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell ant-fullcalendar-next-month-btn-day"
role="gridcell"
title="2016-12-2">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
02
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell ant-fullcalendar-next-month-btn-day"
role="gridcell"
title="2016-12-3">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
03
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
</tr>
<tr
role="row">
<td
class="ant-fullcalendar-cell ant-fullcalendar-next-month-btn-day"
role="gridcell"
title="2016-12-4">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
04
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell ant-fullcalendar-next-month-btn-day"
role="gridcell"
title="2016-12-5">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
05
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell ant-fullcalendar-next-month-btn-day"
role="gridcell"
title="2016-12-6">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
06
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell ant-fullcalendar-next-month-btn-day"
role="gridcell"
title="2016-12-7">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
07
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell ant-fullcalendar-next-month-btn-day"
role="gridcell"
title="2016-12-8">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
08
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell ant-fullcalendar-next-month-btn-day"
role="gridcell"
title="2016-12-9">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
09
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
<td
class="ant-fullcalendar-cell ant-fullcalendar-next-month-btn-day"
role="gridcell"
title="2016-12-10">
<div
class="ant-fullcalendar-date">
<div
class="ant-fullcalendar-value">
10
</div>
<div
class="ant-fullcalendar-content" />
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
`;
exports[`test renders ./components/calendar/demo/notice-calendar.md correctly 1`] = `
<div
class=" ant-fullcalendar-fullscreen">

View File

@@ -13,7 +13,7 @@ title:
A basic calendar component with Year/Month switch.
````__react
````jsx
import { Calendar } from 'antd';
function onPanelChange(value, mode) {

View File

@@ -13,7 +13,7 @@ title:
Nested inside a container element for rendering in limited space.
````__react
````jsx
import { Calendar } from 'antd';
function onPanelChange(value, mode) {

View File

@@ -1,30 +0,0 @@
---
order: 3
title:
zh-CN: 国际化
en-US: locale
---
## zh-CN
通过 `locale` 配置语言, 默认支持 en_US, zh_CN
## en-US
To set the language. en_US, zh_CN are supported by default.
````__react
import { Calendar } from 'antd';
import enUS from 'antd/lib/calendar/locale/en_US';
import moment from 'moment';
// It's recommended to set moment locale globally, otherwise, you need to set it by `value` or `defaultValue`
// moment.locale('en');
function onPanelChange(value, mode) {
console.log(value, mode);
}
ReactDOM.render(
<Calendar defaultValue={moment().locale('en')} onPanelChange={onPanelChange} locale={enUS} />
, mountNode);
````

View File

@@ -13,7 +13,7 @@ title:
This component can be rendered by using `dateCellRender` and `monthCellRender` with the data you need.
````__react
````jsx
import { Calendar } from 'antd';
function getListData(value) {

View File

@@ -13,7 +13,15 @@ When data is in the form of date, such as schedule, timetable, prices calendar,
## API
```html
**Note:** Part of locale of Calendar 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');
<Calendar
dateCellRender={dateCellRender}
monthCellRender={monthCellRender}

View File

@@ -15,7 +15,15 @@ title: Calendar
## API
```html
**注意:**Calendar 部分 locale 是从 value 中读取,所以请先正确设置 moment 的 locale。
```jsx
import moment from 'moment';
// 推荐在入口文件全局设置 locale
import 'moment/locale/zh-cn';
moment.locale('zh-cn');
<Calendar
dateCellRender={dateCellRender}
monthCellRender={monthCellRender}

View File

@@ -13,7 +13,7 @@ title:
A basic card containing a title, content and an extra corner content.
````__react
````jsx
import { Card } from 'antd';
ReactDOM.render(

View File

@@ -13,7 +13,7 @@ title:
A borderless card on a gray background.
````__react
````jsx
import { Card } from 'antd';
ReactDOM.render(

View File

@@ -13,7 +13,7 @@ title:
Cards usually cooperate with grid layout in overview page.
````__react
````jsx
import { Card, Col, Row } from 'antd';
ReactDOM.render(

View File

@@ -13,7 +13,7 @@ title:
Shows a loading indicator while the contents of the card is being fetched.
````__react
````jsx
import { Card } from 'antd';
ReactDOM.render(

View File

@@ -14,7 +14,7 @@ title:
Customizing default width and margin.
````__react
````jsx
import { Card } from 'antd';
ReactDOM.render(

View File

@@ -13,7 +13,7 @@ title:
A simple card only containing a content area.
````__react
````jsx
import { Card } from 'antd';
ReactDOM.render(

View File

@@ -13,7 +13,7 @@ title:
Timing of scrolling to the next card/picture.
````__react
````jsx
import { Carousel } from 'antd';
ReactDOM.render(

View File

@@ -13,7 +13,7 @@ title:
Basic usage.
````__react
````jsx
import { Carousel } from 'antd';
function onChange(a, b, c) {

View File

@@ -13,7 +13,7 @@ title:
Slides use fade for transition.
````__react
````jsx
import { Carousel } from 'antd';
ReactDOM.render(

View File

@@ -13,7 +13,7 @@ title:
Vertical pagination.
````__react
````jsx
import { Carousel } from 'antd';
ReactDOM.render(

View File

@@ -1,6 +1,8 @@
// matchMedia polyfill for
// https://github.com/WickyNilliams/enquire.js/issues/82
import assign from 'object-assign';
import debounce from 'lodash.debounce';
if (typeof window !== 'undefined') {
const matchMediaPolyfill = function matchMediaPolyfill(mediaQuery: string): MediaQueryList {
return {
@@ -48,6 +50,41 @@ export default class Carousel extends React.Component<CarouselProps, any> {
draggable: false,
};
refs: {
slick: any,
};
constructor() {
super();
this.onWindowResized = debounce(this.onWindowResized, 500, {
leading: false,
});
}
componentDidMount() {
const { autoplay } = this.props;
if (autoplay) {
window.addEventListener('resize', this.onWindowResized);
}
}
componentWillUnmount() {
const { autoplay } = this.props;
if (autoplay) {
window.removeEventListener('resize', this.onWindowResized);
(this.onWindowResized as any).cancel();
}
}
onWindowResized = () => {
// Fix https://github.com/ant-design/ant-design/issues/2550
const { slick } = this.refs;
const { autoplay } = this.props;
if (autoplay && slick && slick.innerSlider && slick.innerSlider.autoPlay) {
slick.innerSlider.autoPlay();
}
}
render() {
let props = assign({}, this.props);

View File

@@ -0,0 +1,179 @@
exports[`Cascader can be selected 1`] = `
<div>
<div
class="ant-cascader-menus ant-cascader-menus-placement-bottomLeft ">
<div>
<ul
class="ant-cascader-menu">
<li
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
title="Zhejiang">
Zhejiang
</li>
<li
class="ant-cascader-menu-item ant-cascader-menu-item-expand"
title="Jiangsu">
Jiangsu
</li>
</ul>
<ul
class="ant-cascader-menu">
<li
class="ant-cascader-menu-item ant-cascader-menu-item-expand"
title="Hangzhou">
Hangzhou
</li>
</ul>
</div>
</div>
</div>
`;
exports[`Cascader can be selected 2`] = `
<div>
<div
class="ant-cascader-menus ant-cascader-menus-placement-bottomLeft ">
<div>
<ul
class="ant-cascader-menu">
<li
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
title="Zhejiang">
Zhejiang
</li>
<li
class="ant-cascader-menu-item ant-cascader-menu-item-expand"
title="Jiangsu">
Jiangsu
</li>
</ul>
<ul
class="ant-cascader-menu">
<li
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
title="Hangzhou">
Hangzhou
</li>
</ul>
<ul
class="ant-cascader-menu">
<li
class="ant-cascader-menu-item"
title="West Lake">
West Lake
</li>
</ul>
</div>
</div>
</div>
`;
exports[`Cascader can be selected 3`] = `
<div>
<div
class="ant-cascader-menus ant-cascader-menus-placement-bottomLeft ant-cascader-menus-hidden">
<div>
<ul
class="ant-cascader-menu">
<li
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
title="Zhejiang">
Zhejiang
</li>
<li
class="ant-cascader-menu-item ant-cascader-menu-item-expand"
title="Jiangsu">
Jiangsu
</li>
</ul>
<ul
class="ant-cascader-menu">
<li
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
title="Hangzhou">
Hangzhou
</li>
</ul>
<ul
class="ant-cascader-menu">
<li
class="ant-cascader-menu-item ant-cascader-menu-item-active"
title="West Lake">
West Lake
</li>
</ul>
</div>
</div>
</div>
`;
exports[`Cascader popup correctly when panel is hidden 1`] = `
<div>
<div
class="ant-cascader-menus ant-cascader-menus-empty ant-cascader-menus-placement-bottomLeft ant-cascader-menus-hidden">
<div />
</div>
</div>
`;
exports[`Cascader popup correctly when panel is open 1`] = `
<div>
<div
class="ant-cascader-menus ant-cascader-menus-placement-bottomLeft ">
<div>
<ul
class="ant-cascader-menu">
<li
class="ant-cascader-menu-item ant-cascader-menu-item-expand"
title="Zhejiang">
Zhejiang
</li>
<li
class="ant-cascader-menu-item ant-cascader-menu-item-expand"
title="Jiangsu">
Jiangsu
</li>
</ul>
</div>
</div>
</div>
`;
exports[`Cascader popup correctly with defaultValue 1`] = `
<div>
<div
class="ant-cascader-menus ant-cascader-menus-placement-bottomLeft ">
<div>
<ul
class="ant-cascader-menu">
<li
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
title="Zhejiang">
Zhejiang
</li>
<li
class="ant-cascader-menu-item ant-cascader-menu-item-expand"
title="Jiangsu">
Jiangsu
</li>
</ul>
<ul
class="ant-cascader-menu">
<li
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
title="Hangzhou">
Hangzhou
</li>
</ul>
<ul
class="ant-cascader-menu">
<li
class="ant-cascader-menu-item"
title="West Lake">
West Lake
</li>
</ul>
</div>
</div>
</div>
`;

View File

@@ -0,0 +1,71 @@
import React from 'react';
import { render, mount } from 'enzyme';
import { renderToJson } from 'enzyme-to-json';
import Cascader from '..';
const options = [{
value: 'zhejiang',
label: 'Zhejiang',
children: [{
value: 'hangzhou',
label: 'Hangzhou',
children: [{
value: 'xihu',
label: 'West Lake',
}],
}],
}, {
value: 'jiangsu',
label: 'Jiangsu',
children: [{
value: 'nanjing',
label: 'Nanjing',
children: [{
value: 'zhonghuamen',
label: 'Zhong Hua Men',
}],
}],
}];
describe('Cascader', () => {
it('popup correctly when panel is hidden', () => {
const wrapper = mount(
<Cascader options={options} />
);
expect(renderToJson(render(wrapper.find('Trigger').node.getComponent()))).toMatchSnapshot();
});
it('popup correctly when panel is open', () => {
const wrapper = mount(
<Cascader options={options} />
);
wrapper.find('input').simulate('click');
expect(renderToJson(render(wrapper.find('Trigger').node.getComponent()))).toMatchSnapshot();
});
it('popup correctly with defaultValue', () => {
const wrapper = mount(
<Cascader options={options} defaultValue={['zhejiang', 'hangzhou']} />
);
wrapper.find('input').simulate('click');
expect(renderToJson(render(wrapper.find('Trigger').node.getComponent()))).toMatchSnapshot();
});
it('can be selected', () => {
const wrapper = mount(<Cascader options={options} />);
wrapper.find('input').simulate('click');
let popupWrapper = mount(wrapper.find('Trigger').node.getComponent());
popupWrapper.find('.ant-cascader-menu').at(0).find('.ant-cascader-menu-item').at(0)
.simulate('click');
expect(renderToJson(render(wrapper.find('Trigger').node.getComponent()))).toMatchSnapshot();
popupWrapper = mount(wrapper.find('Trigger').node.getComponent());
popupWrapper.find('.ant-cascader-menu').at(1).find('.ant-cascader-menu-item').at(0)
.simulate('click');
expect(renderToJson(render(wrapper.find('Trigger').node.getComponent()))).toMatchSnapshot();
popupWrapper = mount(wrapper.find('Trigger').node.getComponent());
popupWrapper.find('.ant-cascader-menu').at(2).find('.ant-cascader-menu-item').at(0)
.simulate('click');
expect(renderToJson(render(wrapper.find('Trigger').node.getComponent()))).toMatchSnapshot();
});
});

View File

@@ -13,7 +13,7 @@ title:
Cascade selection box for selecting province/city/district.
````__react
````jsx
import { Cascader } from 'antd';
const options = [{

View File

@@ -13,7 +13,7 @@ title:
Allow only select parent options.
````__react
````jsx
import { Cascader } from 'antd';
const options = [{

View File

@@ -13,7 +13,7 @@ title:
For instance, add an external link after the selected value.
````__react
````jsx
import { Cascader } from 'antd';
const options = [{

View File

@@ -13,7 +13,7 @@ title:
Separate trigger button and result.
````__react
````jsx
import { Cascader } from 'antd';
const options = [{
@@ -32,17 +32,16 @@ const options = [{
}],
}];
const CitySwitcher = React.createClass({
getInitialState() {
return {
text: 'Unselect',
};
},
onChange(value, selectedOptions) {
class CitySwitcher extends React.Component {
state = {
text: 'Unselect',
};
onChange = (value, selectedOptions) => {
this.setState({
text: selectedOptions.map(o => o.label).join(', '),
});
},
}
render() {
return (
<span>
@@ -53,8 +52,8 @@ const CitySwitcher = React.createClass({
</Cascader>
</span>
);
},
});
}
}
ReactDOM.render(<CitySwitcher />, mountNode);
````

View File

@@ -13,7 +13,7 @@ title:
Specifies default value by an array.
````__react
````jsx
import { Cascader } from 'antd';
const options = [{

View File

@@ -13,7 +13,7 @@ title:
Disable option by specifying the `disabled` property in `options`.
````__react
````jsx
import { Cascader } from 'antd';
const options = [{

View File

@@ -13,7 +13,7 @@ title:
Hover to expand sub menu, click to select option.
````__react
````jsx
import { Cascader } from 'antd';
const options = [{

View File

@@ -17,7 +17,7 @@ Load options lazily with `loadData`.
> Note: `loadData` cannot work with `showSearch`.
````__react
````jsx
import { Cascader } from 'antd';
const options = [{

View File

@@ -13,7 +13,7 @@ title:
Search and select options directly.
````__react
````jsx
import { Cascader } from 'antd';
const options = [{
@@ -25,6 +25,10 @@ const options = [{
children: [{
value: 'xihu',
label: 'West Lake',
}, {
value: 'xiasha',
label: 'Xia Sha',
disabled: true,
}],
}],
}, {

View File

@@ -13,7 +13,7 @@ title:
Cascade selection box of different sizes.
````__react
````jsx
import { Cascader } from 'antd';
const options = [{

View File

@@ -239,6 +239,7 @@ export default class Cascader extends React.Component<CascaderProps, any> {
path,
label: render(inputValue, path, prefixCls),
value: path.map(o => o.value),
disabled: path.some(o => o.disabled),
};
});
}

View File

@@ -8,7 +8,9 @@
font-size: @font-size-base;
&-input.@{ant-prefix}-input {
background-color: transparent;
// Add important to fix https://github.com/ant-design/ant-design/issues/5078
// because input.less will compile after cascader.less
background-color: transparent!important;
cursor: pointer;
width: 100%;
z-index: 1;

View File

@@ -13,7 +13,7 @@ title:
Basic usage of checkbox.
````__react
````jsx
import { Checkbox } from 'antd';
function onChange(e) {

View File

@@ -13,21 +13,19 @@ title:
The `indeterminate` property can help you to achieve a 'check all' effect.
````__react
````jsx
import { Checkbox } from 'antd';
const CheckboxGroup = Checkbox.Group;
const plainOptions = ['Apple', 'Pear', 'Orange'];
const defaultCheckedList = ['Apple', 'Orange'];
const App = React.createClass({
getInitialState() {
return {
checkedList: defaultCheckedList,
indeterminate: true,
checkAll: false,
};
},
class App extends React.Component {
state = {
checkedList: defaultCheckedList,
indeterminate: true,
checkAll: false,
};
render() {
return (
<div>
@@ -44,22 +42,22 @@ const App = React.createClass({
<CheckboxGroup options={plainOptions} value={this.state.checkedList} onChange={this.onChange} />
</div>
);
},
onChange(checkedList) {
}
onChange = (checkedList) => {
this.setState({
checkedList,
indeterminate: !!checkedList.length && (checkedList.length < plainOptions.length),
checkAll: checkedList.length === plainOptions.length,
});
},
onCheckAllChange(e) {
}
onCheckAllChange = (e) => {
this.setState({
checkedList: e.target.checked ? plainOptions : [],
indeterminate: false,
checkAll: e.target.checked,
});
},
});
}
}
ReactDOM.render(<App />, mountNode);
````

View File

@@ -13,16 +13,14 @@ title:
Communicated with other components.
````__react
````jsx
import { Checkbox, Button } from 'antd';
const App = React.createClass({
getInitialState() {
return {
checked: true,
disabled: false,
};
},
class App extends React.Component {
state = {
checked: true,
disabled: false,
};
render() {
const label = `${this.state.checked ? 'Checked' : 'Unchecked'}-${this.state.disabled ? 'Disabled' : 'Enabled'}`;
return (
@@ -50,20 +48,20 @@ const App = React.createClass({
</p>
</div>
);
},
toggleChecked() {
}
toggleChecked = () => {
this.setState({ checked: !this.state.checked });
},
toggleDisable() {
}
toggleDisable = () => {
this.setState({ disabled: !this.state.disabled });
},
onChange(e) {
}
onChange = (e) => {
console.log('checked = ', e.target.checked);
this.setState({
checked: e.target.checked,
});
},
});
}
}
ReactDOM.render(<App />, mountNode);
````

View File

@@ -13,12 +13,14 @@ checkbox 不可用。
Disabled checkbox.
````__react
````jsx
import { Checkbox } from 'antd';
ReactDOM.render(<div>
<Checkbox defaultChecked={false} disabled />
<br />
<Checkbox defaultChecked disabled />
</div>, mountNode);
ReactDOM.render(
<div>
<Checkbox defaultChecked={false} disabled />
<br />
<Checkbox defaultChecked disabled />
</div>
, mountNode);
````

View File

@@ -13,7 +13,7 @@ title:
Generate a group of checkboxes from an array.
````__react
````jsx
import { Checkbox } from 'antd';
const CheckboxGroup = Checkbox.Group;

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