Compare commits

...

300 Commits
2.6.2 ... 2.7.2

Author SHA1 Message Date
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
乐仪
1306c4656d - version -> 2.7.1
- rc-pagination -> ~1.7.0
- fix site bug
2017-02-10 20:32:55 +08:00
陆离
9711c6bbf6 Anchor position with offsetTop bug (#4817)
+ close #4706
 + `<Anchor offset={x} />` will calculate target position correctly.
2017-02-10 16:34:10 +08:00
Benjy Cui
5d2513ce91 docs: update img 2017-02-10 13:55:17 +08:00
afc163
948edb227f fix tabs border radius 2017-02-10 13:24:24 +08:00
Benjy Cui
6fdc6ff19a site: homepage will switch to right lang, close: #4552 2017-02-10 12:12:13 +08:00
Benjy Cui
a14bb37ae5 site: can search with google now, close: #4814 2017-02-10 11:46:57 +08:00
Benjy Cui
34edd91207 chore: remove useless code 2017-02-10 09:43:33 +08:00
Warren Seymour
7010dd018d Add 'middle' as a valid value for Table.props.size (#4819) 2017-02-09 22:43:58 +08:00
ddcat1115
16ad027988 change version slector position (#4799) 2017-02-09 19:46:23 +08:00
Benjy Cui
251930f183 docs: fix some link 2017-02-09 17:55:26 +08:00
Benjy Cui
bdd5be88f2 site: generate link with locale 2017-02-09 17:55:26 +08:00
Benjy Cui
a950a1298a site: upgrade bisheng to 0.21.0 2017-02-09 17:55:26 +08:00
afc163
ac23cca8b3 Fix missing ts types for TabPane, close #4776 2017-02-09 16:25:16 +08:00
afc163
df2982aacf Fix spec/layout demo, close #4816 2017-02-09 16:22:03 +08:00
afc163
d1b91bcc99 Fix direction of pop animation for Dropdown, ref #4811 2017-02-09 15:45:51 +08:00
ddcat1115
d71252ea12 improve Layout.Sider's animation effect (#4812) 2017-02-09 15:20:06 +08:00
afc163
5a643418d2 docs: Add missing demo and document fo Dropdown[placement], close #4811 2017-02-09 15:09:32 +08:00
Benjy Cui
c88cdc60ce docs: update docs for form, close: #4802 2017-02-09 14:50:25 +08:00
afc163
10199e5d96 docs: update customize theme doc
ref: dvajs/dva#562 dvajs/dva#575
2017-02-09 14:44:36 +08:00
afc163
4ec6bf3bcd Fix a strange cover bug with Affix, close #4800 2017-02-09 11:43:41 +08:00
偏右
e0c2b872ce upgrade @types/react version (#4741)
ref DefinitelyTyped/DefinitelyTyped#14284
2017-02-09 11:09:32 +08:00
zhenzong
fdaf15d16c fix issue #4783 (#4788) 2017-02-09 11:09:22 +08:00
陆离
fc3f4e1922 fix AutoComplete size (#4768)
*  fix AutoComplete size

 + close #4766

* use input mixin

* use css variables

*  use children directly instead of React.Children.toArray

 + close #4778
2017-02-09 10:45:42 +08:00
afc163
637c479c4c Fix Tabs in IE9, close #4795 2017-02-08 17:16:48 +08:00
afc163
5b14b4f1eb docs: update Col missing API in english doc 2017-02-08 15:22:33 +08:00
yiminghe
dbae84c83d add version (#4751)
* add version

* add version to dist
2017-02-08 14:53:18 +08:00
陆离
3789e0cbbb Affix listener bug fix (#4756)
*  Affix listener bug fix

 + close #4755
 + close #4760
 + clearScrollEventListeners before setTargetEventListeners
 + add tests for throttle
 + append affix test case

*  genMockFn -> fn()
2017-02-08 14:44:43 +08:00
Wei Zhu
f84dfbbaa9 Fix table filter in JSX (#4765)
Fix #4759
2017-02-08 14:43:00 +08:00
afc163
a07c71165a demo: update table demo code style 2017-02-08 14:42:33 +08:00
偏右
75a4b06e44 Unified border radius, close #4772 (#4773) 2017-02-08 14:21:29 +08:00
afc163
f9ee19ae05 Improve breadcrumb separator color for darker background 2017-02-08 14:09:27 +08:00
afc163
3bc202a721 update link to cn version 2017-02-08 13:15:19 +08:00
afc163
50ccc3ad7d fix link, #4793 2017-02-08 13:14:38 +08:00
afc163
33c171c04b docs: update for compatibility 2017-02-08 11:33:41 +08:00
Benjy Cui
9ed06dea8a docs: remove outdated warning, ref: #4783 2017-02-08 09:40:25 +08:00
Chikara Chan
64f6a71cc9 fix: should not render useless className when type is undefined (#4784) 2017-02-08 09:31:09 +08:00
zerob4wl
a39d435925 Update without-form-create.md (#4781)
typo
2017-02-07 21:38:14 +08:00
afc163
93e152268c remove it.only, ref #4779 2017-02-07 21:21:51 +08:00
afc163
a585f603d0 Fix Table selection page-jumping issue, close #4779 2017-02-07 21:09:51 +08:00
afc163
de185ddc19 docs: update text 2017-02-07 19:56:08 +08:00
afc163
cf22bb926a site: update footer style 2017-02-07 19:54:30 +08:00
afc163
ef5df24936 fix InputNumber onChange argument type 2017-02-07 17:27:28 +08:00
afc163
d8f6accbba docs: update input number api 2017-02-07 17:26:40 +08:00
afc163
1e55c145cc docs: update babel option 2017-02-07 17:20:59 +08:00
afc163
94f5a07f68 Add rowKey link into console warning message 2017-02-07 15:32:44 +08:00
afc163
168cec0dd1 docs: move Release Schedule to changelog 2017-02-07 15:22:16 +08:00
afc163
ac40780265 site: update footer link 2017-02-07 14:57:09 +08:00
Benjy Cui
5d7fc8c2b8 chore: add comment for tricky code 2017-02-07 12:10:20 +08:00
Benjy Cui
c565d42847 Revert "chore: remove useless code, close: #4402"
This reverts commit 9b77a21a16.
2017-02-07 12:05:12 +08:00
afc163
10d6486b4d docs: fix markdown link 2017-02-07 00:40:37 +08:00
Benjy Cui
9b77a21a16 chore: remove useless code, close: #4402 2017-02-06 18:04:37 +08:00
Benjy Cui
0408c8c133 style: update code style to fix lint 2017-02-06 15:12:02 +08:00
Benjy Cui
d2b8d65c87 style: update code style to please lint, close: #2179 2017-02-06 12:09:58 +08:00
Benjy Cui
382dd86475 chore: replace lesshint with stylelint 2017-02-06 12:09:58 +08:00
afc163
2196774b7f update less code style 2017-02-06 10:54:59 +08:00
Benjy Cui
766cded638 docs: update docs for Grid, close: #4744 2017-02-06 10:28:59 +08:00
Jesper We
f7aaa0d399 Fix issues with the new Swedish locale provider. (#4762) 2017-02-05 22:18:10 +08:00
afc163
0eb5c689a3 remove type="ghost" from demo 2017-02-04 22:35:33 +08:00
afc163
a5d69b893b add blank 2017-02-04 18:32:31 +08:00
afc163
a67264d68c Add aliases for icon naming style, close #4758 2017-02-04 18:10:25 +08:00
afc163
dbc2895899 Add Changelog 2017-02-04 18:06:57 +08:00
afc163
8775e7de5e Fix scroll Table lagging issue in IE, close #4522 2017-02-04 17:58:48 +08:00
afc163
70a0cc0940 fix badge borderColor 2017-02-04 01:14:10 +08:00
afc163
1a5f0f9fa7 remove whitespaces 2017-02-04 01:13:35 +08:00
afc163
b0fede60f7 update changelog 2017-02-03 19:04:12 +08:00
afc163
fb421f10e0 Change another approach to fix #4637
avoid issues like #4750 and #4753 caused by old way
2017-02-03 19:01:06 +08:00
偏右
f786f607cf Fix misplace Badge when browser zoom above 100% (#4749)
close #4747 #4290 #4176
2017-02-03 14:20:42 +08:00
afc163
24b1e1913a update button text 2017-02-01 12:00:12 +08:00
afc163
c17fc7c2ad remove blank line 2017-01-31 22:03:20 +08:00
afc163
a53e0668e1 update changelog for tree-select 2017-01-31 22:02:47 +08:00
afc163
5f8988a266 fix ghost primary button hover border color 2017-01-31 21:27:23 +08:00
afc163
f976eb8f1e Lock @types/react for #4741 temporarily 2017-01-31 21:14:16 +08:00
afc163
d79a08c468 update links 2017-01-31 21:12:52 +08:00
afc163
98ad1a9186 site: update home 2017-01-31 21:00:45 +08:00
afc163
99317b4661 Fix changelog PR link 2017-01-31 20:42:33 +08:00
afc163
9f06925a79 update Changelog 2017-01-31 16:10:48 +08:00
Graeme Yeates
1006015ef0 Add border customization variables (#4734)
* Add border customization variables (#4712)

* Make border styles customizable (fixes #4712)
2017-01-31 16:05:10 +08:00
afc163
7381cc95fe update input test case 2017-01-31 16:03:14 +08:00
afc163
767c4ab70d docs: update LocalProvider doc 2017-01-31 15:08:35 +08:00
afc163
99e7139634 docs: update LocalProvider doc 2017-01-31 15:08:07 +08:00
afc163
611b6acb11 site: update Home button text 2017-01-31 15:05:17 +08:00
afc163
3a3efc3e5a test input auto calculate height 2017-01-30 20:05:47 +08:00
afc163
30b2fa2c37 Move locale files 2017-01-30 18:20:57 +08:00
afc163
c9335c56ad update Dependency Status url 2017-01-30 18:09:37 +08:00
afc163
53b94a5996 site: update start button style 2017-01-30 17:44:25 +08:00
afc163
2b41f098c7 update changelog for input-number 2017-01-30 12:54:02 +08:00
afc163
ffcdbb66ab docs: improve changelog 2017-01-30 12:50:49 +08:00
afc163
b6b507d6be docs: improve changelog 2017-01-30 12:50:39 +08:00
RaoHai
2e0bfe975a 2.7.0 🎉 2017-01-30 12:17:15 +08:00
陆离
faf14df55e Merge pull request #4732 from ant-design/feature-2.7
antd 2.7 features
2017-01-30 11:23:48 +08:00
afc163
dda37d873b update LocaleProvider documentation 2017-01-27 17:54:57 +08:00
afc163
490a90b46f Add localProvider test for more language 2017-01-27 17:49:20 +08:00
afc163
95a74044b0 fix eslint warning 2017-01-27 17:26:52 +08:00
afc163
f2bb4afd4d Merge from master 2017-01-27 17:23:51 +08:00
Rex
aadf623dc6 support notification pop up from topLeft or bottomRight or bottomLeft (#4700)
* update snapshots

* update snapshots

* support notification pop up from topLeft or bottomRight or bottomLeft

* update snapshots

* 1. add test
2. update doc
3. support `placement` arguments in `open` method

* update doc

* update doc.
2017-01-27 17:12:25 +08:00
paranoidjk
f2e19c16be fix(transfer): checkall should response to filter result; fix #4654 (#4665) 2017-01-27 17:08:12 +08:00
Wei Zhu
85086f14b6 Using a special static property for type detecting (#4673)
Related issue: #4655
2017-01-27 17:08:05 +08:00
afc163
1a3ea43ebe Fix style prop of spin 2017-01-27 14:27:18 +08:00
Penghan Wang
29081542e6 doc: fix checkbox description error (#4731) 2017-01-27 13:54:15 +08:00
Benjy Cui
0d2b8989bc chore: update scripts 2017-01-27 11:32:03 +08:00
Penghan Wang
8a412ae260 doc: improve document for Form validateFields (#4730) 2017-01-27 10:39:09 +08:00
Andrey G
a96dd7a9f3 *up rc-menu (fixed bug with SubMenu) (#4727) 2017-01-26 19:10:45 +08:00
Benjy Cui
f0bdbfdd97 chore: improve readability for npm scripts 2017-01-26 17:04:31 +08:00
Bo Chen
f0adb4dc5f site: run ant-design on windows #4725
* 5hours's work

* 过年好!!

* lint issue
2017-01-26 16:51:06 +08:00
Valentin Vichnal
6c0dba60e7 Create reverseArrow prop for Sider (#4611)
Create reverseArrow prop for Sider
2017-01-26 12:30:37 +08:00
陆离
e270fa87af Mention in controlled mode suggestions bug fix (#4718)
*  Mention in controlled mode suggestions bug fix

 + close #4716
2017-01-26 12:09:26 +08:00
陆离
340385d34d pass style props to Affix (#4715)
+ close #4701
2017-01-26 12:08:40 +08:00
陆离
5cd111d486 recalculate width while resize (#4676)
+ close #4645
 + throttleByAnimationFrameDecorator as a function decorator
2017-01-26 11:23:54 +08:00
Benjy Cui
879bc9320c docs: update docs for Tooltip, close: #4724 2017-01-26 10:56:24 +08:00
Walter Barbagallo
5e3618c26d Fix Popover demo typo (#4703) 2017-01-25 21:27:14 +08:00
afc163
1ce6f7fc35 remove unused varable @layout-content-margin, close #4714 2017-01-25 21:18:06 +08:00
Simon Waloschek
fd233cf430 Added German locale (#4686)
* Added German locale

* Added German locale for pagination
2017-01-25 21:12:27 +08:00
Marius Ileana
882ecc370a Review of docs/spec/layout/demo/ceiling.md (#4709)
Small review corrections.
2017-01-25 21:11:02 +08:00
Marius Ileana
d2e862d3af Update aside.md (#4707)
Small review corrections.
2017-01-25 21:10:51 +08:00
Marius Ileana
a963fd1c60 Review of docs/spec/layout/demo/top.md (#4710)
Small review corrections.
2017-01-25 21:10:42 +08:00
afc163
a7517c7000 docs: update react-fa link 2017-01-25 12:00:38 +08:00
Wei Zhu
6a83118597 Upgrade rc-tree-select to 1.9.0 (#4698) 2017-01-25 11:15:41 +08:00
Marius Ileana
def370ee33 Update aside-collapse.md (#4708)
Small corrections as part of my review.
2017-01-25 11:12:04 +08:00
偏右
0dfdace923 Keep bundle size warning out of server side 2017-01-24 21:38:43 +08:00
afc163
edf9ebb0ef Fix Button font size inside Dropdown, close #4705 2017-01-24 17:59:17 +08:00
afc163
f4e887b784 remove steps demo 2017-01-24 16:07:03 +08:00
afc163
f3b2e155b5 style: Select height should flex with @input-height variable, close #4694 2017-01-24 15:20:06 +08:00
afc163
70188ae40e Merge branch 'feature-2.7' of github.com:ant-design/ant-design into feature-2.7 2017-01-24 15:10:34 +08:00
afc163
75128c8e22 fix ts error, ref #4675 2017-01-24 15:10:25 +08:00
afc163
e5a735e888 fix ts error, ref #4675 2017-01-24 15:10:04 +08:00
afc163
f4021d5255 Fix default locale in Upload, close #4697 2017-01-24 15:02:54 +08:00
afc163
a81bf8f73e use file.thumbUrl for <img /> in priority, close #4653 2017-01-24 14:59:39 +08:00
偏右
f850993fda More types of Button (#4679)
* Add Button[ghost] property, close #4625

* Add danger button

close #1308

* update API doc about ghost and danger property
2017-01-23 22:24:36 +08:00
afc163
128d35b391 update Changelog for semver 2017-01-23 21:12:19 +08:00
偏右
273c089aad Add test case for LocalProvider (#4693) 2017-01-23 21:08:16 +08:00
afc163
bb54dce712 Add test case for Menu openKeys undefined bug
ref #4677 and #4692
2017-01-23 19:10:50 +08:00
afc163
720ea3690a expand dot responsive area 2017-01-23 16:18:49 +08:00
afc163
eb2a02618f update steps API 2017-01-23 16:09:34 +08:00
afc163
179f030d45 Remove labelPlacement 2017-01-23 16:04:05 +08:00
afc163
cd9c85c969 fix code demo type 2017-01-23 15:52:03 +08:00
ddcat1115
09397187ac Steps support progressDot and labelPlacement (#4659) 2017-01-23 14:37:40 +08:00
afc163
52577054ad fix site style breaks when there is lib directory 2017-01-23 14:31:21 +08:00
afc163
5b9d8f0e5a Fix style of Tabs[tabPosition&type="card"], close #4669 2017-01-23 14:11:14 +08:00
kacjay
1ed890c095 fix Menu selected change error (#4677)
protect none parameter[openKeys, defaultOpenKeys] Menu
2017-01-23 13:55:39 +08:00
Gray Choi
bde7d1c624 Translate layout specification (#4542)
* create english index file

* tanslated the index

* tanslated aside.md

* adjust code format

* translated aside-collapse.md

* translated ceiling.md

* translated top.md

* translated top-aside.md
2017-01-23 11:08:46 +08:00
caoyi
cebf3a4c9e docs: fix Mention props API (#4683) 2017-01-22 19:49:08 +08:00
afc163
fa10c9dee0 adjust page margin in small device, ref #4682 2017-01-22 19:31:25 +08:00
afc163
04a94a691e site: update sider menu order 2017-01-22 19:16:54 +08:00
afc163
7518fde405 Fix align issue inside InputGroup, close #4680 2017-01-22 18:50:12 +08:00
afc163
bcd3b63c50 update tag colorful demo 2017-01-22 16:23:11 +08:00
afc163
9598169f90 fix tag snapshot test 2017-01-22 16:21:18 +08:00
afc163
f343d6c606 fix tag snapshot test 2017-01-22 16:20:20 +08:00
afc163
a183ee8ede Adjust Tag vertical-align and margin 2017-01-22 16:09:13 +08:00
afc163
b2ee5b2319 Adjust Tag vertical-align and margin 2017-01-22 16:08:54 +08:00
Wei Zhu
f91ac37ad3 docs: Oops, no onHover event. 2017-01-22 15:05:32 +08:00
Wei Zhu
774b778474 docs: Add note to Popconfirm, Popover and tooltip about child node.
Related issue: #4672
2017-01-22 14:29:24 +08:00
afc163
2d2534321a Fix Table fixed header align issue, close #4637 2017-01-22 11:15:14 +08:00
afc163
0b2342f9c2 update README.md 2017-01-22 01:19:04 +08:00
afc163
2292a8e6c5 update README.md 2017-01-22 01:15:29 +08:00
Wei Zhu
c681e8acf2 docs: Add backquote to default value 2017-01-21 22:35:42 +08:00
afc163
896bd7e55b fix site style breaks when there is lib directory 2017-01-20 21:41:24 +08:00
Wei Zhu
d596299210 Bump version 2017-01-20 21:34:34 +08:00
afc163
5a8d15333d site: update header style 2017-01-20 20:52:12 +08:00
Wei Zhu
703ccadb83 Add 2.6.4 CHANGELOG (#4667) 2017-01-20 20:23:43 +08:00
Wei Zhu
77b78a9389 docs: Unify type naming (#4636)
* Unify name of ReactNode type in document

* Lowser all string type name

* Lowercase all number type name

* Lowercase all boolean type name

* Unify array type

* Lowercase all object type name

* Unify mutilple types
2017-01-20 20:10:50 +08:00
ddcat1115
d2c00fae4b fix Layout demo (#4661)
* fix Layout demo

* update snapshot
2017-01-20 20:09:59 +08:00
afc163
67da059874 fix demo language 2017-01-20 18:39:13 +08:00
afc163
35523be6e9 Merge from master 2017-01-20 18:28:09 +08:00
陆离
bee522133e docs: Autocomplete optionLabelProp document (#4663)
close #4656
2017-01-20 16:16:31 +08:00
Wei Zhu
823ac6c139 fix TableColumnConfig exporting, #4660 2017-01-20 16:08:20 +08:00
afc163
9c6ce3fe48 fix RangePicker snapshot 2017-01-20 14:12:06 +08:00
afc163
e245facb48 Fix table snapshots 2017-01-20 13:43:39 +08:00
afc163
6c98d94b0d site: improve style of toc and color page 2017-01-20 13:41:26 +08:00
Benjy Cui
eb254572b7 site: upgrade bisheng to 0.20.0 2017-01-20 11:48:38 +08:00
afc163
2004c13653 Add semver link 2017-01-20 11:47:31 +08:00
afc163
fae7fd1658 Fix default value of Table showHeader, close #4658 2017-01-20 11:34:08 +08:00
偏右
48ea23e026 Update README-zh_CN.md 2017-01-20 01:10:06 +08:00
偏右
fd1ae531f4 Update README.md 2017-01-20 01:07:13 +08:00
Wei Zhu
fd861d6c0d Tweak empty table border (#4650) 2017-01-19 22:40:30 +08:00
afc163
ddc7054751 Fix fixed column table border radius 2017-01-19 21:51:53 +08:00
afc163
1db0e06bc4 Fix Table[small]'s title and footer border, close #4647 2017-01-19 21:49:03 +08:00
afc163
5203cabb8f update comment 2017-01-19 17:36:02 +08:00
afc163
fe5f8910dd Hide scroll bar in fixed header of table, close #4637 2017-01-19 16:08:21 +08:00
Benjy Cui
3e17551b7e site: improve build speed 2017-01-19 15:22:53 +08:00
afc163
e90189db8d site: improve style of component demo toc 2017-01-19 15:09:03 +08:00
afc163
df0426b2c9 workaround for table loading style in safari, close #4622 2017-01-19 15:08:28 +08:00
afc163
9189d3cc5d Fix Cascader[disabled] style with defaultValue, close #4648 2017-01-19 14:25:44 +08:00
Benjy Cui
e3758168e4 fix: should switch to right panels, close: #4561 (#4614)
* fix: should switch to right panels, close: #4561

* docs: update demo
2017-01-19 13:55:04 +08:00
Richard D. Worth
c427c3c4b9 lightweight.en-US.md typo 'while' -> 'whole' (#4643) 2017-01-19 09:00:56 +08:00
Richard D. Worth
e7f329a168 invitation.en-US.md change "" to &quot; (#4644) 2017-01-19 09:00:31 +08:00
afc163
bc842e2a67 Merge branch 'master' of github.com:ant-design/ant-design 2017-01-17 20:30:53 +08:00
Benjy Cui
11bcb58685 site: reduce bundle size 2017-01-17 15:24:13 +08:00
afc163
8f57451d8c fix snap test for cascader upgrade 2017-01-17 13:45:26 +08:00
afc163
34fec11e31 upgrade @types/react 2017-01-17 12:13:57 +08:00
afc163
83fbdf80cc upgrade rc-input-number for #4265 2017-01-17 12:10:39 +08:00
afc163
3a5d08383a upgrade rc-cascader and support keyboard, close #4411 2017-01-17 12:10:17 +08:00
afc163
ebc6d9d2c2 Merge branch 'master' of github.com:ant-design/ant-design 2017-01-17 11:47:44 +08:00
偏右
13952d451e Update README-zh_CN.md 2017-01-17 00:11:22 +08:00
偏右
5ad748c1fd Update README.md 2017-01-17 00:10:37 +08:00
偏右
0a68959207 Fix openKeys and defaultOpenKeys of Menu, close #3783 (#4609) 2017-01-16 21:13:59 +08:00
afc163
75abadac84 Add doc about clearing Modal old state 2017-01-16 14:30:07 +08:00
Benjy Cui
d0ddf94d78 docs: update deps for site 2017-01-16 12:19:45 +08:00
afc163
b7c5fb40ae update home page style 2017-01-16 12:05:03 +08:00
afc163
95bc803dc3 update doc 2017-01-16 11:35:44 +08:00
pd4d10
ca4697be55 doc: Fix star count (#4610) 2017-01-16 10:08:20 +08:00
chencheng (云谦)
82581f2217 fix(docs): port is not correct, Close #4607 (#4612) 2017-01-16 10:01:42 +08:00
afc163
efd1d1e89d Improve carousel default style 2017-01-15 22:48:57 +08:00
afc163
8d91206da1 Add react-fa 2017-01-15 15:14:54 +08:00
afc163
abd264ebf0 fix test case name 2017-01-15 14:37:22 +08:00
afc163
784915e55b Fix DatePicker time scroll issue, close #4412 2017-01-15 14:10:20 +08:00
afc163
041457fa5e fix typo 2017-01-15 13:39:44 +08:00
afc163
b245659887 update API table style 2017-01-15 13:15:30 +08:00
afc163
1bf0bab2a7 bump 2.6.3 2017-01-15 00:30:28 +08:00
afc163
55da11db22 Fix Popconfirm not response, close #4606 2017-01-15 00:27:02 +08:00
afc163
fc32c751ca update doc 2017-01-14 22:49:40 +08:00
afc163
a1a46ae57a update Changelog 2017-01-14 21:58:33 +08:00
偏右
6e3565b983 Add Form[hideRequiredMark] (#4500)
* Add Form[hideRequiredMark]

* omit hideRequiredMark

* Add test case for Form[hideRequiredMark]
2017-01-13 21:52:48 +08:00
偏右
10396419b5 Add preset color Tag (#4571)
* Add preset color Tag, close #4528

* Use color back over presetColor

* fix snap

* simplify isPresetColor
2017-01-13 21:25:55 +08:00
陆离
46c200896f Customize Input Component of AutoComplete (#4483)
* cherry-pick

* remove useless files

* remove useless files

* Group ts

* update interface

* ReactElement
2017-01-13 21:19:23 +08:00
bokzor
47fcd7651f feat: Add french locale (#4538)
* add french locale

* Add french locale
2017-01-11 10:28:47 +08:00
偏右
aa89addcc2 Improve upload list (#4516)
* support prevent removing when return value is false, close #4456

* Add showRemoveIcon & showPreviewIcon into showUploadList

close #4384 & #4351

* fix typo
2017-01-10 20:15:02 +08:00
Benjy Cui
3fa5d10da3 Merge branch 'master' into feature-2.7 2017-01-10 10:50:40 +08:00
Benjy Cui
f436b5c2f4 deps: upgrade rc-form, close: #4374 2017-01-09 17:40:01 +08:00
afc163
b5d0acee45 Merge branch 'master' into feature-2.7 2017-01-09 12:56:36 +08:00
afc163
6a8c88fd6b Merge branch 'master' into feature-2.7 2017-01-09 12:10:30 +08:00
afc163
1835961af1 Merge branch 'feature-2.7' of github.com:ant-design/ant-design into feature-2.7 2017-01-09 11:54:44 +08:00
afc163
c040c410e2 Merge branch 'master' into feature-2.7 2017-01-09 11:54:29 +08:00
Hans Chan
ef6c19e97b docs: add property colon for Form.Item (#4505)
* docs: 修改错别字

* docs: add property `colon` for Form.Item

`colon` is available since 2.0.0-beta.1
2017-01-09 11:03:35 +08:00
afc163
7d75a2673a components/date-picker/locale/sv_SE.jsx 2017-01-08 19:24:55 +08:00
Pixy Yuan
a2bef2b87e feat: Modal.confirm add maskClosable option (#4488) (#4490)
* feat: Modal.confirm add maskClosable option (#4488)

* feat: Modal.confirm add maskClosable option (#4488)
2017-01-08 19:14:28 +08:00
Jesper We
c6f6de3605 feat: Add support for Swedish locale (#4455)
* Swedish locale

* Create sv_SE.tsx

* Create sv_SE.tsx

* Create sv_SE.tsx
2017-01-08 19:14:28 +08:00
Rex
93128d1481 feat: add slider vertical style (#4473) 2017-01-08 19:14:02 +08:00
陆离
f54e822930 feat: Transfer on search change (#4464)
*  add `onSearchChange(direction: 'left'|'right') => void ` of Transfer

* typo
2017-01-08 19:14:02 +08:00
Benjy Cui
df18edda79 chore: update link to locale format 2017-01-08 19:14:02 +08:00
Jesper We
11ebc915eb feat: Add support for Swedish locale (#4455)
* Swedish locale

* Create sv_SE.tsx

* Create sv_SE.tsx

* Create sv_SE.tsx
2017-01-08 19:14:01 +08:00
394 changed files with 16105 additions and 10173 deletions

View File

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

View File

@@ -3,7 +3,7 @@ const eslintrc = {
env: {
browser: true,
node: true,
mocha: true,
jasmine: true,
jest: true,
es6: true,
},

View File

@@ -1,19 +0,0 @@
{
"propertyOrdering": false,
"hexLength": "short",
"stringQuotes": false,
"decimalZero": false,
"importantRule": false,
"zeroUnit": "no_unit",
"qualifyingElement": false,
"newlineAfterBlock": false,
"maxCharPerLine": false,
"excludedFiles": [
"components/grid/style/mixin.less",
"components/style/core/base.less",
"components/style/core/iconfont.less",
"components/style/core/normalize.less",
"components/style/mixins/compatibility.less",
"components/style/color/*"
]
}

24
.stylelintrc Normal file
View File

@@ -0,0 +1,24 @@
{
"extends": "stylelint-config-standard",
"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,
"function-name-case": null,
"function-parentheses-newline-inside": null,
"function-max-empty-lines": null,
"function-whitespace-after": null,
"indentation": null,
"number-leading-zero": null,
"number-no-trailing-zeros": null,
"rule-empty-line-before": null,
"selector-combinator-space-after": null,
"selector-list-comma-newline-after": null,
"selector-pseudo-element-colon-notation": null,
"unit-no-unknown": null,
"value-list-max-empty-lines": null
}
}

View File

@@ -1,19 +1,145 @@
---
order: 9
order: 6
title: Change Log
toc: false
timeline: true
---
If you want to read change logs before `2.0.0`, please visit [GitHub](https://github.com/ant-design/ant-design/releases?after=2.0.0).
`antd` strictly follows [Semantic Versioning 2.0.0](http://semver.org/).
#### Release Schedule
* Weekly release: patch version at the end of every week for routine bugfix (anytime for urgent bugfix).
* Monthly release: minor version at the end of every month for new features.
* Major version release is not included in this schedule for breadking change and new features.
If you want to read change logs before `2.0.0`, please visit [GitHub](https://github.com/ant-design/ant-design/blob/1.x-stable/CHANGELOG.md).
---
## 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`
- **Affix**
- Fix the problem of element been hidden when hover on. [#4800](https://github.com/ant-design/ant-design/issues/4800)
- Fix event listener can not be removed. [#4755](https://github.com/ant-design/ant-design/issues/4755)
- Fix can not be unfixed when scrolling fastly. [#4760](https://github.com/ant-design/ant-design/issues/4760)
- **Anchor** Fix the location problem when offsetTop has been set. [#4706](https://github.com/ant-design/ant-design/issues/4706)
- **AutoComplete**
- 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)
- **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**
- 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)
- **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)
- **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)
- Change the position of version switch. [pull-4799](https://github.com/ant-design/ant-design/pull/4799)
## 2.7.0
`2017-02-03`
* Added `danger` button and `ghost` button style. [#4679](https://github.com/ant-design/ant-design/pull/4679)
* Input element of AutoComplete can be customized. [#4483](https://github.com/ant-design/ant-design/pull/4483)
* Upgrade rc-cascader to `0.11.0`, keyborad interactions supported. [#4411](https://github.com/ant-design/ant-design/pull/4411)
* More popup directions are supported in notification. [#4732](https://github.com/ant-design/ant-design/pull/4700)
* Upgrade rc-steps to `2.3.0`, added `progressDot` property of Steps, which allows users to customize the display for Steps with progress dot style.
* Upgrade rc-input-number to `3.0.0`
* Input behavious will trigger `onChange` callback now.[#4265](https://github.com/ant-design/ant-design/pull/4265)
* Fixed `onKeyUp`. [#4717](https://github.com/ant-design/ant-design/issues/4717)
* Added `vertical` mode of Slider. [#4473](https://github.com/ant-design/ant-design/pull/4473)
* Tag
* Added preset colors. [#4571](https://github.com/ant-design/ant-design/pull/4571)
* Improvement vertical-align and margin.
* Add German localization for LocaleProvider.[#4686](https://github.com/ant-design/ant-design/pull/4686)
* Add Swedish localization for LocaleProvider. [#4455](https://github.com/ant-design/ant-design/pull/4455)
* Add French localization for LocaleProvider. [#4538](https://github.com/ant-design/ant-design/pull/4538)
* Added `onSearchChange` callback of Transfer. [#4464](https://github.com/ant-design/ant-design/pull/4464)
* Added `maskClosable` property of Modal.confirm. [#4488](https://github.com/ant-design/ant-design/pull/4488), [#4488](https://github.com/ant-design/ant-design/pull/4490)
* Added `hideRequiredMark` property if Form. [#4732](https://github.com/ant-design/ant-design/pull/4732)
* Improvement upload list of Upload. [#4516](https://github.com/ant-design/ant-design/pull/4516)
* Upgrade rc-select to `6.7.1`.
* Fixed duplication `onChange` callback. [#156@rc-select](https://github.com/react-component/select/pull/156)
* Fixed displaying of initial value. [#152@rc-select](https://github.com/react-component/select/pull/152)
* Upgrade rc-tree-select to `1.9.0`.
* Added `treeDefaultExpandedKeys` property.[#43@rc-tree-select](https://github.com/react-component/tree-select/pull/43)
* Fixed an overflow-wrap issue. [#42@rc-tree-select](https://github.com/react-component/tree-select/pull/42)
* Added less variables: `@border-style-base` `@border-width-base` `@btn-danger-color` `@btn-danger-bg` and etc.
* Fixed Badge misplace issue when browser zoom above 100%. [#4747](https://github.com/ant-design/ant-design/issues/4747) [#4290](https://github.com/ant-design/ant-design/issues/4290)
* Fixed a mis-align issue of fixed header Table. [#4750](https://github.com/ant-design/ant-design/issues/4750)
* Fixed Table scrolling lag issue in IE. [#4522](https://github.com/ant-design/ant-design/issues/4522)
* Add icon aliases: `addfile` => `file-add``addfolder` => `folder-open`, and the old type names are still working. [#4758](https://github.com/ant-design/ant-design/issues/4758)
## 2.6.4
`2017-01-20`
* Improve RangePicker when selecting a preset date.[#4561](https://github.com/ant-design/ant-design/issues/4561)
* Fix DatePicker select time scroll issue.[#4412](https://github.com/ant-design/ant-design/issues/4412)
* Fix issue resulting in vertical Menu can't be controlled.[#3783](https://github.com/ant-design/ant-design/issues/3783)
* Fix Cascader's style when it's disabled.[#4648](https://github.com/ant-design/ant-design/issues/4648)
* Table
* Improve Table fixed header's scrollbar style.[#4637](https://github.com/ant-design/ant-design/issues/4637)
* Fix issue resulting in Table's header flashes when `loading` is true in Safari.[#4622](https://github.com/ant-design/ant-design/issues/4622)
* Fix multiple border issues. [#4647](https://github.com/ant-design/ant-design/issues/4647)、[#4635](https://github.com/ant-design/ant-design/issues/4635)
* Fix `showHeader`'s default value.[#4658](https://github.com/ant-design/ant-design/issues/4658)
* Fix missing `TableColumnConfig` type.[#4660](https://github.com/ant-design/ant-design/issues/4660)
## 2.6.3
`2017-01-15`
* Fixed issue introduced in `2.6.2` that Popconfirm is not working. [#4606](https://github.com/ant-design/ant-design/issues/4606)
## 2.6.2
`2017-01-14`
* Added a Third-Party Library Page for recommending other greet react components. [Link](/docs/react/recommendation)
* Added a Third-Party Library Page for recommending other greet react components. [Link](/docs/react/recommendation)
* Fixed misplaced Sider of Layout. [#4459](https://github.com/ant-design/ant-design/issues/4459)
* Fixed Input.Search wrong block layout and misplaced icon. [#4540](https://github.com/ant-design/ant-design/issues/4540)
* Added a customize Collapse panel demo. [Link](/components/collapse/#components-collapse-demo-custom)
@@ -76,7 +202,7 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi
* Supports TypeScript@2.1. [#4208](https://github.com/ant-design/ant-design/issues/4208)
* Fix style issue resulting in nested Tabs. [#4317](https://github.com/ant-design/ant-design/issues/4317)
* Fix `onChange` callback issue resulting in Radio. [#4242](https://github.com/ant-design/ant-design/issues/4242) [@ystarlongzi](https://github.com/ystarlongzi)
* Fix a FormItem mis-aligin bug [#4271](https://github.com/ant-design/ant-design/issues/4271)
* Fix a FormItem mis-aligin bug. [#4271](https://github.com/ant-design/ant-design/issues/4271)
* Fix background issue resulting in selected element of veritcal Menu.[#4253](https://github.com/ant-design/ant-design/issues/4253)
* Improve arguments type of `onVisibleChange` callback of Dropdown.[#4236](https://github.com/ant-design/ant-design/issues/4236) [@bang88](https://github.com/bang88)
* Improve first argument type of `onChange` callback of Cascader.[#4231](https://github.com/ant-design/ant-design/issues/4231) [@bang88](https://github.com/bang88)
@@ -244,10 +370,10 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi
* Add `type`. [#3560](https://github.com/ant-design/ant-design/issues/3560)
* Add `checkable`. [#3560](https://github.com/ant-design/ant-design/issues/3560)
* Radio.Group
* Add `className`
* Add `className`.
* `null` or `undefined` `children` will be ignored.
* Select
* Add `tokenSeparators` to support automatic tokenization[#2071](https://github.com/ant-design/ant-design/issues/2071)
* Add `tokenSeparators` to support automatic tokenization. [#2071](https://github.com/ant-design/ant-design/issues/2071)
* Add `onFocus` callback. [#3587](https://github.com/ant-design/ant-design/issues/3587)
* Fix issue resulting in Select can't display correct selected item text in `combobox` mode. [#3401](https://github.com/ant-design/ant-design/issues/3401)
@@ -488,4 +614,4 @@ The following change will throw some warnings in the console and it will still w
## 1.11.4
Visit [GitHub](https://github.com/ant-design/ant-design/blob/1.x-stable/CHANGELOG.md) to read change logs from `0.x` to `1.x`
Visit [GitHub](https://github.com/ant-design/ant-design/blob/1.x-stable/CHANGELOG.md) to read change logs from `0.x` to `1.x`.

View File

@@ -1,19 +1,145 @@
---
order: 9
order: 6
title: 更新日志
toc: false
timeline: true
---
如果需要查看 `2.0.0` 之前的更新日志,请移步 [GitHub](https://github.com/ant-design/ant-design/releases?after=2.0.0)
`antd` 严格遵循 [Semantic Versioning 2.0.0](http://semver.org/lang/zh-CN/) 语义化版本规范
#### 发布周期
* patch 版本:每周末会进行日常 bugfix 更新。(如果有紧急的 bugfix则任何时候都可发布
* minor 版本:每月发布一个带有新特性的向下兼容的版本。
* 大版本号:含有破坏性更新和新特性,不在发布周期内。
如果需要查看 `2.0.0` 之前的更新日志,请移步 [GitHub](https://github.com/ant-design/ant-design/blob/1.x-stable/CHANGELOG.md)。
---
## 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`
- **Affix**
- 修复 hover 时元素被隐藏的问题。[#4800](https://github.com/ant-design/ant-design/issues/4800)
- 修复 event listener 未被正确移除的问题。[#4755](https://github.com/ant-design/ant-design/issues/4755)
- 修复快速滚动时不能正确复位的问题。[#4760](https://github.com/ant-design/ant-design/issues/4760)
- **Anchor** 修复了有 offsetTop 时的定位问题。[#4706](https://github.com/ant-design/ant-design/issues/4706)
- **AutoComplete**
- 修复了 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)
- **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)
- 修复过滤功能在 JSX 模式下不生效的问题。[#4759](https://github.com/ant-design/ant-design/issues/4759)
- 修复分页跳转问题。[#4779](https://github.com/ant-design/ant-design/issues/4779)
- **Tabs** 修复了在 IE9 中从第二个标签页起都显示空白的问题。[#4795](https://github.com/ant-design/ant-design/issues/4795)
- **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)
- **网站**
- 首页自动选择语言。[#4552](https://github.com/ant-design/ant-design/issues/4552)
- 接入 Google 作为文档的全文本搜索。[#4814](https://github.com/ant-design/ant-design/issues/4814)
- 改变版本切换 Select 的位置。[pull-4799](https://github.com/ant-design/ant-design/pull/4799)
## 2.7.0
`2017-02-03`
* Button 新增 `danger``ghost` 属性。[#4679](https://github.com/ant-design/ant-design/pull/4679)
* AutoComplete 支持自定义输入框的用法。 [#4483](https://github.com/ant-design/ant-design/pull/4483)
* 升级了 rc-cascader 到 0.11.0,支持键盘操作。[#4411](https://github.com/ant-design/ant-design/pull/4411)
* notification 支持更多弹出方向。[#4732](https://github.com/ant-design/ant-design/pull/4700)
* 升级了 rc-steps 到 2.3.0Steps 新增 `progressDot` 属性,支持自定义点状步骤条的样式。[#4659](https://github.com/ant-design/ant-design/pull/4659)
* 升级了 rc-input-number 到 3.0.0
* 现在输入时也会触发 `onChange`。[#4265](https://github.com/ant-design/ant-design/pull/4265)
* 修复了 `onKeyUp` 事件。[#4717](https://github.com/ant-design/ant-design/issues/4717)
* Slider 增加 `veritical` 模式。[#4473](https://github.com/ant-design/ant-design/pull/4473)
* Tag
- 增加了预设颜色。[#4571](https://github.com/ant-design/ant-design/pull/4571)
- 调整了垂直对齐和默认间距。
* 添加了对德语的支持。[#4686](https://github.com/ant-design/ant-design/pull/4686)
* 添加了对瑞典语的支持。[#4455](https://github.com/ant-design/ant-design/pull/4455)
* 添加了对法语的支持。[#4538](https://github.com/ant-design/ant-design/pull/4538)
* Transfer 添加了 `onSearchChange` 回调。 [#4464](https://github.com/ant-design/ant-design/pull/4464)
* Modal.confirm 添加了 maskClosable 配置项。[#4488](https://github.com/ant-design/ant-design/pull/4488), [#4488](https://github.com/ant-design/ant-design/pull/4490)
* Form 增加 `hideRequiredMark` 属性。[#4732](https://github.com/ant-design/ant-design/pull/4732)
* 改进了 Upload 的列表图片预览。 [#4516](https://github.com/ant-design/ant-design/pull/4516)
* 升级了 rc-select 到 6.7.1。
* 修复了 Select 的 `onChange` 回调重复触发的问题。[#156@rc-select](https://github.com/react-component/select/pull/156)
* 修复了 Select 显示初始化值的问题。[#152@rc-select](https://github.com/react-component/select/pull/152)
* 升级 rc-tree-select 到 `1.9.0`
* 新增 `treeDefaultExpandedKeys` 属性。[#43@rc-tree-select](https://github.com/react-component/tree-select/pull/43)
* 修复了文字溢出换行问题。[#42@rc-tree-select](https://github.com/react-component/tree-select/pull/42)
* 新增 less 变量: `@border-style-base` `@border-width-base` `@btn-danger-color` `@btn-danger-bg` 等。
* 修复了 Badge 在页面放大时错位的问题。[#4747](https://github.com/ant-design/ant-design/issues/4747) [#4290](https://github.com/ant-design/ant-design/issues/4290)
* 修复一个固定表头的表格错位问题。[#4750](https://github.com/ant-design/ant-design/issues/4750)
* 修复一个 IE 下表格滚动时卡顿的问题。[#4522](https://github.com/ant-design/ant-design/issues/4522)
* 添加别名以修正图标命名风格:`addfile` => `file-add``addfolder` => `folder-open`,原有的命名依然有效。[#4758](https://github.com/ant-design/ant-design/issues/4758)
## 2.6.4
`2017-01-20`
* 优化 RangePicker 选择预设时间时的界面显示。[#4561](https://github.com/ant-design/ant-design/issues/4561)
* 修复 DatePicker 选择时间界面的滚动问题。[#4412](https://github.com/ant-design/ant-design/issues/4412)
* 修复 Menu 在 `vertical` 的受控模式下,子菜单不会弹出的问题。[#3783](https://github.com/ant-design/ant-design/issues/3783)
* 修复 Cascader 禁用时的值显示样式问题。[#4648](https://github.com/ant-design/ant-design/issues/4648)
* Table
* 优化固定表头的滚动条显示。[#4637](https://github.com/ant-design/ant-design/issues/4637)
* 修复在 Safari 下显示 loading 效果时表头会闪烁的问题。[#4622](https://github.com/ant-design/ant-design/issues/4622)
* 修复多处边框问题。[#4647](https://github.com/ant-design/ant-design/issues/4647)、[#4635](https://github.com/ant-design/ant-design/issues/4635)
* 修复 showHeader 的默认值不为 `false` 的问题。[#4658](https://github.com/ant-design/ant-design/issues/4658)
* 修复找不到 `TableColumnConfig` 的类型定义的问题。[#4660](https://github.com/ant-design/ant-design/issues/4660)
## 2.6.3
`2017-01-15`
* 修复 `2.6.2` 中 Popconfirm 不可用的问题。[#4606](https://github.com/ant-design/ant-design/issues/4606)
## 2.6.2
`2017-01-14`
* 新增社区精选组件页面。[链接](/docs/react/recommendation/)
* 新增社区精选组件页面。[链接](/docs/react/recommendation-cn)
* 修复一个内容过长导致 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)

View File

@@ -8,7 +8,7 @@
[![](https://img.shields.io/travis/ant-design/ant-design.svg?style=flat-square)](https://travis-ci.org/ant-design/ant-design)
[![Coveralls](https://img.shields.io/coveralls/ant-design/ant-design.svg?style=flat-square)](https://coveralls.io/github/ant-design/ant-design)
[![Dependency Status](https://img.shields.io/david/ant-design/ant-design.svg?style=flat-square)](https://david-dm.org/ant-design/ant-design)
[![Dependency Status](https://img.shields.io/gemnasium/react-component/trigger.svg?style=flat-square)](https://gemnasium.com/ant-design/ant-design)
[![npm package](https://img.shields.io/npm/v/antd.svg?style=flat-square)](https://www.npmjs.org/package/antd)
[![NPM downloads](http://img.shields.io/npm/dm/antd.svg?style=flat-square)](https://npmjs.org/package/antd)
@@ -21,10 +21,10 @@
## 特性
- 提炼和服务企业级中后台产品的交互语言和视觉风格。
- [React Component](http://react-component.github.io/badgeboard/) 基础上精心封装的高质量 UI 组件。
- 提炼企业级中后台产品的交互语言和视觉风格。
- 开箱即用的高质量 React 组件。
- 使用 TypeScript 构建,提供完整的类型定义文件。
- 基于 npm + webpack + babel + [dora](https://github.com/dora-js/dora) + [dva](https://github.com/dvajs/dva) 的企业级业务开发框架。
- 基于 npm + webpack + [dva](https://github.com/dvajs/dva) 的企业级开发框架。
## 安装
@@ -73,30 +73,23 @@ tsconfig.json
## 链接
- [首页](http://ant.design/)
- [组件文档](http://ant.design/docs/react/introduce)
- [首页](http://ant.design/index-cn)
- [组件文档](http://ant.design/docs/react/introduce-cn)
- [更新日志](CHANGELOG.en-US.md)
- [开发脚手架](https://github.com/dvajs/dva-cli)
- [开发工具文档](http://ant-tool.github.io/)
- [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)
- [常见问题](https://github.com/ant-design/ant-design/wiki/FAQ)
- [CodePen 模板](http://codepen.io/benjycui/pen/KgPZrE?editors=001) for bug reports
- [Awesome Ant Design](https://github.com/websemantics/awesome-ant-design)
- [定制主题](http://ant.design/docs/react/customize-theme)
- [定制主题](http://ant.design/docs/react/customize-theme-cn)
## 如何贡献
我们欢迎任何形式的贡献,有任何建议或意见您可以进行 [Pull Request](https://github.com/ant-design/ant-design/pulls),或者给我们 [提问](https://github.com/ant-design/ant-design/issues)。
## 发布周期
* 每周末会发布一个完全兼容的 patch 版本。
* 每月发布一个带有新特性的 minor 版本。
* 任何时候都可以发布紧急补丁。
* 大版本号不在此发布周期内。

View File

@@ -8,7 +8,7 @@
[![](https://img.shields.io/travis/ant-design/ant-design.svg?style=flat-square)](https://travis-ci.org/ant-design/ant-design)
[![Coveralls](https://img.shields.io/coveralls/ant-design/ant-design.svg?style=flat-square)](https://coveralls.io/github/ant-design/ant-design)
[![Dependency Status](https://img.shields.io/david/ant-design/ant-design.svg?style=flat-square)](https://david-dm.org/ant-design/ant-design)
[![Dependency Status](https://img.shields.io/gemnasium/react-component/trigger.svg?style=flat-square)](https://gemnasium.com/ant-design/ant-design)
[![npm package](https://img.shields.io/npm/v/antd.svg?style=flat-square)](https://www.npmjs.org/package/antd)
[![NPM downloads](http://img.shields.io/npm/dm/antd.svg?style=flat-square)](https://npmjs.org/package/antd)
@@ -21,10 +21,10 @@ An enterprise-class UI design language and React-based implementation.
## Features
- An enterprise-class design language and high quality UI.
- Graceful UI components out of the box, based on [React Component](http://react-component.github.io/badgeboard/).
- An enterprise-class UI design language for web applications.
- A set of high-quality React components out of the box.
- Written in TypeScript with complete define types.
- A npm + webpack + babel + [dora](https://github.com/dora-js/dora) + [dva](https://github.com/dvajs/dva) development framework.
- A npm + webpack + [dva](https://github.com/dvajs/dva) front-end development workflow.
## Let's build a better antd together [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
@@ -56,7 +56,7 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
- Use [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) (Recommended)
```js
// .babelrc
// .babelrc or babel-loader option
{
"plugins": [["import", { libraryName: "antd", style: "css" }]]
}
@@ -120,10 +120,3 @@ tsconfig.json
## Contributing
We welcome all contributions, please read our [CONTRIBUTING.md](https://github.com/ant-design/ant-design/blob/master/.github/CONTRIBUTING.md) first. You can submit any ideas as [pull requests](https://github.com/ant-design/ant-design/pulls) or as [GitHub issues](https://github.com/ant-design/ant-design/issues). If you'd like to improve code, check out the [Development Instructions](https://github.com/ant-design/ant-design/wiki/Development) and have a good time! :)
## Release Schedule
* Weekly release: patch version at the end of every week.
* Monthly release: minor version at the end of every month.
* Emergence release: emergence patch anytime if necessary.
* Major version release is not included in this schedule.

View File

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

View File

@@ -0,0 +1,29 @@
import throttleByAnimationFrame from '../throttleByAnimationFrame';
jest.useFakeTimers();
describe('Test utils function', () => {
it('throttle function should work', () => {
const callback = jest.fn();
const throttled = throttleByAnimationFrame(callback);
expect(callback).not.toBeCalled();
throttled();
throttled();
jest.runAllTimers();
expect(callback).toBeCalled();
expect(callback.mock.calls.length).toBe(1);
});
it('throttle function should be canceled', () => {
const callback = jest.fn();
const throttled = throttleByAnimationFrame(callback);
throttled();
throttled.cancel();
jest.runAllTimers();
expect(callback).not.toBeCalled();
});
});

View File

@@ -1,3 +1,16 @@
const availablePrefixs = ['moz', 'ms', 'webkit'];
function requestAnimationFramePolyfill() {
let lastTime = 0;
return function(callback) {
const currTime = new Date().getTime();
const timeToCall = Math.max(0, 16 - (currTime - lastTime));
const id = window.setTimeout(function() { callback(currTime + timeToCall); }, timeToCall);
lastTime = currTime + timeToCall;
return id;
};
}
export default function getRequestAnimationFrame() {
if (typeof window === 'undefined') {
return () => {};
@@ -5,8 +18,27 @@ export default function getRequestAnimationFrame() {
if (window.requestAnimationFrame) {
return window.requestAnimationFrame;
}
const prefix = ['moz', 'ms', 'webkit'].filter(key => `${key}RequestAnimationFrame` in window)[0];
const prefix = availablePrefixs.filter(key => `${key}RequestAnimationFrame` in window)[0];
return prefix
? window[`${prefix}RequestAnimationFrame`]
: callback => setTimeout(callback, 1000 / 60);
: requestAnimationFramePolyfill();
}
export function cancelRequestAnimationFrame(id) {
if (typeof window === 'undefined') {
return null;
}
if (window.cancelAnimationFrame) {
return window.cancelAnimationFrame(id);
}
const prefix = availablePrefixs.filter(key =>
`${key}CancelAnimationFrame` in window || `${key}CancelRequestAnimationFrame` in window
)[0];
return prefix ?
(window[`${prefix}CancelAnimationFrame`] || window[`${prefix}CancelRequestAnimationFrame`]).call(this, id)
: clearTimeout(id);
}

View File

@@ -0,0 +1,10 @@
export default function isFlexSupported() {
if (typeof window !== 'undefined' && window.document && window.document.documentElement) {
const { documentElement } = window.document;
return 'flex' in documentElement.style ||
'webkitFlex' in documentElement.style ||
'Flex' in documentElement.style ||
'msFlex' in documentElement.style;
}
return false;
}

View File

@@ -0,0 +1,47 @@
import getRequestAnimationFrame, { cancelRequestAnimationFrame } from '../_util/getRequestAnimationFrame';
const reqAnimFrame = getRequestAnimationFrame();
export default function throttleByAnimationFrame(fn) {
let requestId;
const later = args => () => {
requestId = null;
fn(...args);
};
const throttled = (...args) => {
if (requestId == null) {
requestId = reqAnimFrame(later(args));
}
};
(throttled as any).cancel = () => cancelRequestAnimationFrame(requestId);
return throttled;
}
export function throttleByAnimationFrameDecorator() {
return function(target, key, descriptor) {
let fn = descriptor.value;
let definingProperty = false;
return {
configurable: true,
get() {
if (definingProperty || this === target.prototype || this.hasOwnProperty(key)) {
return fn;
}
let boundFn = throttleByAnimationFrame(fn.bind(this));
definingProperty = true;
Object.defineProperty(this, key, {
value: boundFn,
configurable: true,
writable: true,
});
definingProperty = false;
return boundFn;
},
};
};
}

View File

@@ -0,0 +1,68 @@
import React from 'react';
import { mount } from 'enzyme';
import Affix from '..';
import Button from '../../button';
jest.useFakeTimers();
const events = {};
class AffixMounter extends React.Component {
componentDidMount() {
this.container.scrollTop = 100;
this.container.addEventListener = jest.fn().mockImplementation((event, cb) => {
events[event] = cb;
});
}
getTarget = () => {
return this.container;
}
render() {
return (<div
style={{
height: 100,
overflowY: 'scroll',
}}
ref={(node) => { this.container = node; }}
>
<div
className="background"
style={{
paddingTop: 60,
height: 300,
}}
>
<Affix
target={() => this.container}
ref={ele => this.affix = ele}
>
<Button type="primary" >
Fixed at the top of container
</Button>
</Affix>
</div>
</div>);
}
}
describe('Affix Render', () => {
it('Anchor render perfectly', () => {
document.body.innerHTML = '<div id="mounter" />';
const wrapper = mount(<AffixMounter />, { attachTo: document.getElementById('mounter') });
jest.runAllTimers();
wrapper.node.affix.refs.fixedNode.parentNode.getBoundingClientRect = jest.fn(() => {
return {
bottom: 100, height: 28, left: 0, right: 0, top: -50, width: 195,
};
});
events.scroll({
type: 'scroll',
});
jest.runAllTimers();
expect(wrapper.node.affix.state.affixStyle).not.toBe(null);
});
});

View File

@@ -16,8 +16,8 @@ Please note that Affix should not cover other content on the page, especially wh
| Property | Description | Type | Default |
|--------------|-----------------------|----------|--------------|
| offsetTop | Pixels to offset from top when calculating position of scroll | Number | 0 |
| offsetBottom | Pixels to offset from bottom when calculating position of scroll | Number | - |
| offsetTop | Pixels to offset from top when calculating position of scroll | number | 0 |
| offsetBottom | Pixels to offset from bottom when calculating position of scroll | number | - |
| onChange | Callback when affix state is changed | Function(affixed) | - |
**Note:** Children of `Affix` can not be `position: absolute`, but you can set `Affix` as `position: absolute`:

View File

@@ -5,6 +5,7 @@ import classNames from 'classnames';
import shallowequal from 'shallowequal';
import omit from 'omit.js';
import getScroll from '../_util/getScroll';
import { throttleByAnimationFrameDecorator } from '../_util/throttleByAnimationFrame';
function getTargetRect(target): ClientRect {
return target !== window ?
@@ -96,18 +97,16 @@ export default class Affix extends React.Component<AffixProps, any> {
});
}
setPlaceholderStyle(e, placeholderStyle) {
setPlaceholderStyle(placeholderStyle) {
const originalPlaceholderStyle = this.state.placeholderStyle;
if (e.type === 'resize') {
return;
}
if (shallowequal(placeholderStyle, originalPlaceholderStyle)) {
return;
}
this.setState({ placeholderStyle });
}
updatePosition = (e) => {
@throttleByAnimationFrameDecorator()
updatePosition(e) {
let { offsetTop, offsetBottom, offset, target = getDefaultTarget } = this.props;
const targetNode = target();
@@ -145,7 +144,7 @@ export default class Affix extends React.Component<AffixProps, any> {
left: targetRect.left + elemOffset.left,
width: affixNode.offsetWidth,
});
this.setPlaceholderStyle(e, {
this.setPlaceholderStyle({
width: affixNode.offsetWidth,
height: affixNode.offsetHeight,
});
@@ -161,13 +160,18 @@ export default class Affix extends React.Component<AffixProps, any> {
left: targetRect.left + elemOffset.left,
width: affixNode.offsetWidth,
});
this.setPlaceholderStyle(e, {
this.setPlaceholderStyle({
width: affixNode.offsetWidth,
height: affixNode.offsetHeight,
});
} else {
this.setAffixStyle(e, null);
this.setPlaceholderStyle(e, null);
const { affixStyle } = this.state;
if (e.type === 'resize' && affixStyle && affixStyle.position === 'fixed' && affixNode.offsetWidth) {
this.setAffixStyle(e, {...affixStyle, width: affixNode.offsetWidth });
} else {
this.setAffixStyle(e, null);
}
this.setPlaceholderStyle(null);
}
}
@@ -192,6 +196,7 @@ export default class Affix extends React.Component<AffixProps, any> {
componentWillUnmount() {
this.clearScrollEventListeners();
clearTimeout(this.timeout);
(this.updatePosition as any).cancel();
}
setTargetEventListeners(getTarget) {
@@ -199,6 +204,7 @@ export default class Affix extends React.Component<AffixProps, any> {
if (!target) {
return;
}
this.clearScrollEventListeners();
this.scrollEvent = addEventListener(target, 'scroll', this.updatePosition);
this.resizeEvent = addEventListener(target, 'resize', this.updatePosition);
}
@@ -217,9 +223,9 @@ export default class Affix extends React.Component<AffixProps, any> {
});
const props = omit(this.props, ['prefixCls', 'offsetTop', 'offsetBottom', 'target']);
const placeholderStyle = { ...this.state.placeholderStyle, ...this.props.style };
return (
<div {...props} style={this.state.placeholderStyle}>
<div {...props} style={placeholderStyle}>
<div className={className} ref="fixedNode" style={this.state.affixStyle}>
{this.props.children}
</div>

View File

@@ -17,8 +17,8 @@ title: Affix
| 成员 | 说明 | 类型 | 默认值 |
|-------------|----------------|--------------------|--------------|
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | Number | |
| offsetBottom | 距离窗口底部达到指定偏移量后触发 | Number | |
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | number | |
| offsetBottom | 距离窗口底部达到指定偏移量后触发 | number | |
| target | 设置 `Affix` 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 | Function | () => window |
| onChange | 固定状态改变时触发的回调函数 | Function(affixed) | 无 |

View File

@@ -15,11 +15,11 @@ Alert component for feedback.
| Property | Description | Type | Default |
|----------- |--------------------------------------------------------- | ---------- |-------|
| type | Type of Alert styles, options:`success`, `info`, `warning`, `error` | String | `info` |
| closable | Whether Alert can be closed | Boolean | - |
| closeText | Close text to show | React.Node | - |
| message | Content of Alert | React.Node | - |
| description | Additional content of Alert | React.Node | - |
| type | Type of Alert styles, options:`success`, `info`, `warning`, `error` | string | `info` |
| closable | Whether Alert can be closed | boolean | - |
| closeText | Close text to show | string\|ReactNode | - |
| message | Content of Alert | string\|ReactNode | - |
| description | Additional content of Alert | string\|ReactNode | - |
| onClose | Callback when close Alert | Function | - |
| showIcon | Whether to show icon | Boolean | false |
| banner | Whether to show as banner | Boolean | false |
| showIcon | Whether to show icon | boolean | false |
| banner | Whether to show as banner | boolean | false |

View File

@@ -16,12 +16,12 @@ title: Alert
| 参数 | 说明 | 类型 | 默认值 |
|----------- |--------------------------------------------------------- | ---------- |-------|
| type | 指定警告提示的样式,有四种选择 `success``info``warning``error` | String | `info` |
| closable | 默认不显示关闭按钮 | Boolean | 无 |
| closeText | 自定义关闭按钮 | React.Node | 无 |
| message | 警告提示内容 | React.Node | 无 |
| description | 警告提示的辅助性文字介绍 | React.Node | 无 |
| type | 指定警告提示的样式,有四种选择 `success``info``warning``error` | string | `info` |
| closable | 默认不显示关闭按钮 | boolean | 无 |
| closeText | 自定义关闭按钮 | string\|ReactNode | 无 |
| message | 警告提示内容 | string\|ReactNode | 无 |
| description | 警告提示的辅助性文字介绍 | string\|ReactNode | 无 |
| onClose | 关闭时触发的回调函数 | Function | 无 |
| showIcon | 是否显示辅助图标 | Boolean | false |
| banner | 是否用作顶部公告 | Boolean | false |
| showIcon | 是否显示辅助图标 | boolean | false |
| banner | 是否用作顶部公告 | boolean | false |

View File

@@ -29,7 +29,7 @@
}
&-success {
border: 1px solid @green-2;
border: @border-width-base @border-style-base @green-2;
background-color: @green-1;
.@{alert-prefix-cls}-icon {
color: @success-color;
@@ -37,7 +37,7 @@
}
&-info {
border: 1px solid @primary-2;
border: @border-width-base @border-style-base @primary-2;
background-color: @primary-1;
.@{alert-prefix-cls}-icon {
color: @primary-color;
@@ -45,7 +45,7 @@
}
&-warning {
border: 1px solid @yellow-2;
border: @border-width-base @border-style-base @yellow-2;
background-color: @yellow-1;
.@{alert-prefix-cls}-icon {
color: @warning-color;
@@ -53,7 +53,7 @@
}
&-error {
border: 1px solid @red-2;
border: @border-width-base @border-style-base @red-2;
background-color: @red-1;
.@{alert-prefix-cls}-icon {
color: @error-color;

View File

@@ -8,7 +8,8 @@ export interface AnchorLinkProps {
active?: boolean;
prefixCls?: string;
children?: any;
title?: Element;
title?: React.ReactNode;
offsetTop: number;
bounds: number;
target?: () => HTMLElement | Window;
affix?: boolean;
@@ -31,9 +32,9 @@ export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
private _component: Element;
setActiveAnchor() {
const { bounds, href, affix } = this.props;
const { bounds, offsetTop, href, affix } = this.props;
const { anchorHelper } = this.context;
const active = affix && anchorHelper && anchorHelper.getCurrentAnchor(bounds) === href;
const active = affix && anchorHelper && anchorHelper.getCurrentAnchor(offsetTop, bounds) === href;
if (active && anchorHelper) {
anchorHelper.setActiveAnchor(this._component);
}
@@ -55,6 +56,7 @@ export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
onClick: this.props.onClick,
prefixCls: this.props.prefixCls,
affix: this.props.affix,
offsetTop: this.props.offsetTop,
});
}
return child;
@@ -73,14 +75,14 @@ export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
} else {
e.stopPreventDefault();
const scrollToFn = anchorHelper ? anchorHelper.scrollTo : scrollTo;
scrollToFn(href);
scrollToFn(href, this.props.offsetTop);
}
}
render() {
const { prefixCls, href, children, title, bounds, affix } = this.props;
const { prefixCls, href, children, title, bounds, offsetTop, affix } = this.props;
const { anchorHelper } = this.context;
const active = affix && anchorHelper && anchorHelper.getCurrentAnchor(bounds) === href;
const active = affix && anchorHelper && anchorHelper.getCurrentAnchor(offsetTop, bounds) === href;
const cls = classNames({
[`${prefixCls}-link`]: true,
[`${prefixCls}-link-active`]: active,

View File

@@ -43,14 +43,14 @@ export type Section = {
section: any;
};
export function scrollTo(href, target = getDefaultTarget, callback = () => {}) {
export function scrollTo(href, offsetTop = 0, target = getDefaultTarget, callback = () => {}) {
const scrollTop = getScroll(target(), true);
const targetElement = document.getElementById(href.substring(1));
if (!targetElement) {
return;
}
const offsetTop = getOffsetTop(targetElement);
const targetScrollTop = scrollTop + offsetTop;
const eleOffsetTop = getOffsetTop(targetElement);
const targetScrollTop = scrollTop + eleOffsetTop - offsetTop;
const startTime = Date.now();
const frameFunc = () => {
const timestamp = Date.now();
@@ -91,7 +91,7 @@ class AnchorHelper {
this.currentAnchor = component;
}
getCurrentAnchor(bounds = 5) {
getCurrentAnchor(offsetTop: number = 0, bounds = 5) {
let activeAnchor = '';
if (typeof document === 'undefined') {
return activeAnchor;
@@ -100,9 +100,9 @@ class AnchorHelper {
const linksPositions = (this.links
.map(section => {
const target = document.getElementById(section.substring(1));
if (target && getOffsetTop(target) < bounds) {
if (target && getOffsetTop(target) < offsetTop + bounds) {
const top = getOffsetTop(target);
if (top <= bounds) {
if (top <= offsetTop + bounds) {
return {
section,
top,
@@ -121,8 +121,8 @@ class AnchorHelper {
return '';
}
scrollTo(href, target = getDefaultTarget, callback = () => {}) {
scrollTo(href, target, callback);
scrollTo(href, offsetTop, target = getDefaultTarget, callback = () => {}) {
scrollTo(href, offsetTop, target, callback);
}
}

View File

@@ -17,13 +17,13 @@ For displaying anchor hyperlinks on page and jumping between them.
| Property | Description | Type | Default |
|--------------|-----------------------|----------|--------------|
| offsetTop | Pixels to offset from top when calculating position of scroll | Number | 0 |
| offsetBottom | Pixels to offset from bottom when calculating position of scroll | Number | - |
| bounds | Bounding distance of anchor area | Number | 5(px) |
| offsetTop | Pixels to offset from top when calculating position of scroll | number | 0 |
| offsetBottom | Pixels to offset from bottom when calculating position of scroll | number | - |
| bounds | Bounding distance of anchor area | number | 5(px) |
### Link Props
| Property | Description | Type | Default |
|-------------|----------------|--------------------|--------------|
| href | target of hyperlink | String | |
| title | content of hyperlink | React.Node | |
| href | target of hyperlink | string | |
| title | content of hyperlink | string\|ReactNode | |

View File

@@ -47,7 +47,7 @@ export default class Anchor extends React.Component<AnchorProps, any> {
handleScroll = () => {
this.setState({
activeAnchor: this.anchorHelper.getCurrentAnchor(this.props.bounds),
activeAnchor: this.anchorHelper.getCurrentAnchor(this.props.offsetTop, this.props.bounds),
});
}
@@ -85,7 +85,7 @@ export default class Anchor extends React.Component<AnchorProps, any> {
clickAnchorLink = (href, component) => {
this._avoidInk = true;
this.refs.ink.style.top = `${component.offsetTop + component.clientHeight / 2 - 4.5}px`;
this.anchorHelper.scrollTo(href, getDefaultTarget, () => {
this.anchorHelper.scrollTo(href, this.props.offsetTop, getDefaultTarget, () => {
this._avoidInk = false;
});
}
@@ -99,6 +99,7 @@ export default class Anchor extends React.Component<AnchorProps, any> {
prefixCls: this.props.prefixCls,
bounds: this.props.bounds,
affix: this.props.affix,
offsetTop: this.props.offsetTop,
});
}
return child;

View File

@@ -18,13 +18,13 @@ title: Anchor
| 成员 | 说明 | 类型 | 默认值 |
|-------------|----------------|--------------------|--------------|
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | Number | |
| offsetBottom | 距离窗口底部达到指定偏移量后触发 | Number | |
| bounds | 锚点区域边界 | Number | 5(px) |
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | number | |
| offsetBottom | 距离窗口底部达到指定偏移量后触发 | number | |
| bounds | 锚点区域边界 | number | 5(px) |
### Link Props
| 成员 | 说明 | 类型 | 默认值 |
|-------------|----------------|--------------------|--------------|
| href | 锚点链接 | String | |
| title | 文字内容 | React.Node | |
| href | 锚点链接 | string | |
| title | 文字内容 | string\|ReactNode | |

View File

@@ -1,6 +1,49 @@
exports[`test renders ./components/auto-complete/demo/antd.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">
input here
</div>
<ul>
<li
class="ant-select-search ant-select-search--inline">
<div
class="ant-select-search__field__wrap">
<textarea
class="ant-input ant-select-search__field"
style="height:50px;" />
<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/basic.md correctly 1`] = `
<div
class="ant-select-show-search ant-select ant-select-combobox ant-select-enabled"
class="ant-select-show-search ant-select-auto-complete ant-select ant-select-combobox ant-select-enabled"
style="width:200px;">
<div
aria-autocomplete="list"
@@ -23,7 +66,52 @@ exports[`test renders ./components/auto-complete/demo/basic.md correctly 1`] = `
<div
class="ant-select-search__field__wrap">
<input
class="ant-select-search__field"
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/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" />
@@ -43,7 +131,7 @@ exports[`test renders ./components/auto-complete/demo/basic.md correctly 1`] = `
exports[`test renders ./components/auto-complete/demo/options.md correctly 1`] = `
<div
class="ant-select-show-search ant-select ant-select-combobox ant-select-enabled"
class="ant-select-show-search ant-select-auto-complete ant-select ant-select-combobox ant-select-enabled"
style="width:200px;">
<div
aria-autocomplete="list"
@@ -66,7 +154,8 @@ exports[`test renders ./components/auto-complete/demo/options.md correctly 1`] =
<div
class="ant-select-search__field__wrap">
<input
class="ant-select-search__field"
class="ant-input ant-input ant-select-search__field"
type="text"
value="" />
<span
class="ant-select-search__field__mirror" />
@@ -83,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

@@ -0,0 +1,20 @@
import React from 'react';
import { mount } from 'enzyme';
import AutoComplete from '..';
describe('AutoComplete with Custom Input Element Render', () => {
it('AutoComplete with custom Input render perfectly', () => {
const wrapper = mount(
<AutoComplete dataSource={['12345', '23456', '34567']}>
<textarea />
</AutoComplete>
);
expect(wrapper.find('textarea').length).toBe(1);
wrapper.find('textarea').simulate('change', { target: { value: '123' } });
const dropdownWrapper = mount(wrapper.find('Trigger').node.getComponent());
expect(dropdownWrapper.find('MenuItem').length).toBe(1);
expect(dropdownWrapper.find('MenuItem').props().value).toBe('12345');
});
});

View File

@@ -0,0 +1,58 @@
---
order: 3
title:
zh-CN: 自定义输入组件
en-US: Customize Input Component
---
## zh-CN
自定义输入组件。
## en-US
Customize Input Component
````jsx
import { AutoComplete } from 'antd';
function onSelect(value) {
console.log('onSelect', value);
}
const Complete = React.createClass({
getInitialState() {
return {
dataSource: [],
};
},
handleChange(value) {
this.setState({
dataSource: !value ? [] : [
value,
value + value,
value + value + value,
],
});
},
handleKeyPress(ev) {
console.log('handleKeyPress', ev);
},
render() {
const { dataSource } = this.state;
return (
<AutoComplete
dataSource={dataSource}
style={{ width: 200 }}
onSelect={onSelect}
onChange={this.handleChange}
placeholder="input here"
>
<textarea onKeyPress={this.handleKeyPress} style={{ height: 50 }} />
</AutoComplete>
);
},
});
ReactDOM.render(<Complete />, mountNode);
````

View File

@@ -0,0 +1,31 @@
---
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

@@ -0,0 +1,138 @@
---
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 style={{ float: 'right' }}>约 {item.count} 个结果</span>
</Option>
);
}
const Complete = React.createClass({
getInitialState() {
return {
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 {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
````

View File

@@ -17,15 +17,17 @@ 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 |
|----------------|----------------------------------|------------|--------|
| dataSource | Data source for autocomplete | Array | |
| value | selected option | String/Array<String>/{key: String, label: React.Node}/Array<{key, label}> | - |
| defaultValue | Initial selected option. | string/Array<String> | - |
| dataSource | Data source for autocomplete | [DataSourceItemType](https://git.io/vMMKF)[] | |
| value | selected option | string\|string[]\|{ key: string, label: string\|ReactNode }\|Array<{ key: string, label: string\|ReactNode }> | - |
| defaultValue | Initial selected option. | string\|string[]\|{ key: string, label: string\|ReactNode }\|Array<{ key: string, label: string\|ReactNode }> | - |
| allowClear | Show clear button, effective in multiple mode only. | boolean | false |
| 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 |
| 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

@@ -1,5 +1,7 @@
import React from 'react';
import { findDOMNode } from 'react-dom';
import Select, { AbstractSelectProps, OptionProps, OptGroupProps } from '../select';
import Input from '../input';
import { Option, OptGroup } from 'rc-select';
import classNames from 'classnames';
@@ -11,12 +13,45 @@ export interface SelectedValue {
export interface DataSourceItemObject { value: string; text: string; };
export type DataSourceItemType = string | DataSourceItemObject;
export interface InputProps {
onChange?: React.FormEventHandler<any>;
value: any;
}
export type ValidInputElement =
HTMLInputElement |
HTMLTextAreaElement |
React.ReactElement<InputProps>;
export interface AutoCompleteProps extends AbstractSelectProps {
size?: 'large' | 'small' | 'default';
className?: string;
notFoundContent?: Element;
dataSource: DataSourceItemType[];
defaultValue?: string | Array<any> | SelectedValue | Array<SelectedValue>;
value?: string | Array<any> | SelectedValue | Array<SelectedValue>;
onChange?: (value: string | Array<any> | SelectedValue | Array<SelectedValue>) => void;
onSelect?: (value: string | Array<any> | SelectedValue | Array<SelectedValue>, option: Object) => any;
disabled?: boolean;
children: ValidInputElement |
React.ReactElement<OptionProps> |
Array<React.ReactElement<OptionProps>>;
}
class InputElement extends React.Component<any, any> {
private ele: Element;
focus = () => {
(findDOMNode(this.ele) as HTMLInputElement).focus();
}
blur = () => {
(findDOMNode(this.ele) as HTMLInputElement).blur();
}
render() {
return React.cloneElement(this.props.children, {
...this.props,
ref: ele => this.ele = ele,
}, null);
}
}
export default class AutoComplete extends React.Component<AutoCompleteProps, any> {
@@ -35,6 +70,14 @@ export default class AutoComplete extends React.Component<AutoCompleteProps, any
antLocale: React.PropTypes.object,
};
getInputElement = () => {
const { children } = this.props;
const element = children && React.isValidElement(children) && children.type !== Option ?
React.Children.only(this.props.children) :
<Input/>;
return <InputElement className="ant-input">{element}</InputElement>;
}
render() {
let {
size, className = '', notFoundContent, prefixCls, optionLabelProp, dataSource, children,
@@ -45,22 +88,32 @@ export default class AutoComplete extends React.Component<AutoCompleteProps, any
[`${prefixCls}-sm`]: size === 'small',
[className]: !!className,
[`${prefixCls}-show-search`]: true,
[`${prefixCls}-auto-complete`]: true,
});
const options = children || (dataSource ? dataSource.map((item) => {
switch (typeof item) {
case 'string':
return <Option key={item}>{item}</Option>;
case 'object':
return (
<Option key={(item as DataSourceItemObject).value}>
{(item as DataSourceItemObject).text}
</Option>
);
default:
throw new Error('AutoComplete[dataSource] only supports type `string[] | Object[]`.');
}
}) : []);
let options;
const childArray = React.Children.toArray(children);
if (childArray.length && (childArray[0] as React.ReactElement<any>).type === Option) {
options = children;
} else {
options = dataSource ? dataSource.map((item) => {
if (React.isValidElement(item)) {
return item;
}
switch (typeof item) {
case 'string':
return <Option key={item}>{item}</Option>;
case 'object':
return (
<Option key={(item as DataSourceItemObject).value}>
{(item as DataSourceItemObject).text}
</Option>
);
default:
throw new Error('AutoComplete[dataSource] only supports type `string[] | Object[]`.');
}
}) : [];
}
return (
<Select
@@ -68,6 +121,7 @@ export default class AutoComplete extends React.Component<AutoCompleteProps, any
className={cls}
optionLabelProp={optionLabelProp}
combobox
getInputElement={this.getInputElement}
notFoundContent={notFoundContent}
>
{options}

View File

@@ -2,7 +2,7 @@
category: Components
subtitle: 自动完成
type: Data Entry
cols: 1
cols: 2
title: AutoComplete
---
@@ -18,15 +18,18 @@ title: AutoComplete
const dataSource = ['12345', '23456', '34567'];
<AutoComplete dataSource={dataSource} />
```
因为 `AutoComplete` 是基于 `Select` 封装的,所以除了以下 API 外,`AutoComplete``Select` 拥有一样的 API。
| 参数 | 说明 | 类型 | 默认值 |
|----------------|----------------------------------|------------|---------|
| dataSource | 自动完成的数据源 | Array | |
| value | 指定当前选中的条目 | String/Array<String>/{key: String, label: React.Node}/Array<{key, label}> | 无 |
| defaultValue | 指定默认选中的条目 | String/Array<String>/{key: String, label: React.Node}/Array<{key, label}> | 无 |
| dataSource | 自动完成的数据源 | [DataSourceItemType](https://git.io/vMMKF)[] | |
| value | 指定当前选中的条目 | string\|string[]\|{ key: string, label: string\|ReactNode }\|Array<{ key: string, label: string\|ReactNode }> | 无 |
| defaultValue | 指定默认选中的条目 | string\|string[]\|{ key: string, label: string\|ReactNode }\|Array<{ key: string, label: string\|ReactNode}> | 无 |
| allowClear | 支持清除, 单选模式有效 | boolean | false |
| onChange | 选中 option或 input 的 value 变化时,调用此函数 | function(value) | 无 |
| onSelect | 被选中时调用,参数为选中项的 value 值 | function(value, option) | 无 |
| disabled | 是否禁用 | boolean | false |
| 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

@@ -0,0 +1,65 @@
@import "../../style/themes/default";
@import "../../style/mixins/index";
@import "../../input/style/mixin";
@input-prefix-cls: ~"@{ant-prefix}-input";
@select-prefix-cls: ~"@{ant-prefix}-select";
@autocomplete-prefix-cls: ~"@{select-prefix-cls}-auto-complete";
.@{autocomplete-prefix-cls} {
&.@{select-prefix-cls} {
.@{select-prefix-cls} {
&-search--inline {
position: relative;
}
&-selection {
border: 0;
&--single {
height: auto;
}
&__rendered {
margin-left: 0;
margin-right: 0;
line-height: 0;
}
&__placeholder {
margin-left: 8px;
margin-right: 8px;
top: @input-height-base / 2;
}
}
}
.@{input-prefix-cls} {
.input();
background: transparent;
}
&-lg {
.@{select-prefix-cls}-selection__placeholder {
top: @input-height-lg / 2;
}
.@{input-prefix-cls} {
.input-lg();
}
}
&-sm {
.@{select-prefix-cls}-selection__placeholder {
top: @input-height-sm / 2;
}
.@{input-prefix-cls} {
.input-sm();
}
}
.@{input-prefix-cls} {
border: @border-width-base @border-style-base @border-color-base;
&:focus,
&:hover {
.hover;
}
}
}
}

View File

@@ -20,6 +20,6 @@ title: BackTop
Property | Description | Type | Default
-----|-----|-----|------
visibilityHeight | the `BackTop` button will not show until the scroll height reaches this value | Number | 400
visibilityHeight | the `BackTop` button will not show until the scroll height reaches this value | number | 400
onClick | a callback function, which can be executed when you click the button | Function | -

View File

@@ -20,5 +20,5 @@ title: BackTop
| 参数 | 说明 | 类型 | 默认值 |
|-------------|----------------|--------------------|--------------|
| visibilityHeight | 滚动高度达到此参数值才出现 `BackTop` | Number | 400 |
| visibilityHeight | 滚动高度达到此参数值才出现 `BackTop` | number | 400 |
| onClick | 点击按钮的回调函数 | Function | - |

View File

@@ -19,7 +19,6 @@ export interface ScrollNumberProps {
count?: string | number;
component?: string;
onAnimated?: Function;
height?: number;
style?: React.CSSProperties;
}
@@ -29,7 +28,6 @@ export default class ScrollNumber extends Component<ScrollNumberProps, any> {
count: null,
onAnimated() {
},
height: 18,
};
lastCount: any;
@@ -105,16 +103,14 @@ export default class ScrollNumber extends Component<ScrollNumberProps, any> {
renderCurrentNumber(num, i) {
const position = this.getPositionByNum(num, i);
const height = this.props.height;
const removeTransition = this.state.animateStarted ||
(getNumberArray(this.lastCount)[i] === undefined);
return createElement('span', {
className: `${this.props.prefixCls}-only`,
style: {
transition: removeTransition && 'none',
WebkitTransform: `translateY(${-position * height}px)`,
transform: `translateY(${-position * height}px)`,
height,
WebkitTransform: `translateY(${-position * 100}%)`,
transform: `translateY(${-position * 100}%)`,
},
key: i,
}, this.renderNumberList(position));
@@ -139,6 +135,12 @@ export default class ScrollNumber extends Component<ScrollNumberProps, any> {
]), {
className: `${this.props.prefixCls} ${this.props.className}`,
});
// allow specify the border
// mock border-color by box-shadow for compatible with old usage:
// <Badge count={4} style={{ backgroundColor: '#fff', color: '#999', borderColor: '#d9d9d9' }} />
if (props.style && props.style.borderColor) {
props.style.boxShadow = `0 0 0 1px ${props.style.borderColor} inset`;
}
return createElement(
this.props.component || 'sup',
props,

View File

@@ -7,11 +7,10 @@ exports[`test renders ./components/badge/demo/basic.md correctly 1`] = `
href="#" />
<sup
class="ant-scroll-number ant-badge-count"
data-show="true"
height="18">
data-show="true">
<span
class="ant-scroll-number-only"
style="transition:none;-webkit-transform:translateY(-270px);transform:translateY(-270px);height:18px;">
style="transition:none;-webkit-transform:translateY(-1500%);transform:translateY(-1500%);">
<p
class="">
0
@@ -148,11 +147,10 @@ exports[`test renders ./components/badge/demo/change.md correctly 1`] = `
href="#" />
<sup
class="ant-scroll-number ant-badge-count"
data-show="true"
height="18">
data-show="true">
<span
class="ant-scroll-number-only"
style="transition:none;-webkit-transform:translateY(-270px);transform:translateY(-270px);height:18px;">
style="transition:none;-webkit-transform:translateY(-1500%);transform:translateY(-1500%);">
<p
class="">
0
@@ -279,13 +277,13 @@ exports[`test renders ./components/badge/demo/change.md correctly 1`] = `
<div
class="ant-btn-group">
<button
class="ant-btn ant-btn-ghost"
class="ant-btn"
type="button">
<i
class="anticon anticon-minus" />
</button>
<button
class="ant-btn ant-btn-ghost"
class="ant-btn"
type="button">
<i
class="anticon anticon-plus" />
@@ -301,8 +299,7 @@ exports[`test renders ./components/badge/demo/change.md correctly 1`] = `
href="#" />
<sup
class="ant-scroll-number ant-badge-dot"
data-show="true"
height="18" />
data-show="true" />
</span>
<span
class="ant-switch"
@@ -322,8 +319,7 @@ exports[`test renders ./components/badge/demo/dot.md correctly 1`] = `
class="anticon anticon-notification" />
<sup
class="ant-scroll-number ant-badge-dot"
data-show="true"
height="18" />
data-show="true" />
</span>
<span
class="ant-badge">
@@ -333,8 +329,7 @@ exports[`test renders ./components/badge/demo/dot.md correctly 1`] = `
</a>
<sup
class="ant-scroll-number ant-badge-dot"
data-show="true"
height="18" />
data-show="true" />
</span>
</div>
`;
@@ -349,11 +344,10 @@ exports[`test renders ./components/badge/demo/link.md correctly 1`] = `
class="head-example" />
<sup
class="ant-scroll-number ant-badge-count"
data-show="true"
height="18">
data-show="true">
<span
class="ant-scroll-number-only"
style="transition:none;-webkit-transform:translateY(-270px);transform:translateY(-270px);height:18px;">
style="transition:none;-webkit-transform:translateY(-1500%);transform:translateY(-1500%);">
<p
class="">
0
@@ -487,11 +481,10 @@ exports[`test renders ./components/badge/demo/no-wrapper.md correctly 1`] = `
title="25">
<sup
class="ant-scroll-number ant-badge-count"
data-show="true"
height="18">
data-show="true">
<span
class="ant-scroll-number-only"
style="transition:none;-webkit-transform:translateY(-216px);transform:translateY(-216px);height:18px;">
style="transition:none;-webkit-transform:translateY(-1200%);transform:translateY(-1200%);">
<p
class="">
0
@@ -615,7 +608,7 @@ exports[`test renders ./components/badge/demo/no-wrapper.md correctly 1`] = `
</span>
<span
class="ant-scroll-number-only"
style="transition:none;-webkit-transform:translateY(-270px);transform:translateY(-270px);height:18px;">
style="transition:none;-webkit-transform:translateY(-1500%);transform:translateY(-1500%);">
<p
class="">
0
@@ -745,11 +738,10 @@ exports[`test renders ./components/badge/demo/no-wrapper.md correctly 1`] = `
<sup
class="ant-scroll-number ant-badge-count"
data-show="true"
height="18"
style="background-color:#fff;color:#999;border-color:#d9d9d9;">
style="background-color:#fff;color:#999;box-shadow:0 0 0 1px #d9d9d9 inset;">
<span
class="ant-scroll-number-only"
style="transition:none;-webkit-transform:translateY(-252px);transform:translateY(-252px);height:18px;">
style="transition:none;-webkit-transform:translateY(-1400%);transform:translateY(-1400%);">
<p
class="">
0
@@ -879,7 +871,6 @@ exports[`test renders ./components/badge/demo/no-wrapper.md correctly 1`] = `
<sup
class="ant-scroll-number ant-badge-count"
data-show="true"
height="18"
style="background-color:#87d068;">
99+
</sup>
@@ -897,11 +888,10 @@ exports[`test renders ./components/badge/demo/overflow.md correctly 1`] = `
href="#" />
<sup
class="ant-scroll-number ant-badge-count"
data-show="true"
height="18">
data-show="true">
<span
class="ant-scroll-number-only"
style="transition:none;-webkit-transform:translateY(-342px);transform:translateY(-342px);height:18px;">
style="transition:none;-webkit-transform:translateY(-1900%);transform:translateY(-1900%);">
<p
class="">
0
@@ -1025,7 +1015,7 @@ exports[`test renders ./components/badge/demo/overflow.md correctly 1`] = `
</span>
<span
class="ant-scroll-number-only"
style="transition:none;-webkit-transform:translateY(-342px);transform:translateY(-342px);height:18px;">
style="transition:none;-webkit-transform:translateY(-1900%);transform:translateY(-1900%);">
<p
class="">
0
@@ -1157,8 +1147,7 @@ exports[`test renders ./components/badge/demo/overflow.md correctly 1`] = `
href="#" />
<sup
class="ant-scroll-number ant-badge-count"
data-show="true"
height="18">
data-show="true">
99+
</sup>
</span>
@@ -1170,8 +1159,7 @@ exports[`test renders ./components/badge/demo/overflow.md correctly 1`] = `
href="#" />
<sup
class="ant-scroll-number ant-badge-count"
data-show="true"
height="18">
data-show="true">
10+
</sup>
</span>
@@ -1183,8 +1171,7 @@ exports[`test renders ./components/badge/demo/overflow.md correctly 1`] = `
href="#" />
<sup
class="ant-scroll-number ant-badge-count"
data-show="true"
height="18">
data-show="true">
999+
</sup>
</span>

View File

@@ -46,10 +46,10 @@ const Test = React.createClass({
<a href="#" className="head-example" />
</Badge>
<ButtonGroup>
<Button type="ghost" onClick={this.decline}>
<Button onClick={this.decline}>
<Icon type="minus" />
</Button>
<Button type="ghost" onClick={this.increase}>
<Button onClick={this.increase}>
<Icon type="plus" />
</Button>
</ButtonGroup>

View File

@@ -20,7 +20,7 @@ import { Badge } from 'antd';
ReactDOM.render(<div>
<Badge count={25} />
<Badge count={4} style={{ backgroundColor: '#fff', color: '#999', borderColor: '#d9d9d9' }} />
<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

@@ -25,8 +25,8 @@ Badge normally appears in proximity to notification or head picture with eye-cat
| Property | Description | Type | Default |
|----------------|-------------------------|------------|---------|
| count | Number to show in badge | Number | |
| overflowCount | Max count to show | Number | 99 |
| dot | Whether to show red dot without number | Boolean | false |
| count | Number to show in badge | number | |
| overflowCount | Max count to show | number | 99 |
| dot | Whether to show red dot without number | boolean | false |
| status | Set Badge as a status dot | Enum{ 'success', 'processing, 'default', 'error', 'warning' } | '' |
| text | If `status` is set, `text` is to set the text of status dot | String | '' |
| text | If `status` is set, `text` is to set the text of status dot | string | '' |

View File

@@ -26,8 +26,8 @@ title: Badge
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|----------------|----------------------------------|------------|---------|--------|
| count | 展示的数字,大于 overflowCount 时显示为 `${overflowCount}+`,为 0 时隐藏 | Number | | |
| overflowCount | 展示封顶的数字值 | Number | | 99 |
| dot | 不展示数字,只有一个小红点 | Boolean | | false |
| count | 展示的数字,大于 overflowCount 时显示为 `${overflowCount}+`,为 0 时隐藏 | number | | |
| overflowCount | 展示封顶的数字值 | number | | 99 |
| dot | 不展示数字,只有一个小红点 | boolean | | false |
| status | 设置 Badge 为状态点 | Enum | 'success'、'processing'、'default'、'error'、'warning' | '' |
| text | 在设置了 `status` 的前提下有效,设置状态点的文本 | String | | '' |
| text | 在设置了 `status` 的前提下有效,设置状态点的文本 | string | | '' |

View File

@@ -12,14 +12,13 @@
&-count {
position: absolute;
transform: translateX(-50%);
top: -10px;
height: 20px;
border-radius: 10px;
min-width: 20px;
top: -@badge-height / 2;
height: @badge-height;
border-radius: @badge-height / 2;
min-width: @badge-height;
background: @highlight-color;
border: 1px solid transparent;
color: #fff;
line-height: 18px;
line-height: @badge-height;
text-align: center;
padding: 0 6px;
font-size: @font-size-base;
@@ -36,10 +35,10 @@
&-dot {
position: absolute;
transform: translateX(-50%);
transform-origin: 0px center;
top: -4px;
height: 8px;
width: 8px;
transform-origin: 0 center;
top: -@badge-dot-size / 2;
height: @badge-dot-size;
width: @badge-dot-size;
border-radius: 100%;
background: @highlight-color;
z-index: 10;
@@ -61,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;
@@ -99,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;
}
}
@@ -113,6 +124,10 @@
&-only {
display: inline-block;
transition: transform .3s @ease-in-out;
height: @badge-height;
> p {
height: @badge-height;
}
}
// for IE8/9 display
&.not-support-css-animation &-only {

View File

@@ -8,7 +8,7 @@ export interface BreadcrumbProps {
prefixCls?: string;
routes?: Array<any>;
params?: Object;
separator?: string | React.ReactNode;
separator?: React.ReactNode;
itemRender?: (route: any, params: any, routes: Array<any>, paths: Array<string>) => React.ReactNode;
style?: React.CSSProperties;
className?: string;
@@ -44,10 +44,7 @@ export default class Breadcrumb extends React.Component<BreadcrumbProps, any> {
static propTypes = {
prefixCls: React.PropTypes.string,
separator: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.element,
]),
separator: React.PropTypes.node,
routes: React.PropTypes.array,
params: React.PropTypes.object,
linkRender: React.PropTypes.func,
@@ -92,8 +89,8 @@ export default class Breadcrumb extends React.Component<BreadcrumbProps, any> {
} else if (children) {
crumbs = React.Children.map(children, (element: any, index) => {
warning(
element.type === BreadcrumbItem,
' `BreadcrumbItem` is required as the wrapper of children element. '
element && element.type.__ANT_BREADCRUMB_ITEM,
'Breadcrumb only accetps Breadcrumb.Item as it\'s children'
);
return cloneElement(element, {
separator,

View File

@@ -8,6 +8,8 @@ export interface BreadcrumbItemProps {
}
export default class BreadcrumbItem extends React.Component<BreadcrumbItemProps, any> {
static __ANT_BREADCRUMB_ITEM = true;
static defaultProps = {
prefixCls: 'ant-breadcrumb',
separator: '/',

View File

@@ -0,0 +1,21 @@
import React from 'react';
import { mount } from 'enzyme';
import Breadcrumb from '../Breadcrumb';
describe('Breadcrumb', () => {
it('warns on non-Breadcrumb.Item children', () => {
const MyCom = () => <div>foo</div>;
spyOn(console, 'error');
mount(
<Breadcrumb>
<MyCom />
</Breadcrumb>
);
// eslint-disable-next-line
expect(console.error.calls.count()).toBe(1);
// eslint-disable-next-line
expect(console.error.calls.argsFor(0)[0]).toContain(
'Breadcrumb only accetps Breadcrumb.Item as it\'s children'
);
});
});

View File

@@ -17,10 +17,10 @@ A breadcrumb displays the current location within a hierarchy. It allows going b
| Property | Description | Type | Optional | Default |
|-----------|-----------------------------------|-----------------|---------|--------|
| routes | The routing stack information of router | Array | | - |
| params | Routing parameter | Object | | - |
| separator | Custom separator | String or Element | | '/' |
| itemRender | Custom item renderer | (route, params, routes, paths) => React.ReactNode | | - |
| routes | The routing stack information of router | object[] | | - |
| params | Routing parameter | object | | - |
| separator | Custom separator | string\|ReactNode | | '/' |
| itemRender | Custom item renderer | (route, params, routes, paths) => ReactNode | | - |
> `linkRender` and `nameRender` were removed after `antd@2.0`, please use `itemRender` instead.

View File

@@ -17,10 +17,10 @@ title: Breadcrumb
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|-----------|-----------------------------------|-----------------|---------|--------|
| routes | router 的路由栈信息 | Array | | - |
| params | 路由的参数 | Object | | - |
| separator | 分隔符自定义 | String or Element | | '/' |
| itemRender | 自定义链接函数,和 react-router 配置使用 | (route, params, routes, paths) => React.ReactNode | | - |
| routes | router 的路由栈信息 | object[] | | - |
| params | 路由的参数 | object | | - |
| separator | 分隔符自定义 | string\|ReactNode | | '/' |
| itemRender | 自定义链接函数,和 react-router 配置使用 | (route, params, routes, paths) => ReactNode | | - |
> 2.0 之后,`linkRender` 和 `nameRender` 被移除,请使用 `itemRender` 来代替。

View File

@@ -3,7 +3,7 @@
@breadcrumb-prefix-cls: ~"@{ant-prefix}-breadcrumb";
.@{breadcrumb-prefix-cls} {
color: @text-color-secondary;
color: @text-color;
font-size: @font-size-base;
a {
@@ -25,7 +25,7 @@
&-separator {
margin: 0 8px;
color: @border-color-base;
color: rgba(0, 0, 0, 0.3);
}
&-link {

View File

@@ -14,13 +14,6 @@ exports[`test renders ./components/button/demo/basic.md correctly 1`] = `
Default
</span>
</button>
<button
class="ant-btn ant-btn-ghost"
type="button">
<span>
Ghost
</span>
</button>
<button
class="ant-btn ant-btn-dashed"
type="button">
@@ -28,6 +21,13 @@ exports[`test renders ./components/button/demo/basic.md correctly 1`] = `
Dashed
</span>
</button>
<button
class="ant-btn ant-btn-danger"
type="button">
<span>
Danger
</span>
</button>
</div>
`;
@@ -97,7 +97,7 @@ exports[`test renders ./components/button/demo/button-group.md correctly 1`] = `
</span>
</button>
<button
class="ant-btn ant-btn-ghost"
class="ant-btn"
type="button">
<span>
M
@@ -188,14 +188,14 @@ exports[`test renders ./components/button/demo/disabled.md correctly 1`] = `
</button>
<br />
<button
class="ant-btn ant-btn-ghost"
class="ant-btn"
type="button">
<span>
Ghost
</span>
</button>
<button
class="ant-btn ant-btn-ghost"
class="ant-btn"
disabled=""
type="button">
<span>
@@ -221,6 +221,33 @@ exports[`test renders ./components/button/demo/disabled.md correctly 1`] = `
</div>
`;
exports[`test renders ./components/button/demo/ghost.md correctly 1`] = `
<div
style="background:rgb(190, 200, 200);padding:26px 16px 16px;">
<button
class="ant-btn ant-btn-primary ant-btn-background-ghost"
type="button">
<span>
Primary Ghost
</span>
</button>
<button
class="ant-btn ant-btn-background-ghost"
type="button">
<span>
Default Ghost
</span>
</button>
<button
class="ant-btn ant-btn-dashed ant-btn-background-ghost"
type="button">
<span>
Dashed Ghost
</span>
</button>
</div>
`;
exports[`test renders ./components/button/demo/icon.md correctly 1`] = `
<div>
<button
@@ -255,13 +282,13 @@ exports[`test renders ./components/button/demo/icon.md correctly 1`] = `
</button>
<br />
<button
class="ant-btn ant-btn-ghost ant-btn-circle ant-btn-icon-only"
class="ant-btn ant-btn-circle ant-btn-icon-only"
type="button">
<i
class="anticon anticon-search" />
</button>
<button
class="ant-btn ant-btn-ghost"
class="ant-btn"
type="button">
<i
class="anticon anticon-search" />
@@ -324,6 +351,19 @@ exports[`test renders ./components/button/demo/loading.md correctly 1`] = `
Click me!
</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>
`;
@@ -337,14 +377,14 @@ exports[`test renders ./components/button/demo/multiple.md correctly 1`] = `
</span>
</button>
<button
class="ant-btn ant-btn-ghost"
class="ant-btn"
type="button">
<span>
secondary
</span>
</button>
<button
class="ant-btn ant-btn-ghost ant-dropdown-trigger"
class="ant-btn ant-dropdown-trigger"
type="button">
<span>
more

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

@@ -24,7 +24,7 @@ function insertSpace(child) {
return child;
}
export type ButtonType = 'primary' | 'ghost' | 'dashed'
export type ButtonType = 'primary' | 'ghost' | 'dashed' | 'danger'
export type ButtonShape = 'circle' | 'circle-outline'
export type ButtonSize = 'small' | 'large'
@@ -41,14 +41,17 @@ export interface ButtonProps {
style?: React.CSSProperties;
prefixCls?: string;
className?: string;
ghost?: boolean;
}
export default class Button extends React.Component<ButtonProps, any> {
static Group: any;
static __ANT_BUTTON = true;
static defaultProps = {
prefixCls: 'ant-btn',
loading: false,
ghost: false,
};
static propTypes = {
@@ -101,7 +104,9 @@ export default class Button extends React.Component<ButtonProps, any> {
}
render() {
const { type, shape, size = '', className, htmlType, children, icon, loading, prefixCls, ...others } = this.props;
const {
type, shape, size = '', className, htmlType, children, icon, loading, prefixCls, ghost, ...others,
} = this.props;
// large => lg
// small => sm
@@ -116,6 +121,7 @@ export default class Button extends React.Component<ButtonProps, any> {
[`${prefixCls}-${sizeCls}`]: sizeCls,
[`${prefixCls}-icon-only`]: !children && icon,
[`${prefixCls}-loading`]: loading,
[`${prefixCls}-background-ghost`]: ghost,
}, className);
const iconType = loading ? 'loading' : icon;

View File

@@ -7,19 +7,15 @@ title:
## zh-CN
按钮有四种类型:主按钮、次按钮、幽灵按钮、虚线按钮
按钮有四种类型:主按钮、次按钮、虚线按钮、危险按钮。主按钮在同一个操作区域最多出现一次
通过设置 `type``primary` `ghost` `dashed` 可分别创建主按钮、幽灵按钮、虚线按钮,若不设置 `type` 值则为次按钮。不同的样式可以用来区别其重要程度
主按钮和次按钮可独立使用,幽灵按钮用于和主按钮组合。需要强引导用主按钮,切记主按钮在同一个操作区域最多出现一次。
> `danger` 在 `antd@2.7` 后支持
## en-US
There are primary button, default button, ghost button and dashed button in antd.
There are `primary` button, `default` button, `dashed` button and `danger` button in antd.
`type` can be set as `primary` or `ghost` or `dashed`, in order to create primary button or ghost button or dashed button. If nothing is provided to `type`, we will get default button. Users can tell the significance of button from it's appearance.
Primary button and default button can be used without other button, but ghost button must be used with primary button.
> `danger` is supported after `antd@2.7`.
````jsx
import { Button } from 'antd';
@@ -28,8 +24,8 @@ ReactDOM.render(
<div>
<Button type="primary">Primary</Button>
<Button>Default</Button>
<Button type="ghost">Ghost</Button>
<Button type="dashed">Dashed</Button>
<Button type="danger">Danger</Button>
</div>
, mountNode);
````

View File

@@ -1,5 +1,5 @@
---
order: 5
order: 6
title:
zh-CN: 按钮组合
en-US: Button Group
@@ -36,7 +36,7 @@ ReactDOM.render(
<ButtonGroup>
<Button type="primary">L</Button>
<Button>M</Button>
<Button type="ghost">M</Button>
<Button>M</Button>
<Button type="dashed">R</Button>
</ButtonGroup>

View File

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

View File

@@ -0,0 +1,26 @@
---
order: 8
title:
zh-CN: 幽灵按钮
en-US: Ghost Button
---
## zh-CN
幽灵按钮将其他按钮的内容反色,背景变为透明,常用在有色背景上。
## en-US
`ghost` property will make button's background transparent, it is common used in colored background.
````jsx
import { Button } from 'antd';
ReactDOM.render(
<div style={{ background: 'rgb(190, 200, 200)', padding: '26px 16px 16px' }}>
<Button type="primary" ghost>Primary Ghost</Button>
<Button ghost>Default Ghost</Button>
<Button type="dashed" ghost>Dashed Ghost</Button>
</div>
, mountNode);
````

View File

@@ -27,8 +27,8 @@ ReactDOM.render(
<Button shape="circle" icon="search" />
<Button icon="search">Search</Button>
<br />
<Button type="ghost" shape="circle" icon="search" />
<Button type="ghost" icon="search">Search</Button>
<Button shape="circle" icon="search" />
<Button icon="search">Search</Button>
<Button type="dashed" shape="circle" icon="search" />
<Button type="dashed" icon="search">Search</Button>
</div>,

View File

@@ -45,6 +45,9 @@ const App = React.createClass({
<Button type="primary" icon="poweroff" loading={this.state.iconLoading} onClick={this.enterIconLoading}>
Click me!
</Button>
<br />
<Button shape="circle" loading />
<Button type="primary" shape="circle" loading />
</div>
);
},

View File

@@ -1,5 +1,5 @@
---
order: 6
order: 5
title:
zh-CN: 多个按钮组合
en-US: Multiple Buttons
@@ -32,9 +32,9 @@ const menu = (
ReactDOM.render(
<div>
<Button type="primary">primary</Button>
<Button type="ghost">secondary</Button>
<Button>secondary</Button>
<Dropdown overlay={menu}>
<Button type="ghost">
<Button>
more <Icon type="down" />
</Button>
</Dropdown>

View File

@@ -16,13 +16,14 @@ To get a customized button, just set `type`/`shape`/`size`/`loading`/`disabled`.
Property | Description | Type | Default
-----|-----|-----|------
type | can be set to `primary` `ghost` `dashed` or omitted | string | -
type | can be set to `primary` `dashed` `danger`(added in 2.7) or omitted | string | 'default'
htmlType | to set the original `type` of `button`, see: [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) | string | `button`
icon | set the icon of button, see: Icon component | string | -
shape | can be set to `circle` or omitted | string | -
size | can be set to `small` `large` or omitted | string | `default`
loading | to set the loading status of button | boolean | false
loading | to set the loading status of button | boolean | `false`
onClick | set the handler to handle `click` event | function | -
ghost | make background transparent and invert text and border color, added in 2.7 | boolean | false
`<Button>Hello world!</Button>` will be rendered into `<button>Hello world!</button>`, and all the properties which are not listed above will be transferred to the `<button>` tag.

View File

@@ -19,13 +19,14 @@ subtitle: 按钮
属性 | 说明 | 类型 | 默认值
-----|-----|-----|------
type | 设置按钮类型,可选值为 `primary` `ghost` `dashed` 或者不设 | string | -
type | 设置按钮类型,可选值为 `primary` `dashed` `danger`(版本 2.7 中增加) 或者不设 | string | -
htmlType | 设置 `button` 原生的 `type` 值,可选值请参考 [HTML 标准](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) | string | `button`
icon | 设置按钮的图标类型 | string | -
shape | 设置按钮形状,可选值为 `circle` 或者不设 | string | -
size | 设置按钮大小,可选值为 `small` `large` 或者不设 | string | `default`
loading | 设置按钮载入状态 | boolean | false
loading | 设置按钮载入状态 | boolean | `false`
onClick | `click` 事件的 handler | function | -
ghost | 幽灵属性,使按钮背景透明,版本 2.7 中增加 | boolean | false
`<Button>Hello world!</Button>` 最终会被渲染为 `<button>Hello world!</button>`,并且除了上表中的属性,其它属性都会直接传到 `<button></button>`

View File

@@ -4,6 +4,11 @@
@btn-prefix-cls: ~"@{ant-prefix}-btn";
// for compatibile
@btn-ghost-color : @text-color;
@btn-ghost-bg : transparent;
@btn-ghost-border : @border-color-base;
// Button styles
// -----------------------------
.@{btn-prefix-cls} {
@@ -48,6 +53,10 @@
.btn-dashed;
}
&-danger {
.btn-danger;
}
&-circle,
&-circle-outline {
.btn-circle(@btn-prefix-cls);
@@ -69,7 +78,11 @@
display: none;
}
&&-loading {
&&-loading:before {
display: block;
}
&&-loading:not(&-circle):not(&-circle-outline) {
padding-left: 29px;
pointer-events: none;
position: relative;
@@ -77,12 +90,9 @@
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;
@@ -112,11 +122,25 @@
bottom: -1px;
right: -1px;
border-radius: inherit;
border: 0 solid @primary-color;
border: 1.5px solid @primary-color;
opacity: 0.4;
animation: buttonEffect 0.36s ease-out forwards;
animation: buttonEffect 0.4s ease-in-out forwards;
display: block;
}
&-danger&-clicked:after {
border-color: @btn-danger-bg;
}
&-background-ghost {
background: transparent!important;
border-color: #fff;
color: #fff;
}
&-background-ghost&-primary {
.button-variant-other(@primary-color; transparent; @primary-color);
}
}
@keyframes buttonEffect {
@@ -126,6 +150,5 @@
left: -6px;
bottom: -6px;
right: -6px;
border-width: 6px;
}
}

View File

@@ -112,7 +112,7 @@
touch-action: manipulation;
cursor: pointer;
background-image: none;
border: 1px solid transparent;
border: @border-width-base @border-style-base transparent;
white-space: nowrap;
line-height: @line-height-base;
.button-size(@btn-padding-base; @font-size-base; @btn-border-radius-base);
@@ -177,12 +177,17 @@
.button-variant-other(@btn-ghost-color, @btn-ghost-bg, @btn-ghost-border);
}
// ghost button style
// dashed button style
.btn-dashed() {
.button-variant-other(@btn-ghost-color, @btn-ghost-bg, @btn-ghost-border);
.button-variant-other(@btn-default-color, @btn-default-bg, @btn-default-border);
border-style: dashed;
}
// danger button style
.btn-danger() {
.button-variant-primary(@btn-danger-color, @btn-danger-bg);
}
// circle button: the content only contains icon
.btn-circle(@btnClassName: btn) {
.square(@btn-circle-size);

View File

@@ -29,5 +29,5 @@ When data is in the form of date, such as schedule, timetable, prices calendar,
| fullscreen | to set whether full-screen display | boolean | true |
| dateCellRender | to set the way of renderer the date cell | function(date: moment): ReactNode | - |
| monthCellRender | to set the way of renderer the month cell | function(date: moment): ReactNode | - |
| locale | set locale | Object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
| locale | set locale | object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
| onPanelChange| the callback when panel change | function(date: moment, mode: string) | - |

View File

@@ -31,5 +31,5 @@ title: Calendar
| fullscreen | 是否全屏显示 | boolean | true |
| dateCellRender | 自定义渲染日期单元格| function(date: moment): ReactNode | 无 |
| monthCellRender | 自定义渲染月单元格 | function(date: moment): ReactNode | 无 |
| locale | 国际化配置 | Object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
| onPanelChange| 日期面板变化回调 | function(date: moment, mode: string) | 无 |

View File

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

View File

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

View File

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

View File

@@ -6,7 +6,7 @@
font-size: @font-size-base;
line-height: @line-height-base;
outline: none;
border-top: 1px solid @border-color-base;
border-top: @border-width-base @border-style-base @border-color-base;
&-month-select {
margin-left: 5px;
@@ -204,7 +204,6 @@
color: @text-color;
}
&-fullscreen &-month-panel-current-cell &-month,
&-fullscreen &-today &-date {
border-top-color: @primary-color;

View File

@@ -19,7 +19,7 @@ A card can be used to display content related to a single subject. The content c
| Property | Description | Type | Default |
|----------|----------------|----------|--------------|
| title | Card title | React.Element | - |
| extra | Content to render in the top-right corner of the card | React.Element | - |
| bordered | Toggles rendering of the border around the card | Boolean | true |
| bodyStyle | Inline style to apply to the card content | Object | - |
| title | Card title | string\|ReactNode | - |
| extra | Content to render in the top-right corner of the card | string\|ReactNode | - |
| bordered | Toggles rendering of the border around the card | boolean | true |
| bodyStyle | Inline style to apply to the card content | object | - |

View File

@@ -20,7 +20,7 @@ cols: 1
| 参数 | 说明 | 类型 | 默认值 |
|----------|----------------|----------|--------------|
| title | 卡片标题 | React.Element | - |
| extra | 卡片右上角的操作区域 | React.Element | - |
| bordered | 是否有边框 | Boolean | true |
| bodyStyle | 内容区域自定义样式 | Object | - |
| title | 卡片标题 | string\|ReactNode | - |
| extra | 卡片右上角的操作区域 | string\|ReactNode | - |
| bordered | 是否有边框 | boolean | true |
| bodyStyle | 内容区域自定义样式 | object | - |

View File

@@ -4,7 +4,7 @@
.@{card-prefix-cls} {
background: @component-background;
border-radius: @border-radius-sm;
border-radius: @border-radius-base;
font-size: @font-size-base;
position: relative;
overflow: hidden;
@@ -13,17 +13,16 @@
&:hover {
box-shadow: @box-shadow-base;
border-color: transparent;
z-index: 1;
}
&-bordered {
border: 1px solid @border-color-split;
border: @border-width-base @border-style-base @border-color-split;
}
&-head {
height: 48px;
line-height: 48px;
border-bottom: 1px solid @border-color-split;
border-bottom: @border-width-base @border-style-base @border-color-split;
padding: 0 24px;
&-title {

View File

@@ -16,11 +16,11 @@ A carousel component. Scales with its container.
| Property | Description | Type | Default |
|------------------|----------------------------------------------|----------|---------------------------------|
| effect | Animation effect, either `scrollx` or `fade` | String | scrollx |
| dots | Whether to show the dots at the bottom of the gallery | Boolean | true |
| vertical | Whether to use a vertical display | Boolean | false |
| autoplay | Whether to scroll automatically | Boolean | false |
| easing | Transition name | String | linear |
| effect | Animation effect, either `scrollx` or `fade` | string | scrollx |
| dots | Whether to show the dots at the bottom of the gallery | boolean | true |
| vertical | Whether to use a vertical display | boolean | false |
| autoplay | Whether to scroll automatically | boolean | false |
| easing | Transition name | string | linear |
| beforeChange | Callback function called before the current index changes | function(from, to) |
| afterChange | Callback function called after the current index changes | function(current) |

View File

@@ -17,11 +17,11 @@ subtitle: 走马灯
| 参数 | 说明 | 类型 | 默认值 |
|------------------|----------------------------------------------|----------|---------------------------------|
| effect | 动画效果函数,可取 scrollx, fade | String | scrollx |
| dots | 是否显示面板指示点 | Boolean | true |
| vertical | 垂直显示 | Boolean | false |
| autoplay | 是否自动切换 | Boolean | false |
| easing | 动画效果 | String | linear |
| effect | 动画效果函数,可取 scrollx, fade | string | scrollx |
| dots | 是否显示面板指示点 | boolean | true |
| vertical | 垂直显示 | boolean | false |
| autoplay | 是否自动切换 | boolean | false |
| easing | 动画效果 | string | linear |
| beforeChange | 切换面板的回调 | function(from, to) | 无
| afterChange | 切换面板的回调 | function(current) | 无

View File

@@ -83,7 +83,7 @@
.slick-vertical .slick-slide {
display: block;
height: auto;
border: 1px solid transparent;
border: @border-width-base @border-style-base transparent;
}
.slick-arrow.slick-hidden {
display: none;
@@ -137,34 +137,33 @@
// Dots
.slick-dots {
position: absolute;
bottom: 6px;
bottom: 12px;
list-style: none;
display: block;
text-align: center;
padding: 0;
width: 100%;
height: @carousel-dot-height;
li {
position: relative;
display: inline-block;
height: 20px;
width: 20px;
line-height: 20px;
vertical-align: top;
text-align: center;
margin: 0 2px;
padding: 0;
button {
border: 0;
cursor: pointer;
background: #000;
background: #fff;
opacity: 0.3;
display: inline-block;
width: 7px;
height: 7px;
border-radius: 7px;
display: block;
width: @carousel-dot-width;
height: @carousel-dot-height;
border-radius: 1px;
outline: none;
font-size: 0;
color: transparent;
transition: all .3s;
transition: all .5s;
&:hover,
&:focus {
opacity: 0.75;
@@ -173,7 +172,7 @@
&.slick-active button {
background: #fff;
opacity: 1;
box-shadow: 0 0 3px rgba(0, 0, 0, .25);
width: @carousel-dot-active-width;
&:hover,
&:focus {
opacity: 1;
@@ -185,10 +184,23 @@
.@{ant-prefix}-carousel-vertical {
.slick-dots {
width: 20px;
width: @carousel-dot-height;
bottom: auto;
right: 8px;
right: 12px;
top: 50%;
transform: translateY(-50%);
height: auto;
li {
margin: 0 2px;
vertical-align: baseline;
button {
width: @carousel-dot-height;
height: @carousel-dot-width;
}
&.slick-active button {
width: @carousel-dot-height;
height: @carousel-dot-active-width;
}
}
}
}

View File

@@ -1,6 +1,7 @@
exports[`test renders ./components/cascader/demo/basic.md correctly 1`] = `
<span
class="ant-cascader-picker">
class="ant-cascader-picker"
tabindex="0">
<input
autocomplete="off"
class="ant-input ant-cascader-input "
@@ -17,7 +18,8 @@ exports[`test renders ./components/cascader/demo/basic.md correctly 1`] = `
exports[`test renders ./components/cascader/demo/change-on-select.md correctly 1`] = `
<span
class="ant-cascader-picker">
class="ant-cascader-picker"
tabindex="0">
<input
autocomplete="off"
class="ant-input ant-cascader-input "
@@ -35,7 +37,8 @@ exports[`test renders ./components/cascader/demo/change-on-select.md correctly 1
exports[`test renders ./components/cascader/demo/custom-render.md correctly 1`] = `
<span
class="ant-cascader-picker"
style="width:270px;">
style="width:270px;"
tabindex="0">
<input
autocomplete="off"
class="ant-input ant-cascader-input "
@@ -69,7 +72,8 @@ exports[`test renders ./components/cascader/demo/custom-trigger.md correctly 1`]
<span>
Unselect 
<a
href="#">
href="#"
tabindex="0">
Change city
</a>
</span>
@@ -77,7 +81,8 @@ exports[`test renders ./components/cascader/demo/custom-trigger.md correctly 1`]
exports[`test renders ./components/cascader/demo/default-value.md correctly 1`] = `
<span
class="ant-cascader-picker">
class="ant-cascader-picker"
tabindex="0">
<input
autocomplete="off"
class="ant-input ant-cascader-input "
@@ -97,7 +102,8 @@ exports[`test renders ./components/cascader/demo/default-value.md correctly 1`]
exports[`test renders ./components/cascader/demo/disabled-option.md correctly 1`] = `
<span
class="ant-cascader-picker">
class="ant-cascader-picker"
tabindex="0">
<input
autocomplete="off"
class="ant-input ant-cascader-input "
@@ -114,7 +120,8 @@ exports[`test renders ./components/cascader/demo/disabled-option.md correctly 1`
exports[`test renders ./components/cascader/demo/hover.md correctly 1`] = `
<span
class="ant-cascader-picker">
class="ant-cascader-picker"
tabindex="0">
<input
autocomplete="off"
class="ant-input ant-cascader-input "
@@ -131,7 +138,8 @@ exports[`test renders ./components/cascader/demo/hover.md correctly 1`] = `
exports[`test renders ./components/cascader/demo/lazy.md correctly 1`] = `
<span
class="ant-cascader-picker">
class="ant-cascader-picker"
tabindex="0">
<input
autocomplete="off"
class="ant-input ant-cascader-input "
@@ -148,7 +156,8 @@ exports[`test renders ./components/cascader/demo/lazy.md correctly 1`] = `
exports[`test renders ./components/cascader/demo/search.md correctly 1`] = `
<span
class="ant-cascader-picker">
class="ant-cascader-picker"
tabindex="0">
<input
autocomplete="off"
class="ant-input ant-cascader-input "
@@ -165,7 +174,8 @@ exports[`test renders ./components/cascader/demo/search.md correctly 1`] = `
exports[`test renders ./components/cascader/demo/size.md correctly 1`] = `
<div>
<span
class="ant-cascader-picker">
class="ant-cascader-picker"
tabindex="0">
<input
autocomplete="off"
class="ant-input ant-cascader-input ant-input-lg"
@@ -181,7 +191,8 @@ exports[`test renders ./components/cascader/demo/size.md correctly 1`] = `
<br />
<br />
<span
class="ant-cascader-picker">
class="ant-cascader-picker"
tabindex="0">
<input
autocomplete="off"
class="ant-input ant-cascader-input "
@@ -197,7 +208,8 @@ exports[`test renders ./components/cascader/demo/size.md correctly 1`] = `
<br />
<br />
<span
class="ant-cascader-picker">
class="ant-cascader-picker"
tabindex="0">
<input
autocomplete="off"
class="ant-input ant-cascader-input ant-input-sm"

View File

@@ -25,6 +25,10 @@ const options = [{
children: [{
value: 'xihu',
label: 'West Lake',
}, {
value: 'xiasha',
label: 'Xia Sha',
disabled: true,
}],
}],
}, {

View File

@@ -22,10 +22,10 @@ Cascade selection box.
| Property | Description | Type | Default |
|------|------|------|--------|
| options | data options of cascade | object | - |
| defaultValue | initial selected value | array |[] |
| value | selected value | array | - |
| defaultValue | initial selected value | [CascaderOptionType](https://git.io/vMMoK)[] |[] |
| value | selected value | [CascaderOptionType](https://git.io/vMMoK)[] | - |
| onChange | callback when finishing cascader select | `(value, selectedOptions) => void` | - |
| displayRender | render function of displaying selected options | `(label, selectedOptions) => React.ReactNode` | `label => label.join(' / ')` |
| displayRender | render function of displaying selected options | `(label, selectedOptions) => ReactNode` | `label => label.join(' / ')` |
| style | additional style | string | - |
| className | additional css class | string | - |
| popupClassName | additional className of popup overlay | string | - |
@@ -36,8 +36,8 @@ Cascade selection box.
| allowClear | whether allow clear | boolean | true |
| expandTrigger | expand current item when click or hover, one of 'click' 'hover' | string | 'click' |
| changeOnSelect | change value on each selection if set to true, see above demo for details | boolean | false |
| showSearch | Whether show search input in single mode. | Boolean or Object | false |
| notFoundContent | Specify content to show when no result matches. | String | 'Not Found' |
| showSearch | Whether show search input in single mode. | boolean\|object | false |
| notFoundContent | Specify content to show when no result matches. | string | 'Not Found' |
| loadData | To load option lazily, and it cannot work with `showSearch` | `(selectedOptions) => void` | - |
| getPopupContainer | Parent Node which the selector should be rendered to. Default to `body`. When position issues happen, try to modify it into scrollable content and position it relative.[example](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
@@ -46,7 +46,7 @@ Fields in `showSearch`:
| Property | Description | Type | Default |
|----------|-------------|------|---------|
| filter | 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. | `function(inputValue, path): boolean` | |
| render | Used to render filtered options. | `function(inputValue, path): React.ReactNode` | |
| render | Used to render filtered options. | `function(inputValue, path): ReactNode` | |
| sort | Used to sort filtered options. | `function(a, b, inputValue)` | |
| matchInputWidth | Whether the width of result list equals to input's | boolean | |

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

@@ -22,23 +22,23 @@ subtitle: 级联选择
| 参数 | 说明 | 类型 | 默认值 |
|------|------|------|--------|
| options | 可选项数据源 | Object | - |
| defaultValue | 默认的选中项 | Array |[] |
| value | 指定选中项 | Array | - |
| options | 可选项数据源 | object | - |
| defaultValue | 默认的选中项 | [CascaderOptionType](https://git.io/vMMoK)[] |[] |
| value | 指定选中项 | [CascaderOptionType](https://git.io/vMMoK)[] | - |
| onChange | 选择完成后的回调 | `(value, selectedOptions) => void` | - |
| displayRender | 选择后展示的渲染函数 | `(label, selectedOptions) => React.ReactNode` | `label => label.join(' / ')` |
| style | 自定义样式 | String | - |
| className | 自定义类名 | String | - |
| popupClassName | 自定义浮层类名 | String | - |
| displayRender | 选择后展示的渲染函数 | `(label, selectedOptions) => ReactNode` | `label => label.join(' / ')` |
| style | 自定义样式 | string | - |
| className | 自定义类名 | string | - |
| popupClassName | 自定义浮层类名 | string | - |
| popupPlacement | 浮层预设位置:`bottomLeft` `bottomRight` `topLeft` `topRight` | Enum | `bottomLeft` |
| placeholder | 输入框占位文本 | String | '请选择' |
| size | 输入框大小,可选 `large` `default` `small` | String | `default` |
| disabled | 禁用 | Boolean | false |
| allowClear | 是否支持清除 | Boolean | true |
| expandTrigger | 次级菜单的展开方式,可选 'click' 和 'hover' | String | 'click' |
| changeOnSelect | 当此项为 true 时,点选每级菜单选项值都会发生变化,具体见上面的演示 | Boolean | false |
| showSearch | 在选择框中显示搜索框 | Boolean | false |
| notFoundContent | 当下拉列表为空时显示的内容 | String | 'Not Found' |
| placeholder | 输入框占位文本 | string | '请选择' |
| size | 输入框大小,可选 `large` `default` `small` | string | `default` |
| disabled | 禁用 | boolean | false |
| allowClear | 是否支持清除 | boolean | true |
| expandTrigger | 次级菜单的展开方式,可选 'click' 和 'hover' | string | 'click' |
| changeOnSelect | 当此项为 true 时,点选每级菜单选项值都会发生变化,具体见上面的演示 | boolean | false |
| showSearch | 在选择框中显示搜索框 | boolean | false |
| notFoundContent | 当下拉列表为空时显示的内容 | string | 'Not Found' |
| loadData | 用于动态加载选项,无法与 `showSearch` 一起使用 | `(selectedOptions) => void` | - |
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
@@ -47,7 +47,7 @@ subtitle: 级联选择
| 参数 | 说明 | 类型 | 默认值 |
|------|------|------|--------|
| filter | 接收 `inputValue` `path` 两个参数,当 `path` 符合筛选条件时,应返回 true反之则返回 false。 | `function(inputValue, path): boolean` | |
| render | 用于渲染 filter 后的选项 | `function(inputValue, path): React.ReactNode` | |
| render | 用于渲染 filter 后的选项 | `function(inputValue, path): ReactNode` | |
| sort | 用于排序 filter 后的选项 | `function(a, b, inputValue)` | |
| matchInputWidth | 搜索结果列表是否与输入框同宽 | boolean | |

View File

@@ -1,16 +1,19 @@
@import "../../style/themes/default";
@import "../../style/mixins/index";
@import "../../input/style/mixin";
@cascader-prefix-cls: ~"@{ant-prefix}-cascader";
.@{cascader-prefix-cls} {
font-size: @font-size-base;
&-input.@{ant-prefix}-input {
background-color: transparent;
cursor: pointer;
width: 100%;
z-index: 1;
}
&-picker {
position: relative;
display: inline-block;
@@ -18,6 +21,7 @@
font-size: @font-size-base;
background-color: #fff;
border-radius: @border-radius-base;
outline: 0;
&-with-value &-label {
color: transparent;
@@ -25,13 +29,17 @@
&-disabled {
cursor: not-allowed;
background: @input-disabled-bg;
color: @disabled-color;
.@{cascader-prefix-cls}-input {
cursor: not-allowed;
background: @input-disabled-bg;
}
}
&:focus .@{cascader-prefix-cls}-input {
.active;
}
&-label {
position: absolute;
left: 0;
@@ -131,7 +139,7 @@
list-style: none;
margin: 0;
padding: 0;
border-right: 1px solid @border-color-split;
border-right: @border-width-base @border-style-base @border-color-split;
overflow: auto;
&:first-child {
border-radius: @border-radius-base 0 0 @border-radius-base;

View File

@@ -58,7 +58,7 @@ export default class CheckboxGroup extends React.Component<CheckboxGroupProps, C
getOptions() {
const { options } = this.props;
// https://github.com/Microsoft/TypeScript/issues/7960
return (options as Array<any>).map(option => {
return (options as Array<CheckboxOptionType>).map(option => {
if (typeof option === 'string') {
return {
label: option,

View File

@@ -17,15 +17,15 @@ Checkbox.
| Property | Description | Type | Default |
|----------|------------------|----------|--------|
| checked | Specifies whether the checkbox is selected. | Boolean | false |
| defaultChecked | Specifies the initial state: whether or not the checkbox is selected. | Boolean | false |
| checked | Specifies whether the checkbox is selected. | boolean | false |
| defaultChecked | Specifies the initial state: whether or not the checkbox is selected. | boolean | false |
| onChange | The callback function that is triggered when the state changes. | Function(e:Event) | - |
### Checkbox Group
| Property | Description | Type | Default |
|----------|------------------|----------|--------|
| defaultValue | Default selected value | Array | [] |
| value | Used for setting the currently selected value. | Array | [] |
| options | Specifies options | Array | [] |
| defaultValue | Default selected value | string[] | [] |
| value | Used for setting the currently selected value. | string[] | [] |
| options | Specifies options | string[] | [] |
| onChange | The callback function that is triggered when the state changes. | Function(checkedValue) | - |

View File

@@ -18,16 +18,16 @@ title: Checkbox
| 参数 | 说明 | 类型 | 默认值 |
|----------|------------------|----------|--------|
| checked | 指定当前是否选中 | Boolean | false |
| defaultChecked | 初始是否选中 | Boolean | false |
| checked | 指定当前是否选中 | boolean | false |
| defaultChecked | 初始是否选中 | boolean | false |
| onChange | 变化时回调函数 | Function(e:Event) | - |
| indeterminate | 设置 indeterminate 状态,只负责样式控制 | Boolean | false |
| indeterminate | 设置 indeterminate 状态,只负责样式控制 | boolean | false |
### Checkbox Group
| 参数 | 说明 | 类型 | 默认值 |
|----------|------------------|----------|--------|
| defaultValue | 默认选中的选项 | Array | [] |
| value | 指定选中的选项| Array | [] |
| options | 指定可选项 | Array | [] |
| defaultValue | 默认选中的选项 | string[] | [] |
| value | 指定选中的选项| string[] | [] |
| options | 指定可选项 | string[] | [] |
| onChange | 变化时回调函数 | Function(checkedValue) | - |

View File

@@ -27,8 +27,8 @@
display: inline-block;
width: 14px;
height: 14px;
border: 1px solid @border-color-base;
border-radius: 3px;
border: @border-width-base @border-style-base @border-color-base;
border-radius: @border-radius-sm;
background-color: #fff;
transition: all .3s;

View File

@@ -18,13 +18,13 @@ A content area which can be collapsed and expanded.
| Property | Description | Type | Default |
|----------|----------------|----------|--------------|
| activeKey | key of the active panel | Array or String | No default value. In `accordion` mode, it's the key of the first panel. |
| defaultActiveKey | key of the initialized active panel | String | - |
| activeKey | key of the active panel | string[]\|string | No default value. In `accordion` mode, it's the key of the first panel. |
| defaultActiveKey | key of the initialized active panel | string | - |
| onChange | a callback function, which can be executed when you switch the panels | Function | - |
### Collapse.Panel
| Property | Description | Type | Default |
|----------|----------------|----------|--------------|
| key | corresponds to the `activeKey` | String | - |
| header | title of the panel | React.Element or String | - |
| key | corresponds to the `activeKey` | string | - |
| header | title of the panel | string\|ReactNode | - |

View File

@@ -19,8 +19,8 @@ cols: 1
| 参数 | 说明 | 类型 | 默认值 |
|------------------|----------------------------------------------|----------|---------------------------------|
| activeKey | 当前激活 tab 面板的 key| Array or String | 默认无accordion模式下默认第一个元素|
| defaultActiveKey | 初始化选中面板的 key | String | 无 |
| activeKey | 当前激活 tab 面板的 key| string[]\|string | 默认无accordion模式下默认第一个元素|
| defaultActiveKey | 初始化选中面板的 key | string | 无 |
| onChange | 切换面板的回调 | Function | 无 |
@@ -28,5 +28,5 @@ cols: 1
| 参数 | 说明 | 类型 | 默认值 |
|------|------------------|-------------------------|--------|
| key | 对应 activeKey | String | 无 |
| header | 面板头内容 | React.Element or String | 无 |
| key | 对应 activeKey | string | 无 |
| header | 面板头内容 | string\|ReactNode | 无 |

View File

@@ -4,20 +4,20 @@
@collapse-prefix-cls: ~"@{ant-prefix}-collapse";
.collapse-close() {
.iconfont-size-under-12px(7px, 270deg);
.iconfont-size-under-12px(9px, 0);
}
.collapse-open() {
.iconfont-size-under-12px(7px, 360deg);
.iconfont-size-under-12px(9px, 90deg);
}
.@{collapse-prefix-cls} {
background-color: @background-color-base;
border-radius: 3px;
border: 1px solid @border-color-base;
border-radius: @border-radius-base;
border: @border-width-base @border-style-base @border-color-base;
border-bottom: 0;
& > &-item {
border-bottom: 1px solid @border-color-base;
border-bottom: @border-width-base @border-style-base @border-color-base;
> .@{collapse-prefix-cls}-header {
height: 38px;
line-height: 38px;
@@ -25,24 +25,30 @@
color: @text-color;
cursor: pointer;
position: relative;
transition: all .3s;
&:active {
background-color: #eee!important;
}
.arrow {
.collapse-close();
.iconfont-mixin();
position: absolute;
color: @text-color;
color: @text-color-secondary;
display: inline-block;
margin-right: 8px;
font-weight: bold;
line-height: 40px;
content: "\e606";
vertical-align: middle;
transition: transform 0.24s ease;
transition: transform 0.24s;
top: 0;
left: 16px;
top: ~"16px \9"; // lesshint duplicateProperty: false
left: ~"0 \9"; // lesshint duplicateProperty: false
/* stylelint-disable declaration-block-no-duplicate-properties */
top: ~"16px \9";
left: ~"0 \9";
/* stylelint-enable declaration-block-no-duplicate-properties */
&:before {
content: "\e606";
content: "\E61F";
}
}
}
@@ -70,7 +76,7 @@
&-item:last-child {
> .@{collapse-prefix-cls}-content {
border-radius: 0 0 3px 3px;
border-radius: 0 0 @border-radius-base @border-radius-base;
}
}
@@ -91,7 +97,7 @@
&-borderless > &-item > &-content {
background-color: transparent;
border-top: 1px solid @border-color-base;
border-top: @border-width-base @border-style-base @border-color-base;
}
&-borderless > &-item > &-header {

View File

@@ -37,9 +37,9 @@ export default class RangePicker extends React.Component<any, any> {
componentWillReceiveProps(nextProps) {
if ('value' in nextProps) {
this.setState({
value: nextProps.value || [],
});
const value = nextProps.value || [];
const showDate = value[0];
this.setState({ value, showDate });
}
if ('open' in nextProps) {
this.setState({
@@ -58,7 +58,7 @@ export default class RangePicker extends React.Component<any, any> {
handleChange = (value) => {
const props = this.props;
if (!('value' in props)) {
this.setState({ value });
this.setState({ value, showDate: value[0] });
}
props.onChange(value, [
(value[0] && value[0].format(props.format)) || '',
@@ -69,12 +69,14 @@ export default class RangePicker extends React.Component<any, any> {
handleOpenChange = (open) => {
this.setState({ open });
const onOpenChange = this.props.onOpenChange;
const { onOpenChange } = this.props;
if (onOpenChange) {
onOpenChange(open);
}
}
handleShowDateChange = showDate => this.setState({ showDate })
setValue(value) {
this.handleChange(value);
if (!this.props.showTime) {
@@ -101,7 +103,7 @@ export default class RangePicker extends React.Component<any, any> {
render() {
const { state, props, context } = this;
const { value, open } = state;
const { value, showDate, open } = state;
const localeCode = getLocaleCode(context);
if (value && localeCode) {
if (value[0]) {
@@ -154,7 +156,8 @@ export default class RangePicker extends React.Component<any, any> {
dateInputPlaceholder={[startPlaceholder, endPlaceholder]}
locale={locale.lang}
onOk={onOk}
defaultValue={props.defaultPickerValue || [moment(), moment()]}
value={showDate || props.defaultPickerValue || moment()}
onValueChange={this.handleShowDateChange}
showToday={showToday}
/>
);
@@ -162,7 +165,7 @@ export default class RangePicker extends React.Component<any, any> {
// default width for showTime
const pickerStyle = {} as any;
if (props.showTime) {
pickerStyle.minWidth = 300;
pickerStyle.width = (style && style.width) || 300;
}
const clearIcon = (!props.disabled && props.allowClear && value && (value[0] || value[1]))

View File

@@ -0,0 +1,42 @@
import React from 'react';
import { mount, render } from 'enzyme';
import { renderToJson } from 'enzyme-to-json';
import moment from 'moment';
import { RangePicker } from '../';
describe('RangePicker', () => {
it('show month panel according to value', () => {
const birthday = moment('2000-01-01', 'YYYY-MM-DD');
const wrapper = mount(
<RangePicker
getCalendarContainer={trigger => trigger}
format="YYYY/MM/DD"
showTime open
/>
);
wrapper.setProps({ value: [birthday, birthday] });
expect(renderToJson(render(wrapper.find('Trigger').node.getComponent())))
.toMatchSnapshot();
});
it('switch to corresponding month panel when click presetted ranges', () => {
const birthday = moment('2000-01-01', 'YYYY-MM-DD');
const wrapper = mount(
<RangePicker
ranges={{
'My Birthday': [birthday, birthday],
}}
getCalendarContainer={trigger => trigger}
format="YYYY/MM/DD"
showTime open
/>
);
const rangeCalendarWrapper = mount(wrapper.find('Trigger').node.getComponent());
rangeCalendarWrapper.find('.ant-calendar-range-quick-selector a')
.simulate('click');
expect(renderToJson(render(wrapper.find('Trigger').node.getComponent())))
.toMatchSnapshot();
});
});

File diff suppressed because it is too large Load Diff

View File

@@ -18,7 +18,7 @@ exports[`test renders ./components/date-picker/demo/basic.md correctly 1`] = `
<span>
<input
class="ant-calendar-picker-input ant-input"
placeholder="请选择日期"
placeholder="Select month"
readonly=""
value="" />
<span
@@ -127,7 +127,7 @@ exports[`test renders ./components/date-picker/demo/disabled-date.md correctly 1
<br />
<span
class="ant-calendar-picker"
style="min-width:300px;">
style="width:300px;">
<span
class="ant-calendar-picker-input ant-input">
<input
@@ -255,7 +255,7 @@ exports[`test renders ./components/date-picker/demo/presetted-ranges.md correctl
<br />
<span
class="ant-calendar-picker"
style="min-width:300px;">
style="width:300px;">
<span
class="ant-calendar-picker-input ant-input">
<input
@@ -429,7 +429,7 @@ exports[`test renders ./components/date-picker/demo/time.md correctly 1`] = `
<br />
<span
class="ant-calendar-picker"
style="min-width:300px;">
style="width:300px;">
<span
class="ant-calendar-picker-input ant-input">
<input

View File

@@ -25,7 +25,7 @@ ReactDOM.render(
<div>
<DatePicker onChange={onChange} />
<br />
<MonthPicker onChange={onChange} />
<MonthPicker onChange={onChange} placeholder="Select month" />
<br />
<RangePicker onChange={onChange} />
</div>

View File

@@ -55,9 +55,19 @@ function disabledRangeTime(_, type) {
ReactDOM.render(
<div>
<DatePicker format="YYYY-MM-DD HH:mm:ss" disabledDate={disabledDate} disabledTime={disabledDateTime} showTime />
<DatePicker
format="YYYY-MM-DD HH:mm:ss"
disabledDate={disabledDate}
disabledTime={disabledDateTime}
showTime
/>
<br />
<RangePicker disabledDate={disabledDate} disabledTime={disabledRangeTime} showTime={{ hideDisabledOptions: true }} />
<RangePicker
disabledDate={disabledDate}
disabledTime={disabledRangeTime}
showTime={{ hideDisabledOptions: true }}
format="YYYY-MM-DD HH:mm:ss"
/>
</div>,
mountNode
);

View File

@@ -36,17 +36,17 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker.
| Property | Description | Type | Default |
|--------------|----------------|----------|--------------|
| allowClear | Whether to show clear button | bool | true |
| disabled | determine whether the DatePicker is disabled | Boolean | false |
| style | to customize the style of the input box | Object | {} |
| popupStyle | to customize the style of the popup calendar | Object | {} |
| size | determine the size of the input box, the height of `large` and `small`, are 32px and 22px respectively, while default size is 28px | String | - |
| locale | localization configuration | Object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
| allowClear | Whether to show clear button | boolean | true |
| disabled | determine whether the DatePicker is disabled | boolean | false |
| style | to customize the style of the input box | object | {} |
| popupStyle | to customize the style of the popup calendar | object | {} |
| size | determine the size of the input box, the height of `large` and `small`, are 32px and 22px respectively, while default size is 28px | string | - |
| locale | localization configuration | object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
| disabledDate | to specify the date that cannot be selected | function | - |
| getCalendarContainer | to set the container of the floating layer, while the default is to create a `div` element in `body` | function(trigger) | - |
| open | open state of picker | bool | - |
| open | open state of picker | boolean | - |
| onOpenChange | a callback function, can be executed whether the popup calendar is popped up or closed | function(status) | - |
| placeholder | placeholder of date input | string or array (RangePicker) | - |
| placeholder | placeholder of date input | string\|RangePicker[] | - |
### DatePicker
@@ -54,10 +54,10 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker.
|--------------|----------------|----------|--------------|
| value | to set date | [moment](http://momentjs.com/) | - |
| defaultValue | to set default date | [moment](http://momentjs.com/) | - |
| format | to set the date format, refer to [moment.js](http://momentjs.com/) | String | "YYYY-MM-DD" |
| format | to set the date format, refer to [moment.js](http://momentjs.com/) | string | "YYYY-MM-DD" |
| onChange | a callback function, can be executed when the selected time is changing | function(date: moment, dateString: string) | - |
| showTime | to provide an additional time selection | Object/Boolean | [TimePicker Options](/components/time-picker/#api) |
| showToday | whether to show "Today" button | Boolean | true |
| showTime | to provide an additional time selection | object\|boolean | [TimePicker Options](/components/time-picker/#API) |
| showToday | whether to show "Today" button | boolean | true |
| disabledTime | to specify the time that cannot be selected | function(date) | - |
### MonthPicker
@@ -66,9 +66,9 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker.
|--------------|----------------|----------|--------------|
| value | to set date | [moment](http://momentjs.com/) | - |
| defaultValue | to set default date | [moment](http://momentjs.com/) | - |
| format | to set the date format, refer to [moment.js](http://momentjs.com/) | String | "YYYY-MM" |
| format | to set the date format, refer to [moment.js](http://momentjs.com/) | string | "YYYY-MM" |
| onChange | a callback function, can be executed when the selected time is changing | function(date: moment, dateString: string) | - |
| monthCellContentRender | Custom month cell content render method | function(date, locale): React.Node | - |
| monthCellContentRender | Custom month cell content render method | function(date, locale): ReactNode | - |
### RangePicker
@@ -76,11 +76,11 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker.
|--------------|----------------|----------|--------------|
| value | to set date | [[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - |
| defaultValue | to set default date | [[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - |
| format | to set the date format | String | "YYYY-MM-DD HH:mm:ss" |
| format | to set the date format | string | "YYYY-MM-DD HH:mm:ss" |
| onChange | a callback function, can be executed when the selected time is changing | function(dates: [moment, moment], dateStrings: [string, string]) | - |
| showTime | to provide an additional time selection | Object/Boolean | [TimePicker Options](/components/time-picker/#api) |
| showTime | to provide an additional time selection | object\|boolean | [TimePicker Options](/components/time-picker/#API) |
| disabledTime | to specify the time that cannot be selected | function(dates: [moment, moment], partial: `'start'|'end'`) | - |
| ranges | preseted ranges for quick selection | Object { [range: string]: [moment, moment] } | - |
| ranges | preseted ranges for quick selection | { [range: string]: [moment](http://momentjs.com/)[] } | - |
<style>
.code-box-demo .ant-calendar-picker {

View File

@@ -37,17 +37,17 @@ moment.locale('zh-cn');
| 参数 | 说明 | 类型 | 默认值 |
|--------------|----------------|----------|--------------|
| allowClear | 是否显示清除按钮 | bool | true |
| disabled | 禁用 | bool | false |
| allowClear | 是否显示清除按钮 | boolean | true |
| disabled | 禁用 | boolean | false |
| style | 自定义输入框样式 | object | {} |
| popupStyle | 格外的弹出日历样式 | object | {} |
| size | 输入框大小,`large` 高度为 32px`small` 为 22px默认是 28px | string | 无 |
| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
| disabledDate | 不可选择的日期 | function | 无 |
| getCalendarContainer | 定义浮层的容器,默认为 body 上新建 div | function(trigger) | 无 |
| open | 控制弹层是否展开 | bool | - |
| open | 控制弹层是否展开 | boolean | - |
| onOpenChange | 弹出日历和关闭日历的回调 | function(status) | 无 |
| placeholder | 输入框提示文字 | string or array (RangePicker) | - |
| placeholder | 输入框提示文字 | string\|RangePicker[] | - |
### DatePicker
@@ -57,8 +57,8 @@ moment.locale('zh-cn');
| defaultValue | 默认日期 | [moment](http://momentjs.com/) | 无 |
| format | 展示的日期格式,配置参考 [moment.js](http://momentjs.com/) | string | "YYYY-MM-DD" |
| onChange | 时间发生变化的回调 | function(date: moment, dateString: string) | 无 |
| showTime | 增加时间选择功能 | Object or Boolean | [TimePicker Options](/components/time-picker/#api) |
| showToday | 是否展示“今天”按钮 | Boolean | true |
| showTime | 增加时间选择功能 | Object\|boolean | [TimePicker Options](/components/time-picker/#API) |
| showToday | 是否展示“今天”按钮 | boolean | true |
| disabledTime | 不可选择的时间 | function(date) | 无 |
### MonthPicker
@@ -69,19 +69,19 @@ moment.locale('zh-cn');
| defaultValue | 默认日期 | [moment](http://momentjs.com/) | 无 |
| format | 展示的日期格式,配置参考 [moment.js](http://momentjs.com/) | string | "YYYY-MM" |
| onChange | 时间发生变化的回调,发生在用户选择时间时 | function(date: moment, dateString: string) | - |
| monthCellContentRender | 自定义的月份内容渲染方法 | function(date, locale): React.Node | - |
| monthCellContentRender | 自定义的月份内容渲染方法 | function(date, locale): ReactNode | - |
### RangePicker
| 参数 | 说明 | 类型 | 默认值 |
|--------------|----------------|----------|--------------|
| value | 日期 | [[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | 无 |
| defaultValue | 默认日期 | [[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | 无 |
| value | 日期 | [moment](http://momentjs.com/)[] | 无 |
| defaultValue | 默认日期 | [moment](http://momentjs.com/)[] | 无 |
| format | 展示的日期格式 | string | "YYYY-MM-DD HH:mm:ss" |
| onChange | 时间发生变化的回调,发生在用户选择时间时 | function(dates: [moment, moment], dateStrings: [string, string]) | 无 |
| showTime | 增加时间选择功能 | Object or Boolean | [TimePicker Options](/components/time-picker/#api) |
| showTime | 增加时间选择功能 | Object\|boolean | [TimePicker Options](/components/time-picker/#API) |
| disabledTime | 不可选择的时间 | function(dates: [moment, moment], partial: `'start'|'end'`) | 无 |
| ranges | 预设事件范围快捷选择 | Object { [range: string]: [moment, moment] } | 无 |
| ranges | 预设事件范围快捷选择 | { [range: string]: [moment](http://momentjs.com/)[] } | 无 |
<style>
.code-box-demo .ant-calendar-picker {

View File

@@ -0,0 +1,17 @@
import CalendarLocale from 'rc-calendar/lib/locale/de_DE';
import TimePickerLocale from '../../time-picker/locale/de_DE';
import assign from 'object-assign';
// 统一合并为完整的 Locale
const locale = {
lang: assign({
placeholder: 'Datum auswählen',
rangePlaceholder: ['Startdatum', 'Enddatum'],
}, CalendarLocale),
timePickerLocale: assign({}, TimePickerLocale),
};
// All settings at:
// https://github.com/ant-design/ant-design/issues/424
export default locale;

View File

@@ -12,6 +12,6 @@ const locale = {
};
// All settings at:
// https://github.com/ant-design/ant-design/issues/424
// https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json
export default locale;

View File

@@ -0,0 +1,17 @@
import CalendarLocale from 'rc-calendar/lib/locale/fr_BE';
import TimePickerLocale from '../../time-picker/locale/fr_BE';
import assign from 'object-assign';
// 统一合并为完整的 Locale
const locale = {
lang: assign({
placeholder: 'Sélectionner une date',
rangePlaceholder: ['Date de début', 'Date de fin'],
}, CalendarLocale),
timePickerLocale: assign({}, TimePickerLocale),
};
// All settings at:
// https://github.com/ant-design/ant-design/issues/424
export default locale;

View File

@@ -12,6 +12,6 @@ const locale = {
};
// All settings at:
// https://github.com/ant-design/ant-design/issues/424
// https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json
export default locale;

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