mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 10:59:19 +08:00
Compare commits
318 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86a2cf326d | ||
|
|
c1c2e13b9d | ||
|
|
bc937aceb8 | ||
|
|
3e14ab3a0d | ||
|
|
b768533100 | ||
|
|
7413c61b23 | ||
|
|
5b779e8e8e | ||
|
|
60da9909d3 | ||
|
|
3382abde65 | ||
|
|
383101830a | ||
|
|
192ca5d898 | ||
|
|
66f7b050eb | ||
|
|
e1efc29150 | ||
|
|
36a4304de4 | ||
|
|
19b04422ef | ||
|
|
536aed3ffe | ||
|
|
000085eb36 | ||
|
|
1f36734cb6 | ||
|
|
d94f0ab09a | ||
|
|
904be38493 | ||
|
|
4afb7b4b33 | ||
|
|
c48d7b557e | ||
|
|
aab32236c6 | ||
|
|
3fe99ea973 | ||
|
|
f36f1625f1 | ||
|
|
bd1334065d | ||
|
|
ff2d55481e | ||
|
|
1a4d9159b3 | ||
|
|
ec6cec67fd | ||
|
|
49e9523283 | ||
|
|
273faafaa2 | ||
|
|
883066820a | ||
|
|
59f0e6254b | ||
|
|
37140bf5e0 | ||
|
|
9afea0f47d | ||
|
|
8ed8b25d73 | ||
|
|
9701825c23 | ||
|
|
1a37b44dad | ||
|
|
03eff769be | ||
|
|
9006d74034 | ||
|
|
57bb12ca3c | ||
|
|
65431a3981 | ||
|
|
03d6bdc942 | ||
|
|
392805e0e5 | ||
|
|
4c116aaa3a | ||
|
|
f9bad27469 | ||
|
|
99df18139b | ||
|
|
ca1f16556c | ||
|
|
fcdc375f77 | ||
|
|
779a62093d | ||
|
|
bf8b1bf6a9 | ||
|
|
eacfe25e19 | ||
|
|
c4700210e8 | ||
|
|
4ac50c660c | ||
|
|
d2644e3c11 | ||
|
|
304ccf1ea5 | ||
|
|
4e589af9b6 | ||
|
|
ad911d8dfa | ||
|
|
5815ce514a | ||
|
|
9c3c2d7c0c | ||
|
|
264f02d98f | ||
|
|
f5775fec73 | ||
|
|
89fee0a987 | ||
|
|
ab37e056f1 | ||
|
|
2ba1e8f3ef | ||
|
|
89cf3a88e6 | ||
|
|
c06d205833 | ||
|
|
0e97fae3f5 | ||
|
|
cf11a4f809 | ||
|
|
c639c3a796 | ||
|
|
c7c886fda6 | ||
|
|
82902855db | ||
|
|
8df23e2d06 | ||
|
|
bf562c95f1 | ||
|
|
37af26fbdf | ||
|
|
75173dd7b0 | ||
|
|
0e1f154aab | ||
|
|
0bb71e6a6f | ||
|
|
65b2429ed2 | ||
|
|
edd57defa5 | ||
|
|
4184e7c8ac | ||
|
|
575f0dbc21 | ||
|
|
e8cb51e024 | ||
|
|
752392a964 | ||
|
|
c0e9f8c52e | ||
|
|
3df84e33c6 | ||
|
|
c4b6130daa | ||
|
|
2270598f2e | ||
|
|
c4d8c4770c | ||
|
|
a939769069 | ||
|
|
f3ffae9e54 | ||
|
|
5370df346c | ||
|
|
af3d1ff6ef | ||
|
|
adad537532 | ||
|
|
d2918d2456 | ||
|
|
3802f08191 | ||
|
|
643463c9f2 | ||
|
|
39eb19ad9b | ||
|
|
01dbcbe4af | ||
|
|
47a9c80e82 | ||
|
|
d8d065af33 | ||
|
|
75c09cb481 | ||
|
|
04269ecb40 | ||
|
|
1593140912 | ||
|
|
f62fa38ebd | ||
|
|
b4d4af64a1 | ||
|
|
e0e700cddd | ||
|
|
a307a7acf7 | ||
|
|
ee2654dbe1 | ||
|
|
5db5fed7b9 | ||
|
|
6b774a1343 | ||
|
|
6f3eafd061 | ||
|
|
7cb033c545 | ||
|
|
3be71e41bf | ||
|
|
932443099a | ||
|
|
7f4569cc02 | ||
|
|
510f08cadc | ||
|
|
fb4d505801 | ||
|
|
addb6e44dc | ||
|
|
7325cdb37a | ||
|
|
6b0c34bb24 | ||
|
|
7d75f6e3de | ||
|
|
afb845d944 | ||
|
|
32abe10b43 | ||
|
|
9c2b197163 | ||
|
|
58d5fafa19 | ||
|
|
0ed98a5574 | ||
|
|
2aeccd4955 | ||
|
|
7ade6013df | ||
|
|
bc856e787c | ||
|
|
2034126e00 | ||
|
|
3705130315 | ||
|
|
13020b7737 | ||
|
|
87f230f57b | ||
|
|
13e13f333d | ||
|
|
1c58e5ba4b | ||
|
|
72fad02024 | ||
|
|
86f1fa030a | ||
|
|
59e0c6a4c1 | ||
|
|
bd55d21f83 | ||
|
|
c97e687edd | ||
|
|
76c8351fc4 | ||
|
|
38706e16bc | ||
|
|
dfd15f8a56 | ||
|
|
e091efa2b5 | ||
|
|
dc2fb9c2ff | ||
|
|
f5cc937c8f | ||
|
|
9183ef0ede | ||
|
|
5713a7cd39 | ||
|
|
c6c5a0c3a1 | ||
|
|
7c79a1c294 | ||
|
|
52f6f992b3 | ||
|
|
73c776e73d | ||
|
|
91b2242f44 | ||
|
|
f110472c93 | ||
|
|
e6300e0128 | ||
|
|
57fa4cbb52 | ||
|
|
f2f3c5f15a | ||
|
|
fe09c26c50 | ||
|
|
179f526077 | ||
|
|
540d51fe8d | ||
|
|
03360c2bf3 | ||
|
|
f3df6205a4 | ||
|
|
a8c4f53922 | ||
|
|
2260701865 | ||
|
|
6ccaf71841 | ||
|
|
fec52a24c5 | ||
|
|
ccbebe60cc | ||
|
|
5e1b679dfb | ||
|
|
63dadc1efa | ||
|
|
0acc7d592c | ||
|
|
5bd8977d75 | ||
|
|
206a327ade | ||
|
|
7dbeb13093 | ||
|
|
e089f39048 | ||
|
|
f6f63606ea | ||
|
|
e610314461 | ||
|
|
7b61b84145 | ||
|
|
3b8ac48e6b | ||
|
|
b34c4ed423 | ||
|
|
f533f20b38 | ||
|
|
c8caf3a08c | ||
|
|
bb8ec2f836 | ||
|
|
e5f289f1a3 | ||
|
|
6c5fc4ef7f | ||
|
|
2013202386 | ||
|
|
c5d9205a2b | ||
|
|
42c6f92f50 | ||
|
|
66678dd415 | ||
|
|
7ce0598cc3 | ||
|
|
0dffd230a8 | ||
|
|
21a4b08392 | ||
|
|
109d72ea70 | ||
|
|
0613a1b065 | ||
|
|
e62dc08d2c | ||
|
|
57f5d299af | ||
|
|
e552880c32 | ||
|
|
f77d568322 | ||
|
|
d20572bdab | ||
|
|
4b1722e95d | ||
|
|
7748471fa0 | ||
|
|
ed455c01d1 | ||
|
|
1c26bca8fe | ||
|
|
9febc9e71e | ||
|
|
f250bdcc98 | ||
|
|
70e1e26771 | ||
|
|
927dae6159 | ||
|
|
89c9da8121 | ||
|
|
ca881823f2 | ||
|
|
c3064949cc | ||
|
|
dd0be2e82f | ||
|
|
4ee2b9d930 | ||
|
|
34f353deb0 | ||
|
|
84d036bfef | ||
|
|
16c2ee69ab | ||
|
|
b51b18acd6 | ||
|
|
1ae5bb9845 | ||
|
|
cd2a1438b7 | ||
|
|
51971be12a | ||
|
|
485e22f38d | ||
|
|
3caa85b3f3 | ||
|
|
6af5c54e6c | ||
|
|
259de9dbab | ||
|
|
34d00559fc | ||
|
|
c94f577416 | ||
|
|
db035aa691 | ||
|
|
21b3f70ab3 | ||
|
|
5982e94456 | ||
|
|
7af7e8382d | ||
|
|
1287f2a19f | ||
|
|
231b2b9dae | ||
|
|
42b4df295c | ||
|
|
ca9ed27445 | ||
|
|
2c9339039c | ||
|
|
6205118c31 | ||
|
|
5b77cf7452 | ||
|
|
cc1f1be8bd | ||
|
|
a6e09ccfd0 | ||
|
|
38fd7f6feb | ||
|
|
e5deba620d | ||
|
|
f499a026ce | ||
|
|
b5fcb85c24 | ||
|
|
18dcc09751 | ||
|
|
29001ffe4c | ||
|
|
16fdb00282 | ||
|
|
33ad640b0f | ||
|
|
1c23189b1d | ||
|
|
30b7318d38 | ||
|
|
3c9272a60f | ||
|
|
c20239829d | ||
|
|
260665d1c2 | ||
|
|
c2a4cdb17c | ||
|
|
9b7a3d4b82 | ||
|
|
9fd1f88441 | ||
|
|
36508ffabd | ||
|
|
fc79d6f967 | ||
|
|
4f7eff39fd | ||
|
|
489a62b139 | ||
|
|
b0bdfcb94c | ||
|
|
200d3715e3 | ||
|
|
5b3df08ade | ||
|
|
34b4200220 | ||
|
|
0d63e5f6b5 | ||
|
|
321f4e1402 | ||
|
|
9e6439b06c | ||
|
|
92d77e4c5d | ||
|
|
7e5cb09a2d | ||
|
|
36003d03ac | ||
|
|
146f3180aa | ||
|
|
e1e8003e54 | ||
|
|
c37663752c | ||
|
|
aa635b9132 | ||
|
|
b69fd4bf9f | ||
|
|
e2b6054cc4 | ||
|
|
12c974660e | ||
|
|
b37845ef0c | ||
|
|
dde040e3e8 | ||
|
|
f9319e244b | ||
|
|
a1ee6bfa22 | ||
|
|
b875a6104b | ||
|
|
1750fc754c | ||
|
|
bc45f43042 | ||
|
|
1ae4816cd0 | ||
|
|
68fb601f99 | ||
|
|
ab8f8e4506 | ||
|
|
b95800aa04 | ||
|
|
7526d7be08 | ||
|
|
d8516ee8df | ||
|
|
d4269f8f30 | ||
|
|
b0f366cb0f | ||
|
|
fc3d320872 | ||
|
|
82fa3ed2a5 | ||
|
|
1850e4b7cf | ||
|
|
b54d0ccc31 | ||
|
|
92df002fb0 | ||
|
|
a6d2de1a7b | ||
|
|
76b91812f4 | ||
|
|
a0de4d6865 | ||
|
|
4b2e9bbd23 | ||
|
|
05213a5827 | ||
|
|
169e6cf99c | ||
|
|
b6455e2546 | ||
|
|
a7153e6e24 | ||
|
|
bbef274aae | ||
|
|
0a30315a32 | ||
|
|
a1fe873bd9 | ||
|
|
b6fbc266c5 | ||
|
|
ff803c2762 | ||
|
|
3bdfe5bb88 | ||
|
|
de64779546 | ||
|
|
5400cacd13 | ||
|
|
ee8ac670b9 | ||
|
|
449db1499b | ||
|
|
b0c7a714ad | ||
|
|
8457267dad | ||
|
|
24bd14d843 | ||
|
|
f93e2a8df0 | ||
|
|
3c9ccccf61 |
5
.babelrc
5
.babelrc
@@ -1,3 +1,6 @@
|
||||
{
|
||||
"presets": ["es2015", "react", "stage-0"]
|
||||
"presets": ["es2015", "react", "stage-0"],
|
||||
"plugins": [
|
||||
"add-module-exports"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ const eslintrc = {
|
||||
'react/prop-types': 0,
|
||||
'react/jsx-first-prop-new-line': 0,
|
||||
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx', '.md'] }],
|
||||
'import/extensions': 0,
|
||||
'import/no-unresolved': 0,
|
||||
'import/no-extraneous-dependencies': 0,
|
||||
'no-param-reassign': 0,
|
||||
|
||||
6
.github/CONTRIBUTING.md
vendored
6
.github/CONTRIBUTING.md
vendored
@@ -19,7 +19,7 @@ Tips: choose the corresponding documentation with versions selector which in the
|
||||
|
||||
### 2. Make sure that your question is about Ant Design, not React
|
||||
|
||||
Someone may think all of the questions that he/she meets in developing are about Ant Design, but it's not true. So, please read [React's documentaion](http://facebook.github.io/react/docs/getting-started.html) or just Google(not Baidu, seriously) your questions with keywork *React* first. If you are sure that your question is about Ant Design, go ahead.
|
||||
Someone may think all of the questions that he/she meets in developing are about Ant Design, but it's not true. So, please read [React's documentation](http://facebook.github.io/react/docs/getting-started.html) or just Google (not Baidu, seriously) your questions with keyword *React* first. If you are sure that your question is about Ant Design, go ahead.
|
||||
|
||||
### 3. Read the FAQ and search the issues list of Ant Design
|
||||
|
||||
@@ -48,9 +48,11 @@ If you believe that Ant Design should provide some features, but it does not. Yo
|
||||
|
||||
## Tips about Pull Request
|
||||
|
||||
**Working on your first Pull Request?** You can learn how from this *free* series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)
|
||||
|
||||
It's welcomed to pull request. And there are some tips about that:
|
||||
|
||||
1. It is a good habit to create a feature request issue to disscuss whether the feature is necessary before you implement it. However, it's unnecessary to create an issue to claim that you found a typo or improved the readability of documentaion, just create a pull request.
|
||||
1. It is a good habit to create a feature request issue to discuss whether the feature is necessary before you implement it. However, it's unnecessary to create an issue to claim that you found a typo or improved the readability of documentation, just create a pull request.
|
||||
1. Run `npm run lint` and fix those errors before committing in order to keep consistent code style.
|
||||
1. Rebase before creating a PR to keep commit history clear.
|
||||
1. Add some descriptions and refer relative issues for you PR.
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -30,3 +30,4 @@ config/base.yaml
|
||||
components/**/*.js
|
||||
components/**/*.jsx
|
||||
/.vscode/
|
||||
/coverage
|
||||
|
||||
3
.hound.yml
Normal file
3
.hound.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
eslint:
|
||||
enabled: true
|
||||
config_file: .eslintrc.js
|
||||
18
.jest.node.json
Normal file
18
.jest.node.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"setupFiles": [
|
||||
"tests/setup.js"
|
||||
],
|
||||
"moduleFileExtensions": [
|
||||
"ts",
|
||||
"tsx",
|
||||
"js",
|
||||
"md"
|
||||
],
|
||||
"transform": {
|
||||
"\\.tsx?$": "node_modules/typescript-babel-jest",
|
||||
"tests/.*\\.js$": "node_modules/babel-jest",
|
||||
"\\.md$": "node_modules/antd-demo-jest"
|
||||
},
|
||||
"testRegex": "/tests/.*demo\\.test\\.js$",
|
||||
"testEnvironment": "node"
|
||||
}
|
||||
@@ -4,3 +4,6 @@ language: node_js
|
||||
|
||||
node_js:
|
||||
- "6"
|
||||
|
||||
after_script:
|
||||
- cat ./coverage/lcov.info | node_modules/coveralls/bin/coveralls.js
|
||||
|
||||
24
AUTHORS.txt
24
AUTHORS.txt
@@ -1,11 +1,17 @@
|
||||
Albert Zheng <lisong.zheng@gmail.com>
|
||||
Andrew Murray <radarhere@gmail.com>
|
||||
Andrey G <plandem@gmail.com>
|
||||
Benjy Cui <benjytrys@gmail.com>
|
||||
Bernie <bernie.wangbj@gmail.com>
|
||||
Bozhao <yubz86@gmail.com>
|
||||
Bruce Mitchener <bruce.mitchener@gmail.com>
|
||||
Bruno Maia <bruno.mm.maia@gmail.com>
|
||||
C <4019980@qq.com>
|
||||
Cam Song <neosoyn@gmail.com>
|
||||
Catalin Miron <mironcatalin@gmail.com>
|
||||
Cee Cirno <i@cee.moe>
|
||||
Cody Chan <int64ago@gmail.com>
|
||||
Danny Hoower Antonio Viasus Avila <danjavia@gmail.com>
|
||||
Daqi Song <dqaria@gmail.com>
|
||||
DengYun <tdzl2003@gmail.com>
|
||||
Eddie Xie <oeddyo@gmail.com>
|
||||
@@ -16,19 +22,25 @@ Gray Choi <gray.choi.1988@gmail.com>
|
||||
Guan Hao <raptium@gmail.com>
|
||||
Haibin Yu <haibin.yu@oceanwing.com>
|
||||
Hanai <ihanai1991@gmail.com>
|
||||
ImJoeHs <865439601@qq.com>
|
||||
Infinity <305870677@qq.com>
|
||||
James <james@schoolshape.com>
|
||||
Jerry Bendy <jerry@icewingcc.com>
|
||||
Junyu Zhan <irrigator@yeah.net>
|
||||
KgTong <kgtong1992@gmail.com>
|
||||
Leon Shi <superRaytin@163.com>
|
||||
Leon Shi <superRaytin@gmail.com>
|
||||
Liu Yang <zation1@gmail.com>
|
||||
LongYinan <lynweklm@gmail.com>
|
||||
MG12 <wuzhao.mail@gmail.com>
|
||||
Ma Tianxiao <matx2215@outlook.com>
|
||||
Marius Ileana <visvadw@gmail.com>
|
||||
Marshall Chen <Juniors.fei@gmail.com>
|
||||
Meck <yesmeck@gmail.com>
|
||||
Mr.Tone <vector@malubei.com>
|
||||
Nathan Wells <nwwells@gmail.com>
|
||||
Neverland <chenjiahan@buaa.edu.cn>
|
||||
Nimo <nimo.jser@gmail.com>
|
||||
Pyiner <lijiuyang1992@gmail.com>
|
||||
Qiaosen Huang <joesonw@gmail.com>
|
||||
RaoHai <surgesoft@gmail.com>
|
||||
@@ -49,10 +61,12 @@ bang <sqibang@gmail.com>
|
||||
bang88 <sqibang@gmail.com>
|
||||
chencheng (云谦) <sorrycc@gmail.com>
|
||||
ddcat1115 <ddcat1115@gmail.com>
|
||||
denzw <denzw@21cn.com>
|
||||
detailyang <detailyang@gmail.com>
|
||||
devqin <devqin@gmail.com>
|
||||
djorkaeff <djorkae55@gmail.com>
|
||||
ecofe <150641329@qq.com>
|
||||
edgji <j.edgji@gmail.com>
|
||||
elrrrrrrr <elrrrrrrr@gmail.com>
|
||||
ezpub <ez.foro@gmail.com>
|
||||
feng zhi hao <fzhihao@outlook.com>
|
||||
@@ -63,15 +77,18 @@ hi-caicai <hi@cai-cai.me>
|
||||
ioldfish <fish.wangl@gmail.com>
|
||||
jasonslyvia <jasonslyvia@gmail.com>
|
||||
jiang <155259966@qq.com>
|
||||
jinouwuque <ee2win@gmail.com>
|
||||
kagawagao <kingsongao1221@gmail.com>
|
||||
kaifei <150641329@qq.com>
|
||||
kasinooya <kasinooya@gmail.com>
|
||||
kayw <kayw@outlook.com>
|
||||
leon.shi <superRaytin@163.com>
|
||||
lgmcolin <gengmin.lgm@gmail.com>
|
||||
lgmcolin <lgmcolin@gmail.com>
|
||||
lixiaochou077 <qi.liqi07@gmail.com>
|
||||
lizhaocai <lzc09008@gmail.com>
|
||||
muzuiget <muzuiget@gmail.com>
|
||||
parlop <parlop@gmail.com>
|
||||
pizn <pizner@gmail.com>
|
||||
plandem <plandem@gmail.com>
|
||||
popomore <sakura9515@gmail.com>
|
||||
@@ -88,6 +105,7 @@ tom <caolvchong@gmail.com>
|
||||
ustccjw <317713370@qq.com>
|
||||
warmhug <hualei5280@gmail.com>
|
||||
wizawu <wizawu@gmail.com>
|
||||
xiaofan2406 <xiaofan2406@gmail.com>
|
||||
yeliex <yeliex@yeliex.com>
|
||||
yiminghe <yiminghe@gmail.com>
|
||||
yubozhao <yubz86@gmail.com>
|
||||
@@ -99,9 +117,15 @@ zhaocai <lzc09008@gmail.com>
|
||||
zhujun24 <zhujun87654321@gmail.com>
|
||||
zilong <jzlxiaohei@163.com>
|
||||
zinkey <yaya@uloveit.com.cn>
|
||||
zuiidea <zuiiidea@gmail.com>
|
||||
偏右 <afc163@gmail.com>
|
||||
逸达 <dqaria@gmail.com>
|
||||
蔡伦 <sliuqin@gmail.com>
|
||||
陆离 <surgesoft@gmail.com>
|
||||
低位 <zhujun87654321@gmail.com>
|
||||
广彬-梁 <326741518@qq.com>
|
||||
闲耘™ <hotoo.cn@gmail.com>
|
||||
吕立青 <jimmy.jinglv@gmail.com>
|
||||
马斯特 <sd4399340@126.com>
|
||||
马金花儿 <o.o@mug.dog>
|
||||
白羊座小葛 <abeyuhang@gmail.com>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
order: 3
|
||||
order: 6
|
||||
title: Change Log
|
||||
toc: false
|
||||
timeline: true
|
||||
@@ -9,20 +9,123 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi
|
||||
|
||||
---
|
||||
|
||||
## 2.5.2
|
||||
|
||||
`2016-12-10`
|
||||
|
||||
* Improve selected item style of Menu.
|
||||
* Fix issue resulting in Mention not responses `onFocus` and `onBlur`. [#4163](https://github.com/ant-design/ant-design/issues/4163)
|
||||
* Fix issue resulting in there is a redundant shadow between `disabled` and `checked` Radio. [#4114](https://github.com/ant-design/ant-design/pull/4114) @jdz321
|
||||
* Fix error when setting Momment `defaultValue` or `value` on RangePicker, TimePicker, Calendar. [#4147](https://github.com/ant-design/ant-design/issues/4147)
|
||||
* Fix issue resulting in Affix disappears when it's uesed in animated Tabs. [#3943](https://github.com/ant-design/ant-design/issues/3943)
|
||||
* Fix issue resulting in Cascader passes different `selectedOptions` to `onChange` when manually selecting and selecting by search. [#4096](https://github.com/ant-design/ant-design/issues/4096)
|
||||
* Fix issue resulting in Tabs get offset, when too many tabs are opening. [#3637](https://github.com/ant-design/ant-design/issues/3637)
|
||||
* Table
|
||||
* Align text of grouped parent header to center.
|
||||
* Fix issue resulting in `filterDropdownVisible` can't be set correctly. [#4162](https://github.com/ant-design/ant-design/issues/4162)
|
||||
|
||||
## 2.5.1
|
||||
|
||||
`2016-12-03`
|
||||
|
||||
* Improve website experience on mobile devices.
|
||||
* Add some migrate warnings for `1.x` to `2.x`.
|
||||
* ToolTip, Popover, Popconfirm support to wrap text node and multiple node directly now. [#3924](https://github.com/ant-design/ant-design/issues/3924)
|
||||
* Anchor
|
||||
* Fix current position bug when scroll fastly. [#4053](https://github.com/ant-design/ant-design/issues/4053)
|
||||
* Fix a bug of parent component ref node is undefined. [#4037](https://github.com/ant-design/ant-design/issues/4037)
|
||||
* Table
|
||||
* Fix a selection problem when setting defaultChecked in rowSelection. [#4020](https://github.com/ant-design/ant-design/issues/4020)
|
||||
* Fix grouping column title cannot work with filters. [#4099](https://github.com/ant-design/ant-design/issues/4099)
|
||||
* Fix a misplace bug when using Popover over `Input[type="textarea"]`. [#4092](https://github.com/ant-design/ant-design/issues/4092)
|
||||
* Fix Popconfirm `visible` is not-working problem. [#4068](https://github.com/ant-design/ant-design/issues/4068)
|
||||
* Fix TimePicker can not override width by `style.width`.
|
||||
* Unify Steps icon size. [#3817](https://github.com/ant-design/ant-design/issues/3817)
|
||||
* Fix style details of Form, Button, Slider, Table.
|
||||
|
||||
## 2.5.0
|
||||
|
||||
`2016-11-25`
|
||||
|
||||
* Change the default theme to Alipay style and improve lots of style details.
|
||||
* Supports server-side rendering. (`Mention` will throw warning for [draft-js](https://github.com/facebook/draft-js/issues/385)' issue)
|
||||
* Introduce [Jest Snapshot](https://facebook.github.io/jest/docs/tutorial-react.html#snapshot-testing) to test the structure of components and SSR issues.
|
||||
* Improve official website and documentation.
|
||||
* Add [document](https://ant.design/docs/react/customize-theme) for customizing theme.
|
||||
* Add [Sketch template files](https://ant.design/docs/resource/download).
|
||||
* `LocaleProvider` supports Brazilian. [#4004](https://github.com/ant-design/ant-design/pull/4004) [@nathantn](https://github.com/nathantn)
|
||||
* DatePicker
|
||||
* DatePicker can determine whether to show "Today" button. [commit](https://github.com/ant-design/ant-design/commit/bbef274aae169d142e3e7e3ea0af922d48e6dd64)
|
||||
* RangePicker can set presetted ranges. [demo](https://ant.design/components/date-picker/#components-date-picker-demo-presetted-ranges)
|
||||
* Fix "Now" button doesn't work while `DatePicker[showTime]` is set. [#3748](https://github.com/ant-design/ant-design/issues/3748)
|
||||
* Fix `RangePicker[format]` should work. [#3808](https://github.com/ant-design/ant-design/issues/3808)
|
||||
* Add and update some icons. [#3977](https://github.com/ant-design/ant-design/pull/3977)
|
||||
* New component `Input.Search`. [demo](https://ant.design/components/input/#components-input-demo-search-input)
|
||||
* Mention onSelect event will get complete record. [#3867](https://github.com/ant-design/ant-design/issues/3867)
|
||||
* Pagination can get current range. [demo](https://ant.design/components/pagination/#components-pagination-demo-total)
|
||||
* Table
|
||||
* We can control the visible of customized `filterDropdown`. [demo](https://ant.design/components/table/#components-table-demo-custom-filter-panel)
|
||||
* Supports JSX-style columns. [demo](https://ant.design/components/table/#components-table-demo-jsx)
|
||||
* Can listen the click event of table cell. [#3774](https://github.com/ant-design/ant-design/issues/3774)
|
||||
* Fix border radius of head of border-less table.
|
||||
* Fix that height of title and footer don't follow `Table[size]`. [commit](https://github.com/ant-design/ant-design/commit/9e6439b06cd099ab384a4a2f026f0def6e12bf23)
|
||||
* Fix issue with selected status. [#3900](https://github.com/ant-design/ant-design/issues/3900)
|
||||
* Upload
|
||||
* Fix that children could not be `null`.
|
||||
* Fix logic of preview. [commit](https://github.com/ant-design/ant-design/commit/e552880c32aaa3f5b0fb09a5e1fb7454c24d5378)
|
||||
* Fix `z-index` of Badge. [#3898](https://github.com/ant-design/ant-design/issues/3898)
|
||||
* Fix alignment of multi-line Checkbox. [#3971](https://github.com/ant-design/ant-design/issues/3971) [@flashback313](https://github.com/flashback313)
|
||||
* Fix alignment of InputNumber while using with other form controls. [#3866(comment)](https://github.com/ant-design/ant-design/issues/3866#issuecomment-261148256)
|
||||
* Fix style of `Menu.Divider`. [#3813](https://github.com/ant-design/ant-design/issues/3813)
|
||||
* Fix that Popover should support Checkbox and Radio as children. [#3455](https://github.com/ant-design/ant-design/issues/3455)
|
||||
* Fix height of `Select[combobox]`. [#3855](https://github.com/ant-design/ant-design/issues/3855)
|
||||
* Fix style of actived Switch. [#3838](https://github.com/ant-design/ant-design/issues/3838)
|
||||
* Fix that Transfer doesn't show "Not Found" while there is no search result. [#3996](https://github.com/ant-design/ant-design/issues/3996)
|
||||
* Fix style of placeholder of TreeSelect. [#3841](https://github.com/ant-design/ant-design/issues/3841)
|
||||
* Fix compile errors in TypeScript. [#3969](https://github.com/ant-design/ant-design/pull/3969) [@AlbertZheng](https://github.com/AlbertZheng)
|
||||
* Fix that feedback icon should not affect users' operation. [#3891](https://github.com/ant-design/ant-design/issues/3891)
|
||||
|
||||
## 2.4.3
|
||||
|
||||
`2016-11-17`
|
||||
|
||||
* Fix errors in `Anchor` about querySelector, and make some experience Optimization .[#3832](https://github.com/ant-design/ant-design/issues/3832) [#3844](https://github.com/ant-design/ant-design/issues/3844)
|
||||
|
||||
## 2.4.2
|
||||
|
||||
`2016-11-13`
|
||||
|
||||
* Fix `Dropdown.Button` cannot popup menu.[#3815](https://github.com/ant-design/ant-design/issues/3815)
|
||||
|
||||
## 2.4.1
|
||||
|
||||
`2016-11-11`
|
||||
|
||||
* Fix `2.4.0` missing index files.
|
||||
|
||||
## 2.4.0
|
||||
|
||||
`2016-11-11`
|
||||
|
||||
* Adjust components structure.
|
||||
* New [Anchor](https://ant.design/components/anchor) Component.
|
||||
* Add new props `selectedKeys` for `Transfer` component [#3729]. (https://github.com/ant-design/ant-design/issues/3729)
|
||||
* Fix less variables `@font-size-base` and `@text-color`, add `@font-size-lg` `@text-color-secondary`.
|
||||
* Add new props `selectedKeys` for `Transfer` component [#3729]. (https://github.com/ant-design/ant-design/issues/3729)
|
||||
* Add `Tag` selected status.
|
||||
* Fix `Today` button of `DatePicker`. [#3748](https://github.com/ant-design/ant-design/issues/3748)
|
||||
* Fix `Dropdown.Button` not support `visible` and `onVisibleChange`. [#3779](https://github.com/ant-design/ant-design/issues/3779)
|
||||
* Fix `Now` button of `DatePicker[showTime]`. [#3748](https://github.com/ant-design/ant-design/issues/3748)
|
||||
* Fix style of `Steps` in vertical mode. [#3760](https://github.com/ant-design/ant-design/issues/3760)
|
||||
* Fix style compatibility of `Spin` in IE10+.[#3755](https://github.com/ant-design/ant-design/issues/3755)
|
||||
* Fix default style of `Carousel` component.
|
||||
* Fix focus logic of `Mention` component. [#3801](https://github.com/ant-design/ant-design/issues/3801)
|
||||
* Fix animate bug of `Progress` component. [#3784](https://github.com/ant-design/ant-design/issues/3784)
|
||||
* Fix focus bug of `Select` component. [#3778](https://github.com/ant-design/ant-design/issues/3778)
|
||||
* Improve style of `TimePicker`. [#3793](https://github.com/ant-design/ant-design/issues/3793)
|
||||
* Fix `TimePicker` not support `format="HH"` bug. [#3793](https://github.com/ant-design/ant-design/issues/3793)
|
||||
* Fix `Input` `suffix` mouse event responsive area. [#3714](https://github.com/ant-design/ant-design/issues/3714)
|
||||
* Improve performance of `Table` selection. [#3757](https://github.com/ant-design/ant-design/pull/3757)
|
||||
* Improve Carousel default UI style.
|
||||
* Improve style of `Checkbox` and `Radio`. [#3590](https://github.com/ant-design/ant-design/issues/3590)
|
||||
|
||||
* Fix style of DatePickek, Form, Table.
|
||||
|
||||
## 2.3.2
|
||||
|
||||
@@ -48,7 +151,7 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi
|
||||
* Add `bordered` for `Collapse`.
|
||||
* Improve `Tabs` switch animation.
|
||||
* Improve `Radio` and `Checkbox` style when it's disabled and mouse hovered. [#3590](https://github.com/ant-design/ant-design/issues/3590)
|
||||
* Opitimize `Transfer` performance.[#2860](https://github.com/ant-design/ant-design/issues/2860)
|
||||
* Optimize `Transfer` performance.[#2860](https://github.com/ant-design/ant-design/issues/2860)
|
||||
* Fix nested `Popover` style issue. [#3448](https://github.com/ant-design/ant-design/issues/3448)
|
||||
* Fix issue resulting in server side render `Transfer` failed. [#3686](https://github.com/ant-design/ant-design/issues/3686)
|
||||
* Fix issue resulting in preview image not display when `Upload` in `picture-card` mode. [#3706](https://github.com/ant-design/ant-design/pull/3706) [@denzw](https://github.com/denzw)
|
||||
@@ -71,7 +174,7 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi
|
||||
* Add `className`。
|
||||
* `null` or `undefined` `children` will be ignored.
|
||||
* Select
|
||||
* Add `tokenSeparators` to supoort 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)
|
||||
|
||||
@@ -168,7 +271,7 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi
|
||||
- Fix developers cannot call methods of react-slick. [#3164](https://github.com/ant-design/ant-design/issues/3164)
|
||||
- Fix Steps.Step[icon] should support React.ReactNode. [#3159](https://github.com/ant-design/ant-design/issues/3159)
|
||||
- Fix server-side render for Affix. [#3216](https://github.com/ant-design/ant-design/issues/3216)
|
||||
- Fix Mention should supoort `onSelect` `placeholder`. [#3236](https://github.com/ant-design/ant-design/issues/3236) [#3226](https://github.com/ant-design/ant-design/issues/3226)
|
||||
- Fix Mention should support `onSelect` `placeholder`. [#3236](https://github.com/ant-design/ant-design/issues/3236) [#3226](https://github.com/ant-design/ant-design/issues/3226)
|
||||
- Fix Transfer cannot work with `getFieldDecorator`.
|
||||
- Fix LocaleProvider doesn't work for time-related components.
|
||||
- Fix Cascader doesn't show search text in search mode.
|
||||
@@ -197,6 +300,8 @@ If you meet any problem while you try to upgrade from `antd@1.0.0`, feel free to
|
||||
|
||||
### 2.x Breaking changes
|
||||
|
||||
> We suggest you upgrade to lastest version of `2.x`.
|
||||
|
||||
There are some breaking changes in `antd@2.0.0`, and you need to modify your code to work with it.
|
||||
|
||||
* `value` and `defaultValue` of all the time-related components will not support type `String/Date`, please use [moment](http://momentjs.com/):
|
||||
@@ -210,7 +315,7 @@ There are some breaking changes in `antd@2.0.0`, and you need to modify your cod
|
||||
- <Calendar defaultValue={new Date('2010-10-10')} />
|
||||
+ <Calendar defaultValue={moment('2010-10-10', 'YYYY-MM-DD')} />
|
||||
```
|
||||
* Parameters of type `Date/GregorianCalendar` of functions such as `onChange` and `onPanelChange`, plus other callback functions had been changed to type moment. Please consult [APIs of gregorian-calendar](https://github.com/yiminghe/gregorian-calendar) and [APIs of moment](http://momentjs.com/docs/), and update your code accordingly. And you can consult this [commit](https://github.com/ant-design/ant-design/commit/5a4ebe535f0353089b30ac331bc4fb7877963371) to see how to upate.
|
||||
* Parameters of type `Date/GregorianCalendar` of functions such as `onChange` and `onPanelChange`, plus other callback functions had been changed to type moment. Please consult [APIs of gregorian-calendar](https://github.com/yiminghe/gregorian-calendar) and [APIs of moment](http://momentjs.com/docs/), and update your code accordingly. And you can consult this [commit](https://github.com/ant-design/ant-design/commit/4026221d451b246956983bb42140142d4a48b7d7) to see how to update.
|
||||
|
||||
Because the return value of `JSON.stringy(date: moment)` will lost time zone, we should use `.format` to convert date to string first, see related issue [#3082](https://github.com/ant-design/ant-design/issues/3082) for details:
|
||||
```js
|
||||
@@ -308,6 +413,6 @@ The following change will throw some warnings in the console and it will still w
|
||||
* [dva@1.0.0](https://github.com/dvajs/dva) is published and it is officially recommended framework [in real world](http://ant.design/docs/react/practical-projects).
|
||||
* The officially recommended scaffold is [dva-cli](https://github.com/dvajs/dva-cli) now, the old `antd-init` is just for studying and demo.
|
||||
|
||||
## 1.0.0
|
||||
## 1.11.4
|
||||
|
||||
Visit [GitHub](https://github.com/ant-design/ant-design/releases?after=2.0.0) to read change logs from `0.x` to `1.x`。
|
||||
|
||||
@@ -1,27 +1,130 @@
|
||||
---
|
||||
order: 3
|
||||
order: 6
|
||||
title: 更新日志
|
||||
toc: false
|
||||
timeline: true
|
||||
---
|
||||
|
||||
如果需要查看 `0.12.x` 及之前的更新日志,请移步 [GitHub](https://github.com/ant-design/ant-design/releases?after=1.0.0)。
|
||||
如果需要查看 `2.0.0` 之前的更新日志,请移步 [GitHub](https://github.com/ant-design/ant-design/releases?after=2.0.0)。
|
||||
|
||||
---
|
||||
|
||||
## 2.5.2
|
||||
|
||||
`2016-12-10`
|
||||
|
||||
* 优化 Menu 已选择项的样式。
|
||||
* 修复 Mention 不能响应 `onFocus` 和 `onBlur` 的问题。[#4163](https://github.com/ant-design/ant-design/issues/4163)
|
||||
* 修复 `disabled` 和 `checked` 的 Radio 之间会多一条阴影的问题。[#4114](https://github.com/ant-design/ant-design/pull/4114) @jdz321
|
||||
* 修复 RangePicker、TimePicker、Calendar 设置 Moment 的 `defaultValue` 和 `value` 时也会报错的问题。[#4147](https://github.com/ant-design/ant-design/issues/4147)
|
||||
* 修复 Affix 在开启动画的 Tabs 里使用时会消失的问题。[#3943](https://github.com/ant-design/ant-design/issues/3943)
|
||||
* 修复 Cascader 手动选择和搜索选择时 `onChange` 接收到的 `selectedOptions` 不同的问题。[#4096](https://github.com/ant-design/ant-design/issues/4096)
|
||||
* 修复 Tabs 页增加到一定数量时会产生偏移的问题。[#3637](https://github.com/ant-design/ant-design/issues/3637)
|
||||
* Table
|
||||
* 居中对齐表头分组的父表头。
|
||||
* 修正设置 filterDropdownVisible 时不生效的问题。[#4162](https://github.com/ant-design/ant-design/issues/4162)
|
||||
|
||||
## 2.5.1
|
||||
|
||||
`2016-12-03`
|
||||
|
||||
* 提升网站首页在移动端访问的体验。
|
||||
* 补充从 `1.x` 升级到 `2.x` 时的组件改动警告提示。[#4028](https://github.com/ant-design/ant-design/pull/4028)
|
||||
* 现在 ToolTip、Popover、Popconfirm 支持直接包裹文本节点和多个节点。[#3924](https://github.com/ant-design/ant-design/issues/3924)
|
||||
* Anchor
|
||||
* 修复快速滚动时的定位问题。[#4053](https://github.com/ant-design/ant-design/issues/4053)
|
||||
* 修复 target 指定父元素 ref 时无效的问题。[#4037](https://github.com/ant-design/ant-design/issues/4037)
|
||||
* Table
|
||||
* 修复设置 defaultChecked 时的一个选中问题。[#4020](https://github.com/ant-design/ant-design/issues/4020)
|
||||
* 修复分组表头中筛选功能无法使用的问题。[#4099](https://github.com/ant-design/ant-design/issues/4099)
|
||||
* 修复在 `Input[type="textarea"]` 上使用 Popover 定位错误问题。[#4092](https://github.com/ant-design/ant-design/issues/4092)
|
||||
* 修复 Popconfirm 的 `visible` 属性失效的问题。[#4068](https://github.com/ant-design/ant-design/issues/4068)
|
||||
* 修复 TimePicker 无法设置 `style.width` 的问题。
|
||||
* 修复 Steps 自定义图标和默认图标大小不一致的问题。[#3817](https://github.com/ant-design/ant-design/issues/3817)
|
||||
* 修复 Form、Button、Slider、Table 等组件的一些样式细节。
|
||||
|
||||
## 2.5.0
|
||||
|
||||
`2016-11-25`
|
||||
|
||||
* 默认主题风格修改为支付宝钱包风格,及大量样式优化。
|
||||
* 支持服务端渲染。(Mention 会因为 [draft-js](https://github.com/facebook/draft-js/issues/385) 的问题有 warning)
|
||||
* 引入 [Jest Snapshot](https://facebook.github.io/jest/docs/tutorial-react.html#snapshot-testing) 测试组件结构及服务端渲染问题。
|
||||
* 官网及文档优化。
|
||||
* 新增自定义主题的 [文档](https://ant.design/docs/react/customize-theme)。
|
||||
* 新增 [Sketch 资源文件](https://ant.design/docs/resource/download)。
|
||||
* LocaleProvider 新增巴西语支持。[#4004](https://github.com/ant-design/ant-design/pull/4004) [@nathantn](https://github.com/nathantn)
|
||||
* DatePicker
|
||||
* DatePicker 现在可以决定是否展示 “今天” 按钮。[commit](https://github.com/ant-design/ant-design/commit/bbef274aae169d142e3e7e3ea0af922d48e6dd64)
|
||||
* RangePicker 现在可以自定义快捷选择。[demo](https://ant.design/components/date-picker/#components-date-picker-demo-presetted-ranges)
|
||||
* 修复 DatePicker 设置 `showTime` 后 “此刻” 按钮失效的问题。[#3748](https://github.com/ant-design/ant-design/issues/3748)
|
||||
* 修复 `RangePicker[format]` 失效的问题。[#3808](https://github.com/ant-design/ant-design/issues/3808)
|
||||
* 新增并优化部分 Icon。[#3977](https://github.com/ant-design/ant-design/pull/3977)
|
||||
* 新增 Input.Search 控件。[demo](https://ant.design/components/input/#components-input-demo-search-input)
|
||||
* Mention onSelect 事件现在可以获取完整的数据。[#3867](https://github.com/ant-design/ant-design/issues/3867)
|
||||
* Pagination 现在支持展示当前页的索引范围。[demo](https://ant.design/components/pagination/#components-pagination-demo-total)
|
||||
* Table
|
||||
* 自定义筛选的显示隐藏现在可以通过代码控制。[demo](https://ant.design/components/table/#components-table-demo-custom-filter-panel)
|
||||
* 支持 JSX 风格的方式设置 columns。[demo](https://ant.design/components/table/#components-table-demo-jsx)
|
||||
* 现在可以监听单元格的点击事件。[#3774](https://github.com/ant-design/ant-design/issues/3774)
|
||||
* 修复无边框 Table 头部的圆角样式问题。
|
||||
* 修复 title 和 footer 高度不随 `Table[size]` 变化的问题。[commit](https://github.com/ant-design/ant-design/commit/9e6439b06cd099ab384a4a2f026f0def6e12bf23)
|
||||
* 修复选中状态出错的问题。[#3900](https://github.com/ant-design/ant-design/issues/3900)
|
||||
* Upload
|
||||
* 修复 children 不能为 `null` 的问题。
|
||||
* 修复预览逻辑的问题。[commit](https://github.com/ant-design/ant-design/commit/e552880c32aaa3f5b0fb09a5e1fb7454c24d5378)
|
||||
* 修复 Badge 会覆盖其他组件的问题。[#3898](https://github.com/ant-design/ant-design/issues/3898)
|
||||
* 修复多行 Checkbox 样式不对齐的问题。[#3971](https://github.com/ant-design/ant-design/issues/3971) [@flashback313](https://github.com/flashback313)
|
||||
* 修复 InputNumber 与其它表单控件不对齐的问题。[#3866(comment)](https://github.com/ant-design/ant-design/issues/3866#issuecomment-261148256)
|
||||
* 修复 `Menu.Divider` 样式问题。[#3813](https://github.com/ant-design/ant-design/issues/3813)
|
||||
* 修复 Popover 直接内嵌 Checkbox 和 Radio 无效的问题。[#3455](https://github.com/ant-design/ant-design/issues/3455)
|
||||
* 修复 Select combobox 高度异常问题。[#3855](https://github.com/ant-design/ant-design/issues/3855)
|
||||
* 修复 Switch actived 后的样式问题。[#3838](https://github.com/ant-design/ant-design/issues/3838)
|
||||
* 修复 Transfer 搜索无结果时不展示 “Not Found” 提示的问题。[#3996](https://github.com/ant-design/ant-design/issues/3996)
|
||||
* 修复 TreeSelect 占位符的样式问题。[#3841](https://github.com/ant-design/ant-design/issues/3841)
|
||||
* 修复 TypeScript 编译报错的问题。[#3969](https://github.com/ant-design/ant-design/pull/3969) [@AlbertZheng](https://github.com/AlbertZheng)
|
||||
* 修复表单反馈图标影响用户操作的问题。[#3891](https://github.com/ant-design/ant-design/issues/3891)
|
||||
|
||||
## 2.4.3
|
||||
|
||||
`2016-11-17`
|
||||
|
||||
* 修复 `Anchor` 内部 querySelector 报错,并做了一些体验优化 。[#3832](https://github.com/ant-design/ant-design/issues/3832) [#3844](https://github.com/ant-design/ant-design/issues/3844)
|
||||
|
||||
## 2.4.2
|
||||
|
||||
`2016-11-13`
|
||||
|
||||
* 修复 `Dropdown.Button` 不弹出的问题。[#3815](https://github.com/ant-design/ant-design/issues/3815)
|
||||
|
||||
## 2.4.1
|
||||
|
||||
`2016-11-11`
|
||||
|
||||
* 修复 `2.4.0` 组件 index 文件丢失的问题。
|
||||
|
||||
## 2.4.0
|
||||
|
||||
* 新增 [Anchor](https://ant.design/components/anchor) 组件.
|
||||
* 为 `Transfer` 组件新增了受控属性 `selectedKeys`. [#3729](https://github.com/ant-design/ant-design/issues/3729)
|
||||
* 为 `Tag` 新增选中状态.
|
||||
* 修复 `DatePicker` 的 `今天` 按钮. [#3748](https://github.com/ant-design/ant-design/issues/3748)
|
||||
* 修复 `Steps` 竖直方向的样式. [#3760](https://github.com/ant-design/ant-design/issues/3760)
|
||||
* 修复 `Carousel` 的默认样式.
|
||||
`2016-11-11`
|
||||
|
||||
* 调整了组件的导航结构。
|
||||
* 新增 [Anchor](https://ant.design/components/anchor) 锚点组件。
|
||||
* 整理了样式变量,修复 `@font-size-base` 和 `@text-color` 在部分组件无效的问题,新增 `@font-size-lg` `@text-color-secondary`,并移除了部分无用的变量。
|
||||
* `Transfer` 组件新增了受控属性 `selectedKeys`。[#3729](https://github.com/ant-design/ant-design/issues/3729)
|
||||
* `Tag` 新增选中状态。
|
||||
* 修复 `Dropdown.Button` 不支持 `visible` 和 `onVisibleChange` 的问题。[#3779](https://github.com/ant-design/ant-design/issues/3779)
|
||||
* 修复 `DatePicker[showTime]`` 的 `此刻` 按钮。[#3748](https://github.com/ant-design/ant-design/issues/3748)
|
||||
* 修复 `Steps` 竖直方向的样式。[#3760](https://github.com/ant-design/ant-design/issues/3760)
|
||||
* 修复 `Spin` 组件在 IE10+ 的样式问题。[#3755](https://github.com/ant-design/ant-design/issues/3755)
|
||||
* 修复 `Mention` 组件的 focus 逻辑. [#3801](https://github.com/ant-design/ant-design/issues/3801)
|
||||
* 修复 `Progress` 组件的动画 bug. [#3784](https://github.com/ant-design/ant-design/issues/3784)
|
||||
* 修复 `Select` 的焦点bug. [#3778](https://github.com/ant-design/ant-design/issues/3778)
|
||||
* 优化 `TimePicker` 的样式. [#3793](https://github.com/ant-design/ant-design/issues/3793)
|
||||
* 优化 `Checkbox` 和 `Radio` 的样式. [#3590](https://github.com/ant-design/ant-design/issues/3590)
|
||||
* 修复 `Progress` 组件的动画问题。[#3784](https://github.com/ant-design/ant-design/issues/3784)
|
||||
* 修复 `Select` 搜索时的丢失焦点问题。[#3778](https://github.com/ant-design/ant-design/issues/3778)
|
||||
* 修复 `TimePicker` 不支持 `format="HH"` 等格式的问题。[#3793](https://github.com/ant-design/ant-design/issues/3793)
|
||||
* 修复 `Input` 的 `suffix` 部分区域中鼠标事件无法响应的问题。[#3714](https://github.com/ant-design/ant-design/issues/3714)
|
||||
* 优化了 `Table` 选择的性能。[#3757](https://github.com/ant-design/ant-design/pull/3757)
|
||||
* 优化 `Carousel` 的默认样式。
|
||||
* 优化 `Checkbox` 和 `Radio` 的样式。[#3590](https://github.com/ant-design/ant-design/issues/3590)
|
||||
* 修复 `DatePicker`、`Form`、`Table` 等组件的样式细节。
|
||||
|
||||
## 2.3.2
|
||||
|
||||
@@ -194,6 +297,8 @@ timeline: true
|
||||
|
||||
### 2.x 不兼容改动
|
||||
|
||||
> 建议从 `1.x` 升级时,直接升级到 `2.x` 的最新版本。
|
||||
|
||||
此版本有部分不兼容的改动,升级时确保修改相应的使用代码。
|
||||
|
||||
* 时间类组件的 `value` 和 `defaultValue` 不再支持 `String/Date` 类型,请使用 [moment](http://momentjs.com/)。
|
||||
@@ -207,7 +312,7 @@ timeline: true
|
||||
- <Calendar defaultValue={new Date('2010-10-10')} />
|
||||
+ <Calendar defaultValue={moment('2010-10-10', 'YYYY-MM-DD')} />
|
||||
```
|
||||
* 时间类组件的 `onChange` 和 `onPanelChange` 及其他回调函数中为 `Date/GregorianCalendar` 类型的参数,均修改为 moment 类型,两者 API 有所不同,但功能基本一致,请对照 [moment 的 API 文档](http://momentjs.com/docs/) 和 [gregorian-calendar 的文档](https://github.com/yiminghe/gregorian-calendar) 进行修改。你也可以参考这个 [commit](https://github.com/ant-design/ant-design/commit/5a4ebe535f0353089b30ac331bc4fb7877963371) 来进行修改。
|
||||
* 时间类组件的 `onChange` 和 `onPanelChange` 及其他回调函数中为 `Date/GregorianCalendar` 类型的参数,均修改为 moment 类型,两者 API 有所不同,但功能基本一致,请对照 [moment 的 API 文档](http://momentjs.com/docs/) 和 [gregorian-calendar 的文档](https://github.com/yiminghe/gregorian-calendar) 进行修改。你也可以参考这个 [commit](https://github.com/ant-design/ant-design/commit/4026221d451b246956983bb42140142d4a48b7d7) 来进行修改。
|
||||
|
||||
由于 `JSON.stringy(date: moment)` 返回的值会丢失时区设置,所以要先使用 `.format` 把日期转成字符串,相关 issue 见 [#3082](https://github.com/ant-design/ant-design/issues/3082):
|
||||
```js
|
||||
@@ -306,446 +411,6 @@ timeline: true
|
||||
* [dva@1.0.0](https://github.com/dvajs/dva) 也已经发布,并推荐 [在实战项目中使用](http://ant.design/docs/react/practical-projects)。
|
||||
* 脚手架工具推荐使用 [dva-cli](https://github.com/dvajs/dva-cli),原来的 `antd-init` 以后仅会用于学习以及 demo。
|
||||
|
||||
## 1.11.2
|
||||
## 1.11.4
|
||||
|
||||
`2016-09-26`
|
||||
|
||||
- 修复 Popover 内嵌 Badge 后失效的问题。[#3109](https://github.com/ant-design/ant-design/issues/3109)
|
||||
- 修复 Modal 内嵌的 Button 在某些情况下与 Modal 的滚动不同步的问题。[#3031](https://github.com/ant-design/ant-design/issues/3031)
|
||||
|
||||
## 1.11.1
|
||||
|
||||
`2016-09-14`
|
||||
|
||||
- 修复 Menu 设置成 `theme=dark` 后,链接点击无效的问题。[#2929](https://github.com/ant-design/ant-design/issues/2929)
|
||||
- 修复迷你型 Table 表头与内容不对齐的问题。[#2933](https://github.com/ant-design/ant-design/issues/2933)
|
||||
- 修复 Cascader hover 样式。[#3015](https://github.com/ant-design/ant-design/issues/3015)
|
||||
- 修复 Upload 上传多个文件时,`onChange` 调用不正确的问题。[#3001](https://github.com/ant-design/ant-design/issues/3001)
|
||||
- 修复 TimePicker 报错样式的问题。[#2973](https://github.com/ant-design/ant-design/issues/2973)
|
||||
- 修复 Calendar 控件的年度选择下拉内容截断的问题。[#2927](https://github.com/ant-design/ant-design/issues/2927)
|
||||
|
||||
## 1.11.0
|
||||
|
||||
`2016-09-01`
|
||||
|
||||
- `Tooltip` `Popover` `Popconfirm` 修正默认对齐方式为边缘对齐,增加 arrowPointAtCenter 属性用于箭头指向中心的行为。[commit 977e2e3](https://github.com/ant-design/ant-design/commit/977e2e32fc40968846c8201ed72bdc3818375d2f)
|
||||
- `Table`
|
||||
- 移除数据中添加的 `indexForSort`。[#2501](https://github.com/ant-design/ant-design/issues/2501)
|
||||
- 修复 `pagination` 属性中 `defaultPageSize` 不生效的问题。[#2874](https://github.com/ant-design/ant-design/issues/2874)
|
||||
- 修复数据为空时固定列出现重复提示的问题。[#2812](https://github.com/ant-design/ant-design/issues/2812)
|
||||
- 给树形子数据增加排序功能。[#2839](https://github.com/ant-design/ant-design/issues/2839)
|
||||
- `InputNumber` 样式问题修复。[#2876](https://github.com/ant-design/ant-design/issues/2876)
|
||||
- 修复手动导入 less 文件时 input error 样式被 focus 样式覆盖的问题。[#2916](https://github.com/ant-design/ant-design/issues/2916)
|
||||
- index.d.ts 中补充了一些缺失的声明,修复 `Form` 中 typescript 语法检查报错的问题。[#2885](https://github.com/ant-design/ant-design/issues/2885)
|
||||
- 升级 react-slick 依赖到 `0.13`。
|
||||
|
||||
## 1.10.0
|
||||
|
||||
`2016-08-20`
|
||||
|
||||
- Affix 和 BackTop 新增 `target` 属性,支持指定滚动容器。[#2718](https://github.com/ant-design/ant-design/issues/2718)
|
||||
- 文档页面加上编辑按钮,方便社区贡献。[#2325](https://github.com/ant-design/ant-design/issues/2325)
|
||||
- 升级 rc-cascader 依赖,修复一个 `loadData` 属性和表单结合使用的问题。[#2767](https://github.com/ant-design/ant-design/issues/2767)
|
||||
- 修复 `editable-card` 类型的 Tabs 没有关闭图标的问题。[#2747](https://github.com/ant-design/ant-design/issues/2747)
|
||||
- Menu 修正默认 `z-index`。[#2762](https://github.com/ant-design/ant-design/issues/2762)
|
||||
- 修正 Select 组件在 IE 下的一些样式问题。[#2741](https://github.com/ant-design/ant-design/issues/2741)
|
||||
|
||||
## 1.9.1
|
||||
|
||||
`2016-08-16`
|
||||
|
||||
- 修复 `editable-card` 类型的 Tabs 设置 `activeKey` 无效的问题。[#2725](https://github.com/ant-design/ant-design/issues/2725)
|
||||
- 修复一个 Table 的样式兼容性问题。[#2723](https://github.com/ant-design/ant-design/issues/2723)
|
||||
- 更新 axure 部件库。[#2714](https://github.com/ant-design/ant-design/issues/2714)
|
||||
|
||||
## 1.9.0
|
||||
|
||||
`2016-08-15`
|
||||
|
||||
- Transfer 修复在火狐下 item 文案过长时只显示省略号的问题。[#2674](https://github.com/ant-design/ant-design/issues/2674)
|
||||
- Input 修复 `autosize` 模式下特定场景中不能输入中文及光标定位不准的问题。[#2666](https://github.com/ant-design/ant-design/issues/2666) [#2239](https://github.com/ant-design/ant-design/issues/2239)
|
||||
- Tabs 修复 `type="editable-card"` 模式下的 `children` 解析问题。[#2658](https://github.com/ant-design/ant-design/issues/2658)
|
||||
- Radio 修复若干 less 硬编码问题。[#2424](https://github.com/ant-design/ant-design/issues/2424)
|
||||
- Upload 的 rc-upload 依赖升级至 2.x,引入的变化有:
|
||||
- 增加 `disabled` 属性。[#2645](https://github.com/ant-design/ant-design/issues/2645)
|
||||
- 取消上传时会自动 abort 上传请求。[#2571](https://github.com/ant-design/ant-design/issues/2571) [#2518](https://github.com/ant-design/ant-design/issues/2518)
|
||||
- Table
|
||||
- 修复 spin 在可滚动区域的定位问题。[#2652](https://github.com/ant-design/ant-design/issues/2652)
|
||||
- 修复无数据时 提示样式错位的问题。[#2663](https://github.com/ant-design/ant-design/issues/2663)
|
||||
- Popover 修复设定 `getTooltipContainer` 后会导致内嵌 DatePicker 样式失效的问题。[#2675](https://github.com/ant-design/ant-design/issues/2675)
|
||||
- Modal 修复重复卸载组件导致的报错。[#2688](https://github.com/ant-design/ant-design/issues/2688)
|
||||
- 升级 rc-slider 组件依赖。
|
||||
|
||||
## 1.8.0
|
||||
|
||||
`2016-08-08`
|
||||
|
||||
- 修复可关闭 Tabs 组件只有一个 Tab 的时候报错的问题。[#2559](https://github.com/ant-design/ant-design/issues/2559)
|
||||
- 修复 Datepicker 在 IE8 下关闭图标。[#2584](https://github.com/ant-design/ant-design/issues/2584)
|
||||
- Tags 支持自定义标签颜色。[#2585](https://github.com/ant-design/ant-design/issues/2585)
|
||||
- TreeSelect 修复未找到内容时的样式。[9cee9f](https://github.com/ant-design/ant-design/commit/9cee9f103a4729572358206c81cba84e2fdc20f5)
|
||||
- Modal 适配小屏幕。[#2597](https://github.com/ant-design/ant-design/issues/2597)
|
||||
- 修复了 Row 组件在同一行闭合会报错的问题。[#2603](https://github.com/ant-design/ant-design/issues/2603)
|
||||
- Table 的 `rowSelection.onChange` 的参数 `selectedRows` 现在和 `selectedRowKeys` 保持一致。[#2566](https://github.com/ant-design/ant-design/issues/2603)
|
||||
- Checkbox 和 Radio 现在支持 `onClick` 属性。
|
||||
|
||||
## 1.7.0
|
||||
|
||||
`2016-07-30`
|
||||
|
||||
友情提示 [Ant Design Mobile](http://mobile.ant.design) 已经发布。
|
||||
|
||||
- Table
|
||||
- 现可以定义页头。[demo](http://ant.design/components/table#components-table-demo-bordered)
|
||||
- 修复当 `rowKey` 为 `String` 时的报错问题。[#2500](https://github.com/ant-design/ant-design/issues/2500)
|
||||
- 修复 `Table` 会修改 `dataSource` 里面的值的问题。[#2501](https://github.com/ant-design/ant-design/issues/2501)
|
||||
- Form 现在不再需要显式传递 `form={this.props.form}`。
|
||||
- 优化 Breadcrumb.Item 的 hover 效果。
|
||||
- 优化 Progress 的动画效果。
|
||||
- DatePicker
|
||||
- 优化清除按钮样式。
|
||||
- 修复点击 `此刻` 时不触发 `onChange` 的问题。[#1902](https://github.com/ant-design/ant-design/issues/1902)
|
||||
- Menu
|
||||
- 修复子菜单中的 Item 被选中后,父级元素无样式变化的问题。[#2414](https://github.com/ant-design/ant-design/issues/2414)
|
||||
- 修复 Menu.Item disabled 后的样式问题。
|
||||
- TreeSelect
|
||||
- treeNodes 可以设置是否可选。[#2401](https://github.com/ant-design/ant-design/issues/2401)
|
||||
- 修复多选模式下进行搜索会把已选项清掉的问题。[#2393](https://github.com/ant-design/ant-design/issues/2393)
|
||||
- 修复 TreeSelect 会修改原数据的问题。[#2459](https://github.com/ant-design/ant-design/issues/2459)
|
||||
- 修复了 Select 组件 placeholder 溢出的问题。[#2480](https://github.com/ant-design/ant-design/pull/2480)
|
||||
- 修复 Timeline.Item 无法自定义边框颜色的问题。[#2479](https://github.com/ant-design/ant-design/issues/2479)
|
||||
- 修复 Spin 显示突兀的问题。[#2398](https://github.com/ant-design/ant-design/issues/2398)
|
||||
- 修复 Cascader 选项文字过长导致的样式问题。[#2515](https://github.com/ant-design/ant-design/issues/2515)
|
||||
|
||||
## 1.6.5
|
||||
|
||||
`2016-07-16`
|
||||
|
||||
- 修复 Input 的 `value prop on input should not be null` 警告并且导致在表单中无法重置的问题。[#2335](https://github.com/ant-design/ant-design/issues/2335)
|
||||
- 优化 FormItem 的布局实现,修复表单布局不支持响应式布局的问题。[#2305](https://github.com/ant-design/ant-design/issues/2305)
|
||||
- 修复带时间的 DatePicker 的 onChange 触发逻辑。[#2399](https://github.com/ant-design/ant-design/issues/2399#issuecomment-232893146)
|
||||
- 修复 Transfer 搜索后全选的问题。[#2396](https://github.com/ant-design/ant-design/issues/2396)
|
||||
- 修复 Cascader 样式会被 ant-input 样式覆盖的问题。[#2400](https://github.com/ant-design/ant-design/issues/2400)
|
||||
- 修复 Table 删除数据时导致当前页数溢出的问题。[#2301](https://github.com/ant-design/ant-design/pull/2301)
|
||||
- 修复 resize 浏览器时 Affix 元素没有和原来的位置同步的问题。[#1987](https://github.com/ant-design/ant-design/issues/1987)
|
||||
- 给 Affix 元素添加占位,修复固定时页面跳动的问题。
|
||||
- 修复 Select combobox 模式会导致页面出现横向滚动条的问题。[#2353](https://github.com/ant-design/ant-design/issues/2353)
|
||||
- 修复 Upload 组件已上传文件链接点击无效的问题。[#2331](https://github.com/ant-design/ant-design/issues/2331)
|
||||
- 修复 Upload 上传过程中删除图片后的报错问题。[#2342](https://github.com/ant-design/ant-design/issues/2342)
|
||||
|
||||
## 1.6.4
|
||||
|
||||
`2016-07-08`
|
||||
|
||||
- 修复组件在 react@15.2.0 下报 Unknown props 警告的问题。[#2258](https://github.com/ant-design/ant-design/issues/2258)
|
||||
- `Table`
|
||||
- 修复 filterDropDown 中内容未改变也会调用 onChange 的问题。[#2228](https://github.com/ant-design/ant-design/issues/2228)
|
||||
- 修复设置 scroll.y 高度后导致内容无法对齐的问题。[#2227](https://github.com/ant-design/ant-design/issues/2227)
|
||||
- `Form`
|
||||
- 修复 `FormItem` 中带空格后缀的冒号替换问题,关联issue:[#1877](https://github.com/ant-design/ant-design/issues/1877)
|
||||
- demo 优化。
|
||||
- `Transfer`
|
||||
- 修复重复 render 的问题,性能优化。[#2112](https://github.com/ant-design/ant-design/issues/2112)
|
||||
- 优化搜索逻辑,修复搜索时未对特殊字符进行处理的问题。[#2260](https://github.com/ant-design/ant-design/issues/2260)
|
||||
- 清除按钮样式优化。
|
||||
- 修复 `Steps` 最后一步多余横线隐藏的问题。
|
||||
- 修复 `Cascader` small size 样式下沉 1px,以及 hover/click 样式残缺的问题。[#2234](https://github.com/ant-design/ant-design/issues/2234)
|
||||
- 修复 `RangePicker` 无清除按钮的问题。[#2252](https://github.com/ant-design/ant-design/issues/2252)
|
||||
|
||||
## 1.6.3
|
||||
|
||||
`2016-07-04`
|
||||
|
||||
- 修复 Transfer 的一个 unmount 的错误。[#2206](https://github.com/ant-design/ant-design/pull/2206)
|
||||
- 修复了 Badge、Alert、Menu、Tag、Checkbox、Radio 组件的一些样式细节问题。
|
||||
|
||||
## 1.6.2
|
||||
|
||||
`2016-06-27`
|
||||
|
||||
- 修复 Table、Transfer 的样式错位问题。
|
||||
- 修复 DatePicker 的一个样式问题。[#2182](https://github.com/ant-design/ant-design/issues/2182)
|
||||
- 优化 Menu 的 hover 样式响应性能。
|
||||
|
||||
## 1.6.1
|
||||
|
||||
`2016-06-24`
|
||||
|
||||
- 回滚一个未完成的 DatePicker 时间选项改造效果。
|
||||
|
||||
## 1.6.0
|
||||
|
||||
`2016-06-24`
|
||||
|
||||
- 新增置顶组件 [BackTop](/components/back-top)。
|
||||
- 全新的 [Spin](/components/spin) 样式。
|
||||
- 给 `Modal.xxx` 系列方法添加了 `{ destory }` 的访问值,方便事后销毁。[#2110](https://github.com/ant-design/ant-design/issues/2110)
|
||||
- Table 的 `rowKey` 属性支持直接使用字符串。[#2058](https://github.com/ant-design/ant-design/issues/2058)
|
||||
- Table 增加 `column.filterDropdown` 属性用于自定义渲染筛选菜单的浮层。[#1736](https://github.com/ant-design/ant-design/issues/1736)
|
||||
- 修复 Tooltip、Popover、Popconfirm 设置 `onVisibleChange` 后失效的问题。[#2134](https://github.com/ant-design/ant-design/issues/2134)
|
||||
- 修复在 IE8 下 Checkbox 的勾样式变形的问题。[#2148](https://github.com/ant-design/ant-design/issues/2148)
|
||||
- 优化 Checkbox、Radio 失效状态的文字颜色。[#2114](https://github.com/ant-design/ant-design/issues/2114)
|
||||
- 优化 Checkbox、Radio 的默认边距过于拥挤的问题。[#2137](https://github.com/ant-design/ant-design/issues/2137)
|
||||
- 优化 Pagination 在暗色背景下的样式。[#2126](https://github.com/ant-design/ant-design/issues/2126)
|
||||
- 修复 Table 固定列时内容无法换行和高度对齐的问题,同时修复了一个 Chrome 下的表格内容错位问题。[#2130](https://github.com/ant-design/ant-design/issues/2130)
|
||||
- 修复一个 Table 的 `rowSelection` 设为 null 时可能导致报错的问题。[#2127](https://github.com/ant-design/ant-design/issues/2127)
|
||||
- 修复在 IE8 下点击 Table 选择框报错的问题。[#2154](https://github.com/ant-design/ant-design/issues/2154)
|
||||
- 小幅优化了 Transfer 的渲染性能。[#2112](https://github.com/ant-design/ant-design/issues/2112)
|
||||
- 将 DatePicker 的清除按钮从面板上移到外部输入框,解决用户容易误解为关闭的问题。[#1708](https://github.com/ant-design/ant-design/issues/1708)
|
||||
- Upload 的 `onPreview` 现在没有 `file.url` 时也能生效。[#2163](https://github.com/ant-design/ant-design/issues/2163)
|
||||
|
||||
## 1.5.1
|
||||
|
||||
`2016-06-21`
|
||||
|
||||
- 修复一个 TypeScript 定义文件的语法错误。
|
||||
- 修复 Table 固定表头高度和滚动条样式问题。
|
||||
|
||||
## 1.5.0
|
||||
|
||||
`2016-06-17`
|
||||
|
||||
- 升级 `rc-form` 到 0.17,支持 `getFieldProps('xx.yy')` 的写法,并支持单多选控件进行关联。[#](https://github.com/react-component/form/pull/21)
|
||||
- Input 的 `addonBefore` 和 `addonAfter` 支持内嵌选择框。[#1927](https://github.com/ant-design/ant-design/issues/1927)
|
||||
- 优化了两个 DatePicker 组成的时间范围选择演示的体验。
|
||||
- 优化一个多个对话框的遮罩层高度的问题。[#2009](https://github.com/ant-design/ant-design/issues/2009)
|
||||
- 优化 Table 的 `getCheckboxProps` 的调用次数。[#2086](https://github.com/ant-design/ant-design/issues/2086)
|
||||
- 修复 Table 固定列时,表头无法左右滚动的问题。[#2068](https://github.com/ant-design/ant-design/issues/2068)
|
||||
- 修复小型表格固定表头的样式。[#2023](https://github.com/ant-design/ant-design/issues/2023)
|
||||
- 修复 Tabs 的 `tabPosition` 为左右时样式错位的问题。[#2046](https://github.com/ant-design/ant-design/issues/2046)
|
||||
- 修复 RangePicker 的日期范围背景丢失的问题。
|
||||
- 修复 Switch 失效状态下文字颜色太浅的问题。[#2051](https://github.com/ant-design/ant-design/issues/2051)
|
||||
- 修复一个 Select 的 `disabled` 选项依然可以被移除的问题。[#2034](https://github.com/ant-design/ant-design/issues/2034)
|
||||
- 修复官方站点在 IE 下的报错问题。
|
||||
|
||||
## 1.4.1
|
||||
|
||||
`2016-06-12`
|
||||
|
||||
- 修复一个展开 Tabs 会导致表格宽度溢出的问题。[#2013](https://github.com/ant-design/ant-design/issues/2013)
|
||||
- 修复一个某些情况下表格布局被破坏的问题。
|
||||
|
||||
## 1.4.0
|
||||
|
||||
`2016-06-12`
|
||||
|
||||
此版本之后你可能会遇到 [#2030](https://github.com/ant-design/ant-design/issues/2030),请使用 `react@15+` 或 `npm@3+`。
|
||||
|
||||
- `Input[type="textarea"]` 支持自动调整高度。 [#](http://ant.design/components/input#components-input-demo-autosize-textarea)
|
||||
- `Breadcrumb`
|
||||
- `nameRender` 新增 `route` 和 `params` 参数。 [#1999](https://github.com/ant-design/ant-design/issues/1999)
|
||||
- `linkRender` 新增 `paths` 参数。
|
||||
- 再次修复 `Table` 组件 `rowSelection.onChange` 与 `onRowClick` 冲突问题。 [#1470](https://github.com/ant-design/ant-design/issues/1470)
|
||||
- 修复 `Form.Item` 中 `Input` 高度抖动问题。 [#1955](https://github.com/ant-design/ant-design/issues/1955)
|
||||
- 修复高级搜索的 `ant-advanced-search-form` 样式丢失的问题。
|
||||
|
||||
## 1.3.2
|
||||
|
||||
`2016-06-06`
|
||||
|
||||
- 修复全局模式下引用 antd,IE8 环境报错的问题。 [#1970](https://github.com/ant-design/ant-design/issues/1970)
|
||||
|
||||
## 1.3.1
|
||||
|
||||
`2016-06-06`
|
||||
|
||||
- 修复 `Message` `Notification` 找不到的问题。 [#1968](https://github.com/ant-design/ant-design/issues/1968)
|
||||
|
||||
## 1.3.0
|
||||
|
||||
`2016-06-02`
|
||||
|
||||
- Transfer 组件增加 `rowKey` 属性,可自定义数据源主键。 [#1900](https://github.com/ant-design/ant-design/issues/1900)
|
||||
- Tag 组件 `default` 类型的样式增加边框,防止淹没在背景中。 [#1910](https://github.com/ant-design/ant-design/issues/1910)
|
||||
- Table
|
||||
- 修复筛选为单选时仍旧展示多选框的问题。 [#1880](https://github.com/ant-design/ant-design/issues/1880)
|
||||
- 修复 fixed left 的固定列会覆盖 rowSelection 的 Checkbox 的问题。 [#1829](https://github.com/ant-design/ant-design/issues/1829)
|
||||
- 升级 rc-table 依赖
|
||||
- 修复了 fixed 列中数据重复展示以及一些错位问题。 [#1898](https://github.com/ant-design/ant-design/issues/1898)
|
||||
- `dataIndex` 支持内嵌属性的写法。 [react-component/table#46](https://github.com/react-component/table/issues/46)
|
||||
- 修复了 v1.2.0 新增加的组件属性的 TypeScript 定义。 [#1933](https://github.com/ant-design/ant-design/issues/1933)
|
||||
- Form 修复 label中冒号的国际化问题,采用样式实现冒号,不再需要手动输入冒号。 [#1877](https://github.com/ant-design/ant-design/issues/1877)
|
||||
- 修复 DatePicker 组件点击『此刻』失效的问题,并进行了一些代码优化。 [#1902](https://github.com/ant-design/ant-design/issues/1902)
|
||||
- 升级 rc-upload 依赖,修复了 IE10 中第二次上传同一文件不触发 `onChange` 的问题。 [058af3c](https://github.com/ant-design/ant-design/commit/b15a4e3165be5e4db995d3fe75d4d557c7f21c61)
|
||||
- 文档使用 [bisheng](https://github.com/benjycui/bisheng) 重构。
|
||||
|
||||
## 1.2.1
|
||||
|
||||
`2016-05-27`
|
||||
|
||||
- 修复一个 Select 组件的文字重复问题。
|
||||
|
||||
## 1.2.0
|
||||
|
||||
`2016-05-26`
|
||||
|
||||
- Input 组件的文档现在和 Form 分离。 [3c98d3](https://github.com/ant-design/ant-design/commit/3c98d3f80f4ec80066756adc3b4108141d4383ca)
|
||||
- Affix
|
||||
- 新增了 `onChange` 属性。当固定状态改变时回调 [#1777](https://github.com/ant-design/ant-design/issues/1777)
|
||||
- 找回了从 affixStyle 中走失的 `width` 属性,修复固定后错位的问题。[#1820](https://github.com/ant-design/ant-design/issues/1820)
|
||||
- Table
|
||||
- 修复了 Table 组件的分页相关的一系列问题 [#1669](https://github.com/ant-design/ant-design/issues/1669) [#1842](https://github.com/ant-design/ant-design/issues/1842)
|
||||
- 修复了当有列固定在左边时,选择框不显示的问题 [#1829](https://github.com/ant-design/ant-design/issues/1829)
|
||||
- 修复了当 Checkbox 的 label 为数字 0 时, label 不显示的问题 [#1811](https://github.com/ant-design/ant-design/issues/1811)
|
||||
- 修复 Select combobox 模式下无法重置 `optionLabelProp` 的问题。[#1773](https://github.com/ant-design/ant-design/issues/1773)
|
||||
- 修复了 Tag 组件为 closeable 时,内部链接无法点击的问题 [#1862](https://github.com/ant-design/ant-design/issues/1862)
|
||||
- Tab 组件新增 `hideAdd` 属性,用于关闭右边的添加按钮 [#1750](https://github.com/ant-design/ant-design/issues/1750)
|
||||
- 修复了一个在某些情况下找不到 `normalize.css/normalize.css` 文件的问题。[ant-design/antd-init#52](https://github.com/ant-design/antd-init/issues/52)
|
||||
- 修复构建文件在 IE8 下报错的问题。[#1804](https://github.com/ant-design/ant-design/issues/1804)
|
||||
- 更新了第三方依赖。
|
||||
|
||||
## 1.1.0
|
||||
|
||||
`2016-05-18`
|
||||
|
||||
- Cascader 的选择框支持自定义渲染节点,并给 `displayRender` 方法增加了 `selectedOptions` 参数。[#1726](https://github.com/ant-design/ant-design/issues/1726)
|
||||
- Input.Group 新增 `size` 属性,可设置控件尺寸。[#1732](https://github.com/ant-design/ant-design/issues/1732)
|
||||
- Layout 新增常用布局:侧边导航展开收起模式。[#1643](https://github.com/ant-design/ant-design/issues/1643)
|
||||
- Transfer 支持自定义渲染行数据。[#1664](https://github.com/ant-design/ant-design/issues/1664)
|
||||
- Upload 的 children 为空时,不再显示上传按钮。[#1610](https://github.com/ant-design/ant-design/issues/1610)
|
||||
- Table
|
||||
- 修复 `filter` 过滤数据后显示错误分页的问题。[#1669](https://github.com/ant-design/ant-design/issues/1669)
|
||||
- 修复 `pagination` 不指定时显示错误分页的问题。[#1683](https://github.com/ant-design/ant-design/issues/1683)
|
||||
- Modal
|
||||
- 修复弹出时背景依然跟随滚动的问题。[#1751](https://github.com/ant-design/ant-design/issues/1751)
|
||||
- 修复关闭按钮获得焦点时的样式问题。[#1668](https://github.com/ant-design/ant-design/issues/1668)
|
||||
- 将搜索输入框相关样式移到 Input 组件下。[7b7f846](https://github.com/ant-design/ant-design/commit/7b7f8461611e53f4f96ae8d64d37fe28ee8d2553)
|
||||
- 修复 Select 获得焦点时的样式问题。[#1684](https://github.com/ant-design/ant-design/issues/1684)
|
||||
- 修复 TreeSelect 占位符样式问题。[#1657](https://github.com/ant-design/ant-design/issues/1657)
|
||||
- 修复了类型定义以更好地支持 `TypeScript`。[#1696](https://github.com/ant-design/ant-design/pull/1696) [@xujihui1985](https://github.com/xujihui1985)
|
||||
- 优化了 LocaleProvider。[a3850a4](https://github.com/ant-design/ant-design/commit/a3850a4df84d7055a1a40600919f2f9ba1bbf2b2)
|
||||
- 其他组件的样式优化。
|
||||
|
||||
## 1.0.1
|
||||
|
||||
`2016-05-11`
|
||||
|
||||
- 修复当 Table 的 `rowSelection.type` 为 'radio' 时的报错。[#1627](https://github.com/ant-design/ant-design/issues/1627)
|
||||
- 修复 CheckboxGroup 与 `getFieldProps`共用时的问题。[#1631](https://github.com/ant-design/ant-design/issues/1631)
|
||||
- 修复 RangePicker 中 TimePicker 不会受 locale 控制的问题。[#1635](https://github.com/ant-design/ant-design/issues/1635)
|
||||
- 修复 Tag 组件缺失的问题。
|
||||
- 修复 Table 的 className 不在最外层容器上的问题。
|
||||
- 修复一个样式文件重复打包的问题。
|
||||
|
||||
## 1.0.0
|
||||
|
||||
`2016-05-09`
|
||||
|
||||
很高兴的通知各位,经过四个月时间的紧密开发,`antd@1.0.0` 终于发布了。从去年 5 月 7 日提交第一行代码以来,经过整整一年的开发迭代,antd 受到社区的大量关注,使用的公司和产品持续增加,已经日趋成熟。这个版本我们重构了底层代码和站点,持续完善现有组件功能和优化细节,其中很多都来自社区的贡献,无法一一感谢,欢迎各位持续关注和鞭策。在升级过程中遇到任何问题,请及时反馈给我们。
|
||||
|
||||
### 主要变化
|
||||
|
||||
- **兼容 React@15.x**。
|
||||
- **全新单页站点**,使用 React 和 antd 进行了彻底重构,加载更快,访问更流畅。
|
||||
- **样式支持按需加载**。可参考 [antd-init](https://github.com/ant-design/antd-init) 的模版代码, 需要配合 [babel-plugin-antd](https://github.com/ant-design/babel-plugin-antd#usage) 插件和 `style` 配置进行使用。[#900](https://github.com/ant-design/ant-design/issues/900)
|
||||
- **提供独立的构建文件**。[文档](/docs/react/install#浏览器引入)
|
||||
- 新增卡片组件 [Card](/components/card)。
|
||||
- 新增评分组件 [Rate](/components/rate)。
|
||||
- 新增 [LocaleProvider](/components/locale-provider) 组件,提供组件文案的国际化支持,并新增了英语和俄语的语言配置。[#1411](https://github.com/ant-design/ant-design/issues/1411)
|
||||
- 更好的服务端渲染支持,修复了 Badge、Spin、Calendar、Upload 等组件服务端渲染的问题。
|
||||
- 新增 antd.d.ts 以更好的支持 TypeScript。[@bang88](https://github.com/bang88)
|
||||
- 布局组件支持响应式布局和栅格间隔设置。[#1082](https://github.com/ant-design/ant-design/issues/1082)
|
||||
- Table 支持固定列和横向滚动。[#1265](https://github.com/ant-design/ant-design/issues/1265)
|
||||
|
||||
### 不兼容改动
|
||||
|
||||
此版本有部分不兼容的改动,升级时确保修改相应的使用代码。
|
||||
|
||||
- 推荐使用样式按需加载。如果依然需要整体载入样式,**样式入口文件已变为** `antd/dist/antd.css` 和 `antd/dist/antd.less`。如果你在项目中覆盖了 less 变量,less 文件的引用方式也有 [相应变更](https://github.com/ant-design/ant-design/issues/1558#issuecomment-218120000)。
|
||||
|
||||
```diff
|
||||
- import 'antd/lib/index.css'; // import 'antd/style/index.less';
|
||||
+ import 'antd/dist/antd.css'; // import 'antd/dist/antd.less';
|
||||
```
|
||||
|
||||
- 完全移除了 `0.12` 中废弃的 Validation 组件,可以直接 import [rc-form-validation](https://github.com/react-component/form-validation) 用以代替。[#1096](https://github.com/ant-design/ant-design/issues/1096)
|
||||
- Breadcrumb.Item 的 `href` 属性被移除,请直接用 `a` 标签包裹可点击的内容。
|
||||
- Modal 移除了 `align` 属性,现在可以使用 `style` 属性调整位置。
|
||||
- `Modal.confirm` 等方法的配置项 `iconClassName` 重命名为 `iconType`。
|
||||
- Select 移除了 `onChange` 中的 `label` 参数,新增了 `labelInValue` 属性。[#1695](https://github.com/ant-design/ant-design/issues/1695)
|
||||
- 移除了 `import { Form } from 'antd/lib/form';` 的用法,应统一为 `import { Form } from 'antd';` 或 `import Form from 'antd/lib/form';`。
|
||||
|
||||
#### 有兼容提示的改动
|
||||
|
||||
这里的改动在升级后控制台会出现警告提示,请按提示进行修改。
|
||||
|
||||
- 废弃 QueueAnim,可以直接 import [rc-queue-anim](https://github.com/react-component/queue-anim) 用以代替。Ant Design 的动效方案已移至 [Ant Motion](http://motion.ant.design/components/queue-anim),欢迎前往探索。
|
||||
- Affix 的 `offset` 属性重命名为 `offsetTop`。
|
||||
- Popover 的 `overlay` 属性重命名为 `content`。
|
||||
- Progress.Line 使用方式改为 `<Progress />` 或 `<Progress type="line" />`。
|
||||
- Progress.Circle 使用方式改为 `<Progress type="circle" />`。
|
||||
- Spin 的 `spining` 属性更正为 `spinning`。
|
||||
- Alert 的 type `warn` 重命名为 `warning`。[#1225](https://github.com/ant-design/ant-design/issues/1225)
|
||||
- Tree 的 `onExpand` 参数从 `function(node, expanded, expandedKeys)` 调整为 `function(expandedKeys, {expanded, node})`。
|
||||
|
||||
### Bug 修复
|
||||
|
||||
- 修复 Table 的 `size` 为 `middle` 时,分页器大小无法控制的问题。[#1396](https://github.com/ant-design/ant-design/issues/1396)
|
||||
- 修复 Table 的 `pagination.defaultCurrent` 失效的问题。
|
||||
- 修复 Cascader 的 `defaultValue` 没有被 `value` 覆盖的问题。
|
||||
- 修复 Select 同时设置 `allowClear` `disabled` 时还是会出现清除按钮的问题。[#1480](https://github.com/ant-design/ant-design/issues/1480)
|
||||
- 修复 Transfer 的 `DataSource` 变化时已选中项没有同步的问题。[#1587](https://github.com/ant-design/ant-design/issues/1587)
|
||||
- 修复 DatePicker 日期格式与国际化配置不同步的问题。[#1509](https://github.com/ant-design/ant-design/issues/1509)
|
||||
- 修复 Button 禁用时事件仍然会冒泡的问题。[#1541](https://github.com/ant-design/ant-design/issues/1541)
|
||||
- 修复 Carousel 自动播放时的卡顿和报错问题。[#1397](https://github.com/ant-design/ant-design/issues/1397)
|
||||
- 修复 Tabs 的 card 类型内嵌标准 Tabs 时的样式问题。[#1617](https://github.com/ant-design/ant-design/issues/1617)
|
||||
- 修复 Menu `horizontal` 和 `vertical` 模式不支持受控 `openKeys` 的问题。
|
||||
|
||||
### 其他改进
|
||||
|
||||
- 样式变量梳理,去除了部分无用的变量,另外还有大量样式细节问题修复。
|
||||
- 依赖的 normalize.css 升级到 [4.x](https://github.com/necolas/normalize.css/blob/4.1.1/CHANGELOG.md)。
|
||||
- 使用 ES2016 classes 重构了代码。[@waywardmonkeys](https://github.com/waywardmonkeys)
|
||||
- Popover、Popconfirm 和 Tooltip 组件根据不同的弹出位置有了更精准方向的弹出动画。
|
||||
- 补充 Select TreeSelect Switch Radio Checkbox 等组件的 `focus` 表现,增强表单组件的可用性。[#1358](https://github.com/ant-design/ant-design/issues/1358)
|
||||
- message 和 notification 现在可以全局配置 `duration`。[#1143](https://github.com/ant-design/ant-design/issues/1143)
|
||||
- DatePicker 和 TimePicker 的 `onChange(date, dateString)` 方法增加第二个参数用于获得格式化后的日期字符串。[#1104](https://github.com/ant-design/ant-design/issues/1104)
|
||||
- DatePicker 和 DatePicker.RangePicker 现在可以设置内部 TimePikcer 的属性。[#1415](https://github.com/ant-design/ant-design/issues/1415)
|
||||
- Checkbox
|
||||
- 支持类似 Radio 的使用方式 `<Checkbox>option</Checkbox>`。[#1029](https://github.com/ant-design/ant-design/issues/1029)
|
||||
- Checkbox.Group 现在允许 `label` 和 `value` 不同。[#1025](https://github.com/ant-design/ant-design/issues/1025)
|
||||
- Checkbox.Group 允许单独设置某个 Checkbox 为 `disabled`。[#1218](https://github.com/ant-design/ant-design/issues/1218)
|
||||
- Breadcrumb
|
||||
- 支持路由模式下自定义链接 `linkRender`。[#1026](https://github.com/ant-design/ant-design/issues/1026)
|
||||
- 支持路由模式下自定义最后一项内容 `nameRender`。[#1304](https://github.com/ant-design/ant-design/issues/1304)
|
||||
- Modal
|
||||
- 新增 `Modal.warning` 方法。
|
||||
- 弹出时背景不再跟随滚动。[#1195](https://github.com/ant-design/ant-design/issues/1195)
|
||||
- Select
|
||||
- 搜索框和单选选择框合并,以优化视觉和交互效果。
|
||||
- 优化多选框的选中效果。
|
||||
- Spin
|
||||
- 增加延时展示以优化体验。[#1273](https://github.com/ant-design/ant-design/issues/1273)
|
||||
- 增加 `tip` 属性用于定义加载文案。[#1046](https://github.com/ant-design/ant-design/issues/1046)
|
||||
- Steps
|
||||
- 重构布局方式,以支持更灵活的自适应布局和优化了性能,并移除了 `maxDescriptionWidth` 属性。[#1099](https://github.com/ant-design/ant-design/issues/1099)
|
||||
- 新增 `status` 属性以指定当前步骤状态,同时支持错误步骤的展示。[#1098](https://github.com/ant-design/ant-design/issues/1098)
|
||||
- Timeline
|
||||
- 新增 `dot` 属性,可自定义时间轴点。
|
||||
- 现在可以设置 `className` 和 `style` 的问题。
|
||||
- `color` 属性现在支持自定义色值。
|
||||
- Tree
|
||||
- 当子节点被选中时,自动展开父节点。
|
||||
- 新增 `checkStrictly` 属性,支持父子节点选中关系脱离。
|
||||
- Upload
|
||||
- 在上传文件列表中的文件被删除时,将触发 `onRemove` 事件。[#1240](https://github.com/ant-design/ant-design/issues/1240)
|
||||
- 增加 `onPreview` 支持文件的自定义预览方式。[#1240](https://github.com/ant-design/ant-design/issues/1240)
|
||||
- `data` 属性支持设为一个函数,用于动态修改上传参数。[react-component/upload#32](https://github.com/react-component/upload/pull/32)
|
||||
- Slider `marks` 现在支持 JSX 并可以单独设置某个标记的样式。
|
||||
- Tag 的 `onClose` 可以使用 `e.preventDefault()` 阻止默认事件。[#1267](https://github.com/ant-design/ant-design/issues/1267)
|
||||
- Form.Item 在有多个 child 时也可以自动生成错误信息与校验状态,但一个 Form.Item 内仍然只能有一个表单控件。[#1287](https://github.com/ant-design/ant-design/issues/1287)
|
||||
- Input 新增 `onPressEnter` 属性监听回车事件。
|
||||
- Table 现在可以通过 `filteredValue` `sortOrder` 控制筛选和排序的状态。[#971](https://github.com/ant-design/ant-design/issues/971)
|
||||
- Button 增加了 `icon` 属性。[#1199](https://github.com/ant-design/ant-design/issues/1199)
|
||||
- SubMenu 增加 `onTitleClick` 属性。
|
||||
- Affix 增加 `offsetBottm` 属性,支持固定在底部。[#1000](https://github.com/ant-design/ant-design/issues/1000)
|
||||
|
||||
### 相关工具发布
|
||||
|
||||
- [antd-init](http://github.com/ant-design/antd-init) 同步发布 `1.0.0` 版本,享受最新 [ant-tool](https://github.com/ant-tool/) 工具带来的流畅开发体验。
|
||||
- [Ant Motion](http://motion.ant.design) 全新的动效设计解决方案。
|
||||
- [Ant UX](http://ux.ant.design/) 发布 1.0 版本,提供多种平台的流程素材支持。
|
||||
|
||||
## 0.12.17
|
||||
|
||||
去 [GitHub](https://github.com/ant-design/ant-design/releases?after=1.0.0) 查看 `0.12.x` 及之前的更新日志。
|
||||
去 [GitHub](https://github.com/ant-design/ant-design/releases?after=2.0.0) 查看 `0.x` 到 `1.x` 的 Change Log。
|
||||
|
||||
@@ -5,11 +5,14 @@
|
||||
</p>
|
||||
|
||||
# Ant Design
|
||||
|
||||
[](https://travis-ci.org/ant-design/ant-design)
|
||||
[](https://coveralls.io/github/ant-design/ant-design?branch=master)
|
||||
[](https://david-dm.org/ant-design/ant-design)
|
||||
|
||||
[](https://www.npmjs.org/package/antd)
|
||||
[](https://npmjs.org/package/antd)
|
||||
[](https://cdnjs.com/libraries/antd)
|
||||
[](https://david-dm.org/ant-design/ant-design)
|
||||
[](http://isitmaintained.com/project/ant-design/ant-design "Average time to resolve an issue")
|
||||
[](https://gitter.im/ant-design/ant-design?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
一套企业级的 UI 设计语言和 React 实现。
|
||||
@@ -53,7 +56,7 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
|
||||
|
||||
tsconfig.json
|
||||
|
||||
```
|
||||
```js
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node",
|
||||
@@ -63,23 +66,27 @@ tsconfig.json
|
||||
}
|
||||
```
|
||||
|
||||
> 注意:设置 `allowSyntheticDefaultImports` 避免 `error TS1192: Module 'react' has no default export` 的错误。
|
||||
|
||||
|
||||
## 链接
|
||||
|
||||
- [首页](http://ant.design/)
|
||||
- [React 实现](http://ant.design/docs/react/introduce)
|
||||
- [修改记录](CHANGELOG.zh-CN.md)
|
||||
- [开发脚手架](https://github.com/ant-design/antd-init/)
|
||||
- [组件文档](http://ant.design/docs/react/introduce)
|
||||
- [更新日志](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)
|
||||
- [React 代码规范](https://github.com/react-component/react-component.github.io/blob/master/docs/zh-cn/component-code-style.md)
|
||||
- [组件设计原则](https://github.com/react-component/react-component.github.io/blob/master/docs/zh-cn/component-design.md)
|
||||
- [网站和组件开发说明](https://github.com/ant-design/ant-design/wiki/%E7%BD%91%E7%AB%99%E5%92%8C%E7%BB%84%E4%BB%B6%E5%BC%80%E5%8F%91%E8%AF%B4%E6%98%8E)
|
||||
- [版本发布手册](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://motion.ant.design)
|
||||
- [设计规范速查手册](https://os.alipayobjects.com/rmsportal/HTXUgPGkyyxEivE.png)
|
||||
- [开发者说明](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)
|
||||
- [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)
|
||||
|
||||
## 如何贡献
|
||||
|
||||
|
||||
31
README.md
31
README.md
@@ -5,10 +5,13 @@
|
||||
</p>
|
||||
|
||||
# Ant Design
|
||||
|
||||
[](https://travis-ci.org/ant-design/ant-design)
|
||||
[](https://coveralls.io/github/ant-design/ant-design?branch=master)
|
||||
[](https://david-dm.org/ant-design/ant-design)
|
||||
|
||||
[](https://www.npmjs.org/package/antd)
|
||||
[](https://npmjs.org/package/antd)
|
||||
[](https://david-dm.org/ant-design/ant-design)
|
||||
[](http://isitmaintained.com/project/ant-design/ant-design "Average time to resolve an issue")
|
||||
[](https://gitter.im/ant-design/ant-design?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
@@ -18,9 +21,13 @@ An enterprise-class UI design language and React-based implementation.
|
||||
|
||||
- An enterprise-class design language and high quality UI.
|
||||
- Graceful UI components out of the box, base on [React Component](http://react-component.github.io/badgeboard/).
|
||||
- Writen in TypeScript with complete define types.
|
||||
- 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.
|
||||
|
||||
## Let's build a better antd together [](http://makeapullrequest.com)
|
||||
|
||||
`antd` is an open source project, any reasonable improvement is welcomed. If you are interested in contributing to `antd`, you can watch this repository and join in [discussion](https://github.com/ant-design/ant-design/issues?q=is%3Aopen+is%3Aissue+label%3ADiscussion), or try to implement some [features which had been accepted](https://github.com/ant-design/ant-design/issues?q=is%3Aopen+is%3Aissue+label%3A%22PR+welcome%22).
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
@@ -67,18 +74,18 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
|
||||
import 'antd/lib/date-picker/style/css'; // with style
|
||||
```
|
||||
|
||||
## Environment Support
|
||||
|
||||
## Browser Support
|
||||
|
||||
Normal browsers and Internet Explorer 9+.
|
||||
|
||||
* Browser: Modern browsers and Internet Explorer 9+.
|
||||
> [IE8 issues](https://github.com/xcatliu/react-ie8)
|
||||
* Server-side Rendering
|
||||
* [Electron](http://electron.atom.io/)
|
||||
|
||||
## TypeScript
|
||||
|
||||
tsconfig.json
|
||||
|
||||
```
|
||||
```js
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node",
|
||||
@@ -88,25 +95,25 @@ tsconfig.json
|
||||
}
|
||||
```
|
||||
|
||||
> Note: set `allowSyntheticDefaultImports` to prevent `error TS1192: Module 'react' has no default export`.
|
||||
|
||||
## Links
|
||||
|
||||
- [Home page](http://ant.design/)
|
||||
- [UI library](http://ant.design/docs/react/introduce)
|
||||
- [ChangeLog](CHANGELOG.en-US.md)
|
||||
- [Scaffold tool](https://github.com/ant-design/antd-init/)
|
||||
- [Change Log](CHANGELOG.en-US.md)
|
||||
- [Scaffold tool](https://github.com/dvajs/dva-cli/)
|
||||
- [Development tool](http://ant-tool.github.io/)
|
||||
- [React components](http://react-component.github.io/)
|
||||
- [Mobile UI](http://mobile.ant.design)
|
||||
- [Motion](https://motion.ant.design)
|
||||
- [React style guide](https://github.com/react-component/react-component.github.io/blob/master/docs/zh-cn/component-code-style.md)
|
||||
- [React component design guide](https://github.com/react-component/react-component.github.io/blob/master/docs/zh-cn/component-design.md)
|
||||
- [Developer Instruction](https://github.com/ant-design/ant-design/wiki/Development)
|
||||
- [Versioning Release Note](https://github.com/ant-design/ant-design/wiki/%E8%BD%AE%E5%80%BC%E8%A7%84%E5%88%99%E5%92%8C%E7%89%88%E6%9C%AC%E5%8F%91%E5%B8%83%E6%B5%81%E7%A8%8B)
|
||||
- [Boilerplates](https://github.com/ant-design/ant-design/issues/129)
|
||||
- [FAQ](https://github.com/ant-design/ant-design/wiki/FAQ)
|
||||
- [CodePen boilerplate](http://codepen.io/benjycui/pen/KgPZrE?editors=001) for bug reports
|
||||
- [Awesome Ant Design](https://github.com/websemantics/awesome-ant-design)
|
||||
|
||||
- [Customize Theme](http://ant.design/docs/react/customize-theme)
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
@@ -16,36 +16,32 @@ Set a `target` for 'Affix', which is listen to scroll event of target element (d
|
||||
````jsx
|
||||
import { Affix, Button } from 'antd';
|
||||
|
||||
const Demo = () => {
|
||||
return (
|
||||
<div className="view-port">
|
||||
<div id="scrollable-container">
|
||||
class Demo extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div className="scrollable-container" ref={(node) => { this.container = node; }}>
|
||||
<div className="background">
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<Affix target={() => document.getElementById('scrollable-container')} offsetTop={20}>
|
||||
<Button type="primary">Fixed at the top of container</Button>
|
||||
<Affix target={() => this.container}>
|
||||
<Button type="primary">
|
||||
Fixed at the top of container
|
||||
</Button>
|
||||
</Affix>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ReactDOM.render(<Demo />, mountNode);
|
||||
````
|
||||
|
||||
<style>
|
||||
#components-affix-demo-target .view-port {
|
||||
#components-affix-demo-target .scrollable-container {
|
||||
height: 100px;
|
||||
overflow: hidden;
|
||||
}
|
||||
#components-affix-demo-target #scrollable-container {
|
||||
height: 100%;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
#components-affix-demo-target .background {
|
||||
padding-top: 60px;
|
||||
height: 300px;
|
||||
background-image: url('https://zos.alipayobjects.com/rmsportal/RmjwQiJorKyobvI.jpg');
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ Make an element sticky to viewport.
|
||||
|
||||
## When To Use
|
||||
|
||||
When user browses a long web page, some content need to sticky to viewport. It is common for menus and actions.
|
||||
When user browses a long web page, some content need to stick to the viewport. This is common for menus and actions.
|
||||
|
||||
Please note that Affix should not cover other content in page, especially when the size of viewport is small.
|
||||
Please note that Affix should not cover other content on the page, especially when the size of the viewport is small.
|
||||
|
||||
## API
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ export default class Affix extends React.Component<AffixProps, any> {
|
||||
|
||||
scrollEvent: any;
|
||||
resizeEvent: any;
|
||||
timeout: any;
|
||||
refs: {
|
||||
fixedNode: HTMLElement;
|
||||
};
|
||||
@@ -172,7 +173,10 @@ export default class Affix extends React.Component<AffixProps, any> {
|
||||
|
||||
componentDidMount() {
|
||||
const target = this.props.target || getDefaultTarget;
|
||||
this.setTargetEventListeners(target);
|
||||
// Wait for parent component ref has its value
|
||||
this.timeout = setTimeout(() => {
|
||||
this.setTargetEventListeners(target);
|
||||
});
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@@ -187,10 +191,14 @@ export default class Affix extends React.Component<AffixProps, any> {
|
||||
|
||||
componentWillUnmount() {
|
||||
this.clearScrollEventListeners();
|
||||
clearTimeout(this.timeout);
|
||||
}
|
||||
|
||||
setTargetEventListeners(getTarget) {
|
||||
const target = getTarget();
|
||||
if (!target) {
|
||||
return;
|
||||
}
|
||||
this.scrollEvent = addEventListener(target, 'scroll', this.updatePosition);
|
||||
this.resizeEvent = addEventListener(target, 'resize', this.updatePosition);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ Alert component for feedback.
|
||||
## When To Use
|
||||
|
||||
- When you need to show alert messages for users.
|
||||
- When you need a persist static container, and closable by user actions.
|
||||
- When you need a persistent static container which is closable by user actions.
|
||||
|
||||
## API
|
||||
|
||||
|
||||
@@ -93,21 +93,25 @@ export default class Alert extends React.Component<AlertProps, any> {
|
||||
iconType += '-o';
|
||||
}
|
||||
|
||||
let alertCls = classNames({
|
||||
[prefixCls]: true,
|
||||
let alertCls = classNames(prefixCls, {
|
||||
[`${prefixCls}-${type}`]: true,
|
||||
[`${prefixCls}-close`]: !this.state.closing,
|
||||
[`${prefixCls}-with-description`]: !!description,
|
||||
[`${prefixCls}-no-icon`]: !showIcon,
|
||||
[`${prefixCls}-banner`]: !!banner,
|
||||
[className]: !!className,
|
||||
});
|
||||
}, className);
|
||||
|
||||
// closeable when closeText is assigned
|
||||
if (closeText) {
|
||||
closable = true;
|
||||
}
|
||||
|
||||
const closeIcon = closable ? (
|
||||
<a onClick={this.handleClose} className={`${prefixCls}-close-icon`}>
|
||||
{closeText || <Icon type="cross" />}
|
||||
</a>
|
||||
) : null;
|
||||
|
||||
return this.state.closed ? null : (
|
||||
<Animate
|
||||
component=""
|
||||
@@ -119,9 +123,7 @@ export default class Alert extends React.Component<AlertProps, any> {
|
||||
{showIcon ? <Icon className={`${prefixCls}-icon`} type={iconType} /> : null}
|
||||
<span className={`${prefixCls}-message`}>{message}</span>
|
||||
<span className={`${prefixCls}-description`}>{description}</span>
|
||||
{closable ? <a onClick={this.handleClose} className={`${prefixCls}-close-icon`}>
|
||||
{closeText || <Icon type="cross" />}
|
||||
</a> : null}
|
||||
{closeIcon}
|
||||
</div>
|
||||
</Animate>
|
||||
);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
&-icon {
|
||||
font-size: @font-size-lg;
|
||||
top: 9px;
|
||||
top: 9.5px;
|
||||
left: 16px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import AnchorHelper, { scrollTo } from './anchorHelper';
|
||||
|
||||
export interface AnchorLinkProps {
|
||||
href: string;
|
||||
onClick: (href: string) => void;
|
||||
onClick: (href: string, component: Element) => void;
|
||||
active?: boolean;
|
||||
prefixCls?: string;
|
||||
children?: any;
|
||||
@@ -19,10 +19,6 @@ export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
|
||||
anchorHelper: React.PropTypes.any,
|
||||
};
|
||||
|
||||
static childContextTypes = {
|
||||
anchorHelper: React.PropTypes.any,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
href: '#',
|
||||
prefixCls: 'ant-anchor',
|
||||
@@ -32,14 +28,23 @@ export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
|
||||
anchorHelper: AnchorHelper;
|
||||
};
|
||||
|
||||
constructor(props, context) {
|
||||
super(props, context);
|
||||
private _component: Element;
|
||||
|
||||
setActiveAnchor() {
|
||||
const { bounds, href, affix } = this.props;
|
||||
const { anchorHelper } = this.context;
|
||||
const active = affix && anchorHelper && anchorHelper.getCurrentAnchor(bounds) === href;
|
||||
if (active && anchorHelper) {
|
||||
anchorHelper.setActiveAnchor(this._component);
|
||||
}
|
||||
}
|
||||
|
||||
getChildContext() {
|
||||
return {
|
||||
anchorHelper: this.context.anchorHelper,
|
||||
};
|
||||
componentDidMount() {
|
||||
this.setActiveAnchor();
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
this.setActiveAnchor();
|
||||
}
|
||||
|
||||
renderAnchorLink = (child) => {
|
||||
@@ -47,19 +52,24 @@ export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
|
||||
if (href) {
|
||||
this.context.anchorHelper.addLink(href);
|
||||
return React.cloneElement(child, {
|
||||
onClick: this.context.anchorHelper.scrollTo,
|
||||
onClick: this.props.onClick,
|
||||
prefixCls: this.props.prefixCls,
|
||||
affix: this.props.affix,
|
||||
});
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
refsTo = (component) => {
|
||||
this._component = component;
|
||||
}
|
||||
|
||||
scrollTo = (e) => {
|
||||
e.preventDefault();
|
||||
const { onClick, href } = this.props;
|
||||
const { anchorHelper } = this.context;
|
||||
e.preventDefault();
|
||||
if (onClick) {
|
||||
onClick(href);
|
||||
onClick(href, this._component);
|
||||
} else {
|
||||
e.stopPreventDefault();
|
||||
const scrollToFn = anchorHelper ? anchorHelper.scrollTo : scrollTo;
|
||||
@@ -78,7 +88,7 @@ export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
|
||||
return (
|
||||
<div className={cls}>
|
||||
<a
|
||||
ref={(component) => component && active && anchorHelper ? anchorHelper.setActiveAnchor(component) : null}
|
||||
ref={this.refsTo}
|
||||
className={`${prefixCls}-link-title`}
|
||||
onClick={this.scrollTo}
|
||||
href={href}
|
||||
|
||||
@@ -37,9 +37,15 @@ export function getOffsetTop(element): number {
|
||||
return rect.top;
|
||||
}
|
||||
|
||||
export function scrollTo(href, target = getDefaultTarget) {
|
||||
export type Section = {
|
||||
top: number;
|
||||
bottom: number;
|
||||
section: any;
|
||||
};
|
||||
|
||||
export function scrollTo(href, target = getDefaultTarget, callback = () => {}) {
|
||||
const scrollTop = getScroll(target(), true);
|
||||
const targetElement = document.querySelector(href);
|
||||
const targetElement = document.getElementById(href.substring(1));
|
||||
if (!targetElement) {
|
||||
return;
|
||||
}
|
||||
@@ -52,10 +58,12 @@ export function scrollTo(href, target = getDefaultTarget) {
|
||||
window.scrollTo(window.pageXOffset, easeInOutCubic(time, scrollTop, targetScrollTop, 450));
|
||||
if (time < 450) {
|
||||
reqAnimFrame(frameFunc);
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
reqAnimFrame(frameFunc);
|
||||
history.pushState(null, undefined, href);
|
||||
history.pushState(null, '', href);
|
||||
}
|
||||
|
||||
class AnchorHelper {
|
||||
@@ -85,22 +93,36 @@ class AnchorHelper {
|
||||
|
||||
getCurrentAnchor(bounds = 5) {
|
||||
let activeAnchor = '';
|
||||
this.links.forEach(section => {
|
||||
const target = document.querySelector(section);
|
||||
if (target) {
|
||||
if (typeof document === 'undefined') {
|
||||
return activeAnchor;
|
||||
}
|
||||
|
||||
const linksPositions = (this.links
|
||||
.map(section => {
|
||||
const target = document.getElementById(section.substring(1));
|
||||
if (target && getOffsetTop(target) < bounds) {
|
||||
const top = getOffsetTop(target);
|
||||
const bottom = top + target.clientHeight;
|
||||
if ((top <= bounds) && (bottom >= -bounds)) {
|
||||
activeAnchor = section;
|
||||
if (top <= bounds) {
|
||||
return {
|
||||
section,
|
||||
top,
|
||||
bottom: top + target.clientHeight,
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
this._activeAnchor = activeAnchor || this._activeAnchor;
|
||||
return this._activeAnchor;
|
||||
return null;
|
||||
})
|
||||
.filter(section => section !== null) as Array<Section>);
|
||||
|
||||
if (linksPositions.length) {
|
||||
const maxSection = linksPositions.reduce((prev, curr) => curr.top > prev.top ? curr : prev);
|
||||
return maxSection.section;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
scrollTo(href, target = getDefaultTarget) {
|
||||
scrollTo(href, target);
|
||||
scrollTo(href, target = getDefaultTarget, callback = () => {}) {
|
||||
scrollTo(href, target, callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
category: Components
|
||||
type: Other
|
||||
cols: 1
|
||||
type: Navigation
|
||||
cols: 2
|
||||
title: Anchor
|
||||
---
|
||||
|
||||
@@ -9,7 +9,7 @@ Hyperlinks to scroll on one page.
|
||||
|
||||
## When To Use
|
||||
|
||||
For displaying anchor hyperlinks on page, and jump between them.
|
||||
For displaying anchor hyperlinks on page and jumping between them.
|
||||
|
||||
## API
|
||||
|
||||
|
||||
@@ -34,11 +34,13 @@ export default class Anchor extends React.Component<AnchorProps, any> {
|
||||
|
||||
private scrollEvent: any;
|
||||
private anchorHelper: AnchorHelper;
|
||||
private _avoidInk: boolean;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
activeAnchor: null,
|
||||
animated: true,
|
||||
};
|
||||
this.anchorHelper = new AnchorHelper();
|
||||
}
|
||||
@@ -68,7 +70,9 @@ export default class Anchor extends React.Component<AnchorProps, any> {
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
this.updateInk();
|
||||
if (!this._avoidInk) {
|
||||
this.updateInk();
|
||||
}
|
||||
}
|
||||
|
||||
updateInk = () => {
|
||||
@@ -78,12 +82,20 @@ 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._avoidInk = false;
|
||||
});
|
||||
}
|
||||
|
||||
renderAnchorLink = (child) => {
|
||||
const { href } = child.props;
|
||||
if (href) {
|
||||
this.anchorHelper.addLink(href);
|
||||
return React.cloneElement(child, {
|
||||
onClick: this.anchorHelper.scrollTo,
|
||||
onClick: this.clickAnchorLink,
|
||||
prefixCls: this.props.prefixCls,
|
||||
bounds: this.props.bounds,
|
||||
affix: this.props.affix,
|
||||
@@ -94,19 +106,18 @@ export default class Anchor extends React.Component<AnchorProps, any> {
|
||||
|
||||
render() {
|
||||
const { prefixCls, offsetTop, style, className = '', affix } = this.props;
|
||||
const { activeAnchor } = this.state;
|
||||
const { activeAnchor, animated } = this.state;
|
||||
const inkClass = classNames({
|
||||
[`${prefixCls}-ink-ball`]: true,
|
||||
animated,
|
||||
visible: !!activeAnchor,
|
||||
});
|
||||
|
||||
const wrapperClass = classNames({
|
||||
[`${prefixCls}-wrapper`]: true,
|
||||
[className]: !!className,
|
||||
});
|
||||
}, className);
|
||||
|
||||
const anchorClass = classNames({
|
||||
[`${prefixCls}`]: true,
|
||||
const anchorClass = classNames(prefixCls, {
|
||||
'fixed': !affix,
|
||||
});
|
||||
|
||||
@@ -121,7 +132,7 @@ export default class Anchor extends React.Component<AnchorProps, any> {
|
||||
</div>
|
||||
);
|
||||
|
||||
return affix === false ? anchorContent : (
|
||||
return !affix ? anchorContent : (
|
||||
<Affix offsetTop={offsetTop}>
|
||||
{anchorContent}
|
||||
</Affix>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
category: Components
|
||||
subtitle: 锚点
|
||||
cols: 1
|
||||
type: Other
|
||||
cols: 2
|
||||
type: Navigation
|
||||
title: Anchor
|
||||
---
|
||||
|
||||
|
||||
@@ -4,13 +4,11 @@
|
||||
&-anchor {
|
||||
position: relative;
|
||||
&-wrapper {
|
||||
padding: 6px;
|
||||
background-color: white;
|
||||
background-color: @component-background;
|
||||
}
|
||||
|
||||
&-ink {
|
||||
position: absolute;
|
||||
width: 9px;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
@@ -30,9 +28,9 @@
|
||||
height: 9px;
|
||||
border-radius: 9px;
|
||||
border: 3px solid @primary-color;
|
||||
background-color: white;
|
||||
transition: top .3s ease-in-out;
|
||||
background-color: @component-background;
|
||||
left: 50%;
|
||||
transition: top .3s ease-in-out;
|
||||
transform: translateX(-50%);
|
||||
&.visible {
|
||||
display: inline-block;
|
||||
@@ -46,9 +44,14 @@
|
||||
}
|
||||
|
||||
&-anchor-link {
|
||||
padding: 4px 0 4px 16px;
|
||||
padding: 8px 0 8px 18px;
|
||||
line-height: 1;
|
||||
|
||||
& & {
|
||||
padding-top: 6px;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
&-title {
|
||||
display: block;
|
||||
position: relative;
|
||||
@@ -57,6 +60,11 @@
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
&-title:only-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
&-active > &-title {
|
||||
|
||||
@@ -43,6 +43,7 @@ const Complete = React.createClass({
|
||||
style={{ width: 200 }}
|
||||
onSelect={onSelect}
|
||||
onChange={this.handleChange}
|
||||
placeholder="input here"
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
||||
@@ -42,6 +42,7 @@ const Complete = React.createClass({
|
||||
<AutoComplete
|
||||
style={{ width: 200 }}
|
||||
onChange={this.handleChange}
|
||||
placeholder="input here"
|
||||
>
|
||||
{children}
|
||||
</AutoComplete>
|
||||
|
||||
@@ -9,7 +9,7 @@ Autocomplete function of input field.
|
||||
|
||||
## When To Use
|
||||
|
||||
When need to use autocomplete function.
|
||||
When there is a need for autocomplete functionality.
|
||||
|
||||
## API
|
||||
|
||||
@@ -17,7 +17,7 @@ When need to use autocomplete function.
|
||||
const dataSource = ['12345', '23456', '34567'];
|
||||
<AutoComplete dataSource={dataSource} />
|
||||
```
|
||||
Since `AutoComplete` is based on `Select`, so besides following API, `AutoComplete` has same API as `Select`.
|
||||
Since `AutoComplete` is based on `Select`, so besides the following API, `AutoComplete` has the same API as `Select`.
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|----------------|----------------------------------|------------|--------|
|
||||
@@ -28,3 +28,4 @@ Since `AutoComplete` is based on `Select`, so besides following API, `AutoComple
|
||||
| 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 | - |
|
||||
|
||||
@@ -72,11 +72,13 @@ export default class AutoComplete extends React.Component<AutoCompleteProps, any
|
||||
}) : []);
|
||||
|
||||
return (
|
||||
<Select {...this.props}
|
||||
<Select
|
||||
{...this.props}
|
||||
className={cls}
|
||||
optionLabelProp={optionLabelProp}
|
||||
combobox
|
||||
notFoundContent={notFoundContent} >
|
||||
notFoundContent={notFoundContent}
|
||||
>
|
||||
{options}
|
||||
</Select>
|
||||
);
|
||||
|
||||
@@ -29,3 +29,4 @@ const dataSource = ['12345', '23456', '34567'];
|
||||
| onChange | 选中 option,或 input 的 value 变化时,调用此函数 | function(value) | 无 |
|
||||
| onSelect | 被选中时调用,参数为选中项的 value 值 | function(value, option) | 无 |
|
||||
| disabled | 是否禁用 | boolean | false |
|
||||
| placeholder | 输入框提示 | string | - |
|
||||
|
||||
@@ -99,10 +99,7 @@ export default class BackTop extends React.Component<BackTopProps, any> {
|
||||
|
||||
render() {
|
||||
const { prefixCls = 'ant-back-top', className = '', children } = this.props;
|
||||
const classString = classNames({
|
||||
[prefixCls]: true,
|
||||
[className]: !!className,
|
||||
});
|
||||
const classString = classNames(prefixCls, className);
|
||||
|
||||
const defaultElement = (
|
||||
<div className={`${prefixCls}-content`}>
|
||||
@@ -118,15 +115,15 @@ export default class BackTop extends React.Component<BackTopProps, any> {
|
||||
'visibilityHeight',
|
||||
]);
|
||||
|
||||
const backTopBtn = this.state.visible ? (
|
||||
<div {...divProps} className={classString} onClick={this.scrollToTop}>
|
||||
{children || defaultElement}
|
||||
</div>
|
||||
) : null;
|
||||
|
||||
return (
|
||||
<Animate component="" transitionName="fade">
|
||||
{
|
||||
this.state.visible ?
|
||||
<div {...divProps} className={classString} onClick={this.scrollToTop}>
|
||||
{children || defaultElement}
|
||||
</div>
|
||||
: null
|
||||
}
|
||||
{backTopBtn}
|
||||
</Animate>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,6 @@ Badge normally appears in proximity to notification or head picture with eye-cat
|
||||
|----------------|-------------------------|------------|---------|
|
||||
| count | Number to show in badge | Number | |
|
||||
| overflowCount | Max count to show | Number | 99 |
|
||||
| dot | whether to show red dot without number | Boolean | false |
|
||||
| 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 | '' |
|
||||
|
||||
@@ -58,9 +58,7 @@ export default class Badge extends React.Component<BadgeProps, any> {
|
||||
[`${prefixCls}-dot`]: isDot,
|
||||
[`${prefixCls}-count`]: !isDot,
|
||||
});
|
||||
const badgeCls = classNames({
|
||||
[className]: !!className,
|
||||
[prefixCls]: true,
|
||||
const badgeCls = classNames(className, prefixCls, {
|
||||
[`${prefixCls}-status`]: !!status,
|
||||
[`${prefixCls}-not-a-wrapper`]: !children,
|
||||
});
|
||||
@@ -83,6 +81,19 @@ export default class Badge extends React.Component<BadgeProps, any> {
|
||||
);
|
||||
}
|
||||
|
||||
const scrollNumber = hidden ? null : (
|
||||
<ScrollNumber
|
||||
data-show={!hidden}
|
||||
className={scrollNumberCls}
|
||||
count={count}
|
||||
style={style}
|
||||
/>
|
||||
);
|
||||
|
||||
const statusText = (hidden || !text) ? null : (
|
||||
<span className={`${prefixCls}-status-text`}>{text}</span>
|
||||
);
|
||||
|
||||
return (
|
||||
<span {...restProps} className={badgeCls} title={realCount}>
|
||||
{children}
|
||||
@@ -92,20 +103,9 @@ export default class Badge extends React.Component<BadgeProps, any> {
|
||||
transitionName={children ? `${prefixCls}-zoom` : ''}
|
||||
transitionAppear
|
||||
>
|
||||
{
|
||||
hidden ? null :
|
||||
<ScrollNumber
|
||||
data-show={!hidden}
|
||||
className={scrollNumberCls}
|
||||
count={count}
|
||||
style={style}
|
||||
/>
|
||||
}
|
||||
{scrollNumber}
|
||||
</Animate>
|
||||
{
|
||||
hidden || !text ? null :
|
||||
<span className={`${prefixCls}-status-text`}>{text}</span>
|
||||
}
|
||||
{statusText}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
font-size: @font-size-base;
|
||||
white-space: nowrap;
|
||||
transform-origin: -10% center;
|
||||
z-index: 10;
|
||||
font-family: tahoma;
|
||||
box-shadow: 0 0 0 1px #fff;
|
||||
a,
|
||||
|
||||
@@ -56,7 +56,8 @@ export default class Breadcrumb extends React.Component<BreadcrumbProps, any> {
|
||||
const props = this.props;
|
||||
warning(
|
||||
!('linkRender' in props || 'nameRender' in props),
|
||||
'`linkRender` and `nameRender` are removed, please use `itemRender` instead.'
|
||||
'`linkRender` and `nameRender` are removed, please use `itemRender` instead, ' +
|
||||
'see: http://u.ant.design/item-render.'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,15 +8,15 @@ title:
|
||||
|
||||
## zh-CN
|
||||
|
||||
和 `react-router@2.x` 进行结合使用。
|
||||
和 `react-router@2+` 进行结合使用。
|
||||
|
||||
## en-US
|
||||
|
||||
Used together with `react-router@2.x`.
|
||||
Used together with `react-router@2+`.
|
||||
|
||||
````jsx
|
||||
import { Router, Route, Link, hashHistory } from 'react-router';
|
||||
import { Breadcrumb } from 'antd';
|
||||
import { Breadcrumb, Alert } from 'antd';
|
||||
|
||||
const Apps = () => (
|
||||
<ul className="app-list">
|
||||
@@ -29,24 +29,15 @@ const Apps = () => (
|
||||
</ul>
|
||||
);
|
||||
|
||||
const Home = props => (
|
||||
const Home = ({ routes, params, children }) => (
|
||||
<div>
|
||||
<div className="demo-nav">
|
||||
<Link to="/">Home</Link>
|
||||
<Link to="/apps">Application List</Link>
|
||||
</div>
|
||||
{props.children || 'Home'}
|
||||
<div
|
||||
style={{
|
||||
marginBottom: 15,
|
||||
marginTop: 15,
|
||||
paddingBottom: 15,
|
||||
borderBottom: '1px dashed #ccc',
|
||||
}}
|
||||
>
|
||||
Click the navigation above to switch:
|
||||
</div>
|
||||
<Breadcrumb {...props} />
|
||||
{children || 'Home Page'}
|
||||
<Alert style={{ margin: '16px 0' }} message="Click the navigation above to switch:" />
|
||||
<Breadcrumb routes={routes} params={params} />
|
||||
</div>
|
||||
);
|
||||
|
||||
|
||||
@@ -4,25 +4,17 @@ type: Navigation
|
||||
title: Breadcrumb
|
||||
---
|
||||
|
||||
A breadcrumb displays the current location within a hierarchy. It allows going back to states higher up within the hierarchy.
|
||||
A breadcrumb displays the current location within a hierarchy. It allows going back to states higher up in the hierarchy.
|
||||
|
||||
## When To Use
|
||||
|
||||
- When the system has more than two layers in a hierarchy.
|
||||
- When you need to inform the user of where they are.
|
||||
- When the user may need to navigate back to a higher level When the application has multi-layer architecture.
|
||||
- When the user may need to navigate back to a higher level.
|
||||
- When the application has multi-layer architecture.
|
||||
|
||||
## API
|
||||
|
||||
```html
|
||||
<Breadcrumb>
|
||||
<Breadcrumb.Item>Home</Breadcrumb.Item>
|
||||
<Breadcrumb.Item>Application Center</Breadcrumb.Item>
|
||||
<Breadcrumb.Item>Application List</Breadcrumb.Item>
|
||||
<Breadcrumb.Item>An Application</Breadcrumb.Item>
|
||||
</Breadcrumb>
|
||||
```
|
||||
|
||||
| Property | Description | Type | Optional | Default |
|
||||
|-----------|-----------------------------------|-----------------|---------|--------|
|
||||
| routes | The routing stack information of router | Array | | - |
|
||||
@@ -31,3 +23,18 @@ A breadcrumb displays the current location within a hierarchy. It allows going b
|
||||
| itemRender | Custom item renderer | (route, params, routes, paths) => React.ReactNode | | - |
|
||||
|
||||
> `linkRender` and `nameRender` were removed after `antd@2.0`, please use `itemRender` instead.
|
||||
|
||||
### Use with browserHistory
|
||||
|
||||
The link of Breadcrumb item contain `#` defaultly, you can use `itemRender` to make `browserHistory` Link.
|
||||
|
||||
```jsx
|
||||
import { Link } from 'react-router';
|
||||
|
||||
function itemRender(route, params, routes, paths) {
|
||||
const last = routes.indexOf(route) === routes.length - 1;
|
||||
return last ? <span>{route.breadcrumbName}</span> : <Link to={paths.join('/')}>{route.breadcrumbName}</Link>;
|
||||
}
|
||||
|
||||
return <Breadcrumb itemRender={itemRender} />;
|
||||
```
|
||||
|
||||
@@ -15,15 +15,6 @@ title: Breadcrumb
|
||||
|
||||
## API
|
||||
|
||||
```html
|
||||
<Breadcrumb>
|
||||
<Breadcrumb.Item>首页</Breadcrumb.Item>
|
||||
<Breadcrumb.Item>应用中心</Breadcrumb.Item>
|
||||
<Breadcrumb.Item>应用列表</Breadcrumb.Item>
|
||||
<Breadcrumb.Item>某应用</Breadcrumb.Item>
|
||||
</Breadcrumb>
|
||||
```
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|-----------|-----------------------------------|-----------------|---------|--------|
|
||||
| routes | router 的路由栈信息 | Array | | - |
|
||||
@@ -32,3 +23,18 @@ title: Breadcrumb
|
||||
| itemRender | 自定义链接函数,和 react-router 配置使用 | (route, params, routes, paths) => React.ReactNode | | - |
|
||||
|
||||
> 2.0 之后,`linkRender` 和 `nameRender` 被移除,请使用 `itemRender` 来代替。
|
||||
|
||||
### 和 browserHistory 配合
|
||||
|
||||
和 react-router 一起使用时,默认生成的 url 路径是带有 `#` 的,如果和 browserHistory 一起使用的话,你可以使用 `itemRender` 属性定义面包屑链接。
|
||||
|
||||
```jsx
|
||||
import { Link } from 'react-router';
|
||||
|
||||
function itemRender(route, params, routes, paths) {
|
||||
const last = routes.indexOf(route) === routes.length - 1;
|
||||
return last ? <span>{route.breadcrumbName}</span> : <Link to={paths.join('/')}>{route.breadcrumbName}</Link>;
|
||||
}
|
||||
|
||||
return <Breadcrumb itemRender={itemRender} />;
|
||||
```
|
||||
|
||||
@@ -22,11 +22,9 @@ export default function ButtonGroup(props: ButtonGroupProps) {
|
||||
small: 'sm',
|
||||
})[size] || '';
|
||||
|
||||
const classes = classNames({
|
||||
[prefixCls]: true,
|
||||
const classes = classNames(prefixCls, {
|
||||
[`${prefixCls}-${sizeCls}`]: sizeCls,
|
||||
[className]: className,
|
||||
});
|
||||
}, className);
|
||||
|
||||
return <div {...others} className={classes} />;
|
||||
}
|
||||
|
||||
@@ -112,22 +112,21 @@ export default class Button extends React.Component<ButtonProps, any> {
|
||||
small: 'sm',
|
||||
})[size] || '';
|
||||
|
||||
const classes = classNames({
|
||||
[prefixCls]: true,
|
||||
const classes = classNames(prefixCls, {
|
||||
[`${prefixCls}-${type}`]: type,
|
||||
[`${prefixCls}-${shape}`]: shape,
|
||||
[`${prefixCls}-${sizeCls}`]: sizeCls,
|
||||
[`${prefixCls}-icon-only`]: !children && icon,
|
||||
[`${prefixCls}-loading`]: loading,
|
||||
[className]: className,
|
||||
});
|
||||
}, className);
|
||||
|
||||
const iconType = loading ? 'loading' : icon;
|
||||
|
||||
const kids = React.Children.map(children, insertSpace);
|
||||
|
||||
return (
|
||||
<button {...others}
|
||||
<button
|
||||
{...others}
|
||||
type={htmlType || 'button'}
|
||||
className={classes}
|
||||
onMouseUp={this.handleMouseUp}
|
||||
|
||||
@@ -30,7 +30,6 @@ ReactDOM.render(
|
||||
<Button>Default</Button>
|
||||
<Button type="ghost">Ghost</Button>
|
||||
<Button type="dashed">Dashed</Button>
|
||||
</div>,
|
||||
mountNode
|
||||
);
|
||||
</div>
|
||||
, mountNode);
|
||||
````
|
||||
|
||||
@@ -53,20 +53,6 @@ ReactDOM.render(
|
||||
<Button type="primary" icon="cloud" />
|
||||
<Button type="primary" icon="cloud-download" />
|
||||
</ButtonGroup>
|
||||
|
||||
<h4>Size</h4>
|
||||
<ButtonGroup size="large">
|
||||
<Button type="ghost">Large</Button>
|
||||
<Button type="ghost">Large</Button>
|
||||
</ButtonGroup>
|
||||
<ButtonGroup>
|
||||
<Button type="ghost">Default</Button>
|
||||
<Button type="ghost">Default</Button>
|
||||
</ButtonGroup>
|
||||
<ButtonGroup size="small">
|
||||
<Button type="ghost">Small</Button>
|
||||
<Button type="ghost">Small</Button>
|
||||
</ButtonGroup>
|
||||
</div>,
|
||||
mountNode
|
||||
);
|
||||
@@ -85,8 +71,4 @@ ReactDOM.render(
|
||||
#components-button-demo-button-group .ant-btn-group {
|
||||
margin-right: 8px;
|
||||
}
|
||||
#components-button-demo-button-group .ant-btn {
|
||||
margin-bottom: 12px;
|
||||
margin-right: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -24,9 +24,13 @@ ReactDOM.render(
|
||||
<div>
|
||||
<Button type="primary" shape="circle" icon="search" />
|
||||
<Button type="primary" icon="search">Search</Button>
|
||||
<Button shape="circle" icon="search" />
|
||||
<Button icon="search">Search</Button>
|
||||
<br />
|
||||
<Button type="ghost" shape="circle-outline" icon="search" />
|
||||
<Button type="ghost" shape="circle" icon="search" />
|
||||
<Button type="ghost" icon="search">Search</Button>
|
||||
<Button type="dashed" shape="circle" icon="search" />
|
||||
<Button type="dashed" icon="search">Search</Button>
|
||||
</div>,
|
||||
mountNode
|
||||
);
|
||||
|
||||
@@ -18,14 +18,43 @@ Ant Design supports a default button size as well as a large and small size.
|
||||
If a large or small button is desired, set the `size` property to either `large` or `small` respectively. Omit the `size` property for a button with the default size.
|
||||
|
||||
````jsx
|
||||
import { Button } from 'antd';
|
||||
import { Button, Radio, Icon } from 'antd';
|
||||
|
||||
ReactDOM.render(
|
||||
<div>
|
||||
<Button type="primary" size="large">Large</Button>
|
||||
<Button type="primary">Default</Button>
|
||||
<Button type="primary" size="small">Small</Button>
|
||||
</div>,
|
||||
mountNode
|
||||
);
|
||||
class ButtonSize extends React.Component {
|
||||
state = {
|
||||
size: 'default',
|
||||
};
|
||||
|
||||
handleSizeChange = (e) => {
|
||||
this.setState({ size: e.target.value });
|
||||
}
|
||||
|
||||
render() {
|
||||
const size = this.state.size;
|
||||
return (
|
||||
<div>
|
||||
<Radio.Group value={size} onChange={this.handleSizeChange}>
|
||||
<Radio.Button value="large">Large</Radio.Button>
|
||||
<Radio.Button value="default">Default</Radio.Button>
|
||||
<Radio.Button value="small">Small</Radio.Button>
|
||||
</Radio.Group>
|
||||
<br /><br />
|
||||
<Button type="primary" shape="circle" icon="download" size={size} />
|
||||
<Button type="primary" icon="download" size={size}>Download</Button>
|
||||
<Button type="primary" size={size}>Normal</Button>
|
||||
<br />
|
||||
<Button.Group size={size}>
|
||||
<Button type="primary">
|
||||
<Icon type="left" />Backward
|
||||
</Button>
|
||||
<Button type="primary">
|
||||
Forward<Icon type="right" />
|
||||
</Button>
|
||||
</Button.Group>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ReactDOM.render(<ButtonSize />, mountNode);
|
||||
````
|
||||
|
||||
@@ -8,7 +8,7 @@ To trigger an operation.
|
||||
|
||||
## When To Use
|
||||
|
||||
A button means an operation(or a series of operations). Click a button will trigger corresponding business logic.
|
||||
A button means an operation (or a series of operations). Clicking a button will trigger corresponding business logic.
|
||||
|
||||
## API
|
||||
|
||||
@@ -16,10 +16,10 @@ To get a customized button, just set `type`/`shape`/`size`/`loading`/`disabled`.
|
||||
|
||||
Property | Description | Type | Default
|
||||
-----|-----|-----|------
|
||||
type | can be set to `primary` `ghost` or omitted | string | -
|
||||
type | can be set to `primary` `ghost` `dashed` or omitted | string | -
|
||||
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` `circle-outline` or omitted | 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
|
||||
onClick | set the handler to handle `click` event | function | -
|
||||
@@ -27,8 +27,11 @@ onClick | set the handler to handle `click` event | function | -
|
||||
`<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.
|
||||
|
||||
<style>
|
||||
[id^="components-button-demo-"] .ant-btn {
|
||||
[id^=components-button-demo-] .ant-btn {
|
||||
margin-right: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
[id^=components-button-demo-] .ant-btn-group > .ant-btn {
|
||||
margin-right: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -19,10 +19,10 @@ subtitle: 按钮
|
||||
|
||||
属性 | 说明 | 类型 | 默认值
|
||||
-----|-----|-----|------
|
||||
type | 设置按钮类型,可选值为 `primary` `ghost` 或者不设 | string | -
|
||||
type | 设置按钮类型,可选值为 `primary` `ghost` `dashed` 或者不设 | string | -
|
||||
htmlType | 设置 `button` 原生的 `type` 值,可选值请参考 [HTML 标准](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) | string | `button`
|
||||
icon | 设置按钮的图标类型 | string | -
|
||||
shape | 设置按钮形状,可选值为 `circle` `circle-outline` 或者不设 | string | -
|
||||
shape | 设置按钮形状,可选值为 `circle` 或者不设 | string | -
|
||||
size | 设置按钮大小,可选值为 `small` `large` 或者不设 | string | `default`
|
||||
loading | 设置按钮载入状态 | boolean | false
|
||||
onClick | `click` 事件的 handler | function | -
|
||||
@@ -34,4 +34,7 @@ onClick | `click` 事件的 handler | function | -
|
||||
margin-right: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
[id^="components-button-demo-"] .ant-btn-group > .ant-btn {
|
||||
margin-right: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -101,27 +101,27 @@
|
||||
}
|
||||
|
||||
&-clicked:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -1px;
|
||||
left: -1px;
|
||||
bottom: -1px;
|
||||
right: -1px;
|
||||
border-radius: inherit;
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -1px;
|
||||
left: -1px;
|
||||
bottom: -1px;
|
||||
right: -1px;
|
||||
border-radius: inherit;
|
||||
border: 0 solid @primary-color;
|
||||
opacity: 0.4;
|
||||
opacity: 0.4;
|
||||
animation: buttonEffect 0.36s ease-out forwards;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes buttonEffect {
|
||||
to {
|
||||
opacity: 0;
|
||||
to {
|
||||
opacity: 0;
|
||||
top: -6px;
|
||||
left: -6px;
|
||||
bottom: -6px;
|
||||
right: -6px;
|
||||
left: -6px;
|
||||
bottom: -6px;
|
||||
right: -6px;
|
||||
border-width: 6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,6 @@
|
||||
.button-group-base(@btnClassName) {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
> .@{btnClassName} {
|
||||
position: relative;
|
||||
&:hover,
|
||||
|
||||
@@ -108,7 +108,7 @@ ReactDOM.render(
|
||||
}
|
||||
|
||||
.event-normal {
|
||||
color: #2db7f5;
|
||||
color: #108ee9;
|
||||
}
|
||||
|
||||
.event-error {
|
||||
|
||||
@@ -5,7 +5,7 @@ cols: 1
|
||||
title: Calendar
|
||||
---
|
||||
|
||||
When To Use container for displaying data in calendar form.
|
||||
Container for displaying data in calendar form.
|
||||
|
||||
## When To Use
|
||||
|
||||
@@ -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 | [defualt](https://github.com/ant-design/ant-design/issues/424) |
|
||||
| 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) | - |
|
||||
|
||||
@@ -64,8 +64,15 @@ export default class Calendar extends React.Component<CalendarProps, any> {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
const value = props.value || props.defaultValue || moment();
|
||||
if (!moment.isMoment(value)) {
|
||||
throw new Error(
|
||||
'The value/defaultValue of Calendar must be a moment object after `antd@2.0`, ' +
|
||||
'see: http://u.ant.design/calendar-value'
|
||||
);
|
||||
}
|
||||
this.state = {
|
||||
value: props.value || props.defaultValue || moment(),
|
||||
value,
|
||||
mode: props.mode,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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/issues/424) |
|
||||
| locale | 国际化配置 | Object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
|
||||
| onPanelChange| 日期面板变化回调 | function(date: moment, mode: string) | 无 |
|
||||
|
||||
2
components/calendar/locale/pt_BR.tsx
Normal file
2
components/calendar/locale/pt_BR.tsx
Normal file
@@ -0,0 +1,2 @@
|
||||
import pt_BR from '../../date-picker/locale/pt_BR';
|
||||
export default pt_BR;
|
||||
@@ -11,7 +11,7 @@ title:
|
||||
|
||||
## en-US
|
||||
|
||||
Shows a loading indicator while the contents of the card are being fetched.
|
||||
Shows a loading indicator while the contents of the card is being fetched.
|
||||
|
||||
````jsx
|
||||
import { Card } from 'antd';
|
||||
|
||||
@@ -21,9 +21,7 @@ export default (props: CardProps) => {
|
||||
}, others] = splitObject(props,
|
||||
['prefixCls', 'className', 'children', 'extra', 'bodyStyle', 'title', 'loading', 'bordered']);
|
||||
let children = props.children;
|
||||
const classString = classNames({
|
||||
[prefixCls]: true,
|
||||
[className]: !!className,
|
||||
const classString = classNames(prefixCls, className, {
|
||||
[`${prefixCls}-loading`]: loading,
|
||||
[`${prefixCls}-bordered`]: bordered,
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@card-prefix-cls: ~"@{ant-prefix}-card";
|
||||
|
||||
.@{card-prefix-cls} {
|
||||
background: #fff;
|
||||
background: @component-background;
|
||||
border-radius: @border-radius-sm;
|
||||
font-size: @font-size-base;
|
||||
position: relative;
|
||||
@@ -13,6 +13,7 @@
|
||||
&:hover {
|
||||
box-shadow: @box-shadow-base;
|
||||
border-color: transparent;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
&-bordered {
|
||||
|
||||
@@ -10,14 +10,14 @@ A carousel component. Scales with its container.
|
||||
|
||||
- When there is a group of content on the same level.
|
||||
- When there is insufficient content space, it can be used to save space in the form of a resolving door.
|
||||
- Commonly used in a carousel for a group of pictures/cards.
|
||||
- Commonly used for a group of pictures/cards.
|
||||
|
||||
## API
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|------------------|----------------------------------------------|----------|---------------------------------|
|
||||
| effect | Animation effect, either `scrollx` or `fade` | String | scrollx |
|
||||
| dots | Should we show the dots at the bottom of the gallery | Boolean | true |
|
||||
| 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 |
|
||||
|
||||
@@ -40,8 +40,8 @@ const options = [{
|
||||
}],
|
||||
}];
|
||||
|
||||
function onChange(value) {
|
||||
console.log(value);
|
||||
function onChange(value, selectedOptions) {
|
||||
console.log(value, selectedOptions);
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
|
||||
@@ -11,7 +11,7 @@ Cascade selection box.
|
||||
|
||||
- When you need to select from a set of associated data set. Such as province/city/district, company level, things classification.
|
||||
- When selecting from a large data set, with multi-stage classification separated for easy selection.
|
||||
- chooses cascade items in one float layer for better user experience.
|
||||
- Chooses cascade items in one float layer for better user experience.
|
||||
|
||||
## API
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import React from 'react';
|
||||
import RcCascader from 'rc-cascader';
|
||||
import Input from '../input';
|
||||
import Icon from '../icon';
|
||||
import arrayTreeFilter from 'array-tree-filter';
|
||||
import classNames from 'classnames';
|
||||
import splitObject from '../_util/splitObject';
|
||||
import omit from 'omit.js';
|
||||
import Input from '../input';
|
||||
import Icon from '../icon';
|
||||
import splitObject from '../_util/splitObject';
|
||||
|
||||
export interface CascaderOptionType {
|
||||
value: string;
|
||||
@@ -134,9 +134,14 @@ export default class Cascader extends React.Component<CascaderProps, any> {
|
||||
}
|
||||
|
||||
handleChange = (value, selectedOptions) => {
|
||||
const unwrappedValue = Array.isArray(value[0]) ? value[0] : value;
|
||||
this.setState({ inputValue: '' });
|
||||
this.setValue(unwrappedValue, selectedOptions);
|
||||
if (selectedOptions[0].__IS_FILTERED_OPTION) {
|
||||
const unwrappedValue = value[0];
|
||||
const unwrappedSelectedOptions = selectedOptions[0].path;
|
||||
this.setValue(unwrappedValue, unwrappedSelectedOptions);
|
||||
return;
|
||||
}
|
||||
this.setValue(value, selectedOptions);
|
||||
}
|
||||
|
||||
handlePopupVisibleChange = (popupVisible) => {
|
||||
@@ -230,6 +235,8 @@ export default class Cascader extends React.Component<CascaderProps, any> {
|
||||
if (filtered.length > 0) {
|
||||
return filtered.map((path) => {
|
||||
return {
|
||||
__IS_FILTERED_OPTION: true,
|
||||
path,
|
||||
label: render(inputValue, path, prefixCls),
|
||||
value: path.map(o => o.value),
|
||||
};
|
||||
@@ -239,8 +246,7 @@ export default class Cascader extends React.Component<CascaderProps, any> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const props = this.props;
|
||||
const state = this.state;
|
||||
const { props, state } = this;
|
||||
const [{ prefixCls, inputPrefixCls, children, placeholder, size, disabled,
|
||||
className, style, allowClear, showSearch }, otherProps] = splitObject(props,
|
||||
['prefixCls', 'inputPrefixCls', 'children', 'placeholder', 'size', 'disabled',
|
||||
@@ -252,7 +258,8 @@ export default class Cascader extends React.Component<CascaderProps, any> {
|
||||
[`${inputPrefixCls}-sm`]: size === 'small',
|
||||
});
|
||||
const clearIcon = (allowClear && !disabled && value.length > 0) || state.inputValue ?
|
||||
<Icon type="cross-circle"
|
||||
<Icon
|
||||
type="cross-circle"
|
||||
className={`${prefixCls}-picker-clear`}
|
||||
onClick={this.clearSelection}
|
||||
/> : null;
|
||||
@@ -260,8 +267,7 @@ export default class Cascader extends React.Component<CascaderProps, any> {
|
||||
[`${prefixCls}-picker-arrow`]: true,
|
||||
[`${prefixCls}-picker-arrow-expand`]: state.popupVisible,
|
||||
});
|
||||
const pickerCls = classNames({
|
||||
[className]: !!className,
|
||||
const pickerCls = classNames(className, {
|
||||
[`${prefixCls}-picker`]: true,
|
||||
[`${prefixCls}-picker-with-value`]: state.inputValue,
|
||||
[`${prefixCls}-picker-disabled`]: disabled,
|
||||
@@ -309,6 +315,33 @@ export default class Cascader extends React.Component<CascaderProps, any> {
|
||||
if (resultListMatchInputWidth && state.inputValue && this.refs.input) {
|
||||
dropdownMenuColumnStyle.width = this.refs.input.refs.input.offsetWidth;
|
||||
}
|
||||
|
||||
const input = children || (
|
||||
<span
|
||||
style={style}
|
||||
className={pickerCls}
|
||||
>
|
||||
<Input
|
||||
{...inputProps}
|
||||
ref="input"
|
||||
placeholder={value && value.length > 0 ? null : placeholder}
|
||||
className={`${prefixCls}-input ${sizeCls}`}
|
||||
value={state.inputValue}
|
||||
disabled={disabled}
|
||||
readOnly={!showSearch}
|
||||
autoComplete="off"
|
||||
onClick={showSearch ? this.handleInputClick : undefined}
|
||||
onBlur={showSearch ? this.handleInputBlur : undefined}
|
||||
onChange={showSearch ? this.handleInputChange : undefined}
|
||||
/>
|
||||
<span className={`${prefixCls}-picker-label`}>
|
||||
{this.getLabel()}
|
||||
</span>
|
||||
{clearIcon}
|
||||
<Icon type="down" className={arrowCls} />
|
||||
</span>
|
||||
);
|
||||
|
||||
return (
|
||||
<RcCascader
|
||||
{...props}
|
||||
@@ -319,31 +352,7 @@ export default class Cascader extends React.Component<CascaderProps, any> {
|
||||
onChange={this.handleChange}
|
||||
dropdownMenuColumnStyle={dropdownMenuColumnStyle}
|
||||
>
|
||||
{children ||
|
||||
<span
|
||||
style={style}
|
||||
className={pickerCls}
|
||||
>
|
||||
<Input
|
||||
{...inputProps}
|
||||
ref="input"
|
||||
placeholder={value && value.length > 0 ? null : placeholder}
|
||||
className={`${prefixCls}-input ${sizeCls}`}
|
||||
value={state.inputValue}
|
||||
disabled={disabled}
|
||||
readOnly={!showSearch}
|
||||
autoComplete="off"
|
||||
onClick={showSearch ? this.handleInputClick : undefined}
|
||||
onBlur={showSearch ? this.handleInputBlur : undefined}
|
||||
onChange={showSearch ? this.handleInputChange : undefined}
|
||||
/>
|
||||
<span className={`${prefixCls}-picker-label`}>
|
||||
{this.getLabel()}
|
||||
</span>
|
||||
{clearIcon}
|
||||
<Icon type="down" className={arrowCls} />
|
||||
</span>
|
||||
}
|
||||
{input}
|
||||
</RcCascader>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -84,20 +84,21 @@ export default class CheckboxGroup extends React.Component<CheckboxGroupProps, C
|
||||
}
|
||||
render() {
|
||||
const { prefixCls } = this.props;
|
||||
const options = this.getOptions();
|
||||
const options = this.getOptions().map(option =>
|
||||
<Checkbox
|
||||
disabled={'disabled' in option ? option.disabled : this.props.disabled}
|
||||
checked={this.state.value.indexOf(option.value) !== -1}
|
||||
onChange={() => this.toggleOption(option)}
|
||||
className={`${prefixCls}-item`}
|
||||
key={option.value}
|
||||
>
|
||||
{option.label}
|
||||
</Checkbox>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={prefixCls}>
|
||||
{
|
||||
options.map(option =>
|
||||
<Checkbox disabled={'disabled' in option ? option.disabled : this.props.disabled}
|
||||
checked={this.state.value.indexOf(option.value) !== -1}
|
||||
onChange={() => this.toggleOption(option)}
|
||||
className={`${prefixCls}-item`} key={option.value}
|
||||
>
|
||||
{option.label}
|
||||
</Checkbox>
|
||||
)
|
||||
}
|
||||
{options}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -29,18 +29,24 @@ export default class Checkbox extends React.Component<CheckboxProps, any> {
|
||||
return PureRenderMixin.shouldComponentUpdate.apply(this, args);
|
||||
}
|
||||
render() {
|
||||
const [{ prefixCls, style, children, className, indeterminate }, restProps] = splitObject(
|
||||
this.props, ['prefixCls', 'style', 'children', 'className', 'indeterminate']
|
||||
const [{ prefixCls, style, children, className, indeterminate, onMouseEnter,
|
||||
onMouseLeave }, restProps] = splitObject(
|
||||
this.props, ['prefixCls', 'style', 'children', 'className', 'indeterminate',
|
||||
'onMouseEnter', 'onMouseLeave']
|
||||
);
|
||||
const classString = classNames({
|
||||
[className]: !!className,
|
||||
const classString = classNames(className, {
|
||||
[`${prefixCls}-wrapper`]: true,
|
||||
});
|
||||
const checkboxClass = classNames({
|
||||
[`${prefixCls}-indeterminate`]: indeterminate,
|
||||
});
|
||||
return (
|
||||
<label className={classString} style={style}>
|
||||
<label
|
||||
className={classString}
|
||||
style={style}
|
||||
onMouseEnter={onMouseEnter}
|
||||
onMouseLeave={onMouseLeave}
|
||||
>
|
||||
<RcCheckbox
|
||||
{...restProps}
|
||||
prefixCls={prefixCls}
|
||||
|
||||
@@ -124,8 +124,8 @@
|
||||
cursor: pointer;
|
||||
font-size: @font-size-base;
|
||||
display: inline-block;
|
||||
& + & {
|
||||
margin-left: 8px;
|
||||
&:not(:last-child) {
|
||||
margin-right: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,7 @@ export default class Collapse extends React.Component<CollapseProps, any> {
|
||||
const { prefixCls, className = '', bordered } = this.props;
|
||||
const collapseClassName = classNames({
|
||||
[`${prefixCls}-borderless`]: !bordered,
|
||||
[className]: !!className,
|
||||
});
|
||||
}, className);
|
||||
return <RcCollapse {...this.props} className={collapseClassName} />;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
overflow: hidden;
|
||||
color: @text-color;
|
||||
padding: 0 16px;
|
||||
background-color: #fff;
|
||||
background-color: @component-background;
|
||||
|
||||
& > &-box {
|
||||
padding-top: 16px;
|
||||
@@ -84,7 +84,7 @@
|
||||
}
|
||||
|
||||
&-borderless {
|
||||
background-color: #fff;
|
||||
background-color: @component-background;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,12 +9,24 @@ export default class RangePicker extends React.Component<any, any> {
|
||||
static defaultProps = {
|
||||
prefixCls: 'ant-calendar',
|
||||
allowClear: true,
|
||||
showToday: false,
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
const value = props.value || props.defaultValue || [];
|
||||
if (
|
||||
value[0] && !moment.isMoment(value[0]) ||
|
||||
value[1] && !moment.isMoment(value[1])
|
||||
) {
|
||||
throw new Error(
|
||||
'The value/defaultValue of RangePicker must be a moment object array after `antd@2.0`, ' +
|
||||
'see: http://u.ant.design/date-picker-value'
|
||||
);
|
||||
}
|
||||
this.state = {
|
||||
value: props.value || props.defaultValue || [],
|
||||
value,
|
||||
open: props.open,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -24,6 +36,11 @@ export default class RangePicker extends React.Component<any, any> {
|
||||
value: nextProps.value || [],
|
||||
});
|
||||
}
|
||||
if ('open' in nextProps) {
|
||||
this.setState({
|
||||
open: nextProps.open,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
clearSelection = (e) => {
|
||||
@@ -44,13 +61,51 @@ export default class RangePicker extends React.Component<any, any> {
|
||||
]);
|
||||
}
|
||||
|
||||
handleOpenChange = (open) => {
|
||||
this.setState({ open });
|
||||
|
||||
const onOpenChange = this.props.onOpenChange;
|
||||
if (onOpenChange) {
|
||||
onOpenChange(open);
|
||||
}
|
||||
}
|
||||
|
||||
setValue(value) {
|
||||
this.handleChange(value);
|
||||
if (!this.props.showTime) {
|
||||
this.setState({ open: false });
|
||||
}
|
||||
}
|
||||
|
||||
renderFooter = () => {
|
||||
const { prefixCls, ranges } = this.props;
|
||||
if (!ranges) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const operations = Object.keys(ranges).map((range) => {
|
||||
const value = ranges[range];
|
||||
return <a key={range} onClick={() => this.setValue(value)}>{range}</a>;
|
||||
});
|
||||
return (
|
||||
<div className={`${prefixCls}-range-quick-selector`}>
|
||||
{operations}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
const props = this.props;
|
||||
const { disabledDate, disabledTime, showTime, prefixCls, popupStyle, style, onOk, locale } = props;
|
||||
const {
|
||||
disabledDate, disabledTime, showTime, showToday,
|
||||
ranges, prefixCls, popupStyle,
|
||||
style, onOk, locale, format,
|
||||
} = props;
|
||||
const state = this.state;
|
||||
|
||||
const calendarClassName = classNames({
|
||||
[`${prefixCls}-time`]: showTime,
|
||||
[`${prefixCls}-range-with-ranges`]: ranges,
|
||||
});
|
||||
|
||||
// 需要选择时间时,点击 ok 时才触发 onChange
|
||||
@@ -66,16 +121,18 @@ export default class RangePicker extends React.Component<any, any> {
|
||||
calendarHandler = {};
|
||||
}
|
||||
|
||||
const startPlaceholder = ('startPlaceholder' in this.props)
|
||||
? props.startPlaceholder : locale.lang.rangePlaceholder[0];
|
||||
const endPlaceholder = ('endPlaceholder' in props)
|
||||
? props.endPlaceholder : locale.lang.rangePlaceholder[1];
|
||||
const startPlaceholder = ('placeholder' in props)
|
||||
? props.placeholder[0] : locale.lang.rangePlaceholder[0];
|
||||
const endPlaceholder = ('placeholder' in props)
|
||||
? props.placeholder[1] : locale.lang.rangePlaceholder[1];
|
||||
|
||||
const calendar = (
|
||||
<RangeCalendar
|
||||
{...calendarHandler}
|
||||
format={format}
|
||||
prefixCls={prefixCls}
|
||||
className={calendarClassName}
|
||||
renderFooter={this.renderFooter}
|
||||
timePicker={props.timePicker}
|
||||
disabledDate={disabledDate}
|
||||
disabledTime={disabledTime}
|
||||
@@ -83,6 +140,7 @@ export default class RangePicker extends React.Component<any, any> {
|
||||
locale={locale.lang}
|
||||
onOk={onOk}
|
||||
defaultValue={props.defaultPickerValue || [moment(), moment()]}
|
||||
showToday={showToday}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -93,42 +151,44 @@ export default class RangePicker extends React.Component<any, any> {
|
||||
onClick={this.clearSelection}
|
||||
/> : null;
|
||||
|
||||
const input = ({ value }) => {
|
||||
const start = value[0];
|
||||
const end = value[1];
|
||||
return (
|
||||
<span className={props.pickerInputClass} disabled={props.disabled}>
|
||||
<input
|
||||
disabled={props.disabled}
|
||||
readOnly
|
||||
value={(start && start.format(props.format)) || ''}
|
||||
placeholder={startPlaceholder}
|
||||
className={`${prefixCls}-range-picker-input`}
|
||||
/>
|
||||
<span className={`${prefixCls}-range-picker-separator`}> ~ </span>
|
||||
<input
|
||||
disabled={props.disabled}
|
||||
readOnly
|
||||
value={(end && end.format(props.format)) || ''}
|
||||
placeholder={endPlaceholder}
|
||||
className={`${prefixCls}-range-picker-input`}
|
||||
/>
|
||||
{clearIcon}
|
||||
<span className={`${prefixCls}-picker-icon`} />
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
return (<span className={props.pickerClass} style={style}>
|
||||
<RcDatePicker
|
||||
{...props}
|
||||
{...pickerChangeHandler}
|
||||
calendar={calendar}
|
||||
value={state.value}
|
||||
open={state.open}
|
||||
onOpenChange={this.handleOpenChange}
|
||||
prefixCls={`${prefixCls}-picker-container`}
|
||||
style={popupStyle}
|
||||
>
|
||||
{
|
||||
({ value }) => {
|
||||
const start = value[0];
|
||||
const end = value[1];
|
||||
return (
|
||||
<span className={props.pickerInputClass} disabled={props.disabled}>
|
||||
<input
|
||||
disabled={props.disabled}
|
||||
readOnly
|
||||
value={(start && start.format(props.format)) || ''}
|
||||
placeholder={startPlaceholder}
|
||||
className={`${prefixCls}-range-picker-input`}
|
||||
/>
|
||||
<span className={`${prefixCls}-range-picker-separator`}> ~ </span>
|
||||
<input
|
||||
disabled={props.disabled}
|
||||
readOnly
|
||||
value={(end && end.format(props.format)) || ''}
|
||||
placeholder={endPlaceholder}
|
||||
className={`${prefixCls}-range-picker-input`}
|
||||
/>
|
||||
{clearIcon}
|
||||
<span className={`${prefixCls}-picker-icon`} />
|
||||
</span>
|
||||
);
|
||||
}
|
||||
}
|
||||
{input}
|
||||
</RcDatePicker>
|
||||
</span>);
|
||||
}
|
||||
|
||||
@@ -18,19 +18,27 @@ export default function createPicker(TheCalendar) {
|
||||
return {
|
||||
prefixCls: 'ant-calendar',
|
||||
allowClear: true,
|
||||
showToday: true,
|
||||
};
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
const props = this.props;
|
||||
const value = props.value || props.defaultValue;
|
||||
if (value && !moment.isMoment(value)) {
|
||||
throw new Error(
|
||||
'The value/defaultValue of DatePicker or MonthPicker must be ' +
|
||||
'a moment object after `antd@2.0`, see: http://u.ant.design/date-picker-value'
|
||||
);
|
||||
}
|
||||
return {
|
||||
value: props.value || props.defaultValue,
|
||||
value,
|
||||
tempValue: undefined,
|
||||
};
|
||||
},
|
||||
|
||||
componentWillReceiveProps(nextProps: PickerProps) {
|
||||
if (nextProps.value !== undefined) {
|
||||
if ('value' in nextProps) {
|
||||
this.setState({
|
||||
value: nextProps.value,
|
||||
tempValue: nextProps.value,
|
||||
@@ -47,7 +55,7 @@ export default function createPicker(TheCalendar) {
|
||||
|
||||
handleChange(value) {
|
||||
const props = this.props;
|
||||
if (props.value === undefined) {
|
||||
if (!('value' in props)) {
|
||||
this.setState({ value });
|
||||
}
|
||||
props.onChange(value, (value && value.format(props.format)) || '');
|
||||
@@ -59,20 +67,19 @@ export default function createPicker(TheCalendar) {
|
||||
|
||||
// Clear temp value and trigger onChange when hide DatePicker[showTime] panel
|
||||
handleOpenChange(open) {
|
||||
const { showTime, onOpenChange } = this.props;
|
||||
const { showTime, onOpenChange, onChange, format } = this.props;
|
||||
if (!open) {
|
||||
// tricky code to avoid triggering onChange multiple times
|
||||
// when click `Now` button
|
||||
let tempValue;
|
||||
this.setState(prevState => {
|
||||
tempValue = prevState.tempValue;
|
||||
return {
|
||||
tempValue: undefined,
|
||||
};
|
||||
}, () => {
|
||||
const nextState = { tempValue: undefined } as any;
|
||||
if (showTime && tempValue) {
|
||||
this.handleChange(tempValue);
|
||||
nextState.value = tempValue;
|
||||
onChange(tempValue, (tempValue && tempValue.format(format)) || '');
|
||||
}
|
||||
return nextState;
|
||||
});
|
||||
}
|
||||
if (onOpenChange) {
|
||||
@@ -113,6 +120,7 @@ export default function createPicker(TheCalendar) {
|
||||
|
||||
const calendar = (
|
||||
<TheCalendar
|
||||
{...calendarHandler}
|
||||
disabledDate={props.disabledDate}
|
||||
disabledTime={disabledTime}
|
||||
locale={locale.lang}
|
||||
@@ -123,15 +131,31 @@ export default function createPicker(TheCalendar) {
|
||||
className={calendarClassName}
|
||||
onOk={props.onOk}
|
||||
format={props.format}
|
||||
{...calendarHandler}
|
||||
showToday={props.showToday}
|
||||
/>
|
||||
);
|
||||
|
||||
const clearIcon = (!props.disabled && props.allowClear && this.state.value) ?
|
||||
<Icon type="cross-circle"
|
||||
<Icon
|
||||
type="cross-circle"
|
||||
className={`${prefixCls}-picker-clear`}
|
||||
onClick={this.clearSelection}
|
||||
/> : null;
|
||||
|
||||
const input = ({ value }) => (
|
||||
<span>
|
||||
<input
|
||||
disabled={props.disabled}
|
||||
readOnly
|
||||
value={(value && value.format(props.format)) || ''}
|
||||
placeholder={placeholder}
|
||||
className={props.pickerInputClass}
|
||||
/>
|
||||
{clearIcon}
|
||||
<span className={`${prefixCls}-picker-icon`} />
|
||||
</span>
|
||||
);
|
||||
|
||||
return (
|
||||
<span className={props.pickerClass} style={props.style}>
|
||||
<RcDatePicker
|
||||
@@ -143,23 +167,7 @@ export default function createPicker(TheCalendar) {
|
||||
prefixCls={`${prefixCls}-picker-container`}
|
||||
style={props.popupStyle}
|
||||
>
|
||||
{
|
||||
({ value }) => {
|
||||
return (
|
||||
<span>
|
||||
<input
|
||||
disabled={props.disabled}
|
||||
readOnly
|
||||
value={(value && value.format(props.format)) || ''}
|
||||
placeholder={placeholder}
|
||||
className={props.pickerInputClass}
|
||||
/>
|
||||
{clearIcon}
|
||||
<span className={`${prefixCls}-picker-icon`} />
|
||||
</span>
|
||||
);
|
||||
}
|
||||
}
|
||||
{input}
|
||||
</RcDatePicker>
|
||||
</span>
|
||||
);
|
||||
|
||||
@@ -23,10 +23,11 @@ function onChange(date, dateString) {
|
||||
|
||||
ReactDOM.render(
|
||||
<div>
|
||||
<DatePicker onChange={onChange} /><br />
|
||||
<MonthPicker onChange={onChange} /><br />
|
||||
<DatePicker onChange={onChange} />
|
||||
<br />
|
||||
<MonthPicker onChange={onChange} />
|
||||
<br />
|
||||
<RangePicker onChange={onChange} />
|
||||
</div>,
|
||||
mountNode
|
||||
);
|
||||
</div>
|
||||
, mountNode);
|
||||
````
|
||||
|
||||
@@ -25,7 +25,6 @@ function range(start, end) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
function disabledDate(current) {
|
||||
// can not select days before today and today
|
||||
return current && current.valueOf() < Date.now();
|
||||
@@ -33,50 +32,32 @@ function disabledDate(current) {
|
||||
|
||||
function disabledDateTime() {
|
||||
return {
|
||||
disabledHours() {
|
||||
return range(0, 60).splice(4, 20);
|
||||
},
|
||||
disabledMinutes() {
|
||||
return range(30, 60);
|
||||
},
|
||||
disabledSeconds() {
|
||||
return [55, 56];
|
||||
},
|
||||
disabledHours: () => range(0, 24).splice(4, 20),
|
||||
disabledMinutes: () => range(30, 60),
|
||||
disabledSeconds: () => [55, 56],
|
||||
};
|
||||
}
|
||||
|
||||
function disabledRangeTime(_, type) {
|
||||
if (type === 'start') {
|
||||
return {
|
||||
disabledHours() {
|
||||
return range(0, 60).splice(4, 20);
|
||||
},
|
||||
disabledMinutes() {
|
||||
return range(30, 60);
|
||||
},
|
||||
disabledSeconds() {
|
||||
return [55, 56];
|
||||
},
|
||||
disabledHours: () => range(0, 60).splice(4, 20),
|
||||
disabledMinutes: () => range(30, 60),
|
||||
disabledSeconds: () => [55, 56],
|
||||
};
|
||||
}
|
||||
return {
|
||||
disabledHours() {
|
||||
return range(0, 60).splice(20, 4);
|
||||
},
|
||||
disabledMinutes() {
|
||||
return range(0, 31);
|
||||
},
|
||||
disabledSeconds() {
|
||||
return [55, 56];
|
||||
},
|
||||
disabledHours: () => range(0, 60).splice(20, 4),
|
||||
disabledMinutes: () => range(0, 31),
|
||||
disabledSeconds: () => [55, 56],
|
||||
};
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<div>
|
||||
<DatePicker 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 />
|
||||
<RangePicker disabledDate={disabledDate} disabledTime={disabledRangeTime} showTime={{ hideDisabledOptions: true }} />
|
||||
</div>,
|
||||
mountNode
|
||||
);
|
||||
|
||||
@@ -21,13 +21,14 @@ const { MonthPicker, RangePicker } = DatePicker;
|
||||
const dateFormat = 'YYYY-MM-DD';
|
||||
ReactDOM.render(
|
||||
<div>
|
||||
<DatePicker defaultValue={moment('2015-06-06', dateFormat)} disabled /><br />
|
||||
<MonthPicker defaultValue={moment('2015-06', 'YYYY-MM')} disabled /><br />
|
||||
<DatePicker defaultValue={moment('2015-06-06', dateFormat)} disabled />
|
||||
<br />
|
||||
<MonthPicker defaultValue={moment('2015-06', 'YYYY-MM')} disabled />
|
||||
<br />
|
||||
<RangePicker
|
||||
defaultValue={[moment('2015-06-06', dateFormat), moment('2015-06-06', dateFormat)]}
|
||||
disabled
|
||||
/>
|
||||
</div>,
|
||||
mountNode
|
||||
);
|
||||
</div>
|
||||
, mountNode);
|
||||
````
|
||||
|
||||
@@ -22,13 +22,14 @@ const dateFormat = 'YYYY/MM/DD';
|
||||
const monthFormat = 'YYYY/MM';
|
||||
ReactDOM.render(
|
||||
<div>
|
||||
<DatePicker defaultValue={moment('2015/01/01', dateFormat)} format={dateFormat} /><br />
|
||||
<MonthPicker defaultValue={moment('2015/01', monthFormat)} format={monthFormat} /><br />
|
||||
<DatePicker defaultValue={moment('2015/01/01', dateFormat)} format={dateFormat} />
|
||||
<br />
|
||||
<MonthPicker defaultValue={moment('2015/01', monthFormat)} format={monthFormat} />
|
||||
<br />
|
||||
<RangePicker
|
||||
defaultValue={[moment('2015/01/01', dateFormat), moment('2015/01/01', dateFormat)]}
|
||||
format={dateFormat}
|
||||
/><br />
|
||||
</div>,
|
||||
mountNode
|
||||
);
|
||||
/>
|
||||
</div>
|
||||
, mountNode);
|
||||
````
|
||||
|
||||
@@ -39,7 +39,6 @@ ReactDOM.render(
|
||||
locale={enUS}
|
||||
showTime
|
||||
onChange={log}
|
||||
/>,
|
||||
mountNode
|
||||
);
|
||||
/>
|
||||
, mountNode);
|
||||
````
|
||||
|
||||
39
components/date-picker/demo/presetted-ranges.md
Normal file
39
components/date-picker/demo/presetted-ranges.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
order: 8
|
||||
title:
|
||||
zh-CN: 预设范围
|
||||
en-US: Presetted Ranges
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
||||
RangePicker 可以设置常用的 预设范围 提高用户体验。
|
||||
|
||||
## en-US
|
||||
|
||||
We can set presetted ranges to RangePicker to improve user experience.
|
||||
|
||||
````jsx
|
||||
import { DatePicker } from 'antd';
|
||||
import moment from 'moment';
|
||||
const RangePicker = DatePicker.RangePicker;
|
||||
|
||||
function onChange(dates, dateStrings) {
|
||||
console.log('From: ', dates[0], ', to: ', dates[1]);
|
||||
console.log('From: ', dateStrings[0], ', to: ', dateStrings[1]);
|
||||
}
|
||||
ReactDOM.render(
|
||||
<div>
|
||||
<RangePicker
|
||||
ranges={{ Today: [moment(), moment()], 'This Month': [moment(), moment().endOf('month')] }}
|
||||
onChange={onChange}
|
||||
/>
|
||||
<br />
|
||||
<RangePicker
|
||||
ranges={{ Today: [moment(), moment()], 'This Month': [moment(), moment().endOf('month')] }}
|
||||
showTime format="YYYY/MM/DD HH:mm:ss" onChange={onChange}
|
||||
/>
|
||||
</div>,
|
||||
mountNode
|
||||
);
|
||||
````
|
||||
@@ -35,9 +35,12 @@ class PickerSizesDemo extends React.Component {
|
||||
<Radio.Button value="large">Large</Radio.Button>
|
||||
<Radio.Button value="default">Default</Radio.Button>
|
||||
<Radio.Button value="small">Small</Radio.Button>
|
||||
</Radio.Group><br /><br />
|
||||
<DatePicker size={size} /><br />
|
||||
<MonthPicker size={size} /><br />
|
||||
</Radio.Group>
|
||||
<br /><br />
|
||||
<DatePicker size={size} />
|
||||
<br />
|
||||
<MonthPicker size={size} />
|
||||
<br />
|
||||
<RangePicker size={size} />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -25,14 +25,18 @@ function onChange(value, dateString) {
|
||||
ReactDOM.render(
|
||||
<div>
|
||||
<DatePicker
|
||||
showTime={{ format: 'HH:mm' }} format="YYYY-MM-DD HH:mm"
|
||||
placeholder="Select Time" onChange={onChange}
|
||||
/><br />
|
||||
<RangePicker
|
||||
showTime={{ format: 'HH:mm' }} format="YYYY-MM-DD HH:mm"
|
||||
placeholder={['Start Time', 'End Time']} onChange={onChange}
|
||||
showTime
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="Select Time"
|
||||
onChange={onChange}
|
||||
/>
|
||||
</div>,
|
||||
mountNode
|
||||
);
|
||||
<br />
|
||||
<RangePicker
|
||||
showTime
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder={['Start Time', 'End Time']}
|
||||
onChange={onChange}
|
||||
/>
|
||||
</div>
|
||||
, mountNode);
|
||||
````
|
||||
|
||||
@@ -4,10 +4,7 @@ type: Data Entry
|
||||
title: DatePicker
|
||||
---
|
||||
|
||||
To select or input a date. There are three kinds of picker:
|
||||
* DatePicker
|
||||
* MonthPicker
|
||||
* RangePicker
|
||||
To select or input a date.
|
||||
|
||||
## When To Use
|
||||
|
||||
@@ -15,6 +12,12 @@ By clicking the input box, you can select a date from a popup calendar.
|
||||
|
||||
## API
|
||||
|
||||
There are three kinds of picker:
|
||||
|
||||
* DatePicker
|
||||
* MonthPicker
|
||||
* RangePicker
|
||||
|
||||
**Note:** Part of locale of DatePicker, MonthPicker, RangePicker is read from value. So, please set the locale of moment correctly.
|
||||
|
||||
```jsx
|
||||
@@ -38,9 +41,12 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker.
|
||||
| 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/issues/424) |
|
||||
| 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 | - |
|
||||
| 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) | - |
|
||||
|
||||
### DatePicker
|
||||
|
||||
@@ -50,9 +56,8 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker.
|
||||
| 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" |
|
||||
| onChange | a callback function, can be executed when the selected time is changing | function(date: moment, dateString: string) | - |
|
||||
| open | open state of picker | bool | - |
|
||||
| onOpenChange | a callback function, can be executed whether the popup calendar is popped up or closed | function(status) | - |
|
||||
| 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
|
||||
@@ -76,6 +81,7 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker.
|
||||
| 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) |
|
||||
| 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] } | - |
|
||||
|
||||
<style>
|
||||
.code-box-demo .ant-calendar-picker {
|
||||
|
||||
@@ -20,6 +20,8 @@ export interface PickerProps {
|
||||
locale?: any;
|
||||
size?: 'large' | 'small' | 'default';
|
||||
getCalendarContainer?: (trigger: any) => React.ReactNode;
|
||||
open?: boolean;
|
||||
onOpenChange?: (status: boolean) => void;
|
||||
}
|
||||
|
||||
export interface SinglePickerProps {
|
||||
@@ -31,15 +33,18 @@ export interface SinglePickerProps {
|
||||
|
||||
export interface DatePickerProps extends PickerProps, SinglePickerProps {
|
||||
showTime?: TimePickerProps | boolean;
|
||||
showToday?: boolean;
|
||||
open?: boolean;
|
||||
toggleOpen?: (e: {open: boolean}) => void;
|
||||
disabledDate?: (current: moment.Moment) => boolean;
|
||||
onOpenChange?: (status: boolean) => void;
|
||||
placeholder?: string;
|
||||
}
|
||||
const DatePicker = wrapPicker(createPicker(RcCalendar)) as React.ClassicComponentClass<DatePickerProps>;
|
||||
|
||||
export interface MonthPickerProps extends PickerProps, SinglePickerProps {
|
||||
disabledDate?: (current: moment.Moment) => boolean;
|
||||
placeholder?: string;
|
||||
}
|
||||
const MonthPicker = wrapPicker(createPicker(MonthCalendar), 'YYYY-MM');
|
||||
|
||||
@@ -49,6 +54,9 @@ export interface RangePickerProps extends PickerProps {
|
||||
defaultPickerValue?: [moment.Moment, moment.Moment];
|
||||
onChange?: (dates: [moment.Moment, moment.Moment], dateStrings: [string, string]) => void;
|
||||
showTime?: TimePickerProps | boolean;
|
||||
ranges?: {
|
||||
[range: string]: moment.Moment[],
|
||||
};
|
||||
}
|
||||
|
||||
assign(DatePicker, {
|
||||
|
||||
@@ -5,10 +5,7 @@ title: DatePicker
|
||||
subtitle: 日期选择框
|
||||
---
|
||||
|
||||
输入或选择日期的控件,包括以下三种形式。
|
||||
* DatePicker
|
||||
* MonthPicker
|
||||
* RangePicker
|
||||
输入或选择日期的控件。
|
||||
|
||||
## 何时使用
|
||||
|
||||
@@ -16,6 +13,12 @@ subtitle: 日期选择框
|
||||
|
||||
## API
|
||||
|
||||
日期类组件包括以下三种形式。
|
||||
|
||||
* DatePicker
|
||||
* MonthPicker
|
||||
* RangePicker
|
||||
|
||||
**注意:**DatePicker、MonthPicker、RangePicker 部分 locale 是从 value 中读取,所以请先正确设置 moment 的 locale。
|
||||
|
||||
```jsx
|
||||
@@ -39,9 +42,12 @@ moment.locale('zh-cn');
|
||||
| style | 自定义输入框样式 | object | {} |
|
||||
| popupStyle | 格外的弹出日历样式 | object | {} |
|
||||
| size | 输入框大小,`large` 高度为 32px,`small` 为 22px,默认是 28px | string | 无 |
|
||||
| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/issues/424) |
|
||||
| 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 | - |
|
||||
| onOpenChange | 弹出日历和关闭日历的回调 | function(status) | 无 |
|
||||
| placeholder | 输入框提示文字 | string or array (RangePicker) | - |
|
||||
|
||||
### DatePicker
|
||||
|
||||
@@ -51,9 +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) | 无 |
|
||||
| open | 控制弹层是否展开 | bool | - |
|
||||
| onOpenChange | 弹出日历和关闭日历的回调 | function(status) | 无 |
|
||||
| showTime | 增加时间选择功能 | Object or Boolean | [TimePicker Options](/components/time-picker/#api) |
|
||||
| showToday | 是否展示“今天”按钮 | Boolean | true |
|
||||
| disabledTime | 不可选择的时间 | function(date) | 无 |
|
||||
|
||||
### MonthPicker
|
||||
@@ -77,6 +82,7 @@ moment.locale('zh-cn');
|
||||
| onChange | 时间发生变化的回调,发生在用户选择时间时 | function(dates: [moment, moment], dateStrings: [string, string]) | 无 |
|
||||
| showTime | 增加时间选择功能 | Object or Boolean | [TimePicker Options](/components/time-picker/#api) |
|
||||
| disabledTime | 不可选择的时间 | function(dates: [moment, moment], partial: `'start'|'end'`) | 无 |
|
||||
| ranges | 预设事件范围快捷选择 | Object { [range: string]: [moment, moment] } | 无 |
|
||||
|
||||
<style>
|
||||
.code-box-demo .ant-calendar-picker {
|
||||
|
||||
38
components/date-picker/locale/example.json
Normal file
38
components/date-picker/locale/example.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"lang": {
|
||||
"placeholder": "Select date",
|
||||
"rangePlaceholder": [
|
||||
"Start date",
|
||||
"End date"
|
||||
],
|
||||
"today": "Today",
|
||||
"now": "Now",
|
||||
"backToToday": "Back to today",
|
||||
"ok": "Ok",
|
||||
"clear": "Clear",
|
||||
"month": "Month",
|
||||
"year": "Year",
|
||||
"timeSelect": "Select time",
|
||||
"dateSelect": "Select date",
|
||||
"monthSelect": "Choose a month",
|
||||
"yearSelect": "Choose a year",
|
||||
"decadeSelect": "Choose a decade",
|
||||
"yearFormat": "YYYY",
|
||||
"dateFormat": "M/D/YYYY",
|
||||
"dayFormat": "D",
|
||||
"dateTimeFormat": "M/D/YYYY HH:mm:ss",
|
||||
"monthFormat": "MMMM",
|
||||
"monthBeforeYear": true,
|
||||
"previousMonth": "Previous month (PageUp)",
|
||||
"nextMonth": "Next month (PageDown)",
|
||||
"previousYear": "Last year (Control + left)",
|
||||
"nextYear": "Next year (Control + right)",
|
||||
"previousDecade": "Last decade",
|
||||
"nextDecade": "Next decade",
|
||||
"previousCentury": "Last century",
|
||||
"nextCentury": "Next century"
|
||||
},
|
||||
"timePickerLocale": {
|
||||
"placeholder": "Select time"
|
||||
}
|
||||
}
|
||||
17
components/date-picker/locale/pt_BR.tsx
Normal file
17
components/date-picker/locale/pt_BR.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import CalendarLocale from 'rc-calendar/lib/locale/pt_BR';
|
||||
import TimePickerLocale from '../../time-picker/locale/pt_BR';
|
||||
import assign from 'object-assign';
|
||||
|
||||
// 统一合并为完整的 Locale
|
||||
const locale = {
|
||||
lang: assign({
|
||||
placeholder: 'Selecionar data',
|
||||
rangePlaceholder: ['Data de início', 'Data de fim'],
|
||||
}, CalendarLocale),
|
||||
timePickerLocale: assign({}, TimePickerLocale),
|
||||
};
|
||||
|
||||
// All settings at:
|
||||
// https://github.com/ant-design/ant-design/issues/424
|
||||
|
||||
export default locale;
|
||||
@@ -90,7 +90,7 @@
|
||||
list-style: none;
|
||||
font-size: @font-size-base;
|
||||
text-align: left;
|
||||
background-color: #fff;
|
||||
background-color: @component-background;
|
||||
border-radius: @border-radius-base;
|
||||
box-shadow: @box-shadow-base;
|
||||
background-clip: padding-box;
|
||||
@@ -221,6 +221,7 @@
|
||||
background: #f3f3f3;
|
||||
border-radius: 0;
|
||||
width: auto;
|
||||
border: 1px solid transparent;
|
||||
|
||||
&:hover {
|
||||
background: #f3f3f3;
|
||||
@@ -238,9 +239,6 @@
|
||||
}
|
||||
|
||||
&-footer {
|
||||
padding: 0 16px;
|
||||
height: 38px;
|
||||
line-height: 38px;
|
||||
border-top: 1px solid @border-color-split;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
background: #fff;
|
||||
background: @component-background;
|
||||
z-index: 10;
|
||||
position: absolute;
|
||||
outline: none;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
top: 1px;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
background: #fff;
|
||||
background: @component-background;
|
||||
z-index: 10;
|
||||
position: absolute;
|
||||
outline: none;
|
||||
|
||||
@@ -32,14 +32,20 @@
|
||||
display: inline-block;
|
||||
outline: none;
|
||||
font-size: @font-size-base;
|
||||
transition: opacity 0.3s ease;
|
||||
transition: opacity 0.3s;
|
||||
|
||||
> input {
|
||||
&-input {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
&:hover &-input {
|
||||
border-color: @primary-color;
|
||||
}
|
||||
|
||||
&-clear {
|
||||
opacity: 0;
|
||||
z-index: -1;
|
||||
pointer-events: none;
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
right: 7px;
|
||||
background: #fff;
|
||||
@@ -51,7 +57,7 @@
|
||||
margin-top: -7px;
|
||||
line-height: 14px;
|
||||
cursor: pointer;
|
||||
transition: color 0.3s ease, opacity 0.15s ease;
|
||||
transition: color 0.3s, opacity 0.3s;
|
||||
&:hover {
|
||||
color: @text-color-secondary;
|
||||
}
|
||||
@@ -59,12 +65,13 @@
|
||||
|
||||
&:hover &-clear {
|
||||
opacity: 1;
|
||||
z-index: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
&-icon {
|
||||
position: absolute;
|
||||
user-select: none;
|
||||
transition: all .3s @ease-in-out;
|
||||
transition: all .3s;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
line-height: 12px;
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
@input-box-height: 34px;
|
||||
|
||||
.@{calendar-prefix-cls}-range-picker.@{ant-prefix}-input {
|
||||
padding-right: 26px;
|
||||
}
|
||||
|
||||
.@{calendar-prefix-cls}-range-picker-input {
|
||||
background-color: transparent;
|
||||
border: 0;
|
||||
@@ -44,7 +40,7 @@
|
||||
float: left;
|
||||
.@{calendar-prefix-cls} {
|
||||
&-time-picker-inner {
|
||||
border-right: 1px solid @border-color-split;
|
||||
border-right: 2px solid @border-color-split;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,8 +49,7 @@
|
||||
float: right;
|
||||
.@{calendar-prefix-cls} {
|
||||
&-time-picker-inner {
|
||||
margin-left: 3%;
|
||||
border-left: 1px solid @border-color-split;
|
||||
border-left: 2px solid @border-color-split;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,6 +143,21 @@
|
||||
|
||||
&-bottom {
|
||||
text-align: right;
|
||||
|
||||
.@{calendar-prefix-cls}-footer-btn {
|
||||
padding-right: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
div&-quick-selector {
|
||||
display: block;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid @border-color-split;
|
||||
padding: 10.5px 10px;
|
||||
|
||||
> a {
|
||||
margin-right: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.@{calendar-prefix-cls},
|
||||
@@ -164,7 +174,7 @@
|
||||
&.@{calendar-prefix-cls}-time {
|
||||
.@{calendar-timepicker-prefix-cls} {
|
||||
height: 207px;
|
||||
width: 97%;
|
||||
width: 100%;
|
||||
top: 68px;
|
||||
z-index: 2; // cover .ant-calendar-range .ant-calendar-in-range-cell > div (z-index: 1)
|
||||
&-panel {
|
||||
@@ -174,23 +184,25 @@
|
||||
|
||||
&-inner {
|
||||
padding-top: 34px;
|
||||
height: 241px;
|
||||
height: 100%;
|
||||
background: none;
|
||||
}
|
||||
|
||||
&-combobox {
|
||||
display: inline-block;
|
||||
height: 100%;
|
||||
background-color: white;
|
||||
border-top: 1px solid @border-color-split;
|
||||
}
|
||||
&-select {
|
||||
height: 100%;
|
||||
ul {
|
||||
max-height: 206px;
|
||||
max-height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
.@{calendar-prefix-cls}-footer-btn {
|
||||
padding-right: 12px;
|
||||
padding: 9px 12px 9px 0;
|
||||
display: block;
|
||||
.clearfix;
|
||||
}
|
||||
@@ -207,10 +219,17 @@
|
||||
line-height: 22px;
|
||||
}
|
||||
}
|
||||
|
||||
&-with-ranges.@{calendar-prefix-cls}-time .@{calendar-timepicker-prefix-cls} {
|
||||
height: 247px;
|
||||
&-panel {
|
||||
height: 281px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.@{calendar-prefix-cls}-range.@{calendar-prefix-cls}-show-time-picker {
|
||||
.@{calendar-prefix-cls}-body {
|
||||
border-top-color: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
top: 34px;
|
||||
background-color: #fff;
|
||||
background-color: @component-background;
|
||||
height: 206px;
|
||||
|
||||
&-panel {
|
||||
@@ -18,7 +18,7 @@
|
||||
list-style: none;
|
||||
font-size: @font-size-base;
|
||||
text-align: left;
|
||||
background-color: #fff;
|
||||
background-color: @component-background;
|
||||
background-clip: padding-box;
|
||||
line-height: 1.5;
|
||||
overflow: hidden;
|
||||
@@ -129,13 +129,13 @@
|
||||
|
||||
.@{calendar-prefix-cls}-footer {
|
||||
border-top: 1px solid @border-color-split;
|
||||
padding: 10px 0;
|
||||
text-align: right;
|
||||
position: relative;
|
||||
height: auto;
|
||||
line-height: auto;
|
||||
|
||||
&-btn {
|
||||
padding: 10px 0;
|
||||
line-height: 1.5;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
top: 1px;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
background: #fff;
|
||||
background: @component-background;
|
||||
z-index: 10;
|
||||
position: absolute;
|
||||
outline: none;
|
||||
|
||||
@@ -22,6 +22,10 @@ function getColumns({ showHour, showMinute, showSecond }) {
|
||||
|
||||
export default function wrapPicker(Picker, defaultFormat?) {
|
||||
const PickerWrapper = React.createClass({
|
||||
contextTypes: {
|
||||
antLocale: PropTypes.object,
|
||||
},
|
||||
|
||||
getDefaultProps() {
|
||||
return {
|
||||
format: defaultFormat || 'YYYY-MM-DD',
|
||||
@@ -42,10 +46,6 @@ export default function wrapPicker(Picker, defaultFormat?) {
|
||||
};
|
||||
},
|
||||
|
||||
contextTypes: {
|
||||
antLocale: PropTypes.object,
|
||||
},
|
||||
|
||||
handleOpenChange(open) {
|
||||
const { onOpenChange, toggleOpen } = this.props;
|
||||
onOpenChange(open);
|
||||
@@ -54,7 +54,7 @@ export default function wrapPicker(Picker, defaultFormat?) {
|
||||
warning(
|
||||
false,
|
||||
'`toggleOpen` is deprecated and will be removed in the future, ' +
|
||||
'please use `onOpenChange` instead'
|
||||
'please use `onOpenChange` instead, see: http://u.ant.design/date-picker-on-open-change'
|
||||
);
|
||||
toggleOpen({open});
|
||||
}
|
||||
@@ -67,7 +67,7 @@ export default function wrapPicker(Picker, defaultFormat?) {
|
||||
[`${prefixCls}-picker`]: true,
|
||||
});
|
||||
const pickerInputClass = classNames({
|
||||
[`${prefixCls}-range-picker`]: true,
|
||||
[`${prefixCls}-picker-input`]: true,
|
||||
[inputPrefixCls]: true,
|
||||
[`${inputPrefixCls}-lg`]: props.size === 'large',
|
||||
[`${inputPrefixCls}-sm`]: props.size === 'small',
|
||||
|
||||
@@ -16,6 +16,7 @@ export interface DropdownButtonProps {
|
||||
onVisibleChange?: (visible: boolean) => void;
|
||||
style?: React.CSSProperties;
|
||||
prefixCls?: string;
|
||||
children: any;
|
||||
}
|
||||
|
||||
export default class DropdownButton extends React.Component<DropdownButtonProps, any> {
|
||||
@@ -38,21 +39,23 @@ export default class DropdownButton extends React.Component<DropdownButtonProps,
|
||||
disabled, visible, onVisibleChange }, restProps] = splitObject(this.props,
|
||||
['type', 'overlay', 'trigger', 'align', 'children', 'className', 'onClick',
|
||||
'prefixCls', 'disabled', 'visible', 'onVisibleChange']);
|
||||
const cls = classNames({
|
||||
[prefixCls]: true,
|
||||
[className]: !!className,
|
||||
});
|
||||
const cls = classNames(prefixCls, className);
|
||||
|
||||
const dropdownProps = {
|
||||
align,
|
||||
overlay,
|
||||
trigger: disabled ? [] : trigger,
|
||||
onVisibleChange,
|
||||
};
|
||||
|
||||
if ('visible' in this.props) {
|
||||
(dropdownProps as any).visible = visible;
|
||||
}
|
||||
|
||||
return (
|
||||
<ButtonGroup {...restProps} className={cls}>
|
||||
<Button type={type} onClick={onClick} disabled={disabled}>{children}</Button>
|
||||
<Dropdown
|
||||
align={align}
|
||||
overlay={overlay}
|
||||
trigger={disabled ? [] : trigger}
|
||||
visible={visible}
|
||||
onVisibleChange={onVisibleChange}
|
||||
>
|
||||
<Dropdown {...dropdownProps}>
|
||||
<Button type={type} disabled={disabled}>
|
||||
<Icon type="down" />
|
||||
</Button>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from 'react';
|
||||
import React, { cloneElement } from 'react';
|
||||
import RcDropdown from 'rc-dropdown';
|
||||
import classNames from 'classnames';
|
||||
|
||||
export interface DropDownProps {
|
||||
trigger?: Array<'click' | 'hover'>;
|
||||
@@ -9,6 +10,7 @@ export interface DropDownProps {
|
||||
visible?: boolean;
|
||||
align?: Object;
|
||||
getPopupContainer?: () => HTMLElement;
|
||||
prefixCls?: string;
|
||||
}
|
||||
|
||||
export default class Dropdown extends React.Component<DropDownProps, any> {
|
||||
@@ -21,6 +23,14 @@ export default class Dropdown extends React.Component<DropDownProps, any> {
|
||||
};
|
||||
|
||||
render() {
|
||||
return <RcDropdown {...this.props} />;
|
||||
const { children, prefixCls } = this.props;
|
||||
const dropdownTrigger = cloneElement(children as any, {
|
||||
className: classNames((children as any).props.className, `${prefixCls}-trigger`),
|
||||
});
|
||||
return (
|
||||
<RcDropdown {...this.props}>
|
||||
{dropdownTrigger}
|
||||
</RcDropdown>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ You can get the menu list by `antd.Menu`, and set a callback function `onSelect`
|
||||
|--------------|----------------|----------|--------------|
|
||||
| type | type of the button, the same as [Button](/components/button) | String | 'default' |
|
||||
| onClick | a callback function, the same as [Button](/components/button), which will be executed when you click the button on the left | Function | - |
|
||||
| trigger | the trigger mode which can excute the drop-down action | ['click'] or ['hover'] | ['hover'] |
|
||||
| trigger | the trigger mode which can execute the drop-down action | ['click'] or ['hover'] | ['hover'] |
|
||||
| overlay | the dropdown menu | [Menu](/components/menu) | - |
|
||||
| visible | determine whether the dropdown menu is visible | Boolean | - |
|
||||
| onVisibleChange | a callback function takes an argument: `visible`, can be executed when the visible state is changing | Function | - |
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
position: relative;
|
||||
|
||||
.@{ant-prefix}-btn > .@{iconfont-css-prefix}-down {
|
||||
.iconfont-size-under-12px(9px);
|
||||
.iconfont-size-under-12px(10px);
|
||||
}
|
||||
|
||||
.@{iconfont-css-prefix}-down:before {
|
||||
@@ -43,7 +43,7 @@
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
text-align: left;
|
||||
background-color: #fff;
|
||||
background-color: @component-background;
|
||||
border-radius: @border-radius-base;
|
||||
box-shadow: @box-shadow-base;
|
||||
background-clip: padding-box;
|
||||
@@ -78,7 +78,7 @@
|
||||
|
||||
&:hover {
|
||||
color: #ccc;
|
||||
background-color: #fff;
|
||||
background-color: @component-background;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@
|
||||
content: "\e61f";
|
||||
right: 16px;
|
||||
color: @text-color-secondary;
|
||||
.iconfont-size-under-12px(9px);
|
||||
.iconfont-size-under-12px(10px);
|
||||
}
|
||||
|
||||
&-submenu-vertical {
|
||||
@@ -153,10 +153,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
.@{dropdown-prefix-cls}-trigger,
|
||||
.@{dropdown-prefix-cls}-link {
|
||||
font-size: @font-size-base;
|
||||
.@{iconfont-css-prefix}-down {
|
||||
.iconfont-size-under-12px(9px);
|
||||
.iconfont-size-under-12px(10px);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,10 +166,6 @@
|
||||
padding-right: 7px;
|
||||
}
|
||||
.@{iconfont-css-prefix}-down {
|
||||
.iconfont-size-under-12px(9px);
|
||||
.iconfont-size-under-12px(10px);
|
||||
}
|
||||
}
|
||||
|
||||
.ant-btn .anticon-down {
|
||||
.iconfont-size-under-12px(9px);
|
||||
}
|
||||
|
||||
@@ -126,7 +126,8 @@ export default class Form extends React.Component<FormProps, any> {
|
||||
deprecatedGetFieldProps(name, option) {
|
||||
warning(
|
||||
false,
|
||||
'`getFieldProps` is not recommended, please use `getFieldDecorator` instead'
|
||||
'`getFieldProps` is not recommended, please use `getFieldDecorator` instead, ' +
|
||||
'see: http://u.ant.design/get-field-decorator'
|
||||
);
|
||||
return this.__getFieldProps(name, option);
|
||||
},
|
||||
@@ -154,13 +155,11 @@ export default class Form extends React.Component<FormProps, any> {
|
||||
|
||||
render() {
|
||||
const { prefixCls, className = '', inline, horizontal, vertical } = this.props;
|
||||
const formClassName = classNames({
|
||||
[`${prefixCls}`]: true,
|
||||
const formClassName = classNames(prefixCls, {
|
||||
[`${prefixCls}-horizontal`]: horizontal,
|
||||
[`${prefixCls}-vertical`]: vertical,
|
||||
[`${prefixCls}-inline`]: inline,
|
||||
[className]: !!className,
|
||||
});
|
||||
}, className);
|
||||
|
||||
const formProps = omit(this.props, [
|
||||
'prefixCls',
|
||||
|
||||
@@ -136,7 +136,7 @@ export default class FormItem extends React.Component<FormItemProps, any> {
|
||||
renderExtra() {
|
||||
const { prefixCls, extra } = this.props;
|
||||
return extra ? (
|
||||
<span className={`${prefixCls}-extra`}>{extra}</span>
|
||||
<div className={`${prefixCls}-extra`}>{extra}</div>
|
||||
) : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,44 +19,70 @@ Customized or third-party form controls can be used in Form, too. Controls must
|
||||
|
||||
|
||||
````jsx
|
||||
import { Form, Input, Button } from 'antd';
|
||||
import { Form, Input, Select, Button } from 'antd';
|
||||
const FormItem = Form.Item;
|
||||
const Option = Select.Option;
|
||||
|
||||
const CustomizedInputNumber = React.createClass({
|
||||
const PriceInput = React.createClass({
|
||||
getInitialState() {
|
||||
const value = this.props.value || {};
|
||||
return {
|
||||
value: this.props.value || 0,
|
||||
number: value.number || 0,
|
||||
currency: value.currency || 'rmb',
|
||||
};
|
||||
},
|
||||
componentWillReceiveProps(nextProps) {
|
||||
// Should be a controlled component.
|
||||
if ('value' in nextProps) {
|
||||
const value = nextProps.value;
|
||||
this.setState({ value });
|
||||
this.setState(value);
|
||||
}
|
||||
},
|
||||
handleChange(e) {
|
||||
const number = parseFloat(e.target.value || 0);
|
||||
handleNumberChange(e) {
|
||||
const number = parseInt(e.target.value || 0, 10);
|
||||
if (isNaN(number)) {
|
||||
return;
|
||||
}
|
||||
if (!('value' in this.props)) {
|
||||
this.setState({ value: number });
|
||||
this.setState({ number });
|
||||
}
|
||||
this.triggerChange({ number });
|
||||
},
|
||||
handleCurrencyChange(currency) {
|
||||
if (!('value' in this.props)) {
|
||||
this.setState({ currency });
|
||||
}
|
||||
this.triggerChange({ currency });
|
||||
},
|
||||
triggerChange(changedValue) {
|
||||
// Should provide an event to pass value to Form.
|
||||
const onChange = this.props.onChange;
|
||||
if (onChange) {
|
||||
onChange(number);
|
||||
onChange(Object.assign({}, this.state, changedValue));
|
||||
}
|
||||
},
|
||||
render() {
|
||||
const { size } = this.props;
|
||||
const state = this.state;
|
||||
return (
|
||||
<Input
|
||||
type="text"
|
||||
size={this.props.size}
|
||||
value={this.state.value}
|
||||
onChange={this.handleChange}
|
||||
/>
|
||||
<span>
|
||||
<Input
|
||||
type="text"
|
||||
size={size}
|
||||
value={state.number}
|
||||
onChange={this.handleNumberChange}
|
||||
style={{ width: '65%', marginRight: '3%' }}
|
||||
/>
|
||||
<Select
|
||||
value={state.currency}
|
||||
size={size}
|
||||
style={{ width: '32%' }}
|
||||
onChange={this.handleCurrencyChange}
|
||||
>
|
||||
<Option value="rmb">RMB</Option>
|
||||
<Option value="dollar">Dollar</Option>
|
||||
</Select>
|
||||
</span>
|
||||
);
|
||||
},
|
||||
});
|
||||
@@ -70,14 +96,22 @@ const Demo = Form.create()(React.createClass({
|
||||
}
|
||||
});
|
||||
},
|
||||
checkPrice(rule, value, callback) {
|
||||
if (value.number > 0) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
callback('Price must greater than zero!');
|
||||
},
|
||||
render() {
|
||||
const { getFieldDecorator } = this.props.form;
|
||||
return (
|
||||
<Form inline onSubmit={this.handleSubmit}>
|
||||
<FormItem label="Number Only">
|
||||
{getFieldDecorator('number', {
|
||||
rules: [{ type: 'number' }],
|
||||
})(<CustomizedInputNumber />)}
|
||||
<FormItem label="Price">
|
||||
{getFieldDecorator('price', {
|
||||
initialValue: { number: 0, currency: 'rmb' },
|
||||
rules: [{ validator: this.checkPrice }],
|
||||
})(<PriceInput />)}
|
||||
</FormItem>
|
||||
<FormItem>
|
||||
<Button type="primary" htmlType="submit">Submit</Button>
|
||||
|
||||
@@ -80,10 +80,10 @@ class DynamicFieldSet extends React.Component {
|
||||
message: "Please input passenger's name or delete this field.",
|
||||
}],
|
||||
})(
|
||||
<Input style={{ width: '60%', marginRight: 8 }} />
|
||||
<Input placeholder="passenger name" style={{ width: '60%', marginRight: 8 }} />
|
||||
)}
|
||||
<Icon
|
||||
className="delete-button"
|
||||
className="dynamic-delete-button"
|
||||
type="minus-circle-o"
|
||||
disabled={keys.length === 1}
|
||||
onClick={() => this.remove(k)}
|
||||
@@ -109,14 +109,19 @@ ReactDOM.render(<WrappedDynamicFieldSet />, mountNode);
|
||||
````
|
||||
|
||||
````css
|
||||
#components-form-demo-dynamic-form-item .delete-button {
|
||||
.dynamic-delete-button {
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
top: 4px;
|
||||
font-size: 24px;
|
||||
color: #999;
|
||||
transition: all .3s;
|
||||
}
|
||||
#components-form-demo-dynamic-form-item .delete-button[disabled] {
|
||||
.dynamic-delete-button:hover {
|
||||
color: #777;
|
||||
}
|
||||
.dynamic-delete-button[disabled] {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.5;
|
||||
}
|
||||
````
|
||||
|
||||
@@ -183,6 +183,7 @@ const RegistrationForm = Form.create()(React.createClass({
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="Captcha"
|
||||
extra="We must make sure that your are a human."
|
||||
>
|
||||
<Row gutter={8}>
|
||||
<Col span={12}>
|
||||
|
||||
@@ -114,6 +114,19 @@ const Demo = Form.create()(React.createClass({
|
||||
label="Radio.Group"
|
||||
>
|
||||
{getFieldDecorator('radio-group')(
|
||||
<RadioGroup>
|
||||
<Radio value="a">item 1</Radio>
|
||||
<Radio value="b">item 2</Radio>
|
||||
<Radio value="c">item 3</Radio>
|
||||
</RadioGroup>
|
||||
)}
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="Radio.Button"
|
||||
>
|
||||
{getFieldDecorator('radio-button')(
|
||||
<RadioGroup>
|
||||
<RadioButton value="a">item 1</RadioButton>
|
||||
<RadioButton value="b">item 2</RadioButton>
|
||||
|
||||
@@ -53,14 +53,14 @@ CustomizedForm = Form.create({})(CustomizedForm);
|
||||
|
||||
The following `options` are available:
|
||||
|
||||
| Property | Description | Type |
|
||||
| Property | Description | Type |
|
||||
|-----------|------------------------------------------|------------|
|
||||
| onFieldsChange | Specify a function that will be called when the value a `Form.Item` gets changed. Usage example: saving the field's value to Redux store. | Function(props, fields) |
|
||||
| mapPropsToFields | Convert props to corresponding field value. Usage example: reading the values from Redux store. | Function(props): Object{ fieldName: Object{ value } } |
|
||||
|
||||
If the form has been decorated by `Form.create` then it has `this.props.form` property. `this.props.form` provides some APIs as follows:
|
||||
|
||||
| Property | Description | Type |
|
||||
| Property | Description | Type |
|
||||
|-----------|------------------------------------------|------------|
|
||||
| getFieldsValue | Get the specified fields' values. If you don't specify a parameter, you will get all fields' values. | Function([fieldNames: string[]]) |
|
||||
| getFieldValue | Get the value of a field. | Function(fieldName: string) |
|
||||
@@ -79,7 +79,7 @@ After wrapped by `getFieldDecorator`, `value`(or other property defined by `valu
|
||||
|
||||
1. You don't need to use `onChange` to collect data, but you still can listen to `onChange`(and so on) events.
|
||||
2. You can not set value of form control via `value` `defaultValue` prop, and you should set default value with `initialValue` in `getFieldDecorator` instead.
|
||||
3. You don't need to call `setState` manully, please use `this.props.form.setFieldsValue` to change value programmatically.
|
||||
3. You don't need to call `setState` manually, please use `this.props.form.setFieldsValue` to change value programmatically.
|
||||
|
||||
#### Special attention
|
||||
|
||||
@@ -87,8 +87,8 @@ If you use `react@<15.3.0`, then, you can't use `getFieldDecorator` in stateless
|
||||
|
||||
#### getFieldDecorator's parameters
|
||||
|
||||
| Property | Description | Type | Default Value |
|
||||
|-----------|-----------------------------------------|-----|--------|
|
||||
| Property | Description | Type | Default Value |
|
||||
|-----------|-----------------------------------------|------|---------------|
|
||||
| options.id | The unique identifier is required. | string | |
|
||||
| options.valuePropName | Props of children node, for example, the prop of Switch is 'checked'. | string | 'value' |
|
||||
| options.initialValue | You can specify initial value, type, optional value of children node. | | n/a |
|
||||
@@ -104,16 +104,16 @@ Note:
|
||||
* If Form.Item has multiple children that had been decorated by `getFieldDecorator`, `help` and `required` and `validateStatus` can't be generated automatically.
|
||||
* Before `2.2.0`, form controls must be child of Form.Item, otherwise, you need to set `help`, `required` and `validateStatus` by yourself.
|
||||
|
||||
| Property | Description | Type | Optional | Default Value |
|
||||
|-----------|------------------------------------------|-----------|-------|--------|
|
||||
| label | Label text | string | | |
|
||||
| labelCol | The layout of label. You can set `span` `offset` to something like `{span: 3, offset: 12}` same as with `<Col>` | object | | |
|
||||
| wrapperCol | The layout for input controls. Same as `labelCol` | object | | |
|
||||
| help | The prompt message. If not provided, the prompt message will be generated by the validation rule. | string | | |
|
||||
| extra | The extra prompt message. It is similar to help. Usage example: to display error message and prompt message at the same time. | string | | |
|
||||
| required | Whether provided or not, it will be generated by the validation rule. | bool | | false |
|
||||
| validateStatus | The validation status. If not provided, it will be generated by validation rule | string | 'success' 'warning' 'error' 'validating' | |
|
||||
| hasFeedback | Used with `validateStatus`, this option specifies the validation status icon. Recommended to be used only with `Input`. | bool | | false |
|
||||
| Property | Description | Type | Default Value |
|
||||
|---------------|--------------------------------------|--------|---------------|
|
||||
| label | Label text | string | |
|
||||
| labelCol | The layout of label. You can set `span` `offset` to something like `{span: 3, offset: 12}` same as with `<Col>` | object | |
|
||||
| wrapperCol | The layout for input controls. Same as `labelCol` | object | |
|
||||
| help | The prompt message. If not provided, the prompt message will be generated by the validation rule. | string | |
|
||||
| extra | The extra prompt message. It is similar to help. Usage example: to display error message and prompt message at the same time. | string | |
|
||||
| required | Whether provided or not, it will be generated by the validation rule. | boolean | false |
|
||||
| validateStatus | The validation status. If not provided, it will be generated by validation rule. options: 'success' 'warning' 'error' 'validating' | string | |
|
||||
| hasFeedback | Used with `validateStatus`, this option specifies the validation status icon. Recommended to be used only with `Input`. | boolean | false |
|
||||
|
||||
<style>
|
||||
.code-box-demo .ant-form-horizontal {
|
||||
|
||||
@@ -106,16 +106,16 @@ CustomizedForm = Form.create({})(CustomizedForm);
|
||||
* 一个 Form.Item 建议只放一个被 getFieldDecorator 装饰过的 child,当有多个被装饰过的 child 时,`help` `required` `validateStatus` 无法自动生成。
|
||||
* `2.2.0` 之前,只有当表单域为 Form.Item 的子元素时,才会自动生成 `help` `required` `validateStatus`,嵌套情况需要自行设置。
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|-----------|------------------------------------------|-----------|-------|--------|
|
||||
| label | label 标签的文本 | string | | |
|
||||
| labelCol | label 标签布局,通 `<Col>` 组件,设置 `span` `offset` 值,如 `{span: 3, offset: 12}` | object | | |
|
||||
| wrapperCol | 需要为输入控件设置布局样式时,使用该属性,用法同 labelCol | object | | |
|
||||
| help | 提示信息,如不设置,则会根据校验规则自动生成 | string | | |
|
||||
| extra | 额外的提示信息,和 help 类似,当需要错误信息和提示文案同时出现时,可以使用这个。 | string | | |
|
||||
| required | 是否必填,如不设置,则会根据校验规则自动生成 | bool | | false |
|
||||
| validateStatus | 校验状态,如不设置,则会根据校验规则自动生成 | string | 'success' 'warning' 'error' 'validating' | |
|
||||
| hasFeedback | 配合 validateStatus 属性使用,展示校验状态图标,建议只配合 Input 组件使用 | bool | | false |
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|-----------|-----------------------------------------|-----------|--------|
|
||||
| label | label 标签的文本 | string | |
|
||||
| labelCol | label 标签布局,通 `<Col>` 组件,设置 `span` `offset` 值,如 `{span: 3, offset: 12}` | object | |
|
||||
| wrapperCol | 需要为输入控件设置布局样式时,使用该属性,用法同 labelCol | object | |
|
||||
| help | 提示信息,如不设置,则会根据校验规则自动生成 | string | |
|
||||
| extra | 额外的提示信息,和 help 类似,当需要错误信息和提示文案同时出现时,可以使用这个。 | string | |
|
||||
| required | 是否必填,如不设置,则会根据校验规则自动生成 | boolean | false |
|
||||
| validateStatus | 校验状态,如不设置,则会根据校验规则自动生成,可选:'success' 'warning' 'error' 'validating' | string | |
|
||||
| hasFeedback | 配合 validateStatus 属性使用,展示校验状态图标,建议只配合 Input 组件使用 | boolean | false |
|
||||
|
||||
<style>
|
||||
.code-box-demo .ant-form-horizontal {
|
||||
|
||||
@@ -252,6 +252,7 @@ form {
|
||||
|
||||
> div {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,6 +290,7 @@ form {
|
||||
top: 0;
|
||||
right: 0;
|
||||
visibility: visible;
|
||||
pointer-events: none;
|
||||
.square(@input-height-lg);
|
||||
line-height: @input-height-lg;
|
||||
text-align: center;
|
||||
@@ -317,11 +319,6 @@ form {
|
||||
}
|
||||
|
||||
.has-success {
|
||||
.@{ant-prefix}-input {
|
||||
border-color: @input-border-color;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
&.has-feedback:after {
|
||||
content: '\e630';
|
||||
color: @success-color;
|
||||
@@ -340,20 +337,18 @@ form {
|
||||
.@{ant-prefix}-select {
|
||||
&-selection {
|
||||
border-color: @warning-color;
|
||||
}
|
||||
&-open .@{ant-prefix}-select-selection,
|
||||
&-focused .@{ant-prefix}-select-selection {
|
||||
.active(@warning-color);
|
||||
}
|
||||
&-arrow {
|
||||
color: @warning-color;
|
||||
}
|
||||
}
|
||||
|
||||
//datepicker
|
||||
.@{ant-prefix}-calendar-picker-icon:after {
|
||||
color: @warning-color;
|
||||
}
|
||||
|
||||
//timepicker
|
||||
.@{ant-prefix}-time-picker-icon:after {
|
||||
// arrow and icon
|
||||
.@{ant-prefix}-calendar-picker-icon:after,
|
||||
.@{ant-prefix}-picker-icon:after,
|
||||
.@{ant-prefix}-select-arrow,
|
||||
.@{ant-prefix}-cascader-picker-arrow {
|
||||
color: @warning-color;
|
||||
}
|
||||
|
||||
@@ -384,23 +379,17 @@ form {
|
||||
&-selection {
|
||||
border-color: @error-color;
|
||||
}
|
||||
|
||||
&-focused &-selection {
|
||||
&-open .@{ant-prefix}-select-selection,
|
||||
&-focused .@{ant-prefix}-select-selection {
|
||||
.active(@error-color);
|
||||
}
|
||||
|
||||
&-arrow {
|
||||
color: @error-color;
|
||||
}
|
||||
}
|
||||
|
||||
//datepicker
|
||||
.@{ant-prefix}-calendar-picker-icon:after {
|
||||
color: @error-color;
|
||||
}
|
||||
|
||||
//timepicker
|
||||
.@{ant-prefix}-picker-icon:after {
|
||||
// arrow and icon
|
||||
.@{ant-prefix}-calendar-picker-icon:after,
|
||||
.@{ant-prefix}-picker-icon:after,
|
||||
.@{ant-prefix}-select-arrow,
|
||||
.@{ant-prefix}-cascader-picker-arrow {
|
||||
color: @error-color;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user