mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 10:59:19 +08:00
Compare commits
446 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
358aa84fef | ||
|
|
6f716d1003 | ||
|
|
739c6ead54 | ||
|
|
a7255ee885 | ||
|
|
06ff0d44db | ||
|
|
e96b0fc768 | ||
|
|
8489fedb4c | ||
|
|
adf98d3c19 | ||
|
|
ba87b45903 | ||
|
|
1e8830637f | ||
|
|
2275195e15 | ||
|
|
dcf9d4c294 | ||
|
|
6f37caefe7 | ||
|
|
51b6e4904a | ||
|
|
378084376a | ||
|
|
57dcc78989 | ||
|
|
179528af50 | ||
|
|
91fc059c9d | ||
|
|
c08e486e1a | ||
|
|
72741db902 | ||
|
|
086ecec310 | ||
|
|
bf70d30a60 | ||
|
|
9a49a5c775 | ||
|
|
539cca5cc4 | ||
|
|
7604495ab4 | ||
|
|
61968b91cf | ||
|
|
892de0c609 | ||
|
|
8e907cebde | ||
|
|
0865824b61 | ||
|
|
6707824611 | ||
|
|
8b2d7e3982 | ||
|
|
58fa1885fd | ||
|
|
669b3c5b2e | ||
|
|
499b81f79d | ||
|
|
1e1baf01f6 | ||
|
|
08d27b92ee | ||
|
|
6db2630e90 | ||
|
|
9dd858cc62 | ||
|
|
814f9a72de | ||
|
|
c37b1e8425 | ||
|
|
9fb590fe9d | ||
|
|
5cca35cab9 | ||
|
|
b3b3ee043e | ||
|
|
32d96e366b | ||
|
|
b77e7ed554 | ||
|
|
46d1296045 | ||
|
|
9a9196ca10 | ||
|
|
11a3ce4cc6 | ||
|
|
9b552087cd | ||
|
|
1117de7c6f | ||
|
|
e0be248847 | ||
|
|
4535800fa3 | ||
|
|
716c49c55f | ||
|
|
645be586f3 | ||
|
|
16133aac65 | ||
|
|
5402dfe66e | ||
|
|
65b5769abd | ||
|
|
cad769af91 | ||
|
|
2ecb52cd7c | ||
|
|
0c7ce9db17 | ||
|
|
c1ce2cd82c | ||
|
|
54188b8e97 | ||
|
|
148e5bd887 | ||
|
|
ea185fe288 | ||
|
|
0eca38ba2f | ||
|
|
b3e1192482 | ||
|
|
d30e398859 | ||
|
|
dd531b8428 | ||
|
|
1b45a2c005 | ||
|
|
9ffd545b24 | ||
|
|
23033cb9c1 | ||
|
|
c168a92f18 | ||
|
|
72aa5e0763 | ||
|
|
10ab3f5187 | ||
|
|
00227e8688 | ||
|
|
198d033e21 | ||
|
|
4790f84657 | ||
|
|
2d17d8a768 | ||
|
|
e5a57ff60a | ||
|
|
b740d86bbf | ||
|
|
ac96bad478 | ||
|
|
6bedfb6a5c | ||
|
|
be38298f8e | ||
|
|
ffe36725d6 | ||
|
|
32b2c21145 | ||
|
|
5fc64a8433 | ||
|
|
de0493d82b | ||
|
|
c00a2aabe2 | ||
|
|
59db56e953 | ||
|
|
43864988e3 | ||
|
|
a5c3a6c930 | ||
|
|
1af37103f3 | ||
|
|
a3610603bf | ||
|
|
bf82b4c49b | ||
|
|
9583bb4c85 | ||
|
|
36df1c5f83 | ||
|
|
cc305209c0 | ||
|
|
3e7ade8d4e | ||
|
|
2075b056f7 | ||
|
|
ace590273a | ||
|
|
7c3a483190 | ||
|
|
f64e24af8c | ||
|
|
4166474d07 | ||
|
|
9bb216ea19 | ||
|
|
dcde9e7b60 | ||
|
|
a666a59eb0 | ||
|
|
8bde0c0fee | ||
|
|
9696739a36 | ||
|
|
c664d843fb | ||
|
|
3c4cc688a1 | ||
|
|
ad9809ec2e | ||
|
|
5660e81541 | ||
|
|
9ecce8d90f | ||
|
|
36227a10db | ||
|
|
caeaba68fc | ||
|
|
f28d0d4d82 | ||
|
|
6d68d5d8fc | ||
|
|
a22bcec4e7 | ||
|
|
fe19a9b124 | ||
|
|
990d9c6192 | ||
|
|
7d26fb10e0 | ||
|
|
2a92b7a9fa | ||
|
|
ea926fecaf | ||
|
|
0bc5936b23 | ||
|
|
4a3602b536 | ||
|
|
3c1b4da51e | ||
|
|
f03af93b86 | ||
|
|
d829f6c008 | ||
|
|
ff5d05129f | ||
|
|
1599686fc2 | ||
|
|
65ee579480 | ||
|
|
8e1cb081db | ||
|
|
6d94fa0efe | ||
|
|
4cfb34ee4f | ||
|
|
c9bc8d7095 | ||
|
|
1f57cf4e51 | ||
|
|
12819130ec | ||
|
|
8e09745def | ||
|
|
86da4a95ce | ||
|
|
7286e6d0d0 | ||
|
|
f8b7aad53d | ||
|
|
3d6b142621 | ||
|
|
88ed97b63d | ||
|
|
3bc8f1ce5a | ||
|
|
d64ab68adb | ||
|
|
7bc6aad1fd | ||
|
|
cf397a27f0 | ||
|
|
712637907d | ||
|
|
f33b1a279a | ||
|
|
5017234381 | ||
|
|
e7eb8693b6 | ||
|
|
c2e91d3b22 | ||
|
|
43d8c6ad37 | ||
|
|
7841386fcd | ||
|
|
f26217b36f | ||
|
|
fda3f6ddcd | ||
|
|
2356333c54 | ||
|
|
2a34866e83 | ||
|
|
e6b1ba6a28 | ||
|
|
0a6475cb0d | ||
|
|
d4a5606b92 | ||
|
|
d650c1bf50 | ||
|
|
73c9be2f40 | ||
|
|
43362de756 | ||
|
|
b77cc6392e | ||
|
|
2799b73d21 | ||
|
|
35b2c5e58f | ||
|
|
3c0103f8c5 | ||
|
|
09b1d4ffa0 | ||
|
|
627e94fa5a | ||
|
|
3f54dbd3d2 | ||
|
|
43659752d2 | ||
|
|
2b7a60224b | ||
|
|
5a5bb9c3a0 | ||
|
|
b437233467 | ||
|
|
c3f1d0bba6 | ||
|
|
0d572c72a9 | ||
|
|
712451acf7 | ||
|
|
d4c75d43a1 | ||
|
|
9a5894c46e | ||
|
|
2fb304e270 | ||
|
|
73a4873e78 | ||
|
|
942ea41b02 | ||
|
|
475e4ff23d | ||
|
|
8ccd02139c | ||
|
|
a4a0816e5a | ||
|
|
cf788d7b4d | ||
|
|
95c72958ca | ||
|
|
31d0c3a49d | ||
|
|
cf6dfac206 | ||
|
|
2e2acb5be9 | ||
|
|
873c85cec8 | ||
|
|
eb4659c409 | ||
|
|
ac33baf940 | ||
|
|
40b18343c7 | ||
|
|
88220df0fb | ||
|
|
6d4e531775 | ||
|
|
185b3b1e9a | ||
|
|
76a972e062 | ||
|
|
76a30a7686 | ||
|
|
084d4e6d49 | ||
|
|
1a505e8fb0 | ||
|
|
9ab9e62308 | ||
|
|
819e55e968 | ||
|
|
22860b9e87 | ||
|
|
44da4049f6 | ||
|
|
9dc4102cdd | ||
|
|
47e3cedf86 | ||
|
|
3b6dc3f3c4 | ||
|
|
9b68ce020c | ||
|
|
e17c8e093e | ||
|
|
caec11c03a | ||
|
|
ca255cc547 | ||
|
|
4acadc47b5 | ||
|
|
d7eca4e151 | ||
|
|
a8cab96c13 | ||
|
|
4e726fdfd7 | ||
|
|
9f017bc5ae | ||
|
|
ccf507b603 | ||
|
|
f545e52ec5 | ||
|
|
8026020dd4 | ||
|
|
463a5db9ba | ||
|
|
10f6907da4 | ||
|
|
3118e2898e | ||
|
|
6c38ca62c6 | ||
|
|
14b44c880e | ||
|
|
8bff515287 | ||
|
|
fd40643c2d | ||
|
|
c30c156c56 | ||
|
|
f433382180 | ||
|
|
e672f41e1e | ||
|
|
29c262ab36 | ||
|
|
6ded879619 | ||
|
|
d8c1bdb3ab | ||
|
|
89a6aa96ed | ||
|
|
df1b1f5a47 | ||
|
|
dd22bae0fc | ||
|
|
1dc4e45bce | ||
|
|
8b1a4f80a9 | ||
|
|
91bbcd6f2c | ||
|
|
27b8e39666 | ||
|
|
7cfd9b2bcb | ||
|
|
c66062edb4 | ||
|
|
776beaee05 | ||
|
|
bdecb4ebd9 | ||
|
|
9ec8f66c4d | ||
|
|
c2e9abddc7 | ||
|
|
e8f61f11ef | ||
|
|
c419a1ddef | ||
|
|
81435e2798 | ||
|
|
49080aa01d | ||
|
|
17044043dc | ||
|
|
3d1914f45b | ||
|
|
5d7ef9d889 | ||
|
|
38b889f00c | ||
|
|
27e4f1b658 | ||
|
|
7c8e55f0db | ||
|
|
d21e500fab | ||
|
|
afce275d25 | ||
|
|
39993fc749 | ||
|
|
e165b8a705 | ||
|
|
635a0548de | ||
|
|
30abcdf992 | ||
|
|
0ffccf8b0f | ||
|
|
8904b50720 | ||
|
|
f46a87d3e0 | ||
|
|
5b6b36f5d6 | ||
|
|
58fd54e978 | ||
|
|
acd3a8f4d2 | ||
|
|
ed2303a5da | ||
|
|
b2aea45b4f | ||
|
|
bd19b0892c | ||
|
|
5a8bd0f6d8 | ||
|
|
f3c35941ec | ||
|
|
a3d4b753b9 | ||
|
|
fab83990c2 | ||
|
|
43d14f8517 | ||
|
|
644891f8f6 | ||
|
|
c5f56b9db3 | ||
|
|
b651579c1b | ||
|
|
95245c21a7 | ||
|
|
989b2e2041 | ||
|
|
30c437c83e | ||
|
|
429a9714d5 | ||
|
|
81e3429955 | ||
|
|
05fbdd0959 | ||
|
|
a4637526b9 | ||
|
|
11c0683baa | ||
|
|
eb663f0084 | ||
|
|
fdfb4ba843 | ||
|
|
ea2c113530 | ||
|
|
11a6cd51a2 | ||
|
|
5f938a6818 | ||
|
|
641f1ddeeb | ||
|
|
f36bc02ac3 | ||
|
|
6236641c74 | ||
|
|
250c7a9c68 | ||
|
|
9d2c91598b | ||
|
|
9df6e06d70 | ||
|
|
5ac468167d | ||
|
|
b36df9da2b | ||
|
|
6acf6fc643 | ||
|
|
2437ca419e | ||
|
|
eb62c44564 | ||
|
|
9e319990d2 | ||
|
|
ae87b663bf | ||
|
|
89ce2254af | ||
|
|
77d64971e5 | ||
|
|
461470ebc6 | ||
|
|
9b715f0b90 | ||
|
|
298a60f13b | ||
|
|
f321596e04 | ||
|
|
e57cf5ff80 | ||
|
|
aea18c3627 | ||
|
|
2a4adeef46 | ||
|
|
5bb45279bb | ||
|
|
9f484f9bf0 | ||
|
|
bb2c2036ba | ||
|
|
1cdf0d9141 | ||
|
|
eddd1db3e9 | ||
|
|
c2031f701c | ||
|
|
8369557322 | ||
|
|
33a71eb8fb | ||
|
|
a5b20dcb82 | ||
|
|
ed84626f01 | ||
|
|
aa3458deb6 | ||
|
|
b381f1f5ec | ||
|
|
643b32d0d3 | ||
|
|
d5b6cc70cd | ||
|
|
b475ac55f6 | ||
|
|
594dce8f87 | ||
|
|
ac95d1aea4 | ||
|
|
d490a027bb | ||
|
|
66a89df91f | ||
|
|
b216a44b28 | ||
|
|
37c8c4ed30 | ||
|
|
35fc427630 | ||
|
|
2feef3358c | ||
|
|
dbc4e684df | ||
|
|
e77108c775 | ||
|
|
fb8fec6d3a | ||
|
|
30745da52e | ||
|
|
a2eb54b1ae | ||
|
|
e1efb82dcb | ||
|
|
421feb1c84 | ||
|
|
fa1547df84 | ||
|
|
224e65fc27 | ||
|
|
1746e1f0d7 | ||
|
|
0a583afc5c | ||
|
|
072d860f8a | ||
|
|
ace985afce | ||
|
|
b8f6185abc | ||
|
|
c7d6ce5d3f | ||
|
|
bceed31da4 | ||
|
|
94283b730f | ||
|
|
16b2cc044e | ||
|
|
7d619dfbd7 | ||
|
|
121898001d | ||
|
|
e9a592a9c8 | ||
|
|
786f5cd7e0 | ||
|
|
696b4252a8 | ||
|
|
59193ef34a | ||
|
|
a73d0504ca | ||
|
|
9667ec17bd | ||
|
|
f48cf1df90 | ||
|
|
112aaed5fb | ||
|
|
8cc1943b77 | ||
|
|
cb1e0bfe8e | ||
|
|
6654a4220d | ||
|
|
8551b706cf | ||
|
|
ec2322a906 | ||
|
|
5510d12ce8 | ||
|
|
8271b5d069 | ||
|
|
c651c7a04f | ||
|
|
6cb3ae46a2 | ||
|
|
24e2af63f2 | ||
|
|
99a998afb5 | ||
|
|
319fa7c82d | ||
|
|
35229e55b1 | ||
|
|
156c933235 | ||
|
|
471da70c1e | ||
|
|
9423609243 | ||
|
|
07dfac18f7 | ||
|
|
7b56d7248f | ||
|
|
668cec2f9e | ||
|
|
1547b889b7 | ||
|
|
bac4d04844 | ||
|
|
ad3e49e397 | ||
|
|
882ae31199 | ||
|
|
6954c3506c | ||
|
|
a204c0afa2 | ||
|
|
bedfb180a8 | ||
|
|
81f16cb2e0 | ||
|
|
d8aef384d3 | ||
|
|
a3e723648b | ||
|
|
dc1d0af64e | ||
|
|
a0a1bff7fe | ||
|
|
843d82f6bd | ||
|
|
90c1dfc5c0 | ||
|
|
9547fe5bc4 | ||
|
|
81048aafb2 | ||
|
|
96dd7132e8 | ||
|
|
56b6fc38d7 | ||
|
|
3ceda311b6 | ||
|
|
7fed87f835 | ||
|
|
6c509f9712 | ||
|
|
c23afb05d0 | ||
|
|
fe09eec9aa | ||
|
|
2bedd6b0e6 | ||
|
|
a5733f5de3 | ||
|
|
3b6ea67115 | ||
|
|
fc8f533e67 | ||
|
|
a5b0848efe | ||
|
|
bc3a285e64 | ||
|
|
1e48ec0c6a | ||
|
|
eb21c93d3d | ||
|
|
62cbe9e064 | ||
|
|
a7200c906c | ||
|
|
7e2d456453 | ||
|
|
ef8beaffde | ||
|
|
fc884242d8 | ||
|
|
d4171badfd | ||
|
|
e0bf1cefe7 | ||
|
|
7d8c7d72b7 | ||
|
|
7d49cc18a9 | ||
|
|
e633f91c27 | ||
|
|
b69a6886d7 | ||
|
|
94d46e4c01 | ||
|
|
e4c5ab9c69 | ||
|
|
456cea652b | ||
|
|
3727ea2c33 | ||
|
|
a9430e6748 | ||
|
|
e8ef77b963 | ||
|
|
d21523ef8c | ||
|
|
75a6a562a0 | ||
|
|
40e94945d9 | ||
|
|
8016cccd18 | ||
|
|
fa0e90f577 | ||
|
|
528a7645ca | ||
|
|
a5a1458148 | ||
|
|
8f1dd9ccda | ||
|
|
ee176347ac | ||
|
|
f7b918add3 | ||
|
|
c712d072eb | ||
|
|
f2b987aaa9 | ||
|
|
f5ade936e1 |
@@ -30,6 +30,7 @@ const eslintrc = {
|
||||
'import/extensions': 0,
|
||||
'import/no-unresolved': 0,
|
||||
'import/no-extraneous-dependencies': 0,
|
||||
'prefer-destructuring': 0,
|
||||
'no-param-reassign': 0,
|
||||
'no-return-assign': 0,
|
||||
'max-len': 0,
|
||||
@@ -38,8 +39,13 @@ const eslintrc = {
|
||||
'react/require-extension': 0,
|
||||
'jsx-a11y/no-static-element-interactions': 0,
|
||||
'jsx-a11y/anchor-has-content': 0,
|
||||
'jsx-a11y/click-events-have-key-events': 0,
|
||||
'jsx-a11y/anchor-is-valid': 0,
|
||||
'react/no-danger': 0,
|
||||
'comma-dangle': ['error', 'always-multiline'],
|
||||
'function-paren-newline': 0,
|
||||
'object-curly-newline': 0,
|
||||
'no-restricted-globals': 0,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -51,6 +57,7 @@ if (process.env.RUN_ENV === 'DEMO') {
|
||||
};
|
||||
|
||||
Object.assign(eslintrc.rules, {
|
||||
indent: 0,
|
||||
'no-console': 0,
|
||||
'no-plusplus': 0,
|
||||
'eol-last': 0,
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -32,6 +32,7 @@ config/base.yaml
|
||||
/.vscode/
|
||||
/coverage
|
||||
yarn.lock
|
||||
package-lock.json
|
||||
components/**/*.js
|
||||
components/**/*.jsx
|
||||
!components/**/__tests__/*.js
|
||||
|
||||
21
.travis.yml
21
.travis.yml
@@ -3,13 +3,14 @@ sudo: false
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "6"
|
||||
- 8
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- TEST_TYPE=lint
|
||||
- TEST_TYPE=dist
|
||||
- TEST_TYPE=compile
|
||||
- TEST_TYPE=test:dist
|
||||
- TEST_TYPE=test:lib
|
||||
- TEST_TYPE=test:es
|
||||
- TEST_TYPE=test:dom
|
||||
- TEST_TYPE=test:node
|
||||
|
||||
@@ -17,18 +18,18 @@ script:
|
||||
- |
|
||||
if [ "$TEST_TYPE" = lint ]; then
|
||||
npm run lint
|
||||
elif [ "$TEST_TYPE" = dist ]; then
|
||||
elif [ "$TEST_TYPE" = test:dist ]; then
|
||||
npm run dist && \
|
||||
node ./tests/dekko/dist.test.js && \
|
||||
LIB_DIR=dist npm test -- --coverage -w 2
|
||||
elif [ "$TEST_TYPE" = compile ]; then
|
||||
npm run dist && \
|
||||
LIB_DIR=dist npm test -- -w 2
|
||||
elif [ "$TEST_TYPE" = test:lib ]; then
|
||||
npm run compile && \
|
||||
node ./tests/dekko/lib.test.js && \
|
||||
LIB_DIR=es npm test -- --coverage -w 2 && \
|
||||
LIB_DIR=lib npm test -- --coverage -w 2
|
||||
LIB_DIR=lib npm test -- -w 2
|
||||
elif [ "$TEST_TYPE" = test:es ]; then
|
||||
npm run compile && \
|
||||
LIB_DIR=es npm test -- -w 2
|
||||
elif [ "$TEST_TYPE" = test:dom ]; then
|
||||
npm run dist && \
|
||||
npm test -- --coverage -w 2 && \
|
||||
bash <(curl -s https://codecov.io/bash)
|
||||
elif [ "$TEST_TYPE" = test:node ]; then
|
||||
|
||||
@@ -141,6 +141,7 @@ Tino D <ginodeis@gmail.com>
|
||||
Tyler <chaotyler@gmail.com>
|
||||
Vadim Macagon <vadim.macagon@gmail.com>
|
||||
Valentin Vichnal <valentin@vichnal.com>
|
||||
Vemund Santi <veund@santi.no>
|
||||
Vincent Zhang <vxzhong@qq.com>
|
||||
Walter Barbagallo <turbometalskater@gmail.com>
|
||||
Warren Seymour <warren@fountainhead.tech>
|
||||
|
||||
@@ -17,6 +17,190 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi
|
||||
|
||||
---
|
||||
|
||||
## 2.13.12
|
||||
|
||||
`2018-02-26`
|
||||
|
||||
- 🐞 Fix issue resulting in SubMenu can not been shown correctly when `defaultOpenKeys` includes nonexistent key. [#8475](https://github.com/ant-design/ant-design/issues/8475)
|
||||
- 🐞 Fix issue resulting in DatePicker's value can not been controlled correctly. [#8885](https://github.com/ant-design/ant-design/issues/8885)
|
||||
|
||||
## 2.13.11
|
||||
|
||||
`2017-12-01`
|
||||
|
||||
- 📝 Improve support of TypeScript. [#8394](https://github.com/ant-design/ant-design/pull/8394) [#8395](https://github.com/ant-design/ant-design/pull/8395) [@burdell](https://github.com/burdell) [@khayalan-mathew](https://github.com/khayalan-mathew)
|
||||
- 🐞 Fixed Tooltip missing `defaultVisible` property. [#8257](https://github.com/ant-design/ant-design/issues/8257)
|
||||
- 🐞 Fixed Modal `footer` property is overwrited when customing this property. [#8379](https://github.com/ant-design/ant-design/issues/8379)
|
||||
- 🐞 Fixed `fileList` shown incorrect when `beforeUpload` of Upload return `false`. [#8036](https://github.com/ant-design/ant-design/issues/8036)
|
||||
- 🐞 Fixed vertical align of Form.Item's feedback shown incorrect when Input `size` property is `default\small`. [#8243](https://github.com/ant-design/ant-design/issues/8243)
|
||||
- 🐞 Fixed nested Form.Item style incorrect. [#8320](https://github.com/ant-design/ant-design/issues/8320)
|
||||
- 🐞 Fixed Form.Item height are different between Chrome with Safari. [#8220](https://github.com/ant-design/ant-design/issues/8220)
|
||||
- 🐞 Fixed links where inside Form.Item's label are unavailable to click. [bf70d30](https://github.com/ant-design/ant-design/commit/bf70d30a60595916a38671f384ed17cbd0c4ba5d)
|
||||
- 🐞 Fixed Progress word wrap. [#8239](https://github.com/ant-design/ant-design/issues/8239)
|
||||
|
||||
## 2.13.10
|
||||
|
||||
`2017-11-12`
|
||||
|
||||
- 📝 Add documentation of [Work with Us](http://ant.design/docs/resource/work-with-us).
|
||||
- 📝 Refactor edit row demo of Table. [#8026](https://github.com/ant-design/ant-design/issues/8026)
|
||||
- 🌟 Improve detection of Layout.Sider, now we can compose and nest the Sider without specifying `__ANT_LAYOUT_SIDER` attribute. [#8077](https://github.com/ant-design/ant-design/pull/8077/) [@yasinuslu](https://github.com/yasinuslu)
|
||||
- 🐞 Fix align issue of `Input.Group` in Chrome 62. [ant-design/ant-design-pro#139](https://github.com/ant-design/ant-design-pro/issues/139)
|
||||
- 🐞 Fix Cascader search not working when option.children is `[]`. [#8130](https://github.com/ant-design/ant-design/issues/8130) [@jdz321](https://github.com/jdz321)
|
||||
- 🐞 Fix broken padding of AutoComponent caused by style order conflict with Input. [#8081](https://github.com/ant-design/ant-design/issues/8081)
|
||||
- 🐞 Fix Upload constructor error in IE9. [#7706](https://github.com/ant-design/ant-design/issues/7706)
|
||||
- 🐞 Fix Select filterOption's TypeScript definition. [#8128](https://github.com/ant-design/ant-design/issues/8128)
|
||||
|
||||
## 2.13.9
|
||||
|
||||
`2017-11-06`
|
||||
|
||||
- 🌟 Published [Ant Design Pro](https://pro.ant.design/).
|
||||
- 🐞 Fix that `Cascader[popupVisible]` doesn't work. [#8088](https://github.com/ant-design/ant-design/issues/8088)
|
||||
- 🐞 Fix that native `input[type=checkbox|radio]` invisible issue. [7c3a483](https://github.com/ant-design/ant-design/commit/7c3a48319074a800c89935e728904933d503ee86)
|
||||
- 🐞 Fix that `Input.Search[suffix]` doesn't work. [#7970](https://github.com/ant-design/ant-design/issues/7970)
|
||||
- 🐞 Fix TypeScript definitions of Slider. [#8102](https://github.com/ant-design/ant-design/pull/8102) [@davschne](https://github.com/davschne)
|
||||
|
||||
## 2.13.8
|
||||
|
||||
`2017-10-27`
|
||||
|
||||
- 🌟 Add a mirror site in China: [http://ant-design.gitee.io](http://ant-design.gitee.io)
|
||||
- 🐞 Fix `ref warning` of Menu in React 16. [#8037](https://github.com/ant-design/ant-design/pull/8037) [@vgeyi](https://github.com/vgeyi)
|
||||
- 🐞 Fix extra padding of loading Card when it is too wide. [ad9809ec](https://github.com/ant-design/ant-design/commit/ad9809ec2e29275c9348537b04584dcfdc96659a)
|
||||
- 📝 Add sorted API to enhance readability of docs. [#7896](https://github.com/ant-design/ant-design/pull/7896)[@monkindey](https://github.com/monkindey)
|
||||
- 📝 Improve Modal docs of how to setting styles. [#7840](https://github.com/ant-design/ant-design/issues/7840) [@kossel](https://github.com/kossel)
|
||||
- 🐞 Fix the inner shadow of Input on IOS. [#7974](https://github.com/ant-design/ant-design/pull/7974) [@cnahliu](https://github.com/cnahliu)
|
||||
|
||||
## 2.13.7
|
||||
|
||||
`2017-10-22`
|
||||
|
||||
- 🐞 Fix input height in AutoComplete. [#7918](https://github.com/ant-design/ant-design/issues/7918)
|
||||
- 🐞 Fix Cascader `inputPrefixCls` can not be fully effective. [#7945](https://github.com/ant-design/ant-design/pull/7945) [@vgeyi](https://github.com/vgeyi)
|
||||
- 🐞 Fix extra margin in sider Layout. [#7967](https://github.com/ant-design/ant-design/issues/7967)
|
||||
- 🐞 Fix RangePicker can not close panel when click presetted ranges. [#7747](https://github.com/ant-design/ant-design/issues/7747)
|
||||
- Table
|
||||
- 🐞 Fix Radio can not be centered in Table column. [#7969](https://github.com/ant-design/ant-design/issues/7969)
|
||||
- 🐞 Fix Table filter can't show after remove fixed setting. [#7909](https://github.com/ant-design/ant-design/issues/7909)
|
||||
- 🌟 Add `scrollNumberPrefixCls` prop for Badge. [#7882](https://github.com/ant-design/ant-design/pull/7882) [@vgeyi](https://github.com/vgeyi)
|
||||
- 🌟 Add some less variables. [#7886](https://github.com/ant-design/ant-design/issues/7886) [@syssam](https://github.com/syssam)
|
||||
|
||||
## 2.13.6
|
||||
|
||||
`2017-10-12`
|
||||
|
||||
- 🐞 Fix issue that `beforeUpload` will stop uploading when return undefined. [#7870](https://github.com/ant-design/ant-design/issues/7870)
|
||||
|
||||
## 2.13.5
|
||||
|
||||
`2017-10-11`
|
||||
|
||||
- 🐞 Fix issue resulting in FormItem throws error when use with reac-hot-loader. [#7775](https://github.com/ant-design/ant-design/issues/7775)
|
||||
- 🐞 Fix not working less variable `@link-hover-decoration`. [#7821](https://github.com/ant-design/ant-design/issues/7821)
|
||||
- 🐞 Fix issue resulting in Upload's `beforeUpload` method not returning promise properly. [#7833](https://github.com/ant-design/ant-design/issues/7833)
|
||||
- 🐞 Fix issue resulting in Input.Search's search icon being covered with Form's feedback icon. [#7854](https://github.com/ant-design/ant-design/issues/7854)
|
||||
- AutoComplete
|
||||
- 🐞 Fix circular reference with infinite children [#7742](https://github.com/ant-design/ant-design/pull/7742) [@menberg](https://github.com/ant-design/ant-design/pull/7742)
|
||||
- 🐞 Fix style when use with TextArea. [#7801](https://github.com/ant-design/ant-design/issues/7800)
|
||||
- 🌟 Improve TypeScript definition. [cf788d7](https://github.com/ant-design/ant-design/commit/cf788d7b4dda58f61da91086ccfe0c67872fc709) [d4c75d43](https://github.com/ant-design/ant-design/commit/d4c75d43a1824d36583d9d8f9b209a4b9526a3af)
|
||||
- 🌟 Add new less variable. [2e2acb5](https://github.com/ant-design/ant-design/commit/2e2acb5be9a171f217f2a1a143b34b2624b49b06)
|
||||
|
||||
## 2.13.4
|
||||
|
||||
`2017-09-29`
|
||||
|
||||
- 🐞 Fix missing Pagination `size="small"` style.
|
||||
- 🐞 Fix Anchor missing padding. [#7712](https://github.com/ant-design/ant-design/issues/7712)
|
||||
- 🐞 Fix TreeSelect extra select below search input. [#7703](https://github.com/ant-design/ant-design/issues/7703)
|
||||
- 🐞 Fix the jumping problem of Form validate text. [#7730](https://github.com/ant-design/ant-design/issues/7730)
|
||||
- 🐞 Fix Button Group loading style. [#7709](https://github.com/ant-design/ant-design/issues/7709)
|
||||
- 🐞 Fix blur placeholder text color. [#7365](https://github.com/ant-design/ant-design/issues/7365)
|
||||
- 🐞 Fix Mention `suggestion.toLowerCase is not a function` error. [#7696](https://github.com/ant-design/ant-design/issues/7696) [@kappa-gooner](https://github.com/kappa-gooner)
|
||||
- 🐞 Fix a children height problem of Layout.Sider. [#7716](https://github.com/ant-design/ant-design/pull/7716) [@zheeeng](https://github.com/zheeeng)
|
||||
- 🐞 Fix Dropdown menu group style.
|
||||
- 🐞 Fix Table filter icon and dropdown style.
|
||||
- 🐞 Fix a AutoComplete circular reference bug in Inferno. [#7742](https://github.com/ant-design/ant-design/pull/7742) [@menberg](https://github.com/menberg)
|
||||
- 🐞 Fix Upload cannot upload file when using `beforeUpload`. [#7762](https://github.com/ant-design/ant-design/issues/7762) [#6983](https://github.com/ant-design/ant-design/issues/6983)
|
||||
- TypeScript
|
||||
- 🐞 Fix Input `maxLength` definite. [#7744](https://github.com/ant-design/ant-design/pull/7744) [@delesseps](https://github.com/delesseps)
|
||||
- 🐞 Fix `disabledTime` definite of DatePicker. [#7740](https://github.com/ant-design/ant-design/pull/7740) [@778758944](https://github.com/778758944)
|
||||
|
||||
## 2.13.3
|
||||
|
||||
`2017-09-22`
|
||||
|
||||
- 🐞 Fix Affix scrolling bug when document's height minus viewport's height is smaller than the height of children of Affix. [#2349](https://github.com/ant-design/ant-design/issues/2349)
|
||||
- 🐞 Fix broken style of header of Card when `Card[title]` is void and `Card[extra]` is set. [f46112d#commitcomment-24480417](https://github.com/ant-design/ant-design/commit/f46112d38561c89780eb44ecbba82347d2b912da#commitcomment-24480417)
|
||||
- 🐞 Fix TypeScript definition of `Checkbox[children]`. [#7650](https://github.com/ant-design/ant-design/issues/7650) [@liaokaien](https://github.com/liaokaien)
|
||||
- 🐞 Fix error when set nested name in `getFieldDecorator` and then click the label of `Form.Item`. [#7693](https://github.com/ant-design/ant-design/issues/7693)
|
||||
- Input
|
||||
- 🐞 Fix broken style of `Input.Group[compat]` when it has `Select` as its children. [#7662](https://github.com/ant-design/ant-design/issues/7662)
|
||||
- 🐞 Fix TypeScript definition of `Input[autoComplete]`. [#7699](https://github.com/ant-design/ant-design/pull/7699) [@delesseps](https://github.com/delesseps)
|
||||
- LocaleProvider
|
||||
- 🇵🇹 Support Portuguese. [#7449](https://github.com/ant-design/ant-design/pull/7449) [@taviroquai](https://github.com/taviroquai)
|
||||
- 🐞 Fix missing translations in Dutch locale. [#7694](https://github.com/ant-design/ant-design/pull/7694) [@kstiopin](https://github.com/kstiopin)
|
||||
- Table
|
||||
- 🐞 Fix height of table header when `rowSelection` is set. [#7663](https://github.com/ant-design/ant-design/issues/7663)
|
||||
- 🐞 Fix bug that click on first two options will not trigger event when `rowSelection.hideDefaultselections` is set. [#7626](https://github.com/ant-design/ant-design/issues/7626) [@infeng](https://github.com/infeng)
|
||||
- 🐞 Fix TypeScript definition of `Table[scroll]`. [#7640](https://github.com/ant-design/ant-design/pull/7640) [@BlackGanglion](https://github.com/BlackGanglion)
|
||||
|
||||
|
||||
## 2.13.2
|
||||
|
||||
`2017-09-15`
|
||||
|
||||
- 🐞 Fix title and extra content position of narrow Card. [#7604](https://github.com/ant-design/ant-design/issues/7604)
|
||||
- 🐞 Fix inlineCollapsed style of MenuItemGroup. [#7109](https://github.com/ant-design/ant-design/issues/7109)
|
||||
- 🐞 Revert [#7142](https://github.com/ant-design/ant-design/issues/7142) to fix empty data style of Table.
|
||||
- 🐞 Fix Form `getFieldDecoratorOptions` missing types of `normalize` and `validateFirst`. [#7552](https://github.com/ant-design/ant-design/issues/7552) [@meteor91](https://github.com/meteor91) [@mitchelldemler](https://github.com/mitchelldemler)
|
||||
- 🐞 Fix Modal `zIndex` type. [#7624](https://github.com/ant-design/ant-design/issues/7624)
|
||||
- 🌟 Improve tree node loading icon position. [#7584](https://github.com/ant-design/ant-design/issues/7584)
|
||||
- 🌟 Update a lot of components's English doc. [@khalibloo](https://github.com/khalibloo)
|
||||
|
||||
## 2.13.1
|
||||
|
||||
`2017-09-10`
|
||||
|
||||
- 🐞 Fix Card.Grid broken style. [commit/c7d6ce](https://github.com/ant-design/ant-design/commit/c7d6ce5d3f7bfae1f2252d702fb1bdf04fdc80cb)
|
||||
- 🐞 Fix Cascader overlaping text. [#7475](https://github.com/ant-design/ant-design/issues/7475)
|
||||
- 🐞 Fix simple mode Pagination prev and next button missing. [#7500](https://github.com/ant-design/ant-design/issues/7500)
|
||||
- 🐞 Fix Slider typings. [#7532](https://github.com/ant-design/ant-design/issues/7532)
|
||||
- Table
|
||||
- 🐞 Fix empty data scroll style. [#7457](https://github.com/ant-design/ant-design/issues/7457) [#7468](https://github.com/ant-design/ant-design/issues/7468) [#7470](https://github.com/ant-design/ant-design/issues/7470) [#7509](https://github.com/ant-design/ant-design/issues/7509)
|
||||
- 🌟 Make supplement for API docs. [#7525](https://github.com/ant-design/ant-design/pull/7525) [@hansnow](https://github.com/hansnow)
|
||||
- 🐞 Fix Upload typings. [#7507](https://github.com/ant-design/ant-design/pull/7507) [@WingGao](https://github.com/WingGao)
|
||||
- 🐞 Fix inlineCollapsed Menu when Submenu is opened. [#7514](https://github.com/ant-design/ant-design/issues/7514)
|
||||
- 🐞 Fix validateStatus styles of some Form Controls. [#7498](https://github.com/ant-design/ant-design/issues/7498)
|
||||
- 🐞 Fix @link-hover-decoration not working. [#7531](https://github.com/ant-design/ant-design/issues/7531)
|
||||
- 🌟 Optimize the English documentation of some components. [@khalibloo](https://github.com/khalibloo)
|
||||
|
||||
## 2.13.0
|
||||
|
||||
`2017-09-01`
|
||||
|
||||
- 🌟 Add `okType` and `cancelType` prop to Popconfirm and Modal and it's related methods. [#6848](https://github.com/ant-design/ant-design/pull/6848) [@yociduo](https://github.com/yociduo)
|
||||
- 🌟 Add `zIndex` prop to Modal and it's relatedt methos. [#6880](https://github.com/ant-design/ant-design/pull/6880) [@Alex1990](https://github.com/Alex1990)
|
||||
- 🌟 Add `name` prop to RadioGroup. [#7009](https://github.com/ant-design/ant-design/pull/7009) [@djyde](https://github.com/djyde)
|
||||
- 🌟 Add `hideDefaultSelections` props to Table. [#7295](https://github.com/ant-design/ant-design/issues/7295)
|
||||
- Dropdown
|
||||
- 🌟 Add `disabled` prop. [#7102](https://github.com/ant-design/ant-design/pull/7102) [@yociduo](https://github.com/yociduo)
|
||||
- 🌟 Menu can not be selected defaultly now.
|
||||
- 🌟 Add a third parameter `originalElement` to Pagination's `itemRender`.
|
||||
- 🌟 Add `backfill` prop to AutoComplete, items are selected by keyborad will be backfilled to the search input. [#5764](https://github.com/ant-design/ant-design/issues/5764)
|
||||
- 🌟 Add `firstActiveValue` prop to Select to allow specify active item when open select first time. [#6318](https://github.com/ant-design/ant-design/issues/6318) [@L-x-C](https://github.com/ant-design/ant-design/issues/6318)
|
||||
- LocaleProvider
|
||||
- 🌟 Add Persian. [#6878](https://github.com/ant-design/ant-design/pull/6878) [@mkermani144](https://github.com/mkermani144)
|
||||
- 🌟 Add Greek. [#6928](https://github.com/ant-design/ant-design/pull/6928) [@michmach](https://github.com/michmach)
|
||||
- 🌟 Add Norwegian. [#7122](https://github.com/ant-design/ant-design/pull/7122) [@santi](https://github.com/santi)
|
||||
- 🌟 Add Serbian. [#7201](https://github.com/ant-design/ant-design/pull/7201) [@paunovic-stefan](https://github.com/paunovic-stefan)
|
||||
- 🐞 Fix Menu's title can not be hidden when collapsing Sider. [#7409](https://github.com/ant-design/ant-design/issues/7409)
|
||||
- 🐞 Fix some TypeScript type definitions [#7355](https://github.com/ant-design/ant-design/pull/7355) [#7378](https://github.com/ant-design/ant-design/pull/7378) [#7384](https://github.com/ant-design/ant-design/pull/7384)
|
||||
- 🐞 Fix some components can not use conditional rendering. [#6530](https://github.com/ant-design/ant-design/issues/6530)
|
||||
- Website
|
||||
- 🌟 Add a shortcut `s` to focus the search input.
|
||||
- 🌟 Add a color picker to the footer to change primary color and preview lively.
|
||||
|
||||
## 2.12.8
|
||||
|
||||
`2017-08-27`
|
||||
@@ -25,7 +209,6 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi
|
||||
- 🌟 Better empty data style for fixed-columns Table. [#7298](https://github.com/ant-design/ant-design/issues/7298)
|
||||
- 🐞 Fix `disabled` logic of CheckboxGroup and Checkbox. [#7266](https://github.com/ant-design/ant-design/issues/7266) [@dilidili](https://github.com/dilidili)
|
||||
- 🐞 Fix errors of rendering Spin and Carousel in react-snapshot or other jsdom environment. [#3308](https://github.com/ant-design/ant-design/issues/3308) [#7318](https://github.com/ant-design/ant-design/issues/7318)
|
||||

|
||||
- 🐞 Fix some details of Select, Tooltip and Menu.
|
||||
|
||||
## 2.12.7
|
||||
@@ -177,7 +360,7 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi
|
||||
- Add Input.Textarea, Input[type='textArea'] will be deprecated. [pull/6138](https://github.com/ant-design/ant-design/pull/6138)
|
||||
- LocaleProvider supporting Thai. [pull/6721](https://github.com/ant-design/ant-design/pull/6721) [@koobitor](https://github.com/koobitor)
|
||||
- Mention support `focus` function. [#6135](https://github.com/ant-design/ant-design/issues/6135)
|
||||
- Menu[mode='inline'] could be collapsed, and use `context` to pass `collapsed` prop from Layout.Sider to Menu, don't need customized css code anymore. [pull/6686](https://github.com/ant-design/ant-design/pull/6686)
|
||||
- Menu inline mode could be collapsed by `inlineCollapsed`, and use `context` to pass `collapsed` prop from Layout.Sider to Menu, don't need customized css code anymore. [pull/6686](https://github.com/ant-design/ant-design/pull/6686)
|
||||
- Add Pagination `itemRender`, now you can customize the structure of page number. [25a603](https://github.com/ant-design/ant-design/commit/25a60322e5c6649522fb9f0d34919eba0ccb1f65)
|
||||
- Add Tooltip `autoAdjustOverflow` prop, now the auto adjust feature can be disabled. [pull/6661](https://github.com/ant-design/ant-design/pull/6661) [@jdz321](https://github.com/jdz321)
|
||||
- Fix errors in docs of Avatar. [pull/6711](https://github.com/ant-design/ant-design/pull/6711) [@llaski](https://github.com/llaski)
|
||||
@@ -593,7 +776,7 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi
|
||||
- Fix that `Cannot find module '../../package.json'` error. [#4935](https://github.com/ant-design/ant-design/issues/4935)
|
||||
- Fix definitions of Table, RangePicker and Upload.
|
||||
- Fix lack of event argument for Modal `onOk` `afterClose` and Popconfirm `onConfirm` `onCancel`. [#4787](https://github.com/ant-design/ant-design/issues/4787)
|
||||
- Improve animation of Menu[inline] and Collapse.
|
||||
- Improve animation of Menu inline mode and Collapse.
|
||||
- Improve Checkbox and Radio vertical align style.
|
||||
- Table
|
||||
- Fix misplace header when fix column. [#4936](https://github.com/ant-design/ant-design/issues/4936)
|
||||
@@ -1210,8 +1393,8 @@ The following change will throw some warnings in the console and it will still w
|
||||
|
||||
```diff
|
||||
{
|
||||
- "plugins": [["antd", { style: "css" }]]
|
||||
+ "plugins": [["import", { libraryName: "antd", style: "css" }]]
|
||||
- "plugins": [["antd", { "style": "css" }]]
|
||||
+ "plugins": [["import", { "libraryName": "antd", "style": "css" }]]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -17,15 +17,197 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
## 2.13.12
|
||||
|
||||
`2018-02-26`
|
||||
|
||||
- 🐞 修复 Menu 的 `defaultOpenKeys` 包含不存在的 key 时,子菜单不能正确显示的问题。 [#8475](https://github.com/ant-design/ant-design/issues/8475)
|
||||
- 🐞 修复 DatePicker 的值不能正确受控的问题。[#8885](https://github.com/ant-design/ant-design/issues/8885)
|
||||
|
||||
## 2.13.11
|
||||
|
||||
`2017-12-01`
|
||||
|
||||
- 📝 完善组件对 TypeScript 的支持。[#8394](https://github.com/ant-design/ant-design/pull/8394) [#8395](https://github.com/ant-design/ant-design/pull/8395) [@burdell](https://github.com/burdell) [@khayalan-mathew](https://github.com/khayalan-mathew)
|
||||
- 🐞 修复了 Tooltip 不支持 `defaultVisible` 属性的问题。[#8257](https://github.com/ant-design/ant-design/issues/8257)
|
||||
- 🐞 修复了 Modal 组件在传入自定义 `footer` 的时候默认 `footer` 被覆盖的问题。[#8379](https://github.com/ant-design/ant-design/issues/8379)
|
||||
- 🐞 修复了 Upload 组件在 `beforeUpload` 中返回 `false` 时,修改 `fileList` 导致上传列表展示不正常的问题。[#8036](https://github.com/ant-design/ant-design/issues/8036)
|
||||
- 🐞 修复了 Form 表单的信息回显在当 Input 组件 `size` 属性为 `default\small` 时没有对齐的问题。[#8243](https://github.com/ant-design/ant-design/issues/8243)
|
||||
- 🐞 修复了 Form.Item 在互相嵌套时样式异常的问题。[#8320](https://github.com/ant-design/ant-design/issues/8320)
|
||||
- 🐞 修复了 Form.Item 在 Chrome 和 Safari 下高度不一致的问题。 [#8220](https://github.com/ant-design/ant-design/issues/8220)
|
||||
- 🐞 修复了 Form.Item 在部分情况下 label 内链接无法点击的问题。 [bf70d30](https://github.com/ant-design/ant-design/commit/bf70d30a60595916a38671f384ed17cbd0c4ba5d)
|
||||
- 🐞 修复了 Progress 对于折行的场景兼容性问题。[#8239](https://github.com/ant-design/ant-design/issues/8239)
|
||||
|
||||
## 2.13.10
|
||||
|
||||
`2017-11-12`
|
||||
|
||||
- 📝 添加 [招聘](http://ant.design/docs/resource/work-with-us-cn) 页面。
|
||||
- 📝 重构了可编辑表格的演示代码。[#8026](https://github.com/ant-design/ant-design/issues/8026)
|
||||
- 🌟 优化了 Layout.Sider 的探测方式,现在支持 Sider 随意内嵌和组合(不再需要指定 `__ANT_LAYOUT_SIDER` 属性)。[#8077](https://github.com/ant-design/ant-design/pull/8077/) [@yasinuslu](https://github.com/yasinuslu)
|
||||
- 🐞 修复 Chrome 62 下 Input.Group 内 Select 和 Input 的对齐问题。[ant-design/ant-design-pro#139](https://github.com/ant-design/ant-design-pro/issues/139)
|
||||
- 🐞 修复 Cascader 搜索在 options 内 children 为空数组时工作不正常的问题。[#8130](https://github.com/ant-design/ant-design/issues/8130) [@jdz321](https://github.com/jdz321)
|
||||
- 🐞 修复一个 AutoComponent 和 Input 样式优先级导致错位的问题。[#8081](https://github.com/ant-design/ant-design/issues/8081)
|
||||
- 🐞 修复 IE9 下 Upload 初始化时报错的问题。[#7706](https://github.com/ant-design/ant-design/issues/7706)
|
||||
- 🐞 修复 Select 的 filterOption 参数的 TypeScript 定义。[#8128](https://github.com/ant-design/ant-design/issues/8128)
|
||||
|
||||
## 2.13.9
|
||||
|
||||
`2017-11-06`
|
||||
|
||||
- 🌟 发布 [Ant Design Pro](https://pro.ant.design/)。
|
||||
- 🐞 修复 `Cascader[popupVisible]` 失效问题。[#8088](https://github.com/ant-design/ant-design/issues/8088)
|
||||
- 🐞 修复原生 `input[type=checkbox|radio]` 看不到的问题。[7c3a483](https://github.com/ant-design/ant-design/commit/7c3a48319074a800c89935e728904933d503ee86)
|
||||
- 🐞 修复 `Input.Search[suffix]` 失效的问题。[#7970](https://github.com/ant-design/ant-design/issues/7970)
|
||||
- 🐞 修复 Slider TypeScript 定义问题。[#8102](https://github.com/ant-design/ant-design/pull/8102) [@davschne](https://github.com/davschne)
|
||||
|
||||
## 2.13.8
|
||||
|
||||
`2017-10-27`
|
||||
|
||||
- 🌟 新增国内镜像文档站点:[http://ant-design.gitee.io](http://ant-design.gitee.io)
|
||||
- 🐞 修复了 Menu 在 React 16 下 `ref warning` 的问题。[#8037](https://github.com/ant-design/ant-design/pull/8037) [@vgeyi](https://github.com/vgeyi)
|
||||
- 🐞 修复了 Card 在比较宽的时候 `loading` 样式的问题。[ad9809ec](https://github.com/ant-design/ant-design/commit/ad9809ec2e29275c9348537b04584dcfdc96659a)
|
||||
- 📝 引入了 API 展示排序规则,增强文档易读性。[#7896](https://github.com/ant-design/ant-design/pull/7896)[@monkindey](https://github.com/monkindey)
|
||||
- 📝 优化了 Modal 设置样式的文档。[#7840](https://github.com/ant-design/ant-design/issues/7840) [@kossel](https://github.com/kossel)
|
||||
- 🐞 修复了 IOS 下 Input 有内阴影的样式问题。[#7974](https://github.com/ant-design/ant-design/pull/7974) [@cnahliu](https://github.com/cnahliu)
|
||||
|
||||
## 2.13.7
|
||||
|
||||
`2017-10-22`
|
||||
|
||||
- 🐞 修复了 AutoComplete 的 input 高度。 [#7918](https://github.com/ant-design/ant-design/issues/7918)
|
||||
- 🐞 修复了 Cascader `inputPrefixCls` 不能完全生效的问题。[#7945](https://github.com/ant-design/ant-design/pull/7945) [@vgeyi](https://github.com/vgeyi)
|
||||
- 🐞 修复了有侧边栏的 Layout 存在多余外边距的问题。[#7967](https://github.com/ant-design/ant-design/issues/7967)
|
||||
- 🐞 修复了 RangePicker 在选中预设范围时间时不能关闭选择面板的问题。[#7747](https://github.com/ant-design/ant-design/issues/7747)
|
||||
- Table
|
||||
- 🐞 修复了 Table 列中 Radio 选择框无法居中的问题。[#7969](https://github.com/ant-design/ant-design/issues/7969)
|
||||
- 🐞 修复了去掉 `fixed` 属性设置后 Table 列无法进行筛选的问题。[#7909](https://github.com/ant-design/ant-design/issues/7909)
|
||||
- 🌟 Badge 新增 `scrollNumberPrefixCls` 属性。[#7882](https://github.com/ant-design/ant-design/pull/7882) [@vgeyi](https://github.com/vgeyi)
|
||||
- 🌟 补充了一些 less 变量。[#7886](https://github.com/ant-design/ant-design/issues/7886) [@syssam](https://github.com/syssam)
|
||||
|
||||
## 2.13.6
|
||||
|
||||
`2017-10-12`
|
||||
|
||||
- 🐞 修复 `beforeUpload` 未指定返回值时会阻止上传的问题。[#7870](https://github.com/ant-design/ant-design/issues/7870)
|
||||
|
||||
## 2.13.5
|
||||
|
||||
`2017-10-11`
|
||||
|
||||
- 🐞 修复 FormItem 不能跟 reac-hot-loader 一起使用的问题。[#7775](https://github.com/ant-design/ant-design/issues/7775)
|
||||
- 🐞 修复 less 变量 `@link-hover-decoration` 没按预期工作的问题。[#7821](https://github.com/ant-design/ant-design/issues/7821)
|
||||
- 🐞 修复 Uploade 的 `beforeUpload` 没返回 promise 的问题。[#7833](https://github.com/ant-design/ant-design/issues/7833)
|
||||
- 🐞 修复 Input.Search 的搜索图标会被 Form 的验证图标遮住的问题。[#7854](https://github.com/ant-design/ant-design/issues/7854)
|
||||
- AutoComplete
|
||||
- 🐞 修复循环引用问题。[#7742](https://github.com/ant-design/ant-design/pull/7742) [@menberg](https://github.com/ant-design/ant-design/pull/7742)
|
||||
- 🐞 修复使用 TextArea 并拖动输入框大小时的样式错乱问题。[#7801](https://github.com/ant-design/ant-design/issues/7800)
|
||||
- 🌟 改进一些 TypeScript 定义。[cf788d7](https://github.com/ant-design/ant-design/commit/cf788d7b4dda58f61da91086ccfe0c67872fc709) [d4c75d43](https://github.com/ant-design/ant-design/commit/d4c75d43a1824d36583d9d8f9b209a4b9526a3af)
|
||||
- 🌟 新增 less 变量 [2e2acb5](https://github.com/ant-design/ant-design/commit/2e2acb5be9a171f217f2a1a143b34b2624b49b06)
|
||||
|
||||
## 2.13.4
|
||||
|
||||
`2017-09-29`
|
||||
|
||||
- 🐞 修复 Pagination 小号样式失效的问题。
|
||||
- 🐞 修复 Anchor 的样式错位。[#7712](https://github.com/ant-design/ant-design/issues/7712)
|
||||
- 🐞 修复 TreeSelect 搜索框下多余文字的问题。[#7703](https://github.com/ant-design/ant-design/issues/7703)
|
||||
- 🐞 修复 Form 校验文字跳动的问题。[#7730](https://github.com/ant-design/ant-design/issues/7730)
|
||||
- 🐞 修复各类型 Button Group 的 loading 样式。 [#7709](https://github.com/ant-design/ant-design/issues/7709)
|
||||
- 🐞 修复 placeholder 文本在某些情况下无法看清的问题。[#7365](https://github.com/ant-design/ant-design/issues/7365)
|
||||
- 🐞 修复一个 Mention 的 `suggestion.toLowerCase is not a function` 报错问题。 [#7696](https://github.com/ant-design/ant-design/issues/7696) [@kappa-gooner](https://github.com/kappa-gooner)
|
||||
- 🐞 修复一个 Layout.Sider 子元素的高度问题。[#7716](https://github.com/ant-design/ant-design/pull/7716) [@zheeeng](https://github.com/zheeeng)
|
||||
- 🐞 修复 Dropdown 菜单分组的样式。
|
||||
- 🐞 修复 Table 筛选图标和菜单样式错位。
|
||||
- 🐞 修复一个 AutoComplete 在 Inferno 下循环引用的问题。[#7742](https://github.com/ant-design/ant-design/pull/7742) [@menberg](https://github.com/menberg)
|
||||
- 🐞 修复 Upload 使用 `beforeUpload` 验证文件类型失败后无法再次上传的问题。[#7762](https://github.com/ant-design/ant-design/issues/7762) [#6983](https://github.com/ant-design/ant-design/issues/6983)
|
||||
- TypeScript
|
||||
- 🐞 修复 Input 的 `maxLength` 定义。[#7744](https://github.com/ant-design/ant-design/pull/7744) [@delesseps](https://github.com/delesseps)
|
||||
- 🐞 修复 DatePicker 等组件的 `disabledTime` 的返回值定义。[#7740](https://github.com/ant-design/ant-design/pull/7740) [@778758944](https://github.com/778758944)
|
||||
|
||||
## 2.13.3
|
||||
|
||||
`2017-09-22`
|
||||
|
||||
- 🐞 修复 Affix 在内容与视口高度差小于 children 高度时触发的滚动抖动问题。[#2349](https://github.com/ant-design/ant-design/issues/2349)
|
||||
- 🐞 修复 `Card[title]` 为空且设置 `Card[extra]` 时样式错乱的问题。[f46112d#commitcomment-24480417](https://github.com/ant-design/ant-design/commit/f46112d38561c89780eb44ecbba82347d2b912da#commitcomment-24480417)
|
||||
- 🐞 修复 `Checkbox[children]` TypeScript definition。[#7650](https://github.com/ant-design/ant-design/issues/7650) [@liaokaien](https://github.com/liaokaien)
|
||||
- 🐞 修复 `getFieldDecorator` 内使用嵌套 id 后点击 `Form.Item` label 报错的问题。[#7693](https://github.com/ant-design/ant-design/issues/7693)
|
||||
- Input
|
||||
- 🐞 修复 `Input.Group[compat]` 内嵌 `Select` 等控件时的样式问题。[#7662](https://github.com/ant-design/ant-design/issues/7662)
|
||||
- 🐞 优化 `Input[autoComplete]` TypeScript 定义。[#7699](https://github.com/ant-design/ant-design/pull/7699) [@delesseps](https://github.com/delesseps)
|
||||
- LocaleProvider
|
||||
- 🇵🇹 新增葡萄牙语。[#7449](https://github.com/ant-design/ant-design/pull/7449) [@taviroquai](https://github.com/taviroquai)
|
||||
- 🐞 修复荷兰语 locale 缺少文案的问题。[#7694](https://github.com/ant-design/ant-design/pull/7694) [@kstiopin](https://github.com/kstiopin)
|
||||
- Table
|
||||
- 🐞 修复 `rowSelection` 导致的表头高度问题。[#7663](https://github.com/ant-design/ant-design/issues/7663)
|
||||
- 🐞 修复使用 `rowSelection.hideDefaultselections` 时导致自定义选项点击没反应的问题。[#7626](https://github.com/ant-design/ant-design/issues/7626) [@infeng](https://github.com/infeng)
|
||||
- 🐞 优化 `Table[scroll]` TypeScript definition。[#7640](https://github.com/ant-design/ant-design/pull/7640) [@BlackGanglion](https://github.com/BlackGanglion)
|
||||
|
||||
## 2.13.2
|
||||
|
||||
`2017-09-15`
|
||||
|
||||
- 🐞 修复了 Card Extra 内容过多样式错乱的问题。[#7604](https://github.com/ant-design/ant-design/issues/7604)
|
||||
- 🐞 修复了分组 Menu 收缩时的错位问题。[#7109](https://github.com/ant-design/ant-design/issues/7109)
|
||||
- 🐞 回滚 [#7142](https://github.com/ant-design/ant-design/issues/7142) 里对固定列表格空数据的样式优化,修复带来的一系列样式问题。
|
||||
- 🐞 修复了 Form `getFieldDecoratorOptions` 缺失 `normalize` 以及 `validateFirst` 属性定义的问题。[#7552](https://github.com/ant-design/ant-design/issues/7552) [@meteor91](https://github.com/meteor91) [@mitchelldemler](https://github.com/mitchelldemler)
|
||||
- 🐞 修复了 Modal 的 `zIndex` 属性定义。[#7624](https://github.com/ant-design/ant-design/issues/7624)
|
||||
- 🌟 优化了 Tree 加载中图标的显示位置。[#7584](https://github.com/ant-design/ant-design/issues/7584)
|
||||
- 🌟 优化了大量组件的英文文档。[@khalibloo](https://github.com/khalibloo)
|
||||
|
||||
## 2.13.1
|
||||
|
||||
`2017-09-10`
|
||||
|
||||
- 🐞 修复了 Card.Grid 的样式问题。[commit/c7d6ce](https://github.com/ant-design/ant-design/commit/c7d6ce5d3f7bfae1f2252d702fb1bdf04fdc80cb)
|
||||
- 🐞 修复了 Cascader 指针图标与文字重叠的问题。[#7475](https://github.com/ant-design/ant-design/issues/7475)
|
||||
- 🐞 修复了 Pagination 在简洁模式下前后按钮未展示的问题。[#7500](https://github.com/ant-design/ant-design/issues/7500)
|
||||
- 🐞 修复了 Slider 的 type 定义。[#7532](https://github.com/ant-design/ant-design/issues/7532)
|
||||
- Table
|
||||
- 🐞 修复了在空数据情况下包含固定列时的一些样式问题。[#7457](https://github.com/ant-design/ant-design/issues/7457) [#7468](https://github.com/ant-design/ant-design/issues/7468) [#7470](https://github.com/ant-design/ant-design/issues/7470) [#7509](https://github.com/ant-design/ant-design/issues/7509)
|
||||
- 🌟 补充了 API 文档。[#7525](https://github.com/ant-design/ant-design/pull/7525) [@hansnow](https://github.com/hansnow)
|
||||
- 🐞 修复了 Upload 的 type 定义。 [#7507](https://github.com/ant-design/ant-design/pull/7507) [@WingGao](https://github.com/WingGao)
|
||||
- 🐞 修复了 Submenu 展开时 inlineCollapsed Menu 的样式问题。[#7514](https://github.com/ant-design/ant-design/issues/7514)
|
||||
- 🐞 修复了一些表单控件的校验样式问题。[#7498](https://github.com/ant-design/ant-design/issues/7498)
|
||||
- 🐞 修复了 @link-hover-decoration 无效的问题。[#7531](https://github.com/ant-design/ant-design/issues/7531)
|
||||
- 🌟 优化了部分组件的英文文档。[@khalibloo](https://github.com/khalibloo)
|
||||
|
||||
## 2.13.0
|
||||
|
||||
`2017-09-01`
|
||||
|
||||
- 🌟 Popconfirm 和 Modal 及其相关方法新增 `okType` 和 `cancelType` 用以指定按钮类型。[#6848](https://github.com/ant-design/ant-design/pull/6848) [@yociduo](https://github.com/yociduo)
|
||||
- 🌟 Modal 及其相关方法新增 `zIndex`。[#6880](https://github.com/ant-design/ant-design/pull/6880) [@Alex1990](https://github.com/Alex1990)
|
||||
- 🌟 RadioGroup 新增 `name` 属性。[#7009](https://github.com/ant-design/ant-design/pull/7009) [@djyde](https://github.com/djyde)
|
||||
- 🌟 Table 新增 `hideDefaultSelections` 属性。[#7295](https://github.com/ant-design/ant-design/issues/7295)
|
||||
- Dropdown
|
||||
- 🌟 新增 `disabled` 属性。[#7102](https://github.com/ant-design/ant-design/pull/7102) [@yociduo](https://github.com/yociduo)
|
||||
- 🌟 Menu 默认调整为不能选中。
|
||||
- 🌟 Pagination 的 `itemRender` 新增第三个参数 `originalElement`。
|
||||
- 🌟 AutoComplete 新增 `backfill` 属性,键盘选择时能回填选中项到输入框中。[#5764](https://github.com/ant-design/ant-design/issues/5764)
|
||||
- 🌟 Select 新增 `firstActiveValue` 属性,允许指定首次打开时默认选中的项。[#6318](https://github.com/ant-design/ant-design/issues/6318) [@L-x-C](https://github.com/ant-design/ant-design/issues/6318)
|
||||
- LocaleProvider
|
||||
- 🌟 新增波斯语。[#6878](https://github.com/ant-design/ant-design/pull/6878) [@mkermani144](https://github.com/mkermani144)
|
||||
- 🌟 新增希腊语。[#6928](https://github.com/ant-design/ant-design/pull/6928) [@michmach](https://github.com/michmach)
|
||||
- 🌟 新增挪威语。[#7122](https://github.com/ant-design/ant-design/pull/7122) [@santi](https://github.com/santi)
|
||||
- 🌟 新增塞尔维亚语。[#7201](https://github.com/ant-design/ant-design/pull/7201) [@paunovic-stefan](https://github.com/paunovic-stefan)
|
||||
- 🐞 修复 Sider 隐藏时 Menu 的标题不会隐藏的问题。[#7409](https://github.com/ant-design/ant-design/issues/7409)
|
||||
- 🐞 修复 TypeScript 定义 [#7355](https://github.com/ant-design/ant-design/pull/7355) [#7378](https://github.com/ant-design/ant-design/pull/7378) [#7384](https://github.com/ant-design/ant-design/pull/7384)
|
||||
- 🐞 修复一些组件不能使用条件渲染的问题。[#6530](https://github.com/ant-design/ant-design/issues/6530)
|
||||
- 网站
|
||||
- 🌟 新增快捷键 `s` 聚焦搜索框。
|
||||
- 🌟 页脚新增主色修改预览功能。
|
||||
|
||||
## 2.12.8
|
||||
|
||||
`2017-08-27`
|
||||
|
||||
- 📖 重写了 [《在 create-react-app 中使用》](/docs/react/use-with-create-react-app) 文档,现在不再需要 eject。[#7276](https://github.com/ant-design/ant-design/pull/7276)
|
||||
- 🌟 优化了固定列表格的空数据样式。[#7298](https://github.com/ant-design/ant-design/issues/7298)
|
||||
- 🌟 优化了固定列的空表格样式。[#7298](https://github.com/ant-design/ant-design/issues/7298)
|
||||
- 🐞 修复了 CheckboxGroup 和 Checkbox 的 `disabled` 属性逻辑。[#7266](https://github.com/ant-design/ant-design/issues/7266) [@dilidili](https://github.com/dilidili)
|
||||
- 🐞 修复在 react-snapshot 或 jsdom 环境下测试 Spin 和 Carousel 时报错的问题。[#3308](https://github.com/ant-design/ant-design/issues/3308) [#7318](https://github.com/ant-design/ant-design/issues/7318)
|
||||

|
||||
- 🐞 修复 Select、Tooltip、Menu 的一些细节样式问题。
|
||||
|
||||
## 2.12.7
|
||||
@@ -177,7 +359,7 @@ timeline: true
|
||||
- 新增 Input.TextArea,原 Input[type='textArea'] 将被废弃。[pull/6138](https://github.com/ant-design/ant-design/pull/6138)
|
||||
- LocaleProvider 新增泰语支持。[pull/6721](https://github.com/ant-design/ant-design/pull/6721) [@koobitor](https://github.com/koobitor)
|
||||
- Mention 支持 `focus` 方法。[#6135](https://github.com/ant-design/ant-design/issues/6135)
|
||||
- Menu[mode='inline'] 支持缩起/展开,同时 Layout.Sider 使用 `context` 向 Menu 传递 `collapsed` 属性,无需再自己定制样式。[pull/6686](https://github.com/ant-design/ant-design/pull/6686)
|
||||
- Menu `inline` 模式下支持用 `inlineCollapsed` 属性缩起/展开,同时 Layout.Sider 使用 `context` 向 Menu 传递 `collapsed` 属性,无需再自己定制样式。[pull/6686](https://github.com/ant-design/ant-design/pull/6686)
|
||||
- 新增 Pagination `itemRender` 属性,用于自定义页码的结构。[25a603](https://github.com/ant-design/ant-design/commit/25a60322e5c6649522fb9f0d34919eba0ccb1f65)
|
||||
- 新增 Tooltip `autoAdjustOverflow` 属性,支持关闭自动调整位置的功能。[pull/6661](https://github.com/ant-design/ant-design/pull/6661) [@jdz321](https://github.com/jdz321)
|
||||
- 修复了 Avatar 错误的文档。[pull/6711](https://github.com/ant-design/ant-design/pull/6711) [@llaski](https://github.com/llaski)
|
||||
@@ -592,7 +774,7 @@ timeline: true
|
||||
- 修复 `Cannot find module '../../package.json'` 的问题。[#4935](https://github.com/ant-design/ant-design/issues/4935)
|
||||
- 补充了 Table、RangePicker 和 Upload 的部分属性定义。
|
||||
- 修复了 Modal `onOk` `afterClose` 和 Popconfirm `onConfirm` `onCancel` 缺少点击 event 参数的问题。 [#4787](https://github.com/ant-design/ant-design/issues/4787)
|
||||
- 优化 Menu[inline] 和 Collapse 的折叠动画效果。
|
||||
- 优化 Menu inline 模式和 Collapse 的折叠动画效果。
|
||||
- 优化了 Checkbox 和 Radio 的垂直对齐样式。
|
||||
- Table
|
||||
- 修复固定列时列头样式错位的问题。[#4936](https://github.com/ant-design/ant-design/issues/4936)
|
||||
@@ -1226,8 +1408,8 @@ timeline: true
|
||||
|
||||
```diff
|
||||
{
|
||||
- "plugins": [["antd", { style: "css" }]]
|
||||
+ "plugins": [["import", { libraryName: "antd", style: "css" }]]
|
||||
- "plugins": [["antd", { "style": "css" }]]
|
||||
+ "plugins": [["import", { "libraryName": "antd", "style": "css" }]]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -81,11 +81,10 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
|
||||
|
||||
## 链接
|
||||
|
||||
- [首页](http://ant.design/index-cn)
|
||||
- [UI 组件库](http://ant.design/docs/react/introduce-cn)
|
||||
- [首页](http://ant.design/)
|
||||
- [组件库](http://ant.design/docs/react/introduce)
|
||||
- [Ant Design Pro](http://pro.ant.design/)
|
||||
- [更新日志](CHANGELOG.en-US.md)
|
||||
- [官方脚手架](https://github.com/dvajs/dva-cli)
|
||||
- [开发工具文档](http://ant-tool.github.io/)
|
||||
- [脚手架市场](http://scaffold.ant.design)
|
||||
- [React 底层基础组件](http://react-component.github.io/)
|
||||
- [移动端组件](http://mobile.ant.design)
|
||||
|
||||
25
README.md
25
README.md
@@ -58,13 +58,21 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
|
||||
|
||||
### Use modularized antd
|
||||
|
||||
- Use [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) (Recommended)
|
||||
- Manually import
|
||||
|
||||
```jsx
|
||||
import DatePicker from 'antd/lib/date-picker'; // for js
|
||||
import 'antd/lib/date-picker/style/css'; // for css
|
||||
// import 'antd/lib/date-picker/style'; // that will import less
|
||||
```
|
||||
|
||||
- Use [babel-plugin-import](https://github.com/ant-design/babel-plugin-import)
|
||||
|
||||
```js
|
||||
// .babelrc or babel-loader option
|
||||
{
|
||||
"plugins": [
|
||||
["import", { libraryName: "antd", style: "css" }] // `style: true` for less
|
||||
["import", { "libraryName": "antd", "style": "css" }] // `style: true` for less
|
||||
]
|
||||
}
|
||||
```
|
||||
@@ -76,14 +84,6 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
|
||||
import { DatePicker } from 'antd';
|
||||
```
|
||||
|
||||
- Manually import
|
||||
|
||||
```jsx
|
||||
import DatePicker from 'antd/lib/date-picker'; // for js
|
||||
import 'antd/lib/date-picker/style/css'; // for css
|
||||
// import 'antd/lib/date-picker/style'; // that will import less
|
||||
```
|
||||
|
||||
### TypeScript
|
||||
|
||||
```js
|
||||
@@ -121,10 +121,9 @@ See [i18n](http://ant.design/docs/react/i18n).
|
||||
## Links
|
||||
|
||||
- [Home page](http://ant.design/)
|
||||
- [UI library](http://ant.design/docs/react/introduce)
|
||||
- [Components](http://ant.design/docs/react/introduce)
|
||||
- [Ant Design Pro](http://pro.ant.design/)
|
||||
- [Change Log](CHANGELOG.en-US.md)
|
||||
- [Official Scaffold Tool](https://github.com/dvajs/dva-cli/)
|
||||
- [Development Tool](http://ant-tool.github.io/)
|
||||
- [Scaffold Market](http://scaffold.ant.design)
|
||||
- [rc-components](http://react-component.github.io/)
|
||||
- [Mobile UI](http://mobile.ant.design)
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import throttleByAnimationFrame from '../throttleByAnimationFrame';
|
||||
|
||||
jest.useFakeTimers();
|
||||
|
||||
describe('Test utils function', () => {
|
||||
beforeAll(() => {
|
||||
jest.useFakeTimers();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
it('throttle function should work', () => {
|
||||
const callback = jest.fn();
|
||||
const throttled = throttleByAnimationFrame(callback);
|
||||
|
||||
@@ -3,8 +3,6 @@ import { mount } from 'enzyme';
|
||||
import Affix from '..';
|
||||
import Button from '../../button';
|
||||
|
||||
jest.useFakeTimers();
|
||||
|
||||
const events = {};
|
||||
|
||||
class AffixMounter extends React.Component {
|
||||
@@ -18,34 +16,44 @@ class AffixMounter extends React.Component {
|
||||
return this.container;
|
||||
}
|
||||
render() {
|
||||
return (<div
|
||||
style={{
|
||||
height: 100,
|
||||
overflowY: 'scroll',
|
||||
}}
|
||||
ref={(node) => { this.container = node; }}
|
||||
>
|
||||
return (
|
||||
<div
|
||||
className="background"
|
||||
style={{
|
||||
paddingTop: 60,
|
||||
height: 300,
|
||||
height: 100,
|
||||
overflowY: 'scroll',
|
||||
}}
|
||||
ref={(node) => { this.container = node; }}
|
||||
>
|
||||
<Affix
|
||||
target={() => this.container}
|
||||
ref={ele => this.affix = ele}
|
||||
<div
|
||||
className="background"
|
||||
style={{
|
||||
paddingTop: 60,
|
||||
height: 300,
|
||||
}}
|
||||
>
|
||||
<Button type="primary" >
|
||||
Fixed at the top of container
|
||||
</Button>
|
||||
</Affix>
|
||||
<Affix
|
||||
target={() => this.container}
|
||||
ref={ele => this.affix = ele}
|
||||
>
|
||||
<Button type="primary" >
|
||||
Fixed at the top of container
|
||||
</Button>
|
||||
</Affix>
|
||||
</div>
|
||||
</div>
|
||||
</div>);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
describe('Affix Render', () => {
|
||||
beforeAll(() => {
|
||||
jest.useFakeTimers();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
it('Anchor render perfectly', () => {
|
||||
document.body.innerHTML = '<div id="mounter" />';
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ type: Navigation
|
||||
title: Affix
|
||||
---
|
||||
|
||||
Make an element sticky to viewport.
|
||||
Make an element stick to viewport.
|
||||
|
||||
## When To Use
|
||||
|
||||
@@ -14,12 +14,12 @@ Please note that Affix should not cover other content on the page, especially wh
|
||||
|
||||
## API
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|--------------|-----------------------|----------|--------------|
|
||||
| offsetTop | Pixels to offset from top when calculating position of scroll | number | 0 |
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| offsetBottom | Pixels to offset from bottom when calculating position of scroll | number | - |
|
||||
| offsetTop | Pixels to offset from top when calculating position of scroll | number | 0 |
|
||||
| target | specifies the scrollable area dom node | () => HTMLElement | () => window |
|
||||
| onChange | Callback when affix state is changed | Function(affixed) | - |
|
||||
| onChange | Callback for when affix state is changed | Function(affixed) | - |
|
||||
|
||||
**Note:** Children of `Affix` can not be `position: absolute`, but you can set `Affix` as `position: absolute`:
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ export default class Affix extends React.Component<AffixProps, any> {
|
||||
});
|
||||
this.setPlaceholderStyle({
|
||||
width,
|
||||
height: affixNode.offsetHeight,
|
||||
height: elemSize.height,
|
||||
});
|
||||
} else if (
|
||||
scrollTop < elemOffset.top + elemSize.height + (offsetBottom as number) - targetInnerHeight &&
|
||||
@@ -179,7 +179,7 @@ export default class Affix extends React.Component<AffixProps, any> {
|
||||
});
|
||||
this.setPlaceholderStyle({
|
||||
width,
|
||||
height: affixNode.offsetHeight,
|
||||
height: elemOffset.height,
|
||||
});
|
||||
} else {
|
||||
const { affixStyle } = this.state;
|
||||
|
||||
@@ -15,12 +15,12 @@ title: Affix
|
||||
|
||||
## API
|
||||
|
||||
| 成员 | 说明 | 类型 | 默认值 |
|
||||
|-------------|----------------|--------------------|--------------|
|
||||
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | number | |
|
||||
| offsetBottom | 距离窗口底部达到指定偏移量后触发 | number | |
|
||||
| 成员 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| offsetBottom | 距离窗口底部达到指定偏移量后触发 | number | |
|
||||
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | number | |
|
||||
| target | 设置 `Affix` 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 | () => HTMLElement | () => window |
|
||||
| onChange | 固定状态改变时触发的回调函数 | Function(affixed) | 无 |
|
||||
| onChange | 固定状态改变时触发的回调函数 | Function(affixed) | 无 |
|
||||
|
||||
**注意:**`Affix` 内的元素不要使用绝对定位,如需要绝对定位的效果,可以直接设置 `Affix` 为绝对定位:
|
||||
|
||||
|
||||
@@ -20,17 +20,21 @@ const onClose = function (e) {
|
||||
console.log(e, 'I was closed.');
|
||||
};
|
||||
|
||||
ReactDOM.render(<div>
|
||||
<Alert message="Warning Text Warning Text Warning TextW arning Text Warning Text Warning TextWarning Text"
|
||||
type="warning"
|
||||
closable
|
||||
onClose={onClose}
|
||||
/>
|
||||
<Alert message="Error Text"
|
||||
description="Error Description Error Description Error Description Error Description Error Description Error Description"
|
||||
type="error"
|
||||
closable
|
||||
onClose={onClose}
|
||||
/>
|
||||
</div>, mountNode);
|
||||
ReactDOM.render(
|
||||
<div>
|
||||
<Alert
|
||||
message="Warning Text Warning Text Warning TextW arning Text Warning Text Warning TextWarning Text"
|
||||
type="warning"
|
||||
closable
|
||||
onClose={onClose}
|
||||
/>
|
||||
<Alert
|
||||
message="Error Text"
|
||||
description="Error Description Error Description Error Description Error Description Error Description Error Description"
|
||||
type="error"
|
||||
closable
|
||||
onClose={onClose}
|
||||
/>
|
||||
</div>
|
||||
, mountNode);
|
||||
````
|
||||
|
||||
@@ -16,26 +16,28 @@ Additional description for alert message.
|
||||
````jsx
|
||||
import { Alert } from 'antd';
|
||||
|
||||
ReactDOM.render(<div>
|
||||
<Alert
|
||||
message="Success Text"
|
||||
description="Success Description Success Description Success Description"
|
||||
type="success"
|
||||
/>
|
||||
<Alert
|
||||
message="Info Text"
|
||||
description="Info Description Info Description Info Description Info Description"
|
||||
type="info"
|
||||
/>
|
||||
<Alert
|
||||
message="Warning Text"
|
||||
description="Warning Description Warning Description Warning Description Warning Description"
|
||||
type="warning"
|
||||
/>
|
||||
<Alert
|
||||
message="Error Text"
|
||||
description="Error Description Error Description Error Description Error Description"
|
||||
type="error"
|
||||
/>
|
||||
</div>, mountNode);
|
||||
ReactDOM.render(
|
||||
<div>
|
||||
<Alert
|
||||
message="Success Text"
|
||||
description="Success Description Success Description Success Description"
|
||||
type="success"
|
||||
/>
|
||||
<Alert
|
||||
message="Info Text"
|
||||
description="Info Description Info Description Info Description Info Description"
|
||||
type="info"
|
||||
/>
|
||||
<Alert
|
||||
message="Warning Text"
|
||||
description="Warning Description Warning Description Warning Description Warning Description"
|
||||
type="warning"
|
||||
/>
|
||||
<Alert
|
||||
message="Error Text"
|
||||
description="Error Description Error Description Error Description Error Description"
|
||||
type="error"
|
||||
/>
|
||||
</div>
|
||||
, mountNode);
|
||||
````
|
||||
|
||||
@@ -16,34 +16,36 @@ Decent icon make information more clear and more friendly.
|
||||
````jsx
|
||||
import { Alert } from 'antd';
|
||||
|
||||
ReactDOM.render(<div>
|
||||
<Alert message="Success Tips" type="success" showIcon />
|
||||
<Alert message="Informational Notes" type="info" showIcon />
|
||||
<Alert message="Warning" type="warning" showIcon />
|
||||
<Alert message="Error" type="error" showIcon />
|
||||
<Alert
|
||||
message="success tips"
|
||||
description="Detailed description and advices about successful copywriting."
|
||||
type="success"
|
||||
showIcon
|
||||
/>
|
||||
<Alert
|
||||
message="Informational Notes"
|
||||
description="Additional description and informations about copywriting."
|
||||
type="info"
|
||||
showIcon
|
||||
/>
|
||||
<Alert
|
||||
message="Warning"
|
||||
description="This is a warning notice about copywriting."
|
||||
type="warning"
|
||||
showIcon
|
||||
/>
|
||||
<Alert
|
||||
message="Error"
|
||||
description="This is an error message about copywriting."
|
||||
type="error"
|
||||
showIcon
|
||||
/>
|
||||
</div>, mountNode);
|
||||
ReactDOM.render(
|
||||
<div>
|
||||
<Alert message="Success Tips" type="success" showIcon />
|
||||
<Alert message="Informational Notes" type="info" showIcon />
|
||||
<Alert message="Warning" type="warning" showIcon />
|
||||
<Alert message="Error" type="error" showIcon />
|
||||
<Alert
|
||||
message="success tips"
|
||||
description="Detailed description and advices about successful copywriting."
|
||||
type="success"
|
||||
showIcon
|
||||
/>
|
||||
<Alert
|
||||
message="Informational Notes"
|
||||
description="Additional description and informations about copywriting."
|
||||
type="info"
|
||||
showIcon
|
||||
/>
|
||||
<Alert
|
||||
message="Warning"
|
||||
description="This is a warning notice about copywriting."
|
||||
type="warning"
|
||||
showIcon
|
||||
/>
|
||||
<Alert
|
||||
message="Error"
|
||||
description="This is an error message about copywriting."
|
||||
type="error"
|
||||
showIcon
|
||||
/>
|
||||
</div>
|
||||
, mountNode);
|
||||
````
|
||||
|
||||
@@ -16,10 +16,12 @@ There are 4 types of Alert: `success`, `info`, `warning`, `error`.
|
||||
````jsx
|
||||
import { Alert } from 'antd';
|
||||
|
||||
ReactDOM.render(<div>
|
||||
<Alert message="Success Text" type="success" />
|
||||
<Alert message="Info Text" type="info" />
|
||||
<Alert message="Warning Text" type="warning" />
|
||||
<Alert message="Error Text" type="error" />
|
||||
</div>, mountNode);
|
||||
ReactDOM.render(
|
||||
<div>
|
||||
<Alert message="Success Text" type="success" />
|
||||
<Alert message="Info Text" type="info" />
|
||||
<Alert message="Warning Text" type="warning" />
|
||||
<Alert message="Error Text" type="error" />
|
||||
</div>
|
||||
, mountNode);
|
||||
````
|
||||
|
||||
@@ -8,18 +8,18 @@ Alert component for feedback.
|
||||
|
||||
## When To Use
|
||||
|
||||
- When you need to show alert messages for users.
|
||||
- When you need to show alert messages to users.
|
||||
- When you need a persistent static container which is closable by user actions.
|
||||
|
||||
## API
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|----------- |--------------------------------------------------------- | ---------- |-------|
|
||||
| type | Type of Alert styles, options:`success`, `info`, `warning`, `error` | string | `info`, in `banner` mode it's `warning` |
|
||||
| closable | Whether Alert can be closed | boolean | - |
|
||||
| closeText | Close text to show | string\|ReactNode | - |
|
||||
| message | Content of Alert | string\|ReactNode | - |
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| banner | Whether to show as banner | boolean | false |
|
||||
| closable | Whether Alert can be closed | boolean | - |
|
||||
| closeText | Close text to show | string\|ReactNode | - |
|
||||
| description | Additional content of Alert | string\|ReactNode | - |
|
||||
| onClose | Callback when close Alert | Function | - |
|
||||
| showIcon | Whether to show icon | boolean | false, in `banner` mode it's true |
|
||||
| banner | Whether to show as banner | boolean | false |
|
||||
| message | Content of Alert | string\|ReactNode | - |
|
||||
| showIcon | Whether to show icon | boolean | false, in `banner` mode default is true |
|
||||
| type | Type of Alert styles, options: `success`, `info`, `warning`, `error` | string | `info`, in `banner` mode default is `warning` |
|
||||
| onClose | Callback when Alert is closed | Function | - |
|
||||
|
||||
@@ -14,13 +14,13 @@ title: Alert
|
||||
|
||||
## API
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|----------- |--------------------------------------------------------- | ---------- |-------|
|
||||
| type | 指定警告提示的样式,有四种选择 `success`、`info`、`warning`、`error` | string | `info`,`banner` 模式下默认值为 `warning` |
|
||||
| closable | 默认不显示关闭按钮 | boolean | 无 |
|
||||
| closeText | 自定义关闭按钮 | string\|ReactNode | 无 |
|
||||
| message | 警告提示内容 | string\|ReactNode | 无 |
|
||||
| description | 警告提示的辅助性文字介绍 | string\|ReactNode | 无 |
|
||||
| onClose | 关闭时触发的回调函数 | Function | 无 |
|
||||
| showIcon | 是否显示辅助图标 | boolean | false,`banner` 模式下默认值为 true |
|
||||
| banner | 是否用作顶部公告 | boolean | false |
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| banner | 是否用作顶部公告 | boolean | false |
|
||||
| closable | 默认不显示关闭按钮 | boolean | 无 |
|
||||
| closeText | 自定义关闭按钮 | string\|ReactNode | 无 |
|
||||
| description | 警告提示的辅助性文字介绍 | string\|ReactNode | 无 |
|
||||
| message | 警告提示内容 | string\|ReactNode | 无 |
|
||||
| showIcon | 是否显示辅助图标 | boolean | false,`banner` 模式下默认值为 true |
|
||||
| type | 指定警告提示的样式,有四种选择 `success`、`info`、`warning`、`error` | string | `info`,`banner` 模式下默认值为 `warning` |
|
||||
| onClose | 关闭时触发的回调函数 | Function | 无 |
|
||||
|
||||
@@ -42,9 +42,12 @@ function easeInOutCubic(t: number, b: number, c: number, d: number) {
|
||||
}
|
||||
|
||||
const reqAnimFrame = getRequestAnimationFrame();
|
||||
const sharpMatcherRegx = /#([^#]+)$/;
|
||||
function scrollTo(href: string, offsetTop = 0, target, callback = () => { }) {
|
||||
const scrollTop = getScroll(target(), true);
|
||||
const targetElement = document.getElementById(href.substring(1));
|
||||
const sharpLinkMatch = sharpMatcherRegx.exec(href);
|
||||
if (!sharpLinkMatch) { return; }
|
||||
const targetElement = document.getElementById(sharpLinkMatch[1]);
|
||||
if (!targetElement) {
|
||||
return;
|
||||
}
|
||||
@@ -174,7 +177,9 @@ export default class Anchor extends React.Component<AnchorProps, any> {
|
||||
|
||||
const linkSections: Array<Section> = [];
|
||||
this.links.forEach(link => {
|
||||
const target = document.getElementById(link.substring(1));
|
||||
const sharpLinkMatch = sharpMatcherRegx.exec(link.toString());
|
||||
if (!sharpLinkMatch) { return; }
|
||||
const target = document.getElementById(sharpLinkMatch[1]);
|
||||
if (target && getOffsetTop(target) < offsetTop + bounds) {
|
||||
const top = getOffsetTop(target);
|
||||
linkSections.push({
|
||||
|
||||
@@ -17,4 +17,48 @@ describe('Anchor Render', () => {
|
||||
wrapper.node.handleScroll();
|
||||
expect(wrapper.node.state).not.toBe(null);
|
||||
});
|
||||
|
||||
it('Anchor render perfectly for complete href - click', () => {
|
||||
const wrapper = mount(
|
||||
<Anchor>
|
||||
<Link href="http://www.example.com/#API" title="API" />
|
||||
</Anchor>
|
||||
);
|
||||
wrapper.find('a[href="http://www.example.com/#API"]').simulate('click');
|
||||
expect(wrapper.node.state.activeLink).toBe('http://www.example.com/#API');
|
||||
});
|
||||
|
||||
it('Anchor render perfectly for complete href - scoll', () => {
|
||||
let root = document.getElementById('root');
|
||||
if (!root) {
|
||||
root = document.createElement('div', { id: 'root' });
|
||||
root.id = 'root';
|
||||
document.body.appendChild(root);
|
||||
}
|
||||
mount(<div id="API">Hello</div>, { attachTo: root });
|
||||
const wrapper = mount(
|
||||
<Anchor>
|
||||
<Link href="http://www.example.com/#API" title="API" />
|
||||
</Anchor>
|
||||
);
|
||||
wrapper.node.handleScroll();
|
||||
expect(wrapper.node.state.activeLink).toBe('http://www.example.com/#API');
|
||||
});
|
||||
|
||||
it('Anchor render perfectly for complete href - scollTo', () => {
|
||||
let root = document.getElementById('root');
|
||||
if (!root) {
|
||||
root = document.createElement('div', { id: 'root' });
|
||||
root.id = 'root';
|
||||
document.body.appendChild(root);
|
||||
}
|
||||
mount(<div id="API">Hello</div>, { attachTo: root });
|
||||
const wrapper = mount(
|
||||
<Anchor>
|
||||
<Link href="##API" title="API" />
|
||||
</Anchor>
|
||||
);
|
||||
wrapper.node.handleScrollTo('##API');
|
||||
expect(wrapper.node.state.activeLink).toBe('##API');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -15,17 +15,17 @@ For displaying anchor hyperlinks on page and jumping between them.
|
||||
|
||||
### Anchor Props
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|--------------|-----------------------|----------|--------------|
|
||||
| offsetTop | Pixels to offset from top when calculating position of scroll | number | 0 |
|
||||
| offsetBottom | Pixels to offset from bottom when calculating position of scroll | number | - |
|
||||
| bounds | Bounding distance of anchor area | number | 5(px) |
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| affix | Fixed mode of Anchor | boolean | false |
|
||||
| bounds | Bounding distance of anchor area | number | 5(px) |
|
||||
| offsetBottom | Pixels to offset from bottom when calculating position of scroll | number | - |
|
||||
| offsetTop | Pixels to offset from top when calculating position of scroll | number | 0 |
|
||||
| showInkInFixed | Whether show ink-balls in Fixed mode | boolean | false |
|
||||
|
||||
### Link Props
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|-------------|----------------|--------------------|--------------|
|
||||
| href | target of hyperlink | string | |
|
||||
| title | content of hyperlink | string\|ReactNode | |
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| href | target of hyperlink | string | |
|
||||
| title | content of hyperlink | string\|ReactNode | |
|
||||
|
||||
@@ -16,17 +16,17 @@ title: Anchor
|
||||
|
||||
### Anchor Props
|
||||
|
||||
| 成员 | 说明 | 类型 | 默认值 |
|
||||
|-------------|----------------|--------------------|--------------|
|
||||
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | number | |
|
||||
| offsetBottom | 距离窗口底部达到指定偏移量后触发 | number | |
|
||||
| bounds | 锚点区域边界 | number | 5(px) |
|
||||
| 成员 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| affix | 固定模式 | boolean | false |
|
||||
| bounds | 锚点区域边界 | number | 5(px) |
|
||||
| offsetBottom | 距离窗口底部达到指定偏移量后触发 | number | |
|
||||
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | number | |
|
||||
| showInkInFixed | 固定模式是否显示小圆点 | boolean | false |
|
||||
|
||||
### Link Props
|
||||
|
||||
| 成员 | 说明 | 类型 | 默认值 |
|
||||
|-------------|----------------|--------------------|--------------|
|
||||
| href | 锚点链接 | string | |
|
||||
| title | 文字内容 | string\|ReactNode | |
|
||||
| 成员 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| href | 锚点链接 | string | |
|
||||
| title | 文字内容 | string\|ReactNode | |
|
||||
|
||||
@@ -1,57 +1,50 @@
|
||||
@import "../../style/themes/default";
|
||||
|
||||
.@{ant-prefix} {
|
||||
&-anchor {
|
||||
position: relative;
|
||||
&-wrapper {
|
||||
background-color: @component-background;
|
||||
}
|
||||
.@{ant-prefix}-anchor {
|
||||
position: relative;
|
||||
&-wrapper {
|
||||
background-color: @component-background;
|
||||
}
|
||||
|
||||
&-ink {
|
||||
position: absolute;
|
||||
&-ink {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
&:before {
|
||||
content: ' ';
|
||||
position: relative;
|
||||
width: 2px;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
&:before {
|
||||
content: ' ';
|
||||
position: relative;
|
||||
width: 2px;
|
||||
height: 100%;
|
||||
display: block;
|
||||
background-color: @border-color-split;
|
||||
margin: 0 auto;
|
||||
}
|
||||
&-ball {
|
||||
display: none;
|
||||
position: absolute;
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
border-radius: 9px;
|
||||
border: 3px solid @primary-color;
|
||||
background-color: @component-background;
|
||||
left: 50%;
|
||||
transition: top .3s ease-in-out;
|
||||
transform: translateX(-50%);
|
||||
&.visible {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
display: block;
|
||||
background-color: @border-color-split;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
&.fixed &-ink &-ink-ball {
|
||||
&-ball {
|
||||
display: none;
|
||||
position: absolute;
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
border-radius: 9px;
|
||||
border: 3px solid @primary-color;
|
||||
background-color: @component-background;
|
||||
left: 50%;
|
||||
transition: top .3s ease-in-out;
|
||||
transform: translateX(-50%);
|
||||
&.visible {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-anchor-link {
|
||||
&.fixed &-ink &-ink-ball {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&-link {
|
||||
padding: 8px 0 8px 18px;
|
||||
line-height: 1;
|
||||
|
||||
& & {
|
||||
padding-top: 6px;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
&-title {
|
||||
display: block;
|
||||
position: relative;
|
||||
@@ -61,18 +54,19 @@
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
&-title:only-child {
|
||||
margin-bottom: 0;
|
||||
&:only-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&-active > &-title {
|
||||
color: @primary-color;
|
||||
}
|
||||
}
|
||||
|
||||
& > & {
|
||||
font-size: @font-size-base;
|
||||
}
|
||||
&-link &-link {
|
||||
padding-top: 6px;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,59 +1,5 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`renders ./components/auto-complete/demo/antd.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-select-show-search ant-select-auto-complete ant-select ant-select-combobox ant-select-enabled"
|
||||
style="width:200px;height:50px;"
|
||||
>
|
||||
<div
|
||||
aria-autocomplete="list"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
class="ant-select-selection
|
||||
ant-select-selection--single"
|
||||
role="combobox"
|
||||
>
|
||||
<div
|
||||
class="ant-select-selection__rendered"
|
||||
>
|
||||
<div
|
||||
class="ant-select-selection__placeholder"
|
||||
style="display:block;user-select:none;-webkit-user-select:none;"
|
||||
unselectable="unselectable"
|
||||
>
|
||||
input here
|
||||
</div>
|
||||
<ul>
|
||||
<li
|
||||
class="ant-select-search ant-select-search--inline"
|
||||
>
|
||||
<div
|
||||
class="ant-select-search__field__wrap"
|
||||
>
|
||||
<textarea
|
||||
class="ant-input ant-select-search__field"
|
||||
style="height:50px;"
|
||||
/>
|
||||
<span
|
||||
class="ant-select-search__field__mirror"
|
||||
>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<span
|
||||
class="ant-select-arrow"
|
||||
style="user-select:none;-webkit-user-select:none;"
|
||||
unselectable="unselectable"
|
||||
>
|
||||
<b />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders ./components/auto-complete/demo/basic.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-select-show-search ant-select-auto-complete ant-select ant-select-combobox ant-select-enabled"
|
||||
@@ -64,7 +10,7 @@ exports[`renders ./components/auto-complete/demo/basic.md correctly 1`] = `
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
class="ant-select-selection
|
||||
ant-select-selection--single"
|
||||
ant-select-selection--single"
|
||||
role="combobox"
|
||||
>
|
||||
<div
|
||||
@@ -123,7 +69,7 @@ exports[`renders ./components/auto-complete/demo/certain-category.md correctly 1
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
class="ant-select-selection
|
||||
ant-select-selection--single"
|
||||
ant-select-selection--single"
|
||||
role="combobox"
|
||||
>
|
||||
<div
|
||||
@@ -180,6 +126,54 @@ exports[`renders ./components/auto-complete/demo/certain-category.md correctly 1
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders ./components/auto-complete/demo/custom.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-select-show-search ant-select-auto-complete ant-select ant-select-combobox ant-select-enabled"
|
||||
style="width:200px;"
|
||||
>
|
||||
<div
|
||||
aria-autocomplete="list"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
class="ant-select-selection
|
||||
ant-select-selection--single"
|
||||
role="combobox"
|
||||
>
|
||||
<div
|
||||
class="ant-select-selection__rendered"
|
||||
>
|
||||
<ul>
|
||||
<li
|
||||
class="ant-select-search ant-select-search--inline"
|
||||
>
|
||||
<div
|
||||
class="ant-select-search__field__wrap"
|
||||
>
|
||||
<textarea
|
||||
class="ant-input custom ant-select-search__field"
|
||||
placeholder="input here"
|
||||
style="height:50px;"
|
||||
/>
|
||||
<span
|
||||
class="ant-select-search__field__mirror"
|
||||
>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<span
|
||||
class="ant-select-arrow"
|
||||
style="user-select:none;-webkit-user-select:none;"
|
||||
unselectable="unselectable"
|
||||
>
|
||||
<b />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders ./components/auto-complete/demo/non-case-sensitive.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-select-show-search ant-select-auto-complete ant-select ant-select-combobox ant-select-enabled"
|
||||
@@ -190,7 +184,7 @@ exports[`renders ./components/auto-complete/demo/non-case-sensitive.md correctly
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
class="ant-select-selection
|
||||
ant-select-selection--single"
|
||||
ant-select-selection--single"
|
||||
role="combobox"
|
||||
>
|
||||
<div
|
||||
@@ -245,7 +239,7 @@ exports[`renders ./components/auto-complete/demo/options.md correctly 1`] = `
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
class="ant-select-selection
|
||||
ant-select-selection--single"
|
||||
ant-select-selection--single"
|
||||
role="combobox"
|
||||
>
|
||||
<div
|
||||
@@ -304,7 +298,7 @@ exports[`renders ./components/auto-complete/demo/uncertain-category.md correctly
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
class="ant-select-selection
|
||||
ant-select-selection--single"
|
||||
ant-select-selection--single"
|
||||
role="combobox"
|
||||
>
|
||||
<div
|
||||
|
||||
@@ -45,12 +45,16 @@ class Complete extends React.Component {
|
||||
return (
|
||||
<AutoComplete
|
||||
dataSource={dataSource}
|
||||
style={{ width: 200, height: 50 }}
|
||||
style={{ width: 200 }}
|
||||
onSelect={onSelect}
|
||||
onSearch={this.handleSearch}
|
||||
placeholder="input here"
|
||||
>
|
||||
<TextArea onKeyPress={this.handleKeyPress} style={{ height: 50 }} />
|
||||
<TextArea
|
||||
placeholder="input here"
|
||||
className="custom"
|
||||
style={{ height: 50 }}
|
||||
onKeyPress={this.handleKeyPress}
|
||||
/>
|
||||
</AutoComplete>
|
||||
);
|
||||
}
|
||||
@@ -18,19 +18,20 @@ const dataSource = ['12345', '23456', '34567'];
|
||||
<AutoComplete dataSource={dataSource} />
|
||||
```
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|----------------|----------------------------------|------------|--------|
|
||||
| dataSource | Data source for autocomplete | [DataSourceItemType](https://git.io/vMMKF)[] | |
|
||||
| value | selected option | string\|string[]\|{ key: string, label: string\|ReactNode }\|Array<{ key: string, label: string\|ReactNode }> | - |
|
||||
| defaultValue | Initial selected option. | string\|string[]\|{ key: string, label: string\|ReactNode }\|Array<{ key: string, label: string\|ReactNode }> | - |
|
||||
| allowClear | Show clear button, effective in multiple mode only. | boolean | false |
|
||||
| onChange | Called when select an option or input value change, or value of input is changed | function(value, label) | - |
|
||||
| onSelect | Called when a option is selected. param is option's value and option instance. | function(value, option) | - |
|
||||
| onSearch | Called when searching items. | function(value) | - |
|
||||
| disabled | Whether disabled select | boolean | false |
|
||||
| defaultActiveFirstOption | Whether active first option by default | boolean | true |
|
||||
| placeholder | placeholder of input | string | - |
|
||||
| children (for dataSource) | Data source for autocomplet | React.ReactElement<OptionProps> / Array<React.ReactElement<OptionProps>> | - |
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| allowClear | Show clear button, effective in multiple mode only. | boolean | false |
|
||||
| backfill | backfill selected item the input when using keyboard | boolean | false |
|
||||
| children (for customize input element) | customize input element | HTMLInputElement / HTMLTextAreaElement / React.ReactElement<InputProps> | `<Input />` |
|
||||
| children (for dataSource) | Data source for autocomplet | React.ReactElement<OptionProps> / Array<React.ReactElement<OptionProps>> | - |
|
||||
| dataSource | Data source for autocomplete | [DataSourceItemType](https://git.io/vMMKF)\[] | |
|
||||
| defaultActiveFirstOption | Whether active first option by default | boolean | true |
|
||||
| defaultValue | Initial selected option. | string\|string\[]\|{ key: string, label: string\|ReactNode }\|Array<{ key: string, label: string\|ReactNode }> | - |
|
||||
| disabled | Whether disabled select | boolean | false |
|
||||
| filterOption | If true, filter options by input, if function, filter options against it. The function will receive two arguments, `inputValue` and `option`, if the function returns `true`, the option will be included in the filtered set; Otherwise, it will be excluded. | boolean or function(inputValue, option) | true |
|
||||
| optionLabelProp | Which prop value of option will render as content of select. | string | `children` |
|
||||
| filterOption | If true, filter options by input, if function, filter options against it. The function will receive two arguments, `inputValue` and `option`, if the function returns `true`, the option will be included in the filtered set; Otherwise, it will be excluded. | boolean or function(inputValue, option) | true |
|
||||
| placeholder | placeholder of input | string | - |
|
||||
| value | selected option | string\|string\[]\|{ key: string, label: string\|ReactNode }\|Array<{ key: string, label: string\|ReactNode }> | - |
|
||||
| onChange | Called when select an option or input value change, or value of input is changed | function(value, label) | - |
|
||||
| onSearch | Called when searching items. | function(value) | - |
|
||||
| onSelect | Called when a option is selected. param is option's value and option instance. | function(value, option) | - |
|
||||
|
||||
@@ -51,8 +51,11 @@ export default class AutoComplete extends React.Component<AutoCompleteProps, any
|
||||
const { children } = this.props;
|
||||
const element = children && React.isValidElement(children) && children.type !== Option ?
|
||||
React.Children.only(this.props.children) : <Input />;
|
||||
const elementProps = { ...element.props };
|
||||
// https://github.com/ant-design/ant-design/pull/7742
|
||||
delete elementProps.children;
|
||||
return (
|
||||
<InputElement {...element.props}>{element}</InputElement>
|
||||
<InputElement {...elementProps}>{element}</InputElement>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,19 +19,20 @@ const dataSource = ['12345', '23456', '34567'];
|
||||
<AutoComplete dataSource={dataSource} />
|
||||
```
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|----------------|----------------------------------|------------|---------|
|
||||
| dataSource | 自动完成的数据源 | [DataSourceItemType](https://git.io/vMMKF)[] | |
|
||||
| value | 指定当前选中的条目 | string\|string[]\|{ key: string, label: string\|ReactNode }\|Array<{ key: string, label: string\|ReactNode }> | 无 |
|
||||
| defaultValue | 指定默认选中的条目 | string\|string[]\|{ key: string, label: string\|ReactNode }\|Array<{ key: string, label: string\|ReactNode}> | 无 |
|
||||
| allowClear | 支持清除, 单选模式有效 | boolean | false |
|
||||
| onChange | 选中 option,或 input 的 value 变化时,调用此函数 | function(value) | 无 |
|
||||
| onSelect | 被选中时调用,参数为选中项的 value 值 | function(value, option) | 无 |
|
||||
| onSearch | 搜索补全项的时候调用 | function(value) | 无 |
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| allowClear | 支持清除, 单选模式有效 | boolean | false |
|
||||
| backfill | 使用键盘选择选项的时候把选中项回填到输入框中 | boolean | false |
|
||||
| children (自动完成的数据源) | 自动完成的数据源 | React.ReactElement<OptionProps> / Array<React.ReactElement<OptionProps>> | - |
|
||||
| children (自定义输入框) | 自定义输入框 | HTMLInputElement / HTMLTextAreaElement / React.ReactElement<InputProps> | `<Input />` |
|
||||
| dataSource | 自动完成的数据源 | [DataSourceItemType](https://git.io/vMMKF)\[] | |
|
||||
| defaultActiveFirstOption | 是否默认高亮第一个选项。 | boolean | true |
|
||||
| defaultValue | 指定默认选中的条目 | string\|string\[]\|{ key: string, label: string\|ReactNode }\|Array<{ key: string, label: string\|ReactNode}> | 无 |
|
||||
| disabled | 是否禁用 | boolean | false |
|
||||
| defaultActiveFirstOption | 是否默认高亮第一个选项。 | boolean | true
|
||||
| placeholder | 输入框提示 | string | - |
|
||||
| children (自动完成的数据源) | 自动完成的数据源 | React.ReactElement<OptionProps> / Array<React.ReactElement<OptionProps>> | - |
|
||||
| children (自定义输入框) | 自定义输入框 | HTMLInputElement / HTMLTextAreaElement / React.ReactElement<InputProps> | `<Input />` |
|
||||
| filterOption | 是否根据输入项进行筛选。当其为一个函数时,会接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 `true`,反之则返回 `false`。 | boolean or function(inputValue, option) | true |
|
||||
| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` |
|
||||
| filterOption | 是否根据输入项进行筛选。当其为一个函数时,会接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 `true`,反之则返回 `false`。 | boolean or function(inputValue, option) | true |
|
||||
| placeholder | 输入框提示 | string | - |
|
||||
| value | 指定当前选中的条目 | string\|string\[]\|{ key: string, label: string\|ReactNode }\|Array<{ key: string, label: string\|ReactNode }> | 无 |
|
||||
| onChange | 选中 option,或 input 的 value 变化时,调用此函数 | function(value) | 无 |
|
||||
| onSearch | 搜索补全项的时候调用 | function(value) | 无 |
|
||||
| onSelect | 被选中时调用,参数为选中项的 value 值 | function(value, option) | 无 |
|
||||
|
||||
@@ -19,12 +19,22 @@
|
||||
line-height: @input-height-base;
|
||||
}
|
||||
&__placeholder {
|
||||
margin-left: (@input-padding-horizontal + 1px);
|
||||
margin-right: (@input-padding-horizontal + 1px);
|
||||
margin-left: (@input-padding-horizontal-base + 1px);
|
||||
margin-right: (@input-padding-horizontal-base + 1px);
|
||||
}
|
||||
|
||||
&--single {
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fix https://github.com/ant-design/ant-design/issues/7800
|
||||
.@{select-prefix-cls}-search--inline {
|
||||
position: static;
|
||||
float: left;
|
||||
}
|
||||
|
||||
&-allow-clear {
|
||||
.@{select-prefix-cls}-selection:hover .@{select-prefix-cls}-selection__rendered {
|
||||
margin-right: 0 !important;
|
||||
@@ -33,6 +43,13 @@
|
||||
|
||||
.@{input-prefix-cls} {
|
||||
background: transparent;
|
||||
border-width: @border-width-base;
|
||||
line-height: @line-height-base;
|
||||
height: @input-height-base;
|
||||
&:focus,
|
||||
&:hover {
|
||||
.hover;
|
||||
}
|
||||
}
|
||||
|
||||
&-lg {
|
||||
@@ -40,7 +57,9 @@
|
||||
line-height: @input-height-lg;
|
||||
}
|
||||
.@{input-prefix-cls} {
|
||||
.input-lg();
|
||||
padding-top: @input-padding-vertical-lg;
|
||||
padding-bottom: @input-padding-vertical-lg;
|
||||
height: @input-height-lg;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,15 +68,9 @@
|
||||
line-height: @input-height-sm;
|
||||
}
|
||||
.@{input-prefix-cls} {
|
||||
.input-sm();
|
||||
}
|
||||
}
|
||||
|
||||
.@{input-prefix-cls} {
|
||||
border-width: @border-width-base;
|
||||
&:focus,
|
||||
&:hover {
|
||||
.hover;
|
||||
padding-top: @input-padding-vertical-sm;
|
||||
padding-bottom: @input-padding-vertical-sm;
|
||||
height: @input-height-sm;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +192,6 @@ exports[`renders ./components/avatar/demo/badge.md correctly 1`] = `
|
||||
<sup
|
||||
class="ant-scroll-number ant-badge-dot"
|
||||
data-show="true"
|
||||
title=""
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
@@ -4,13 +4,13 @@ type: Data Display
|
||||
title: Avatar
|
||||
---
|
||||
|
||||
Avatars can be used to represent people or object, which supports image, antd-Icon, or letter.
|
||||
Avatars can be used to represent people or objects. It supports images, `Icon`s, or letters.
|
||||
|
||||
## API
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|----------- |--------------------------------------------------------- | ---------- |-------|
|
||||
| shape | to set the shape of avatar | Enum{ 'circle', 'square' } | `circle` |
|
||||
| size | to set the size of avatar | Enum{ 'large', 'small', 'default' } | `default` |
|
||||
| src | the address of a image avatar | string | - |
|
||||
| icon | the icon type of a icon avatar, see `Icon` Component | string | - |
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| icon | the `Icon` type for an icon avatar, see `Icon` Component | string | - |
|
||||
| shape | the shape of avatar | `circle` \| `square` | `circle` |
|
||||
| size | the size of the avatar | `large` \| `small` \| `default` | `default` |
|
||||
| src | the address of the image for an image avatar | string | - |
|
||||
|
||||
@@ -9,9 +9,9 @@ title: Avatar
|
||||
|
||||
## API
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|----------- |--------------------------------------------------------- | ---------- | ------- |
|
||||
| shape | 指定头像的形状 | Enum{ 'circle', 'square' } | `circle` |
|
||||
| size | 设置头像的大小 | Enum{ 'large', 'small', 'default' } | `default` |
|
||||
| src | 图片类头像的资源地址 | string | - |
|
||||
| icon | 设置头像的图标类型,参考 `Icon` 组件 | string | - |
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| icon | 设置头像的图标类型,参考 `Icon` 组件 | string | - |
|
||||
| shape | 指定头像的形状 | Enum{ 'circle', 'square' } | `circle` |
|
||||
| size | 设置头像的大小 | Enum{ 'large', 'small', 'default' } | `default` |
|
||||
| src | 图片类头像的资源地址 | string | - |
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
& > img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,17 +2,23 @@ import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import BackTop from '..';
|
||||
|
||||
const delay = timeout => new Promise(resolve => setTimeout(resolve, timeout));
|
||||
|
||||
describe('BackTop', () => {
|
||||
it('should scroll to top after click it', async () => {
|
||||
beforeAll(() => {
|
||||
jest.useFakeTimers();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
it('should scroll to top after click it', () => {
|
||||
const wrapper = mount(<BackTop visibilityHeight={-1} />);
|
||||
document.documentElement.scrollTop = 400;
|
||||
// trigger scroll manually
|
||||
wrapper.node.handleScroll();
|
||||
await delay(500);
|
||||
jest.runAllTimers();
|
||||
wrapper.find('.ant-back-top').simulate('click');
|
||||
await delay(500);
|
||||
jest.runAllTimers();
|
||||
expect(Math.round(document.documentElement.scrollTop)).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,12 +14,11 @@ title: BackTop
|
||||
## API
|
||||
|
||||
> The distance to the bottom is set to `50px` by default, which is overridable.
|
||||
|
||||
>
|
||||
> If you decide to use custom styles, please note the size limit: no more than `40px * 40px`.
|
||||
|
||||
|
||||
Property | Description | Type | Default
|
||||
-----|-----|-----|------
|
||||
visibilityHeight | the `BackTop` button will not show until the scroll height reaches this value | number | 400
|
||||
onClick | a callback function, which can be executed when you click the button | Function | -
|
||||
target | specifies the scrollable area dom node | () => HTMLElement | () => window
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| target | specifies the scrollable area dom node | () => HTMLElement | () => window |
|
||||
| visibilityHeight | the `BackTop` button will not show until the scroll height reaches this value | number | 400 |
|
||||
| onClick | a callback function, which can be executed when you click the button | Function | - |
|
||||
|
||||
@@ -15,11 +15,11 @@ title: BackTop
|
||||
## API
|
||||
|
||||
> 有默认样式,距离底部 `50px`,可覆盖。
|
||||
>
|
||||
> 自定义样式宽高不大于 40px \* 40px。
|
||||
|
||||
> 自定义样式宽高不大于 40px * 40px。
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|-------------|----------------|--------------------|--------------|
|
||||
| visibilityHeight | 滚动高度达到此参数值才出现 `BackTop` | number | 400 |
|
||||
| onClick | 点击按钮的回调函数 | Function | - |
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| target | 设置需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 | Function | () => window |
|
||||
| visibilityHeight | 滚动高度达到此参数值才出现 `BackTop` | number | 400 |
|
||||
| onClick | 点击按钮的回调函数 | Function | - |
|
||||
|
||||
@@ -18,6 +18,7 @@ export interface ScrollNumberProps {
|
||||
component?: string;
|
||||
onAnimated?: Function;
|
||||
style?: React.CSSProperties;
|
||||
title?: string | number;
|
||||
}
|
||||
|
||||
export default class ScrollNumber extends Component<ScrollNumberProps, any> {
|
||||
@@ -119,7 +120,7 @@ export default class ScrollNumber extends Component<ScrollNumberProps, any> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { prefixCls, className, style, count, component = 'sup' } = this.props;
|
||||
const { prefixCls, className, style, title, component = 'sup' } = this.props;
|
||||
// fix https://fb.me/react-unknown-prop
|
||||
const restProps = omit(this.props, [
|
||||
'count',
|
||||
@@ -129,11 +130,8 @@ export default class ScrollNumber extends Component<ScrollNumberProps, any> {
|
||||
]);
|
||||
const newProps = {
|
||||
...restProps,
|
||||
className: classNames({
|
||||
[`${prefixCls}`]: !!prefixCls,
|
||||
[`${className}`]: !!className,
|
||||
}),
|
||||
title: count as string,
|
||||
className: classNames(prefixCls, className),
|
||||
title: title as string,
|
||||
};
|
||||
// allow specify the border
|
||||
// mock border-color by box-shadow for compatible with old usage:
|
||||
|
||||
@@ -395,7 +395,6 @@ exports[`renders ./components/badge/demo/change.md correctly 1`] = `
|
||||
<sup
|
||||
class="ant-scroll-number ant-badge-dot"
|
||||
data-show="true"
|
||||
title=""
|
||||
/>
|
||||
</span>
|
||||
<span
|
||||
@@ -422,7 +421,6 @@ exports[`renders ./components/badge/demo/dot.md correctly 1`] = `
|
||||
<sup
|
||||
class="ant-scroll-number ant-badge-dot"
|
||||
data-show="true"
|
||||
title=""
|
||||
/>
|
||||
</span>
|
||||
<span
|
||||
@@ -436,7 +434,6 @@ exports[`renders ./components/badge/demo/dot.md correctly 1`] = `
|
||||
<sup
|
||||
class="ant-scroll-number ant-badge-dot"
|
||||
data-show="true"
|
||||
title=""
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
@@ -1112,7 +1109,7 @@ exports[`renders ./components/badge/demo/no-wrapper.md correctly 1`] = `
|
||||
class="ant-scroll-number ant-badge-count"
|
||||
data-show="true"
|
||||
style="background-color:#87d068;"
|
||||
title="99+"
|
||||
title="109"
|
||||
>
|
||||
99+
|
||||
</sup>
|
||||
@@ -1456,7 +1453,7 @@ exports[`renders ./components/badge/demo/overflow.md correctly 1`] = `
|
||||
<sup
|
||||
class="ant-scroll-number ant-badge-count"
|
||||
data-show="true"
|
||||
title="99+"
|
||||
title="100"
|
||||
>
|
||||
99+
|
||||
</sup>
|
||||
@@ -1471,7 +1468,7 @@ exports[`renders ./components/badge/demo/overflow.md correctly 1`] = `
|
||||
<sup
|
||||
class="ant-scroll-number ant-badge-count"
|
||||
data-show="true"
|
||||
title="10+"
|
||||
title="99"
|
||||
>
|
||||
10+
|
||||
</sup>
|
||||
@@ -1486,7 +1483,7 @@ exports[`renders ./components/badge/demo/overflow.md correctly 1`] = `
|
||||
<sup
|
||||
class="ant-scroll-number ant-badge-count"
|
||||
data-show="true"
|
||||
title="999+"
|
||||
title="1000"
|
||||
>
|
||||
999+
|
||||
</sup>
|
||||
|
||||
@@ -4,11 +4,11 @@ type: Data Display
|
||||
title: Badge
|
||||
---
|
||||
|
||||
Small numerical value or status descriptors for UI elements.
|
||||
Small numerical value or status descriptor for UI elements.
|
||||
|
||||
## When To Use
|
||||
|
||||
Badge normally appears in proximity to notification or head picture with eye-catching appeal, typically displaying unread messages count.
|
||||
Badge normally appears in proximity to notifications or user avatars with eye-catching appeal, typically displaying unread messages count.
|
||||
|
||||
## API
|
||||
|
||||
@@ -18,16 +18,15 @@ Badge normally appears in proximity to notification or head picture with eye-cat
|
||||
</Badge>
|
||||
```
|
||||
|
||||
|
||||
```jsx
|
||||
<Badge count={5} />
|
||||
```
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|----------------|-------------------------|------------|---------|
|
||||
| count | Number to show in badge | number | |
|
||||
| overflowCount | Max count to show | number | 99 |
|
||||
| showZero | Whether to show badge when `count` is zero | 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 | '' |
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| count | Number to show in badge | number | |
|
||||
| dot | Whether to display a red dot instead of `count` | boolean | `false` |
|
||||
| overflowCount | Max count to show | number | 99 |
|
||||
| showZero | Whether to show badge when `count` is zero | boolean | `false` |
|
||||
| status | Set Badge as a status dot | `success` \| `processing` \| `default` \| `error` \| `warning` | `''` |
|
||||
| text | If `status` is set, `text` sets the display text of the status `dot` | string | `''` |
|
||||
|
||||
@@ -15,6 +15,7 @@ export interface BadgeProps {
|
||||
dot?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
prefixCls?: string;
|
||||
scrollNumberPrefixCls?: string;
|
||||
className?: string;
|
||||
status?: 'success' | 'processing' | 'default' | 'error' | 'warning';
|
||||
text?: string;
|
||||
@@ -23,6 +24,7 @@ export interface BadgeProps {
|
||||
export default class Badge extends React.Component<BadgeProps, any> {
|
||||
static defaultProps = {
|
||||
prefixCls: 'ant-badge',
|
||||
scrollNumberPrefixCls: 'ant-scroll-number',
|
||||
count: null,
|
||||
showZero: false,
|
||||
dot: false,
|
||||
@@ -44,6 +46,7 @@ export default class Badge extends React.Component<BadgeProps, any> {
|
||||
count,
|
||||
showZero,
|
||||
prefixCls,
|
||||
scrollNumberPrefixCls,
|
||||
overflowCount,
|
||||
className,
|
||||
style,
|
||||
@@ -92,9 +95,11 @@ export default class Badge extends React.Component<BadgeProps, any> {
|
||||
|
||||
const scrollNumber = hidden ? null : (
|
||||
<ScrollNumber
|
||||
prefixCls={scrollNumberPrefixCls}
|
||||
data-show={!hidden}
|
||||
className={scrollNumberCls}
|
||||
count={displayCount}
|
||||
title={count}
|
||||
style={style}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -19,16 +19,15 @@ title: Badge
|
||||
</Badge>
|
||||
```
|
||||
|
||||
|
||||
```jsx
|
||||
<Badge count={5} />
|
||||
```
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|----------------|----------------------------------|------------|---------|
|
||||
| count | 展示的数字,大于 overflowCount 时显示为 `${overflowCount}+`,为 0 时隐藏 | number | |
|
||||
| overflowCount | 展示封顶的数字值 | number | 99 |
|
||||
| showZero | 当数值为 0 时,是否展示 Badge | boolean | false |
|
||||
| dot | 不展示数字,只有一个小红点 | boolean | false |
|
||||
| status | 设置 Badge 为状态点 | Enum{ 'success', 'processing, 'default', 'error', 'warning' } | '' |
|
||||
| text | 在设置了 `status` 的前提下有效,设置状态点的文本 | string | '' |
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| count | 展示的数字,大于 overflowCount 时显示为 `${overflowCount}+`,为 0 时隐藏 | number | |
|
||||
| dot | 不展示数字,只有一个小红点 | boolean | false |
|
||||
| overflowCount | 展示封顶的数字值 | number | 99 |
|
||||
| showZero | 当数值为 0 时,是否展示 Badge | boolean | false |
|
||||
| status | 设置 Badge 为状态点 | Enum{ 'success', 'processing, 'default', 'error', 'warning' } | '' |
|
||||
| text | 在设置了 `status` 的前提下有效,设置状态点的文本 | string | '' |
|
||||
|
||||
@@ -15,26 +15,36 @@ A breadcrumb displays the current location within a hierarchy. It allows going b
|
||||
|
||||
## API
|
||||
|
||||
| Property | Description | Type | Optional | Default |
|
||||
|-----------|-----------------------------------|-----------------|---------|--------|
|
||||
| routes | The routing stack information of router | object[] | | - |
|
||||
| params | Routing parameter | object | | - |
|
||||
| separator | Custom separator | string\|ReactNode | | '/' |
|
||||
| itemRender | Custom item renderer | (route, params, routes, paths) => ReactNode | | - |
|
||||
| Property | Description | Type | Optional | Default |
|
||||
| -------- | ----------- | ---- | -------- | ------- |
|
||||
| itemRender | Custom item renderer | (route, params, routes, paths) => ReactNode | | - |
|
||||
| params | Routing parameters | object | | - |
|
||||
| routes | The routing stack information of router | object\[] | | - |
|
||||
| separator | Custom separator | string\|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.
|
||||
The link of Breadcrumb item targets `#` by default, you can use `itemRender` to make a `browserHistory` Link.
|
||||
|
||||
```jsx
|
||||
import { Link } from 'react-router';
|
||||
|
||||
const routes = [{
|
||||
path: 'index',
|
||||
breadcrumbName: 'home'
|
||||
}, {
|
||||
path: 'first',
|
||||
breadcrumbName: 'first'
|
||||
}, {
|
||||
path: 'second',
|
||||
breadcrumbName: 'second'
|
||||
}];
|
||||
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} />;
|
||||
return <Breadcrumb itemRender={itemRender} routes={routes} />;
|
||||
```
|
||||
|
||||
@@ -15,12 +15,12 @@ title: Breadcrumb
|
||||
|
||||
## API
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|-----------|-----------------------------------|-----------------|---------|--------|
|
||||
| routes | router 的路由栈信息 | object[] | | - |
|
||||
| params | 路由的参数 | object | | - |
|
||||
| separator | 分隔符自定义 | string\|ReactNode | | '/' |
|
||||
| itemRender | 自定义链接函数,和 react-router 配置使用 | (route, params, routes, paths) => ReactNode | | - |
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| itemRender | 自定义链接函数,和 react-router 配置使用 | (route, params, routes, paths) => ReactNode | | - |
|
||||
| params | 路由的参数 | object | | - |
|
||||
| routes | router 的路由栈信息 | object\[] | | - |
|
||||
| separator | 分隔符自定义 | string\|ReactNode | | '/' |
|
||||
|
||||
> 2.0 之后,`linkRender` 和 `nameRender` 被移除,请使用 `itemRender` 来代替。
|
||||
|
||||
@@ -31,10 +31,20 @@ title: Breadcrumb
|
||||
```jsx
|
||||
import { Link } from 'react-router';
|
||||
|
||||
const routes = [{
|
||||
path: 'index',
|
||||
breadcrumbName: '首页'
|
||||
}, {
|
||||
path: 'first',
|
||||
breadcrumbName: '一级面包屑'
|
||||
}, {
|
||||
path: 'second',
|
||||
breadcrumbName: '当前页面'
|
||||
}];
|
||||
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} />;
|
||||
return <Breadcrumb itemRender={itemRender} routes={routes}/>;
|
||||
```
|
||||
|
||||
@@ -54,7 +54,7 @@ exports[`renders ./components/button/demo/button-group.md correctly 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-primary"
|
||||
class="ant-btn"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
@@ -97,7 +97,7 @@ exports[`renders ./components/button/demo/button-group.md correctly 1`] = `
|
||||
class="ant-btn-group"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-primary"
|
||||
class="ant-btn"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
@@ -115,14 +115,6 @@ exports[`renders ./components/button/demo/button-group.md correctly 1`] = `
|
||||
<button
|
||||
class="ant-btn"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
M
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-dashed"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
R
|
||||
@@ -465,7 +457,7 @@ exports[`renders ./components/button/demo/multiple.md correctly 1`] = `
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
more
|
||||
Actions
|
||||
</span>
|
||||
<i
|
||||
class="anticon anticon-down"
|
||||
@@ -480,12 +472,13 @@ exports[`renders ./components/button/demo/size.md correctly 1`] = `
|
||||
class="ant-radio-group"
|
||||
>
|
||||
<label
|
||||
class="ant-radio-button-wrapper"
|
||||
class="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
|
||||
>
|
||||
<span
|
||||
class="ant-radio-button"
|
||||
class="ant-radio-button ant-radio-button-checked"
|
||||
>
|
||||
<input
|
||||
checked=""
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
/>
|
||||
@@ -498,13 +491,12 @@ exports[`renders ./components/button/demo/size.md correctly 1`] = `
|
||||
</span>
|
||||
</label>
|
||||
<label
|
||||
class="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
|
||||
class="ant-radio-button-wrapper"
|
||||
>
|
||||
<span
|
||||
class="ant-radio-button ant-radio-button-checked"
|
||||
class="ant-radio-button"
|
||||
>
|
||||
<input
|
||||
checked=""
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
/>
|
||||
@@ -538,7 +530,40 @@ exports[`renders ./components/button/demo/size.md correctly 1`] = `
|
||||
<br />
|
||||
<br />
|
||||
<button
|
||||
class="ant-btn ant-btn-primary ant-btn-circle ant-btn-icon-only"
|
||||
class="ant-btn ant-btn-primary ant-btn-lg"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Primary
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-lg"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Normal
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-dashed ant-btn-lg"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Dashed
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-danger ant-btn-lg"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Danger
|
||||
</span>
|
||||
</button>
|
||||
<br />
|
||||
<button
|
||||
class="ant-btn ant-btn-primary ant-btn-circle ant-btn-lg ant-btn-icon-only"
|
||||
type="button"
|
||||
>
|
||||
<i
|
||||
@@ -546,7 +571,7 @@ exports[`renders ./components/button/demo/size.md correctly 1`] = `
|
||||
/>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-primary"
|
||||
class="ant-btn ant-btn-primary ant-btn-lg"
|
||||
type="button"
|
||||
>
|
||||
<i
|
||||
@@ -556,17 +581,9 @@ exports[`renders ./components/button/demo/size.md correctly 1`] = `
|
||||
Download
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-primary"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Normal
|
||||
</span>
|
||||
</button>
|
||||
<br />
|
||||
<div
|
||||
class="ant-btn-group"
|
||||
class="ant-btn-group ant-btn-group-lg"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-primary"
|
||||
|
||||
@@ -11,7 +11,7 @@ export interface ButtonGroupProps {
|
||||
}
|
||||
|
||||
const ButtonGroup: React.SFC<ButtonGroupProps> = (props) => {
|
||||
const { prefixCls = 'ant-btn-group', size = '', className, ...others } = props;
|
||||
const { prefixCls = 'ant-btn-group', size, className, ...others } = props;
|
||||
|
||||
// large => lg
|
||||
// small => sm
|
||||
|
||||
@@ -35,7 +35,7 @@ function insertSpace(child: React.ReactChild, needInserted: boolean) {
|
||||
|
||||
export type ButtonType = 'primary' | 'ghost' | 'dashed' | 'danger';
|
||||
export type ButtonShape = 'circle' | 'circle-outline';
|
||||
export type ButtonSize = 'small' | 'large';
|
||||
export type ButtonSize = 'small' | 'default' | 'large';
|
||||
|
||||
export interface ButtonProps {
|
||||
type?: ButtonType;
|
||||
@@ -61,7 +61,6 @@ export default class Button extends React.Component<ButtonProps, any> {
|
||||
static defaultProps = {
|
||||
prefixCls: 'ant-btn',
|
||||
loading: false,
|
||||
clicked: false,
|
||||
ghost: false,
|
||||
};
|
||||
|
||||
@@ -83,6 +82,7 @@ export default class Button extends React.Component<ButtonProps, any> {
|
||||
super(props);
|
||||
this.state = {
|
||||
loading: props.loading,
|
||||
clicked: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ export default class Button extends React.Component<ButtonProps, any> {
|
||||
|
||||
render() {
|
||||
const {
|
||||
type, shape, size = '', className, htmlType, children, icon, prefixCls, ghost, ...others,
|
||||
type, shape, size, className, htmlType, children, icon, prefixCls, ghost, ...others,
|
||||
} = this.props;
|
||||
|
||||
const { loading, clicked } = this.state;
|
||||
@@ -146,7 +146,7 @@ export default class Button extends React.Component<ButtonProps, any> {
|
||||
[`${prefixCls}-${type}`]: type,
|
||||
[`${prefixCls}-${shape}`]: shape,
|
||||
[`${prefixCls}-${sizeCls}`]: sizeCls,
|
||||
[`${prefixCls}-icon-only`]: !children && icon && !loading,
|
||||
[`${prefixCls}-icon-only`]: !children && icon,
|
||||
[`${prefixCls}-loading`]: loading,
|
||||
[`${prefixCls}-clicked`]: clicked,
|
||||
[`${prefixCls}-background-ghost`]: ghost,
|
||||
@@ -159,7 +159,7 @@ export default class Button extends React.Component<ButtonProps, any> {
|
||||
|
||||
return (
|
||||
<button
|
||||
{...omit(others, ['loading', 'clicked'])}
|
||||
{...omit(others, ['loading'])}
|
||||
type={htmlType || 'button'}
|
||||
className={classes}
|
||||
onClick={this.handleClick}
|
||||
|
||||
@@ -26,7 +26,7 @@ ReactDOM.render(
|
||||
<h4>Basic</h4>
|
||||
<ButtonGroup>
|
||||
<Button>Cancel</Button>
|
||||
<Button type="primary">OK</Button>
|
||||
<Button>OK</Button>
|
||||
</ButtonGroup>
|
||||
<ButtonGroup>
|
||||
<Button disabled>L</Button>
|
||||
@@ -34,10 +34,9 @@ ReactDOM.render(
|
||||
<Button disabled>R</Button>
|
||||
</ButtonGroup>
|
||||
<ButtonGroup>
|
||||
<Button type="primary">L</Button>
|
||||
<Button>L</Button>
|
||||
<Button>M</Button>
|
||||
<Button>M</Button>
|
||||
<Button type="dashed">R</Button>
|
||||
<Button>R</Button>
|
||||
</ButtonGroup>
|
||||
|
||||
<h4>With Icon</h4>
|
||||
|
||||
@@ -35,7 +35,7 @@ ReactDOM.render(
|
||||
<Button>secondary</Button>
|
||||
<Dropdown overlay={menu}>
|
||||
<Button>
|
||||
more <Icon type="down" />
|
||||
Actions <Icon type="down" />
|
||||
</Button>
|
||||
</Dropdown>
|
||||
</div>,
|
||||
|
||||
@@ -22,7 +22,7 @@ import { Button, Radio, Icon } from 'antd';
|
||||
|
||||
class ButtonSize extends React.Component {
|
||||
state = {
|
||||
size: 'default',
|
||||
size: 'large',
|
||||
};
|
||||
|
||||
handleSizeChange = (e) => {
|
||||
@@ -39,9 +39,13 @@ class ButtonSize extends React.Component {
|
||||
<Radio.Button value="small">Small</Radio.Button>
|
||||
</Radio.Group>
|
||||
<br /><br />
|
||||
<Button type="primary" size={size}>Primary</Button>
|
||||
<Button size={size}>Normal</Button>
|
||||
<Button type="dashed" size={size}>Dashed</Button>
|
||||
<Button type="danger" size={size}>Danger</Button>
|
||||
<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">
|
||||
|
||||
@@ -14,18 +14,18 @@ A button means an operation (or a series of operations). Clicking a button will
|
||||
|
||||
To get a customized button, just set `type`/`shape`/`size`/`loading`/`disabled`.
|
||||
|
||||
Property | Description | Type | Default
|
||||
-----|-----|-----|------
|
||||
type | can be set to `primary` `dashed` `danger`(added in 2.7) or omitted | string | 'default'
|
||||
htmlType | to set the original `type` of `button`, see: [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) | string | `button`
|
||||
icon | set the icon of button, see: Icon component | string | -
|
||||
shape | can be set to `circle` or omitted | string | -
|
||||
size | can be set to `small` `large` or omitted | string | `default`
|
||||
loading | to set the loading status of button | boolean \| { delay: number } | `false`
|
||||
onClick | set the handler to handle `click` event | function | -
|
||||
ghost | make background transparent and invert text and border color, added in 2.7 | boolean | false
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| ghost | make background transparent and invert text and border colors, added in 2.7 | boolean | false |
|
||||
| htmlType | set the original html `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 | - |
|
||||
| loading | set the loading status of button | boolean \| { delay: number } | false |
|
||||
| shape | can be set to `circle` or omitted | string | - |
|
||||
| size | can be set to `small` `large` or omitted | string | `default` |
|
||||
| type | can be set to `primary` `ghost` `dashed` `danger`(added in 2.7) or omitted (meaning `default`) | string | `default` |
|
||||
| onClick | set the handler to handle `click` event | function | - |
|
||||
|
||||
`<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.
|
||||
`<Button>Hello world!</Button>` will be rendered into `<button><span>Hello world!</span></button>`, and all the properties which are not listed above will be transferred to the `<button>` tag.
|
||||
|
||||
<style>
|
||||
[id^=components-button-demo-] .ant-btn {
|
||||
|
||||
@@ -17,18 +17,18 @@ subtitle: 按钮
|
||||
|
||||
按钮的属性说明如下:
|
||||
|
||||
属性 | 说明 | 类型 | 默认值
|
||||
-----|-----|-----|------
|
||||
type | 设置按钮类型,可选值为 `primary` `dashed` `danger`(版本 2.7 中增加) 或者不设 | string | -
|
||||
htmlType | 设置 `button` 原生的 `type` 值,可选值请参考 [HTML 标准](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) | string | `button`
|
||||
icon | 设置按钮的图标类型 | string | -
|
||||
shape | 设置按钮形状,可选值为 `circle` 或者不设 | string | -
|
||||
size | 设置按钮大小,可选值为 `small` `large` 或者不设 | string | `default`
|
||||
loading | 设置按钮载入状态 | boolean \| { delay: number } | `false`
|
||||
onClick | `click` 事件的 handler | function | -
|
||||
ghost | 幽灵属性,使按钮背景透明,版本 2.7 中增加 | boolean | false
|
||||
| 属性 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| ghost | 幽灵属性,使按钮背景透明,版本 2.7 中增加 | boolean | false |
|
||||
| htmlType | 设置 `button` 原生的 `type` 值,可选值请参考 [HTML 标准](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) | string | `button` |
|
||||
| icon | 设置按钮的图标类型 | string | - |
|
||||
| loading | 设置按钮载入状态 | boolean \| { delay: number } | `false` |
|
||||
| shape | 设置按钮形状,可选值为 `circle` 或者不设 | string | - |
|
||||
| size | 设置按钮大小,可选值为 `small` `large` 或者不设 | string | `default` |
|
||||
| type | 设置按钮类型,可选值为 `primary` `dashed` `danger`(版本 2.7 中增加) 或者不设 | string | - |
|
||||
| onClick | `click` 事件的 handler | function | - |
|
||||
|
||||
`<Button>Hello world!</Button>` 最终会被渲染为 `<button>Hello world!</button>`,并且除了上表中的属性,其它属性都会直接传到 `<button></button>`。
|
||||
`<Button>Hello world!</Button>` 最终会被渲染为 `<button><span>Hello world!</span></button>`,并且除了上表中的属性,其它属性都会直接传到 `<button></button>`。
|
||||
|
||||
<style>
|
||||
[id^="components-button-demo-"] .ant-btn {
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
display: block;
|
||||
}
|
||||
|
||||
&&-loading:not(&-circle):not(&-circle-outline) {
|
||||
&&-loading:not(&-circle):not(&-circle-outline):not(&-icon-only) {
|
||||
padding-left: 29px;
|
||||
pointer-events: none;
|
||||
position: relative;
|
||||
@@ -102,7 +102,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
&-sm&-loading:not(&-circle):not(&-circle-outline) {
|
||||
&-sm&-loading:not(&-circle):not(&-circle-outline):not(&-icon-only) {
|
||||
padding-left: 24px;
|
||||
.@{iconfont-css-prefix} {
|
||||
margin-left: -17px;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -68,10 +68,12 @@ function getMonthData(value) {
|
||||
|
||||
function monthCellRender(value) {
|
||||
const num = getMonthData(value);
|
||||
return num ? <div className="notes-month">
|
||||
<section>{num}</section>
|
||||
<span>Backlog number</span>
|
||||
</div> : null;
|
||||
return num ? (
|
||||
<div className="notes-month">
|
||||
<section>{num}</section>
|
||||
<span>Backlog number</span>
|
||||
</div>
|
||||
) : null;
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
|
||||
@@ -9,11 +9,11 @@ Container for displaying data in calendar form.
|
||||
|
||||
## When To Use
|
||||
|
||||
When data is in the form of date, such as schedule, timetable, prices calendar, Lunar calendar. This component also supports Year/Month switch.
|
||||
When data is in the form of dates, such as schedules, timetables, prices calendar, lunar calendar. This component also supports Year/Month switch.
|
||||
|
||||
## API
|
||||
|
||||
**Note:** Part of locale of Calendar is read from value. So, please set the locale of moment correctly.
|
||||
**Note:** Part of the Calendar's locale is read from `value`. So, please set the locale of `moment` correctly.
|
||||
|
||||
```jsx
|
||||
import moment from 'moment';
|
||||
@@ -30,17 +30,17 @@ moment.locale('zh-cn');
|
||||
/>
|
||||
```
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|--------------|----------------|----------|--------------|
|
||||
| value | set date | [moment](http://momentjs.com/) | current date |
|
||||
| defaultValue | set default date | [moment](http://momentjs.com/) | default date |
|
||||
| mode | can be set to month or year | string | month |
|
||||
| fullscreen | to set whether full-screen display | boolean | true |
|
||||
| dateCellRender | to set the way of renderer the date cell, the returned content will be appended to the cell | function(date: moment): ReactNode | - |
|
||||
| monthCellRender | to set the way of renderer the month cell, the returned content will be appended to the cell | function(date: moment): ReactNode | - |
|
||||
| dateFullCellRender | to set the way of renderer the date cell,the returned content will override the cell | function(date: moment): ReactNode | - |
|
||||
| monthFullCellRender | to set the way of renderer the month cell,the returned content will override the cell | function(date: moment): ReactNode | - |
|
||||
| locale | set locale | object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
|
||||
| onPanelChange| callback when panel change | function(date: moment, mode: string) | - |
|
||||
| onSelect | callback when select date | function(date: moment) | - |
|
||||
| disabledDate | specify the date that cannot be selected | (currentDate: moment) => boolean | 无 |
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| dateCellRender | Customize the display of the date cell, the returned content will be appended to the cell | function(date: moment): ReactNode | - |
|
||||
| dateFullCellRender | Customize the display of the date cell, the returned content will override the cell | function(date: moment): ReactNode | - |
|
||||
| defaultValue | The date selected by default | [moment](http://momentjs.com/) | default date |
|
||||
| disabledDate | Function that specifies the dates that cannot be selected | (currentDate: moment) => boolean | - |
|
||||
| fullscreen | Whether to display in full-screen | boolean | `true` |
|
||||
| locale | The calendar's locale | object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
|
||||
| mode | The display mode of the calendar | `month` \| `year` | `month` |
|
||||
| monthCellRender | Customize the display of the month cell, the returned content will be appended to the cell | function(date: moment): ReactNode | - |
|
||||
| monthFullCellRender | Customize the display of the month cell, the returned content will override the cell | function(date: moment): ReactNode | - |
|
||||
| value | The current selected date | [moment](http://momentjs.com/) | current date |
|
||||
| onPanelChange | Callback for when panel changes | function(date: moment, mode: string) | - |
|
||||
| onSelect | Callback for when a date is selected | function(date: moment) | - |
|
||||
|
||||
@@ -12,7 +12,6 @@ title: Calendar
|
||||
|
||||
当数据是日期或按照日期划分时,例如日程、课表、价格日历等,农历等。目前支持年/月切换。
|
||||
|
||||
|
||||
## API
|
||||
|
||||
**注意:**Calendar 部分 locale 是从 value 中读取,所以请先正确设置 moment 的 locale。
|
||||
@@ -32,17 +31,17 @@ moment.locale('zh-cn');
|
||||
/>
|
||||
```
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|--------------|----------------|----------|--------------|
|
||||
| value | 展示日期 | [moment](http://momentjs.com/) | 当前日期 |
|
||||
| defaultValue | 默认展示的日期 | [moment](http://momentjs.com/) | 默认日期 |
|
||||
| mode | 初始模式,`month/year` | string | month |
|
||||
| fullscreen | 是否全屏显示 | boolean | true |
|
||||
| dateCellRender | 自定义渲染日期单元格,返回内容会被追加到单元格| function(date: moment): ReactNode | 无 |
|
||||
| monthCellRender | 自定义渲染月单元格,返回内容会被追加到单元格 | function(date: moment): ReactNode | 无 |
|
||||
| dateFullCellRender | 自定义渲染日期单元格,返回内容覆盖单元格| function(date: moment): ReactNode | 无 |
|
||||
| monthFullCellRender | 自定义渲染月单元格,返回内容覆盖单元格 | function(date: moment): ReactNode | 无 |
|
||||
| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
|
||||
| onPanelChange| 日期面板变化回调 | function(date: moment, mode: string) | 无 |
|
||||
| onSelect | 点击选择日期回调 | function(date: moment) | 无 |
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| dateCellRender | 自定义渲染日期单元格,返回内容会被追加到单元格 | function(date: moment): ReactNode | 无 |
|
||||
| dateFullCellRender | 自定义渲染日期单元格,返回内容覆盖单元格 | function(date: moment): ReactNode | 无 |
|
||||
| defaultValue | 默认展示的日期 | [moment](http://momentjs.com/) | 默认日期 |
|
||||
| disabledDate | 不可选择的日期 | (currentDate: moment) => boolean | 无 |
|
||||
| fullscreen | 是否全屏显示 | boolean | true |
|
||||
| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
|
||||
| mode | 初始模式,`month/year` | string | month |
|
||||
| monthCellRender | 自定义渲染月单元格,返回内容会被追加到单元格 | function(date: moment): ReactNode | 无 |
|
||||
| monthFullCellRender | 自定义渲染月单元格,返回内容覆盖单元格 | function(date: moment): ReactNode | 无 |
|
||||
| value | 展示日期 | [moment](http://momentjs.com/) | 当前日期 |
|
||||
| onPanelChange | 日期面板变化回调 | function(date: moment, mode: string) | 无 |
|
||||
| onSelect | 点击选择日期回调 | function(date: moment) | 无 |
|
||||
|
||||
2
components/calendar/locale/el_GR.tsx
Normal file
2
components/calendar/locale/el_GR.tsx
Normal file
@@ -0,0 +1,2 @@
|
||||
import el_GR from '../../date-picker/locale/el_GR';
|
||||
export default el_GR;
|
||||
2
components/calendar/locale/fa_IR.tsx
Normal file
2
components/calendar/locale/fa_IR.tsx
Normal file
@@ -0,0 +1,2 @@
|
||||
import fa_IR from '../../date-picker/locale/fa_IR';
|
||||
export default fa_IR;
|
||||
2
components/calendar/locale/nb_NO.tsx
Normal file
2
components/calendar/locale/nb_NO.tsx
Normal file
@@ -0,0 +1,2 @@
|
||||
import nb_NO from '../../date-picker/locale/nb_NO';
|
||||
export default nb_NO;
|
||||
2
components/calendar/locale/pt_PT.tsx
Normal file
2
components/calendar/locale/pt_PT.tsx
Normal file
@@ -0,0 +1,2 @@
|
||||
import pt_PT from '../../date-picker/locale/pt_PT';
|
||||
export default pt_PT;
|
||||
2
components/calendar/locale/sr_RS.tsx
Normal file
2
components/calendar/locale/sr_RS.tsx
Normal file
@@ -0,0 +1,2 @@
|
||||
import sr_RS from '../../date-picker/locale/sr_RS';
|
||||
export default sr_RS;
|
||||
@@ -2,10 +2,17 @@ import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import Card from '../index';
|
||||
|
||||
const delay = timeout => new Promise(resolve => setTimeout(resolve, timeout));
|
||||
const testMethod = typeof window !== 'undefined' ? it : xit;
|
||||
|
||||
describe('Card', () => {
|
||||
beforeAll(() => {
|
||||
jest.useFakeTimers();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
function fakeResizeWindowTo(wrapper, width) {
|
||||
Object.defineProperties(wrapper.node.container, {
|
||||
offsetWidth: {
|
||||
@@ -16,13 +23,13 @@ describe('Card', () => {
|
||||
window.resizeTo(width);
|
||||
}
|
||||
|
||||
testMethod('resize card will trigger different padding', async () => {
|
||||
testMethod('resize card will trigger different padding', () => {
|
||||
const wrapper = mount(<Card title="xxx">xxx</Card>);
|
||||
fakeResizeWindowTo(wrapper, 1000);
|
||||
await delay(0);
|
||||
jest.runAllTimers();
|
||||
expect(wrapper.hasClass('ant-card-wider-padding')).toBe(true);
|
||||
fakeResizeWindowTo(wrapper, 800);
|
||||
await delay(0);
|
||||
jest.runAllTimers();
|
||||
expect(wrapper.hasClass('ant-card-wider-padding')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,11 +5,11 @@ title: Card
|
||||
cols: 1
|
||||
---
|
||||
|
||||
Simple rectangular container
|
||||
Simple rectangular container.
|
||||
|
||||
## When To Use
|
||||
|
||||
A card can be used to display content related to a single subject. The content can consist of multiple elements of varying type and size.
|
||||
A card can be used to display content related to a single subject. The content can consist of multiple elements of varying types and sizes.
|
||||
|
||||
## API
|
||||
|
||||
@@ -19,18 +19,18 @@ A card can be used to display content related to a single subject. The content c
|
||||
|
||||
### Card
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|----------|----------------|----------|--------------|
|
||||
| title | Card title | string\|ReactNode | - |
|
||||
| extra | Content to render in the top-right corner of the card | string\|ReactNode | - |
|
||||
| bordered | Toggles rendering of the border around the card | boolean | true |
|
||||
| bodyStyle | Inline style to apply to the card content | object | - |
|
||||
| noHovering | Whether to be disable hovering when mouse over | boolean | false |
|
||||
| loading | Shows a loading indicator while the contents of the card are being fetched | boolean | false |
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| bodyStyle | Inline style to apply to the card content | object | - |
|
||||
| bordered | Toggles rendering of the border around the card | boolean | `true` |
|
||||
| extra | Content to render in the top-right corner of the card | string\|ReactNode | - |
|
||||
| loading | Shows a loading indicator while the contents of the card are being fetched | boolean | `false` |
|
||||
| noHovering | Whether to disable hover effect on mouse over | boolean | `false` |
|
||||
| title | Card title | string\|ReactNode | - |
|
||||
|
||||
### Card.Grid
|
||||
|
||||
Property | Description | Type | Default
|
||||
---------|-------------|------|---------
|
||||
className | className of container | string | -
|
||||
style | style object of container | object | -
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| className | className of container | string | - |
|
||||
| style | style object of container | object | - |
|
||||
|
||||
@@ -20,18 +20,18 @@ cols: 1
|
||||
|
||||
### Card
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|----------|----------------|----------|--------------|
|
||||
| title | 卡片标题 | string\|ReactNode | - |
|
||||
| extra | 卡片右上角的操作区域 | string\|ReactNode | - |
|
||||
| bordered | 是否有边框 | boolean | true |
|
||||
| bodyStyle | 内容区域自定义样式 | object | - |
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| bodyStyle | 内容区域自定义样式 | object | - |
|
||||
| bordered | 是否有边框 | boolean | true |
|
||||
| extra | 卡片右上角的操作区域 | string\|ReactNode | - |
|
||||
| loading | 当卡片内容还在加载中时,可以用 loading 展示一个占位 | boolean | false |
|
||||
| noHovering | 取消鼠标移过浮起 | boolean | false |
|
||||
| loading | 当卡片内容还在加载中时,可以用 loading 展示一个占位 | boolean | false |
|
||||
| title | 卡片标题 | string\|ReactNode | - |
|
||||
|
||||
### Card.Grid
|
||||
|
||||
Property | Description | Type | Default
|
||||
---------|-------------|------|---------
|
||||
className | 网格容器类名 | string | -
|
||||
style | 定义网格容器类名的样式 | object | -
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| className | 网格容器类名 | string | - |
|
||||
| style | 定义网格容器类名的样式 | object | - |
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
&:not(&-no-hovering):hover {
|
||||
box-shadow: @box-shadow-base;
|
||||
border-color: transparent;
|
||||
border-color: @shadow-color;
|
||||
}
|
||||
|
||||
&-bordered {
|
||||
@@ -30,6 +30,7 @@
|
||||
border-radius: @border-radius-sm @border-radius-sm 0 0;
|
||||
.clearfix;
|
||||
margin-bottom: -1px; // Fix card grid overflow bug: https://gw.alipayobjects.com/zos/rmsportal/XonYxBikwpgbqIQBeuhk.png
|
||||
display: flex;
|
||||
|
||||
&-title {
|
||||
font-size: @font-size-lg;
|
||||
@@ -39,12 +40,16 @@
|
||||
white-space: nowrap;
|
||||
color: @card-head-color;
|
||||
font-weight: 500;
|
||||
float: left;
|
||||
display: inline-block;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&-extra {
|
||||
float: right;
|
||||
text-align: right;
|
||||
// https://stackoverflow.com/a/22429853/3040605
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
&-body {
|
||||
@@ -52,25 +57,6 @@
|
||||
.clearfix;
|
||||
}
|
||||
|
||||
&-loading &-body {
|
||||
user-select: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
&-loading-content {
|
||||
padding: @card-padding-base;
|
||||
}
|
||||
|
||||
&-loading-block {
|
||||
display: inline-block;
|
||||
margin: 5px 1% 0;
|
||||
height: 14px;
|
||||
border-radius: @border-radius-sm;
|
||||
background: linear-gradient(90deg, rgba(207, 216, 220, .2), rgba(207, 216, 220, .4), rgba(207, 216, 220, .2));
|
||||
animation: card-loading 1.4s ease infinite;
|
||||
background-size: 600% 600%;
|
||||
}
|
||||
|
||||
&-contain-grid &-body {
|
||||
margin: -1px 0 0 -1px;
|
||||
padding: 0;
|
||||
@@ -111,6 +97,25 @@
|
||||
&-padding-transition &-extra {
|
||||
transition: right .3s;
|
||||
}
|
||||
|
||||
&-loading &-body {
|
||||
user-select: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
&-loading-content {
|
||||
padding: @card-padding-base;
|
||||
}
|
||||
|
||||
&-loading-block {
|
||||
display: inline-block;
|
||||
margin: 5px 1% 0;
|
||||
height: 14px;
|
||||
border-radius: @border-radius-sm;
|
||||
background: linear-gradient(90deg, rgba(207, 216, 220, .2), rgba(207, 216, 220, .4), rgba(207, 216, 220, .2));
|
||||
animation: card-loading 1.4s ease infinite;
|
||||
background-size: 600% 600%;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes card-loading {
|
||||
|
||||
@@ -62,7 +62,7 @@ exports[`renders ./components/carousel/demo/autoplay.md correctly 1`] = `
|
||||
</h3>
|
||||
</div>
|
||||
<div
|
||||
class="slick-slide slick-active slick-cloned"
|
||||
class="slick-slide slick-cloned"
|
||||
data-index="4"
|
||||
>
|
||||
<h3>
|
||||
@@ -137,7 +137,7 @@ exports[`renders ./components/carousel/demo/basic.md correctly 1`] = `
|
||||
</h3>
|
||||
</div>
|
||||
<div
|
||||
class="slick-slide slick-active slick-cloned"
|
||||
class="slick-slide slick-cloned"
|
||||
data-index="4"
|
||||
>
|
||||
<h3>
|
||||
@@ -271,7 +271,7 @@ exports[`renders ./components/carousel/demo/vertical.md correctly 1`] = `
|
||||
</h3>
|
||||
</div>
|
||||
<div
|
||||
class="slick-slide slick-active slick-cloned"
|
||||
class="slick-slide slick-cloned"
|
||||
data-index="4"
|
||||
>
|
||||
<h3>
|
||||
|
||||
@@ -5,7 +5,7 @@ import Carousel from '..';
|
||||
describe('Carousel', () => {
|
||||
it('should has innerSlider', () => {
|
||||
const wrapper = mount(<Carousel><div /></Carousel>);
|
||||
const innerSlider = wrapper.node.innerSlider;
|
||||
const { innerSlider } = wrapper.node;
|
||||
const innerSliderFromRefs = wrapper.node.refs.slick.innerSlider;
|
||||
expect(innerSlider).toBe(innerSliderFromRefs);
|
||||
expect(typeof innerSlider.slickNext).toBe('function');
|
||||
|
||||
@@ -9,19 +9,19 @@ A carousel component. Scales with its container.
|
||||
## When To Use
|
||||
|
||||
- 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.
|
||||
- When there is insufficient content space, it can be used to save space in the form of a revolving door.
|
||||
- Commonly used for a group of pictures/cards.
|
||||
|
||||
## API
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|------------------|----------------------------------------------|----------|---------------------------------|
|
||||
| effect | Animation effect, either `scrollx` or `fade` | string | scrollx |
|
||||
| dots | Whether to show the dots at the bottom of the gallery | boolean | true |
|
||||
| vertical | Whether to use a vertical display | boolean | false |
|
||||
| autoplay | Whether to scroll automatically | boolean | false |
|
||||
| easing | Transition name | string | linear |
|
||||
| beforeChange | Callback function called before the current index changes | function(from, to) |
|
||||
| afterChange | Callback function called after the current index changes | function(current) |
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| afterChange | Callback function called after the current index changes | function(current) | - |
|
||||
| autoplay | Whether to scroll automatically | boolean | `false` |
|
||||
| beforeChange | Callback function called before the current index changes | function(from, to) | - |
|
||||
| dots | Whether to show the dots at the bottom of the gallery | boolean | `true` |
|
||||
| easing | Transition interpolation function name | string | `linear` |
|
||||
| effect | Transition effect | `scrollx` \| `fade` | `scrollx` |
|
||||
| vertical | Whether to use a vertical display | boolean | `false` |
|
||||
|
||||
For more info on the parameters, refer to the https://github.com/akiran/react-slick
|
||||
For more info on the parameters, refer to the <https://github.com/akiran/react-slick>
|
||||
|
||||
@@ -80,8 +80,8 @@ export default class Carousel extends React.Component<CarouselProps, any> {
|
||||
|
||||
innerSlider: any;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.onWindowResized = debounce(this.onWindowResized, 500, {
|
||||
leading: false,
|
||||
});
|
||||
|
||||
@@ -15,14 +15,14 @@ subtitle: 走马灯
|
||||
|
||||
## API
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|------------------|----------------------------------------------|----------|---------------------------------|
|
||||
| effect | 动画效果函数,可取 scrollx, fade | string | scrollx |
|
||||
| dots | 是否显示面板指示点 | boolean | true |
|
||||
| vertical | 垂直显示 | boolean | false |
|
||||
| autoplay | 是否自动切换 | boolean | false |
|
||||
| easing | 动画效果 | string | linear |
|
||||
| beforeChange | 切换面板的回调 | function(from, to) | 无
|
||||
| afterChange | 切换面板的回调 | function(current) | 无
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| afterChange | 切换面板的回调 | function(current) | 无 |
|
||||
| autoplay | 是否自动切换 | boolean | false |
|
||||
| beforeChange | 切换面板的回调 | function(from, to) | 无 |
|
||||
| dots | 是否显示面板指示点 | boolean | true |
|
||||
| easing | 动画效果 | string | linear |
|
||||
| effect | 动画效果函数,可取 scrollx, fade | string | scrollx |
|
||||
| vertical | 垂直显示 | boolean | false |
|
||||
|
||||
更多参数可参考:https://github.com/akiran/react-slick
|
||||
更多参数可参考:<https://github.com/akiran/react-slick>
|
||||
|
||||
@@ -32,14 +32,10 @@ const options = [{
|
||||
|
||||
class LazyOptions extends React.Component {
|
||||
state = {
|
||||
inputValue: '',
|
||||
options,
|
||||
};
|
||||
onChange = (value, selectedOptions) => {
|
||||
console.log(value, selectedOptions);
|
||||
this.setState({
|
||||
inputValue: selectedOptions.map(o => o.label).join(', '),
|
||||
});
|
||||
}
|
||||
loadData = (selectedOptions) => {
|
||||
const targetOption = selectedOptions[selectedOptions.length - 1];
|
||||
|
||||
@@ -6,7 +6,6 @@ title: Cascader
|
||||
|
||||
Cascade selection box.
|
||||
|
||||
|
||||
## When To Use
|
||||
|
||||
- When you need to select from a set of associated data set. Such as province/city/district, company level, things classification.
|
||||
@@ -20,36 +19,37 @@ Cascade selection box.
|
||||
```
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|------|------|------|--------|
|
||||
| options | data options of cascade | object | - |
|
||||
| defaultValue | initial selected value | [CascaderOptionType](https://git.io/vMMoK)[] |[] |
|
||||
| value | selected value | [CascaderOptionType](https://git.io/vMMoK)[] | - |
|
||||
| onChange | callback when finishing cascader select | `(value, selectedOptions) => void` | - |
|
||||
| onPopupVisibleChange | callback when popup shown or hidden | `(value) => void` | - |
|
||||
| displayRender | render function of displaying selected options | `(label, selectedOptions) => ReactNode` | `label => label.join(' / ')` |
|
||||
| style | additional style | string | - |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| allowClear | whether allow clear | boolean | true |
|
||||
| changeOnSelect | change value on each selection if set to true, see above demo for details | boolean | false |
|
||||
| className | additional css class | string | - |
|
||||
| defaultValue | initial selected value | [CascaderOptionType](https://git.io/vMMoK)\[] | \[] |
|
||||
| disabled | whether disabled select | boolean | false |
|
||||
| displayRender | render function of displaying selected options | `(label, selectedOptions) => ReactNode` | `label => label.join(' / ')` |
|
||||
| expandTrigger | expand current item when click or hover, one of 'click' 'hover' | string | 'click' |
|
||||
| getPopupContainer | Parent Node which the selector should be rendered to. Default to `body`. When position issues happen, try to modify it into scrollable content and position it relative.[example](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | Function(triggerNode) | () => document.body |
|
||||
| loadData | To load option lazily, and it cannot work with `showSearch` | `(selectedOptions) => void` | - |
|
||||
| notFoundContent | Specify content to show when no result matches. | string | 'Not Found' |
|
||||
| options | data options of cascade | object | - |
|
||||
| placeholder | input placeholder | string | 'Please select' |
|
||||
| popupClassName | additional className of popup overlay | string | - |
|
||||
| popupPlacement | use preset popup align config from builtinPlacements:`bottomLeft` `bottomRight` `topLeft` `topRight` | string | `bottomLeft` |
|
||||
| placeholder | input placeholder | string | 'Please select' |
|
||||
| size | input size, one of `large` `default` `small` | string | `default` |
|
||||
| disabled | whether disabled select | boolean | false |
|
||||
| allowClear | whether allow clear | boolean | true |
|
||||
| expandTrigger | expand current item when click or hover, one of 'click' 'hover' | string | 'click' |
|
||||
| changeOnSelect | change value on each selection if set to true, see above demo for details | boolean | false |
|
||||
| showSearch | Whether show search input in single mode. | boolean\|object | false |
|
||||
| notFoundContent | Specify content to show when no result matches. | string | 'Not Found' |
|
||||
| loadData | To load option lazily, and it cannot work with `showSearch` | `(selectedOptions) => void` | - |
|
||||
| getPopupContainer | Parent Node which the selector should be rendered to. Default to `body`. When position issues happen, try to modify it into scrollable content and position it relative.[example](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
|
||||
| size | input size, one of `large` `default` `small` | string | `default` |
|
||||
| style | additional style | string | - |
|
||||
| value | selected value | [CascaderOptionType](https://git.io/vMMoK)\[] | - |
|
||||
| onChange | callback when finishing cascader select | `(value, selectedOptions) => void` | - |
|
||||
| onPopupVisibleChange | callback when popup shown or hidden | `(value) => void` | - |
|
||||
| popupVisible | set visible of cascader popup | boolean | - |
|
||||
|
||||
Fields in `showSearch`:
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|----------|-------------|------|---------|
|
||||
| filter | The function will receive two arguments, inputValue and option, if the function returns true, the option will be included in the filtered set; Otherwise, it will be excluded. | `function(inputValue, path): boolean` | |
|
||||
| render | Used to render filtered options. | `function(inputValue, path): ReactNode` | |
|
||||
| sort | Used to sort filtered options. | `function(a, b, inputValue)` | |
|
||||
| matchInputWidth | Whether the width of result list equals to input's | boolean | |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| filter | The function will receive two arguments, inputValue and option, if the function returns true, the option will be included in the filtered set; Otherwise, it will be excluded. | `function(inputValue, path): boolean` | |
|
||||
| matchInputWidth | Whether the width of result list equals to input's | boolean | |
|
||||
| render | Used to render filtered options. | `function(inputValue, path): ReactNode` | |
|
||||
| sort | Used to sort filtered options. | `function(a, b, inputValue)` | |
|
||||
|
||||
<style>
|
||||
.ant-cascader-picker {
|
||||
|
||||
@@ -120,7 +120,7 @@ export default class Cascader extends React.Component<CascaderProps, any> {
|
||||
value: props.value || props.defaultValue || [],
|
||||
inputValue: '',
|
||||
inputFocused: false,
|
||||
popupVisible: false,
|
||||
popupVisible: props.popupVisible,
|
||||
flattenOptions: props.showSearch && this.flattenTree(props.options, props.changeOnSelect),
|
||||
};
|
||||
}
|
||||
@@ -129,6 +129,9 @@ export default class Cascader extends React.Component<CascaderProps, any> {
|
||||
if ('value' in nextProps) {
|
||||
this.setState({ value: nextProps.value || [] });
|
||||
}
|
||||
if ('popupVisible' in nextProps) {
|
||||
this.setState({ popupVisible: nextProps.popupVisible });
|
||||
}
|
||||
if (nextProps.showSearch && this.props.options !== nextProps.options) {
|
||||
this.setState({ flattenOptions: this.flattenTree(nextProps.options, nextProps.changeOnSelect) });
|
||||
}
|
||||
@@ -146,11 +149,13 @@ export default class Cascader extends React.Component<CascaderProps, any> {
|
||||
}
|
||||
|
||||
handlePopupVisibleChange = (popupVisible) => {
|
||||
this.setState({
|
||||
popupVisible,
|
||||
inputFocused: popupVisible,
|
||||
inputValue: popupVisible ? this.state.inputValue : '',
|
||||
});
|
||||
if (!('popupVisible' in this.props)) {
|
||||
this.setState({
|
||||
popupVisible,
|
||||
inputFocused: popupVisible,
|
||||
inputValue: popupVisible ? this.state.inputValue : '',
|
||||
});
|
||||
}
|
||||
|
||||
const onPopupVisibleChange = this.props.onPopupVisibleChange;
|
||||
if (onPopupVisibleChange) {
|
||||
@@ -208,7 +213,7 @@ export default class Cascader extends React.Component<CascaderProps, any> {
|
||||
e.stopPropagation();
|
||||
if (!this.state.inputValue) {
|
||||
this.setValue([]);
|
||||
this.setState({ popupVisible: false });
|
||||
this.handlePopupVisibleChange(false);
|
||||
} else {
|
||||
this.setState({ inputValue: '' });
|
||||
}
|
||||
@@ -218,7 +223,7 @@ export default class Cascader extends React.Component<CascaderProps, any> {
|
||||
let flattenOptions: any = [];
|
||||
options.forEach((option) => {
|
||||
const path = ancestor.concat(option);
|
||||
if (changeOnSelect || !option.children) {
|
||||
if (changeOnSelect || !option.children || !option.children.length) {
|
||||
flattenOptions.push(path);
|
||||
}
|
||||
if (option.children) {
|
||||
@@ -336,6 +341,7 @@ export default class Cascader extends React.Component<CascaderProps, any> {
|
||||
<Input
|
||||
{...inputProps}
|
||||
ref="input"
|
||||
prefixCls={inputPrefixCls}
|
||||
placeholder={value && value.length > 0 ? undefined : placeholder}
|
||||
className={`${prefixCls}-input ${sizeCls}`}
|
||||
value={state.inputValue}
|
||||
|
||||
@@ -7,7 +7,6 @@ subtitle: 级联选择
|
||||
|
||||
级联选择框。
|
||||
|
||||
|
||||
## 何时使用
|
||||
|
||||
- 需要从一组相关联的数据集合进行选择,例如省市区,公司层级,事物分类等。
|
||||
@@ -21,36 +20,37 @@ subtitle: 级联选择
|
||||
```
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|------|------|------|--------|
|
||||
| options | 可选项数据源 | object | - |
|
||||
| defaultValue | 默认的选中项 | [CascaderOptionType](https://git.io/vMMoK)[] |[] |
|
||||
| value | 指定选中项 | [CascaderOptionType](https://git.io/vMMoK)[] | - |
|
||||
| onChange | 选择完成后的回调 | `(value, selectedOptions) => void` | - |
|
||||
| onPopupVisibleChange | 显示/隐藏浮层的回调 | `(value) => void` | - |
|
||||
| displayRender | 选择后展示的渲染函数 | `(label, selectedOptions) => ReactNode` | `label => label.join(' / ')` |
|
||||
| style | 自定义样式 | string | - |
|
||||
| --- | --- | --- | --- |
|
||||
| allowClear | 是否支持清除 | boolean | true |
|
||||
| changeOnSelect | 当此项为 true 时,点选每级菜单选项值都会发生变化,具体见上面的演示 | boolean | false |
|
||||
| className | 自定义类名 | string | - |
|
||||
| defaultValue | 默认的选中项 | [CascaderOptionType](https://git.io/vMMoK)\[] | \[] |
|
||||
| disabled | 禁用 | boolean | false |
|
||||
| displayRender | 选择后展示的渲染函数 | `(label, selectedOptions) => ReactNode` | `label => label.join(' / ')` |
|
||||
| expandTrigger | 次级菜单的展开方式,可选 'click' 和 'hover' | string | 'click' |
|
||||
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | Function(triggerNode) | () => document.body |
|
||||
| loadData | 用于动态加载选项,无法与 `showSearch` 一起使用 | `(selectedOptions) => void` | - |
|
||||
| notFoundContent | 当下拉列表为空时显示的内容 | string | 'Not Found' |
|
||||
| options | 可选项数据源 | object | - |
|
||||
| placeholder | 输入框占位文本 | string | '请选择' |
|
||||
| popupClassName | 自定义浮层类名 | string | - |
|
||||
| popupPlacement | 浮层预设位置:`bottomLeft` `bottomRight` `topLeft` `topRight` | Enum | `bottomLeft` |
|
||||
| placeholder | 输入框占位文本 | string | '请选择' |
|
||||
| size | 输入框大小,可选 `large` `default` `small` | string | `default` |
|
||||
| disabled | 禁用 | boolean | false |
|
||||
| allowClear | 是否支持清除 | boolean | true |
|
||||
| expandTrigger | 次级菜单的展开方式,可选 'click' 和 'hover' | string | 'click' |
|
||||
| changeOnSelect | 当此项为 true 时,点选每级菜单选项值都会发生变化,具体见上面的演示 | boolean | false |
|
||||
| showSearch | 在选择框中显示搜索框 | boolean | false |
|
||||
| notFoundContent | 当下拉列表为空时显示的内容 | string | 'Not Found' |
|
||||
| loadData | 用于动态加载选项,无法与 `showSearch` 一起使用 | `(selectedOptions) => void` | - |
|
||||
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
|
||||
| size | 输入框大小,可选 `large` `default` `small` | string | `default` |
|
||||
| style | 自定义样式 | string | - |
|
||||
| value | 指定选中项 | [CascaderOptionType](https://git.io/vMMoK)\[] | - |
|
||||
| onChange | 选择完成后的回调 | `(value, selectedOptions) => void` | - |
|
||||
| onPopupVisibleChange | 显示/隐藏浮层的回调 | `(value) => void` | - |
|
||||
| popupVisible | 控制浮层显隐 | boolean | - |
|
||||
|
||||
`showSearch` 为对象时,其中的字段:
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|------|------|------|--------|
|
||||
| filter | 接收 `inputValue` `path` 两个参数,当 `path` 符合筛选条件时,应返回 true,反之则返回 false。 | `function(inputValue, path): boolean` | |
|
||||
| render | 用于渲染 filter 后的选项 | `function(inputValue, path): ReactNode` | |
|
||||
| sort | 用于排序 filter 后的选项 | `function(a, b, inputValue)` | |
|
||||
| matchInputWidth | 搜索结果列表是否与输入框同宽 | boolean | |
|
||||
| --- | --- | --- | --- |
|
||||
| filter | 接收 `inputValue` `path` 两个参数,当 `path` 符合筛选条件时,应返回 true,反之则返回 false。 | `function(inputValue, path): boolean` | |
|
||||
| matchInputWidth | 搜索结果列表是否与输入框同宽 | boolean | |
|
||||
| render | 用于渲染 filter 后的选项 | `function(inputValue, path): ReactNode` | |
|
||||
| sort | 用于排序 filter 后的选项 | `function(a, b, inputValue)` | |
|
||||
|
||||
<style>
|
||||
.ant-cascader-picker {
|
||||
|
||||
@@ -179,6 +179,7 @@
|
||||
}
|
||||
&-expand {
|
||||
position: relative;
|
||||
padding-right: 24px;
|
||||
&:after {
|
||||
.iconfont-font("\e61f");
|
||||
.iconfont-size-under-12px(8px);
|
||||
|
||||
@@ -12,12 +12,12 @@ export interface AbstractCheckboxProps {
|
||||
checked?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
disabled?: boolean;
|
||||
onChange?: React.FormEventHandler<any>;
|
||||
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
||||
onMouseEnter?: React.MouseEventHandler<any>;
|
||||
onMouseLeave?: React.MouseEventHandler<any>;
|
||||
value?: any;
|
||||
name?: string;
|
||||
children?: React.ReactChild;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
export interface CheckboxProps extends AbstractCheckboxProps {
|
||||
|
||||
@@ -15,19 +15,19 @@ Checkbox.
|
||||
|
||||
### Checkbox
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|----------|------------------|----------|--------|
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| checked | Specifies whether the checkbox is selected. | boolean | false |
|
||||
| defaultChecked | Specifies the initial state: whether or not the checkbox is selected. | boolean | false |
|
||||
| disabled | Disable checkbox | boolean | false |
|
||||
| onChange | The callback function that is triggered when the state changes. | Function(e:Event) | - |
|
||||
| disabled | Disable checkbox | boolean | false|
|
||||
|
||||
### Checkbox Group
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|----------|------------------|----------|--------|
|
||||
| defaultValue | Default selected value | string[] | [] |
|
||||
| value | Used for setting the currently selected value. | string[] | [] |
|
||||
| options | Specifies options | string[] | [] |
|
||||
| onChange | The callback function that is triggered when the state changes. | Function(checkedValue) | - |
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| defaultValue | Default selected value | string\[] | \[] |
|
||||
| disabled | Disable all checkboxes | boolean | false |
|
||||
| options | Specifies options | string\[] | \[] |
|
||||
| value | Used for setting the currently selected value. | string\[] | \[] |
|
||||
| onChange | The callback function that is triggered when the state changes. | Function(checkedValue) | - |
|
||||
|
||||
@@ -16,18 +16,18 @@ title: Checkbox
|
||||
|
||||
### Checkbox
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|----------|------------------|----------|--------|
|
||||
| checked | 指定当前是否选中 | boolean | false |
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| checked | 指定当前是否选中 | boolean | false |
|
||||
| defaultChecked | 初始是否选中 | boolean | false |
|
||||
| onChange | 变化时回调函数 | Function(e:Event) | - |
|
||||
| indeterminate | 设置 indeterminate 状态,只负责样式控制 | boolean | false |
|
||||
| onChange | 变化时回调函数 | Function(e:Event) | - |
|
||||
|
||||
### Checkbox Group
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|----------|------------------|----------|--------|
|
||||
| defaultValue | 默认选中的选项 | string[] | [] |
|
||||
| value | 指定选中的选项| string[] | [] |
|
||||
| options | 指定可选项 | string[] | [] |
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| defaultValue | 默认选中的选项 | string\[] | \[] |
|
||||
| options | 指定可选项 | string\[] | \[] |
|
||||
| value | 指定选中的选项 | string\[] | \[] |
|
||||
| onChange | 变化时回调函数 | Function(checkedValue) | - |
|
||||
|
||||
@@ -42,21 +42,23 @@
|
||||
top: 0;
|
||||
left: 0;
|
||||
display: block;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
width: @checkbox-size;
|
||||
height: @checkbox-size;
|
||||
border: @border-width-base @border-style-base @border-color-base;
|
||||
border-radius: @border-radius-sm;
|
||||
background-color: #fff;
|
||||
transition: all .3s;
|
||||
|
||||
&:after {
|
||||
@check-width: (@checkbox-size / 14) * 5px;
|
||||
@check-height: (@checkbox-size / 14) * 8px;
|
||||
transform: rotate(45deg) scale(0);
|
||||
position: absolute;
|
||||
left: 4px;
|
||||
top: 1px;
|
||||
left: (@checkbox-size - @check-width) / 2 - 0.5px * (@checkbox-size / 14);
|
||||
top: (@checkbox-size - @check-height) / 2 - 2px * (@checkbox-size / 14);
|
||||
display: table;
|
||||
width: 5px;
|
||||
height: 8px;
|
||||
width: @check-width;
|
||||
height: @check-height;
|
||||
border: 2px solid #fff;
|
||||
border-top: 0;
|
||||
border-left: 0;
|
||||
@@ -81,13 +83,15 @@
|
||||
|
||||
// 半选状态
|
||||
.@{checkbox-prefix-cls}-indeterminate .@{checkbox-inner-prefix-cls}:after {
|
||||
@indeterminate-width: (@checkbox-size / 14) * 8px;
|
||||
@indeterminate-height: (@checkbox-size / 14) * 1px;
|
||||
content: ' ';
|
||||
transform: scale(1);
|
||||
position: absolute;
|
||||
left: 2px;
|
||||
top: 5px;
|
||||
width: 8px;
|
||||
height: 1px;
|
||||
left: (@checkbox-size - 2 - @indeterminate-width) / 2;
|
||||
top: (@checkbox-size - 3 - @indeterminate-height) / 2;
|
||||
width: @indeterminate-width;
|
||||
height: @indeterminate-height;
|
||||
}
|
||||
|
||||
.@{checkbox-prefix-cls}-indeterminate.@{checkbox-prefix-cls}-disabled .@{checkbox-inner-prefix-cls}:after {
|
||||
@@ -98,11 +102,7 @@
|
||||
.@{checkbox-prefix-cls}-checked .@{checkbox-inner-prefix-cls}:after {
|
||||
transform: rotate(45deg) scale(1);
|
||||
position: absolute;
|
||||
left: 4px;
|
||||
top: 1px;
|
||||
display: table;
|
||||
width: 5px;
|
||||
height: 8px;
|
||||
border: 2px solid #fff;
|
||||
border-top: 0;
|
||||
border-left: 0;
|
||||
@@ -151,8 +151,8 @@
|
||||
cursor: pointer;
|
||||
font-size: @font-size-base;
|
||||
display: inline-block;
|
||||
&:not(:last-child) {
|
||||
margin-right: 8px;
|
||||
& + & {
|
||||
margin-left: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,6 +166,13 @@
|
||||
font-size: @font-size-base;
|
||||
&-item {
|
||||
display: inline-block;
|
||||
margin-right: 8px;
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
&-item + &-item {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ exports[`renders ./components/collapse/demo/accordion.md correctly 1`] = `
|
||||
>
|
||||
<div
|
||||
class="ant-collapse-item"
|
||||
role="tablist"
|
||||
>
|
||||
<div
|
||||
aria-expanded="false"
|
||||
@@ -20,6 +21,7 @@ exports[`renders ./components/collapse/demo/accordion.md correctly 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="ant-collapse-item"
|
||||
role="tablist"
|
||||
>
|
||||
<div
|
||||
aria-expanded="false"
|
||||
@@ -34,6 +36,7 @@ exports[`renders ./components/collapse/demo/accordion.md correctly 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="ant-collapse-item"
|
||||
role="tablist"
|
||||
>
|
||||
<div
|
||||
aria-expanded="false"
|
||||
@@ -55,6 +58,7 @@ exports[`renders ./components/collapse/demo/basic.md correctly 1`] = `
|
||||
>
|
||||
<div
|
||||
class="ant-collapse-item ant-collapse-item-active"
|
||||
role="tablist"
|
||||
>
|
||||
<div
|
||||
aria-expanded="true"
|
||||
@@ -75,16 +79,17 @@ exports[`renders ./components/collapse/demo/basic.md correctly 1`] = `
|
||||
>
|
||||
<p>
|
||||
|
||||
A dog is a type of domesticated animal.
|
||||
Known for its loyalty and faithfulness,
|
||||
it can be found as a welcome guest in many households across the world.
|
||||
|
||||
A dog is a type of domesticated animal.
|
||||
Known for its loyalty and faithfulness,
|
||||
it can be found as a welcome guest in many households across the world.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-collapse-item"
|
||||
role="tablist"
|
||||
>
|
||||
<div
|
||||
aria-expanded="false"
|
||||
@@ -99,6 +104,7 @@ exports[`renders ./components/collapse/demo/basic.md correctly 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="ant-collapse-item ant-collapse-item-disabled"
|
||||
role="tablist"
|
||||
>
|
||||
<div
|
||||
aria-expanded="false"
|
||||
@@ -120,6 +126,7 @@ exports[`renders ./components/collapse/demo/borderless.md correctly 1`] = `
|
||||
>
|
||||
<div
|
||||
class="ant-collapse-item ant-collapse-item-active"
|
||||
role="tablist"
|
||||
>
|
||||
<div
|
||||
aria-expanded="true"
|
||||
@@ -140,16 +147,17 @@ exports[`renders ./components/collapse/demo/borderless.md correctly 1`] = `
|
||||
>
|
||||
<p>
|
||||
|
||||
A dog is a type of domesticated animal.
|
||||
Known for its loyalty and faithfulness,
|
||||
it can be found as a welcome guest in many households across the world.
|
||||
|
||||
A dog is a type of domesticated animal.
|
||||
Known for its loyalty and faithfulness,
|
||||
it can be found as a welcome guest in many households across the world.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-collapse-item"
|
||||
role="tablist"
|
||||
>
|
||||
<div
|
||||
aria-expanded="false"
|
||||
@@ -164,6 +172,7 @@ exports[`renders ./components/collapse/demo/borderless.md correctly 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="ant-collapse-item"
|
||||
role="tablist"
|
||||
>
|
||||
<div
|
||||
aria-expanded="false"
|
||||
@@ -185,7 +194,8 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
|
||||
>
|
||||
<div
|
||||
class="ant-collapse-item ant-collapse-item-active"
|
||||
style="background:#f7f7f7;border-radius:4px;margin-bottom:24px;border:0;"
|
||||
role="tablist"
|
||||
style="background:#f7f7f7;border-radius:4px;margin-bottom:24px;border:0;overflow:hidden;"
|
||||
>
|
||||
<div
|
||||
aria-expanded="true"
|
||||
@@ -206,17 +216,18 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
|
||||
>
|
||||
<p>
|
||||
|
||||
A dog is a type of domesticated animal.
|
||||
Known for its loyalty and faithfulness,
|
||||
it can be found as a welcome guest in many households across the world.
|
||||
|
||||
A dog is a type of domesticated animal.
|
||||
Known for its loyalty and faithfulness,
|
||||
it can be found as a welcome guest in many households across the world.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-collapse-item"
|
||||
style="background:#f7f7f7;border-radius:4px;margin-bottom:24px;border:0;"
|
||||
role="tablist"
|
||||
style="background:#f7f7f7;border-radius:4px;margin-bottom:24px;border:0;overflow:hidden;"
|
||||
>
|
||||
<div
|
||||
aria-expanded="false"
|
||||
@@ -231,7 +242,8 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="ant-collapse-item"
|
||||
style="background:#f7f7f7;border-radius:4px;margin-bottom:24px;border:0;"
|
||||
role="tablist"
|
||||
style="background:#f7f7f7;border-radius:4px;margin-bottom:24px;border:0;overflow:hidden;"
|
||||
>
|
||||
<div
|
||||
aria-expanded="false"
|
||||
@@ -253,6 +265,7 @@ exports[`renders ./components/collapse/demo/mix.md correctly 1`] = `
|
||||
>
|
||||
<div
|
||||
class="ant-collapse-item"
|
||||
role="tablist"
|
||||
>
|
||||
<div
|
||||
aria-expanded="false"
|
||||
@@ -267,6 +280,7 @@ exports[`renders ./components/collapse/demo/mix.md correctly 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="ant-collapse-item"
|
||||
role="tablist"
|
||||
>
|
||||
<div
|
||||
aria-expanded="false"
|
||||
@@ -281,6 +295,7 @@ exports[`renders ./components/collapse/demo/mix.md correctly 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="ant-collapse-item"
|
||||
role="tablist"
|
||||
>
|
||||
<div
|
||||
aria-expanded="false"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
order: 1
|
||||
title:
|
||||
title:
|
||||
zh-CN: 手风琴
|
||||
en-US: Accordion
|
||||
---
|
||||
@@ -25,13 +25,13 @@ const text = `
|
||||
|
||||
ReactDOM.render(
|
||||
<Collapse accordion>
|
||||
<Panel header={'This is panel header 1'} key="1">
|
||||
<Panel header="This is panel header 1" key="1">
|
||||
<p>{text}</p>
|
||||
</Panel>
|
||||
<Panel header={'This is panel header 2'} key="2">
|
||||
<Panel header="This is panel header 2" key="2">
|
||||
<p>{text}</p>
|
||||
</Panel>
|
||||
<Panel header={'This is panel header 3'} key="3">
|
||||
<Panel header="This is panel header 3" key="3">
|
||||
<p>{text}</p>
|
||||
</Panel>
|
||||
</Collapse>
|
||||
|
||||
@@ -28,6 +28,7 @@ const customPanelStyle = {
|
||||
borderRadius: 4,
|
||||
marginBottom: 24,
|
||||
border: 0,
|
||||
overflow: 'hidden',
|
||||
};
|
||||
|
||||
ReactDOM.render(
|
||||
|
||||
@@ -29,17 +29,17 @@ const text = `
|
||||
|
||||
ReactDOM.render(
|
||||
<Collapse onChange={callback}>
|
||||
<Panel header={'This is panel header 1'} key="1">
|
||||
<Panel header="This is panel header 1" key="1">
|
||||
<Collapse defaultActiveKey="1">
|
||||
<Panel header={'This is panel nest panel'} key="1">
|
||||
<Panel header="This is panel nest panel" key="1">
|
||||
<p>{text}</p>
|
||||
</Panel>
|
||||
</Collapse>
|
||||
</Panel>
|
||||
<Panel header={'This is panel header 2'} key="2">
|
||||
<Panel header="This is panel header 2" key="2">
|
||||
<p>{text}</p>
|
||||
</Panel>
|
||||
<Panel header={'This is panel header 3'} key="3">
|
||||
<Panel header="This is panel header 3" key="3">
|
||||
<p>{text}</p>
|
||||
</Panel>
|
||||
</Collapse>
|
||||
|
||||
@@ -16,16 +16,16 @@ A content area which can be collapsed and expanded.
|
||||
|
||||
### Collapse
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|----------|----------------|----------|--------------|
|
||||
| activeKey | key of the active panel | string[]\|string | No default value. In `accordion` mode, it's the key of the first panel. |
|
||||
| defaultActiveKey | key of the initialized active panel | string | - |
|
||||
| onChange | a callback function, which can be executed when you switch the panels | Function | - |
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| activeKey | Key of the active panel | string\[]\|string | No default value. In `accordion` mode, it's the key of the first panel. |
|
||||
| defaultActiveKey | Key of the initial active panel | string | - |
|
||||
| onChange | Callback function executed when active panel is changed | Function | - |
|
||||
|
||||
### Collapse.Panel
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|----------|----------------|----------|--------------|
|
||||
| key | corresponds to the `activeKey` | string | - |
|
||||
| header | title of the panel | string\|ReactNode | - |
|
||||
| disabled | users cannot change opening status of a disabled panel | boolean | false |
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| disabled | If `true`, panel cannot be opened or closed | boolean | `false` |
|
||||
| header | Title of the panel | string\|ReactNode | - |
|
||||
| key | Unique key identifying the panel from among its siblings | string | - |
|
||||
|
||||
@@ -17,17 +17,16 @@ cols: 1
|
||||
|
||||
### Collapse
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|------------------|----------------------------------------------|----------|---------------------------------|
|
||||
| activeKey | 当前激活 tab 面板的 key| string[]\|string | 默认无,accordion模式下默认第一个元素|
|
||||
| defaultActiveKey | 初始化选中面板的 key | string | 无 |
|
||||
| onChange | 切换面板的回调 | Function | 无 |
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| activeKey | 当前激活 tab 面板的 key | string\[]\|string | 默认无,accordion模式下默认第一个元素 |
|
||||
| defaultActiveKey | 初始化选中面板的 key | string | 无 |
|
||||
| onChange | 切换面板的回调 | Function | 无 |
|
||||
|
||||
### Collapse.Panel
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|------|------------------|-------------------------|--------|
|
||||
| key | 对应 activeKey | string | 无 |
|
||||
| header | 面板头内容 | string\|ReactNode | 无 |
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| disabled | 禁用后的面板展开与否将无法通过用户交互改变 | boolean | false |
|
||||
| header | 面板头内容 | string\|ReactNode | 无 |
|
||||
| key | 对应 activeKey | string | 无 |
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
display: inline-block;
|
||||
font-weight: bold;
|
||||
line-height: 40px;
|
||||
vertical-align: middle;
|
||||
vertical-align: top;
|
||||
transition: transform 0.24s;
|
||||
top: 0;
|
||||
left: 16px;
|
||||
@@ -93,6 +93,11 @@
|
||||
border: 0;
|
||||
}
|
||||
|
||||
&-borderless > &-item:last-child,
|
||||
&-borderless > &-item:last-child &-header {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
&-borderless > &-item-active {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,9 @@ export default class RangePicker extends React.Component<any, any> {
|
||||
}
|
||||
|
||||
handleOpenChange = (open) => {
|
||||
this.setState({ open });
|
||||
if (!('open' in this.props)) {
|
||||
this.setState({ open });
|
||||
}
|
||||
|
||||
const { onOpenChange } = this.props;
|
||||
if (onOpenChange) {
|
||||
@@ -123,9 +125,9 @@ export default class RangePicker extends React.Component<any, any> {
|
||||
|
||||
handleHoverChange = hoverValue => this.setState({ hoverValue });
|
||||
|
||||
setValue(value) {
|
||||
setValue(value, hidePanel?) {
|
||||
this.handleChange(value);
|
||||
if (!this.props.showTime) {
|
||||
if ((hidePanel || !this.props.showTime) && !('open' in this.props)) {
|
||||
this.setState({ open: false });
|
||||
}
|
||||
}
|
||||
@@ -145,7 +147,7 @@ export default class RangePicker extends React.Component<any, any> {
|
||||
return (
|
||||
<a
|
||||
key={range}
|
||||
onClick={() => this.setValue(value)}
|
||||
onClick={() => this.setValue(value, true)}
|
||||
onMouseEnter={() => this.setState({ hoverValue: value })}
|
||||
onMouseLeave={this.clearHoverValue}
|
||||
>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -37,6 +37,7 @@ export default function createPicker(TheCalendar): any {
|
||||
}
|
||||
this.state = {
|
||||
value,
|
||||
showDate: value,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -44,6 +45,7 @@ export default function createPicker(TheCalendar): any {
|
||||
if ('value' in nextProps) {
|
||||
this.setState({
|
||||
value: nextProps.value,
|
||||
showDate: nextProps.value,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -66,13 +68,20 @@ export default function createPicker(TheCalendar): any {
|
||||
handleChange = (value) => {
|
||||
const props = this.props;
|
||||
if (!('value' in props)) {
|
||||
this.setState({ value });
|
||||
this.setState({
|
||||
value,
|
||||
showDate: value,
|
||||
});
|
||||
}
|
||||
props.onChange(value, (value && value.format(props.format)) || '');
|
||||
}
|
||||
|
||||
handleCalendarChange = (value: moment.Moment) => {
|
||||
this.setState({ showDate: value });
|
||||
}
|
||||
|
||||
render() {
|
||||
const { value } = this.state;
|
||||
const { value, showDate } = this.state;
|
||||
const props = omit(this.props, ['onChange']);
|
||||
const { prefixCls, locale } = props;
|
||||
|
||||
@@ -116,6 +125,8 @@ export default function createPicker(TheCalendar): any {
|
||||
showToday={props.showToday}
|
||||
monthCellContentRender={props.monthCellContentRender}
|
||||
renderFooter={this.renderFooter}
|
||||
onChange={this.handleCalendarChange}
|
||||
value={showDate}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -156,13 +167,14 @@ export default function createPicker(TheCalendar): any {
|
||||
...props.style,
|
||||
...pickerStyle,
|
||||
};
|
||||
|
||||
return (
|
||||
<span className={classNames(props.className, props.pickerClass)} style={style}>
|
||||
<RcDatePicker
|
||||
{...props}
|
||||
{...pickerChangeHandler}
|
||||
calendar={calendar}
|
||||
value={pickerValue}
|
||||
value={value}
|
||||
prefixCls={`${prefixCls}-picker-container`}
|
||||
style={props.popupStyle}
|
||||
>
|
||||
|
||||
@@ -14,9 +14,9 @@ By clicking the input box, you can select a date from a popup calendar.
|
||||
|
||||
There are three kinds of picker:
|
||||
|
||||
* DatePicker
|
||||
* MonthPicker
|
||||
* RangePicker
|
||||
- DatePicker
|
||||
- MonthPicker
|
||||
- RangePicker
|
||||
|
||||
**Note:** Part of locale of DatePicker, MonthPicker, RangePicker is read from value. So, please set the locale of moment correctly.
|
||||
|
||||
@@ -34,59 +34,59 @@ moment.locale('zh-cn');
|
||||
|
||||
The following APIs are shared by DatePicker, MonthPicker, RangePicker.
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|--------------|----------------|----------|--------------|
|
||||
| allowClear | Whether to show clear button | boolean | true |
|
||||
| disabled | determine whether the DatePicker is disabled | boolean | false |
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| allowClear | Whether to show clear button | boolean | true |
|
||||
| className | picker className | string | '' |
|
||||
| style | to customize the style of the input box | object | {} |
|
||||
| popupStyle | to customize the style of the popup calendar | object | {} |
|
||||
| size | determine the size of the input box, the height of `large` and `small`, are 32px and 22px respectively, while default size is 28px | string | - |
|
||||
| locale | localization configuration | object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
|
||||
| disabledDate | specify the date that cannot be selected | (currentDate: moment) => boolean | - |
|
||||
| disabled | determine whether the DatePicker is disabled | boolean | false |
|
||||
| disabledDate | specify the date that cannot be selected | (currentDate: moment) => boolean | - |
|
||||
| getCalendarContainer | to set the container of the floating layer, while the default is to create a `div` element in `body` | function(trigger) | - |
|
||||
| locale | localization configuration | object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
|
||||
| open | open state of picker | boolean | - |
|
||||
| onOpenChange | a callback function, can be executed whether the popup calendar is popped up or closed | function(status) | - |
|
||||
| placeholder | placeholder of date input | string\|RangePicker[] | - |
|
||||
| placeholder | placeholder of date input | string\|RangePicker\[] | - |
|
||||
| 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 | - |
|
||||
| style | to customize the style of the input box | object | {} |
|
||||
| onOpenChange | a callback function, can be executed whether the popup calendar is popped up or closed | function(status) | - |
|
||||
|
||||
### DatePicker
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|--------------|----------------|----------|--------------|
|
||||
| value | to set date | [moment](http://momentjs.com/) | - |
|
||||
| defaultValue | to set default date | [moment](http://momentjs.com/) | - |
|
||||
| format | to set the date format, refer to [moment.js](http://momentjs.com/) | string | "YYYY-MM-DD" |
|
||||
| onChange | a callback function, can be executed when the selected time is changing | function(date: moment, dateString: string) | - |
|
||||
| showTime | to provide an additional time selection | object\|boolean | [TimePicker Options](/components/time-picker/#API) |
|
||||
| showTime.defaultValue | to set default time of selected date, [demo](https://ant.design/components/date-picker/#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/) | moment() |
|
||||
| showToday | whether to show "Today" button | boolean | true |
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| defaultValue | to set default date | [moment](http://momentjs.com/) | - |
|
||||
| disabledTime | to specify the time that cannot be selected | function(date) | - |
|
||||
| onOk | callback when click ok button | function() | - |
|
||||
| format | to set the date format, refer to [moment.js](http://momentjs.com/) | string | "YYYY-MM-DD" |
|
||||
| renderExtraFooter | render extra footer in panel | () => React.ReactNode | - |
|
||||
| showTime | to provide an additional time selection | object\|boolean | [TimePicker Options](/components/time-picker/#API) |
|
||||
| showTime.defaultValue | to set default time of selected date, [demo](https://ant.design/components/date-picker/#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/) | moment() |
|
||||
| showToday | whether to show "Today" button | boolean | true |
|
||||
| value | to set date | [moment](http://momentjs.com/) | - |
|
||||
| onChange | a callback function, can be executed when the selected time is changing | function(date: moment, dateString: string) | - |
|
||||
| onOk | callback when click ok button | function() | - |
|
||||
|
||||
### MonthPicker
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|--------------|----------------|----------|--------------|
|
||||
| value | to set date | [moment](http://momentjs.com/) | - |
|
||||
| defaultValue | to set default date | [moment](http://momentjs.com/) | - |
|
||||
| format | to set the date format, refer to [moment.js](http://momentjs.com/) | string | "YYYY-MM" |
|
||||
| onChange | a callback function, can be executed when the selected time is changing | function(date: moment, dateString: string) | - |
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| 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" |
|
||||
| monthCellContentRender | Custom month cell content render method | function(date, locale): ReactNode | - |
|
||||
| value | to set date | [moment](http://momentjs.com/) | - |
|
||||
| onChange | a callback function, can be executed when the selected time is changing | function(date: moment, dateString: string) | - |
|
||||
|
||||
### RangePicker
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|--------------|----------------|----------|--------------|
|
||||
| value | to set date | [[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - |
|
||||
| defaultValue | to set default date | [[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - |
|
||||
| format | to set the date format | string | "YYYY-MM-DD HH:mm:ss" |
|
||||
| onChange | a callback function, can be executed when the selected time is changing | function(dates: [moment, moment], dateStrings: [string, string]) | - |
|
||||
| showTime | to provide an additional time selection | object\|boolean | [TimePicker Options](/components/time-picker/#API) |
|
||||
| showTime.defaultValue | to set default time of selected date, [demo](https://ant.design/components/date-picker/#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)[] | [moment(), moment()] |
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| defaultValue | to set default date | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - |
|
||||
| disabledTime | to specify the time that cannot be selected | function(dates: [moment, moment], partial: `'start'|'end'`) | - |
|
||||
| ranges | preseted ranges for quick selection | { [range: string]: [moment](http://momentjs.com/)[] } | - |
|
||||
| format | to set the date format | string | "YYYY-MM-DD HH:mm:ss" |
|
||||
| ranges | preseted ranges for quick selection | { [range: string]: [moment](http://momentjs.com/)\[] } | - |
|
||||
| renderExtraFooter | render extra footer in panel | () => React.ReactNode | - |
|
||||
| showTime | to provide an additional time selection | object\|boolean | [TimePicker Options](/components/time-picker/#API) |
|
||||
| showTime.defaultValue | to set default time of selected date, [demo](https://ant.design/components/date-picker/#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)\[] | [moment(), moment()] |
|
||||
| value | to set date | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - |
|
||||
| onChange | a callback function, can be executed when the selected time is changing | function(dates: [moment, moment], dateStrings: [string, string]) | - |
|
||||
| onOk | callback when click ok button | function() | - |
|
||||
|
||||
<style>
|
||||
|
||||
@@ -40,9 +40,9 @@ export interface DatePickerProps extends PickerProps, SinglePickerProps {
|
||||
open?: boolean;
|
||||
toggleOpen?: (e: {open: boolean}) => void;
|
||||
disabledTime?: (current: moment.Moment) => {
|
||||
disabledHours?: () => [number, number],
|
||||
disabledMinutes?: () => [number, number],
|
||||
disabledSeconds?: () => [number, number],
|
||||
disabledHours?: () => number[],
|
||||
disabledMinutes?: () => number[],
|
||||
disabledSeconds?: () => number[],
|
||||
};
|
||||
onOpenChange?: (status: boolean) => void;
|
||||
onOk?: (selectedTime: moment.Moment) => void;
|
||||
@@ -69,9 +69,9 @@ export interface RangePickerProps extends PickerProps {
|
||||
};
|
||||
placeholder?: [string, string];
|
||||
disabledTime?: (current: moment.Moment, type: string) => {
|
||||
disabledHours?: () => [number, number],
|
||||
disabledMinutes?: () => [number, number],
|
||||
disabledSeconds?: () => [number, number],
|
||||
disabledHours?: () => number[],
|
||||
disabledMinutes?: () => number[],
|
||||
disabledSeconds?: () => number[],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ subtitle: 日期选择框
|
||||
|
||||
日期类组件包括以下三种形式。
|
||||
|
||||
* DatePicker
|
||||
* MonthPicker
|
||||
* RangePicker
|
||||
- DatePicker
|
||||
- MonthPicker
|
||||
- RangePicker
|
||||
|
||||
**注意:**DatePicker、MonthPicker、RangePicker 部分 locale 是从 value 中读取,所以请先正确设置 moment 的 locale。
|
||||
|
||||
@@ -35,59 +35,59 @@ moment.locale('zh-cn');
|
||||
|
||||
以下 API 为 DatePicker、MonthPicker、RangePicker 共享的 API。
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|--------------|----------------|----------|--------------|
|
||||
| allowClear | 是否显示清除按钮 | boolean | true |
|
||||
| disabled | 禁用 | boolean | false |
|
||||
| className | 选择器 className | string | '' |
|
||||
| style | 自定义输入框样式 | object | {} |
|
||||
| popupStyle | 格外的弹出日历样式 | object | {} |
|
||||
| size | 输入框大小,`large` 高度为 32px,`small` 为 22px,默认是 28px | string | 无 |
|
||||
| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
|
||||
| disabledDate | 不可选择的日期 | (currentDate: moment) => boolean | 无 |
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| allowClear | 是否显示清除按钮 | boolean | true |
|
||||
| className | 选择器 className | string | '' |
|
||||
| disabled | 禁用 | boolean | false |
|
||||
| disabledDate | 不可选择的日期 | (currentDate: moment) => boolean | 无 |
|
||||
| getCalendarContainer | 定义浮层的容器,默认为 body 上新建 div | function(trigger) | 无 |
|
||||
| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
|
||||
| open | 控制弹层是否展开 | boolean | - |
|
||||
| onOpenChange | 弹出日历和关闭日历的回调 | function(status) | 无 |
|
||||
| placeholder | 输入框提示文字 | string\|RangePicker[] | - |
|
||||
| placeholder | 输入框提示文字 | string\|RangePicker\[] | - |
|
||||
| popupStyle | 格外的弹出日历样式 | object | {} |
|
||||
| size | 输入框大小,`large` 高度为 32px,`small` 为 22px,默认是 28px | string | 无 |
|
||||
| style | 自定义输入框样式 | object | {} |
|
||||
| onOpenChange | 弹出日历和关闭日历的回调 | function(status) | 无 |
|
||||
|
||||
### DatePicker
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|--------------|----------------|----------|--------------|
|
||||
| value | 日期 | [moment](http://momentjs.com/) | 无 |
|
||||
| defaultValue | 默认日期 | [moment](http://momentjs.com/) | 无 |
|
||||
| format | 展示的日期格式,配置参考 [moment.js](http://momentjs.com/) | string | "YYYY-MM-DD" |
|
||||
| onChange | 时间发生变化的回调 | function(date: moment, dateString: string) | 无 |
|
||||
| showTime | 增加时间选择功能 | Object\|boolean | [TimePicker Options](/components/time-picker/#API) |
|
||||
| showTime.defaultValue | 设置用户选择日期时默认的时分秒,[例子](https://ant.design/components/date-picker/#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/) | moment() |
|
||||
| showToday | 是否展示“今天”按钮 | boolean | true |
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| defaultValue | 默认日期 | [moment](http://momentjs.com/) | 无 |
|
||||
| disabledTime | 不可选择的时间 | function(date) | 无 |
|
||||
| onOk | 点击确定按钮的回调 | function() | - |
|
||||
| format | 展示的日期格式,配置参考 [moment.js](http://momentjs.com/) | string | "YYYY-MM-DD" |
|
||||
| renderExtraFooter | 在面板中添加额外的页脚 | () => React.ReactNode | - |
|
||||
| showTime | 增加时间选择功能 | Object\|boolean | [TimePicker Options](/components/time-picker/#API) |
|
||||
| showTime.defaultValue | 设置用户选择日期时默认的时分秒,[例子](https://ant.design/components/date-picker/#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/) | moment() |
|
||||
| showToday | 是否展示“今天”按钮 | boolean | true |
|
||||
| value | 日期 | [moment](http://momentjs.com/) | 无 |
|
||||
| onChange | 时间发生变化的回调 | function(date: moment, dateString: string) | 无 |
|
||||
| onOk | 点击确定按钮的回调 | function() | - |
|
||||
|
||||
### MonthPicker
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|--------------|----------------|----------|--------------|
|
||||
| value | 日期 | [moment](http://momentjs.com/) | 无 |
|
||||
| defaultValue | 默认日期 | [moment](http://momentjs.com/) | 无 |
|
||||
| format | 展示的日期格式,配置参考 [moment.js](http://momentjs.com/) | string | "YYYY-MM" |
|
||||
| onChange | 时间发生变化的回调,发生在用户选择时间时 | function(date: moment, dateString: string) | - |
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| defaultValue | 默认日期 | [moment](http://momentjs.com/) | 无 |
|
||||
| format | 展示的日期格式,配置参考 [moment.js](http://momentjs.com/) | string | "YYYY-MM" |
|
||||
| monthCellContentRender | 自定义的月份内容渲染方法 | function(date, locale): ReactNode | - |
|
||||
| value | 日期 | [moment](http://momentjs.com/) | 无 |
|
||||
| onChange | 时间发生变化的回调,发生在用户选择时间时 | function(date: moment, dateString: string) | - |
|
||||
|
||||
### RangePicker
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|--------------|----------------|----------|--------------|
|
||||
| value | 日期 | [moment](http://momentjs.com/)[] | 无 |
|
||||
| defaultValue | 默认日期 | [moment](http://momentjs.com/)[] | 无 |
|
||||
| format | 展示的日期格式 | string | "YYYY-MM-DD HH:mm:ss" |
|
||||
| onChange | 时间发生变化的回调,发生在用户选择时间时 | function(dates: [moment, moment], dateStrings: [string, string]) | 无 |
|
||||
| showTime | 增加时间选择功能 | Object\|boolean | [TimePicker Options](/components/time-picker/#API) |
|
||||
| showTime.defaultValue | 设置用户选择日期时默认的时分秒,[例子](https://ant.design/components/date-picker/#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)[] | [moment(), moment()] |
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| defaultValue | 默认日期 | [moment](http://momentjs.com/)\[] | 无 |
|
||||
| disabledTime | 不可选择的时间 | function(dates: [moment, moment], partial: `'start'|'end'`) | 无 |
|
||||
| ranges | 预设时间范围快捷选择 | { [range: string]: [moment](http://momentjs.com/)[] } | 无 |
|
||||
| format | 展示的日期格式 | string | "YYYY-MM-DD HH:mm:ss" |
|
||||
| ranges | 预设时间范围快捷选择 | { [range: string]: [moment](http://momentjs.com/)\[] } | 无 |
|
||||
| renderExtraFooter | 在面板中添加额外的页脚 | () => React.ReactNode | - |
|
||||
| showTime | 增加时间选择功能 | Object\|boolean | [TimePicker Options](/components/time-picker/#API) |
|
||||
| showTime.defaultValue | 设置用户选择日期时默认的时分秒,[例子](https://ant.design/components/date-picker/#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)\[] | [moment(), moment()] |
|
||||
| value | 日期 | [moment](http://momentjs.com/)\[] | 无 |
|
||||
| onChange | 时间发生变化的回调,发生在用户选择时间时 | function(dates: [moment, moment], dateStrings: [string, string]) | 无 |
|
||||
| onOk | 点击确定按钮的回调 | function() | - |
|
||||
|
||||
<style>
|
||||
|
||||
19
components/date-picker/locale/el_GR.tsx
Normal file
19
components/date-picker/locale/el_GR.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import CalendarLocale from 'rc-calendar/lib/locale/el_GR';
|
||||
import TimePickerLocale from '../../time-picker/locale/el_GR';
|
||||
|
||||
// Merge into a locale object
|
||||
const locale = {
|
||||
lang: {
|
||||
placeholder: 'Επιλέξτε ημερομηνία',
|
||||
rangePlaceholder: ['Αρχική ημερομηνία', 'Τελική ημερομηνία'],
|
||||
...CalendarLocale,
|
||||
},
|
||||
timePickerLocale: {
|
||||
...TimePickerLocale,
|
||||
},
|
||||
};
|
||||
|
||||
// All settings at:
|
||||
// https://github.com/ant-design/ant-design/issues/424
|
||||
|
||||
export default locale;
|
||||
19
components/date-picker/locale/fa_IR.tsx
Normal file
19
components/date-picker/locale/fa_IR.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import CalendarLocale from 'rc-calendar/lib/locale/fa_IR';
|
||||
import TimePickerLocale from '../../time-picker/locale/fa_IR';
|
||||
|
||||
// Merge into a locale object
|
||||
const locale = {
|
||||
lang: {
|
||||
placeholder: 'انتخاب تاریخ',
|
||||
rangePlaceholder: ['تاریخ شروع', 'تاریخ پایان'],
|
||||
...CalendarLocale,
|
||||
},
|
||||
timePickerLocale: {
|
||||
...TimePickerLocale,
|
||||
},
|
||||
};
|
||||
|
||||
// All settings at:
|
||||
// https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json
|
||||
|
||||
export default locale;
|
||||
19
components/date-picker/locale/nb_NO.tsx
Normal file
19
components/date-picker/locale/nb_NO.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import CalendarLocale from 'rc-calendar/lib/locale/nb_NO';
|
||||
import TimePickerLocale from '../../time-picker/locale/nb_NO';
|
||||
|
||||
// Merge into a locale object
|
||||
const locale = {
|
||||
lang: {
|
||||
placeholder: 'Velg dato',
|
||||
rangePlaceholder: ['Startdato', 'Sluttdato'],
|
||||
...CalendarLocale,
|
||||
},
|
||||
timePickerLocale: {
|
||||
...TimePickerLocale,
|
||||
},
|
||||
};
|
||||
|
||||
// All settings at:
|
||||
// https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json
|
||||
|
||||
export default locale;
|
||||
46
components/date-picker/locale/pt_PT.tsx
Normal file
46
components/date-picker/locale/pt_PT.tsx
Normal file
@@ -0,0 +1,46 @@
|
||||
import CalendarLocale from 'rc-calendar/lib/locale/pt_PT';
|
||||
import TimePickerLocale from '../../time-picker/locale/pt_PT';
|
||||
|
||||
// Merge into a locale object
|
||||
const locale = {
|
||||
lang: {
|
||||
...CalendarLocale,
|
||||
placeholder: 'Data',
|
||||
rangePlaceholder: ['Data inicial', 'Data final'],
|
||||
today: 'Hoje',
|
||||
now: 'Agora',
|
||||
backToToday: 'Hoje',
|
||||
ok: 'Ok',
|
||||
clear: 'Limpar',
|
||||
month: 'Mês',
|
||||
year: 'Ano',
|
||||
timeSelect: 'Hora',
|
||||
dateSelect: 'Selecionar data',
|
||||
monthSelect: 'Selecionar mês',
|
||||
yearSelect: 'Selecionar ano',
|
||||
decadeSelect: 'Selecionar década',
|
||||
yearFormat: 'YYYY',
|
||||
dateFormat: 'D/M/YYYY',
|
||||
dayFormat: 'D',
|
||||
dateTimeFormat: 'D/M/YYYY HH:mm:ss',
|
||||
monthFormat: 'MMMM',
|
||||
monthBeforeYear: false,
|
||||
previousMonth: 'Mês anterior (PageUp)',
|
||||
nextMonth: 'Mês seguinte (PageDown)',
|
||||
previousYear: 'Ano anterior (Control + left)',
|
||||
nextYear: 'Ano seguinte (Control + right)',
|
||||
previousDecade: 'Última década',
|
||||
nextDecade: 'Próxima década',
|
||||
previousCentury: 'Último século',
|
||||
nextCentury: 'Próximo século',
|
||||
},
|
||||
timePickerLocale: {
|
||||
...TimePickerLocale,
|
||||
placeholder: 'Hora',
|
||||
},
|
||||
};
|
||||
|
||||
// All settings at:
|
||||
// https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json
|
||||
|
||||
export default locale;
|
||||
19
components/date-picker/locale/sr_RS.tsx
Normal file
19
components/date-picker/locale/sr_RS.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import CalendarLocale from 'rc-calendar/lib/locale/sr_RS';
|
||||
import TimePickerLocale from '../../time-picker/locale/sr_RS';
|
||||
|
||||
// Merge into a locale object
|
||||
const locale = {
|
||||
lang: {
|
||||
placeholder: 'Izaberite datum',
|
||||
rangePlaceholder: ['Početni datum', 'Krajnji datum'],
|
||||
...CalendarLocale,
|
||||
},
|
||||
timePickerLocale: {
|
||||
...TimePickerLocale,
|
||||
},
|
||||
};
|
||||
|
||||
// All settings at:
|
||||
// https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json
|
||||
|
||||
export default locale;
|
||||
@@ -17,11 +17,10 @@
|
||||
|
||||
.@{calendar-prefix-cls}-range-picker-separator {
|
||||
color: @text-color-secondary;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
margin-top: -10px;
|
||||
line-height: 20px;
|
||||
height: 20px;
|
||||
width: 8px;
|
||||
display: inline-block;
|
||||
line-height: 18px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.@{calendar-prefix-cls}-range {
|
||||
|
||||
@@ -49,7 +49,6 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-dropdown-trigger ant-btn-default"
|
||||
disabled=""
|
||||
type="button"
|
||||
>
|
||||
<i
|
||||
@@ -175,15 +174,13 @@ exports[`renders ./components/dropdown/demo/sub-menu.md correctly 1`] = `
|
||||
`;
|
||||
|
||||
exports[`renders ./components/dropdown/demo/trigger.md correctly 1`] = `
|
||||
<div>
|
||||
<a
|
||||
class="ant-dropdown-link ant-dropdown-trigger"
|
||||
href="#"
|
||||
>
|
||||
Click me
|
||||
<i
|
||||
class="anticon anticon-down"
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
<a
|
||||
class="ant-dropdown-link ant-dropdown-trigger"
|
||||
href="#"
|
||||
>
|
||||
Click me
|
||||
<i
|
||||
class="anticon anticon-down"
|
||||
/>
|
||||
</a>
|
||||
`;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user