mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-15 13:59:19 +08:00
Compare commits
487 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
65c86e60ce | ||
|
|
156ce90a8e | ||
|
|
a94e3ab3e0 | ||
|
|
6527f9cdb0 | ||
|
|
742999ff28 | ||
|
|
d84452e8b8 | ||
|
|
a7200c906c | ||
|
|
7e2d456453 | ||
|
|
53ffc83d23 | ||
|
|
ef8beaffde | ||
|
|
d9ef06496d | ||
|
|
e0699597ca | ||
|
|
21f375b7d7 | ||
|
|
83a02a6050 | ||
|
|
6dade37aec | ||
|
|
275bdaef1a | ||
|
|
c9b3a50519 | ||
|
|
3d322a7c04 | ||
|
|
0d26b4c972 | ||
|
|
35bc4726a9 | ||
|
|
d0d6e10894 | ||
|
|
c355eae6d1 | ||
|
|
61aac68028 | ||
|
|
44319bec11 | ||
|
|
ef43be1c67 | ||
|
|
f04f340fa1 | ||
|
|
fc884242d8 | ||
|
|
036aeb333d | ||
|
|
72f7232929 | ||
|
|
8bdad3d418 | ||
|
|
640fcc51e8 | ||
|
|
62b72d6c51 | ||
|
|
ac5bdc6983 | ||
|
|
2268418a97 | ||
|
|
a51a37cbd8 | ||
|
|
1fdce5db28 | ||
|
|
50bdbbda40 | ||
|
|
55f58cf59f | ||
|
|
789e45fd52 | ||
|
|
84e561b237 | ||
|
|
ac07dcefb0 | ||
|
|
d4171badfd | ||
|
|
ff7ba0fb6f | ||
|
|
fcb935b101 | ||
|
|
6624805ad4 | ||
|
|
5bf94956e4 | ||
|
|
7b1df54523 | ||
|
|
f56e1a7de7 | ||
|
|
145ed77c00 | ||
|
|
723da5e164 | ||
|
|
f089d1852d | ||
|
|
f77c38bddf | ||
|
|
7b8090d279 | ||
|
|
e00bfdc150 | ||
|
|
988e12f54b | ||
|
|
187e9dd85c | ||
|
|
b216597cfd | ||
|
|
d329d191dd | ||
|
|
a93cb09e15 | ||
|
|
e061ada71a | ||
|
|
9abce572a4 | ||
|
|
26d746bd8f | ||
|
|
f9273bc95a | ||
|
|
01d4acb7a9 | ||
|
|
fe3af14273 | ||
|
|
20ea524ef1 | ||
|
|
ea92bbf371 | ||
|
|
f61f811432 | ||
|
|
70e10dee59 | ||
|
|
7a5e11c799 | ||
|
|
e0bf1cefe7 | ||
|
|
1f652bfe4c | ||
|
|
bee3c43e7a | ||
|
|
ad6dbcb9c6 | ||
|
|
53640c3f18 | ||
|
|
33f37debd7 | ||
|
|
8e744545ff | ||
|
|
f0c6350e0e | ||
|
|
cf3c0aac43 | ||
|
|
d3ec477f8f | ||
|
|
8dfb44ba72 | ||
|
|
f46112d385 | ||
|
|
5443e79329 | ||
|
|
59b11f3b48 | ||
|
|
48f7d22929 | ||
|
|
1f6bcf963f | ||
|
|
749b6e7242 | ||
|
|
dc209c20f9 | ||
|
|
87c8c7ad67 | ||
|
|
7d8c7d72b7 | ||
|
|
57e3be2c32 | ||
|
|
4b38dbd669 | ||
|
|
293d63910a | ||
|
|
e92ef95f74 | ||
|
|
f6d349731c | ||
|
|
f58b1075ac | ||
|
|
32497c35fe | ||
|
|
754966991b | ||
|
|
1e80254059 | ||
|
|
7d49cc18a9 | ||
|
|
e633f91c27 | ||
|
|
258b3d170c | ||
|
|
d5d69d4063 | ||
|
|
47aa36fb06 | ||
|
|
1fb7bd7205 | ||
|
|
e30116f4bd | ||
|
|
9a7c369af6 | ||
|
|
11f9459738 | ||
|
|
1651015688 | ||
|
|
592653c2ad | ||
|
|
711703b91e | ||
|
|
c23c0a6b16 | ||
|
|
f689ede0fa | ||
|
|
30e4fa8a8d | ||
|
|
fdc8d357ef | ||
|
|
c79592cf05 | ||
|
|
af9dc73eef | ||
|
|
d6dde83247 | ||
|
|
d98d7a451c | ||
|
|
9f75694c75 | ||
|
|
9bcde59001 | ||
|
|
43751c9930 | ||
|
|
1f18c93d7f | ||
|
|
b69a6886d7 | ||
|
|
47c5de29f3 | ||
|
|
eb3c274e01 | ||
|
|
df934445c0 | ||
|
|
87bfe2df87 | ||
|
|
3001ca4114 | ||
|
|
02c5616250 | ||
|
|
807b573bff | ||
|
|
b687a32044 | ||
|
|
a329d3d39b | ||
|
|
8892d85e33 | ||
|
|
500b222556 | ||
|
|
d339e628ed | ||
|
|
a033e576fd | ||
|
|
02daedd67b | ||
|
|
53d279eb77 | ||
|
|
acf58de807 | ||
|
|
4c52ccaff9 | ||
|
|
4f73a23a10 | ||
|
|
29b5f433f8 | ||
|
|
5a33774238 | ||
|
|
ba0d2598fe | ||
|
|
e3b6430a4b | ||
|
|
3570458c31 | ||
|
|
a22a011c49 | ||
|
|
94d46e4c01 | ||
|
|
e4c5ab9c69 | ||
|
|
456cea652b | ||
|
|
3727ea2c33 | ||
|
|
a9430e6748 | ||
|
|
e8ef77b963 | ||
|
|
d21523ef8c | ||
|
|
75a6a562a0 | ||
|
|
40e94945d9 | ||
|
|
8016cccd18 | ||
|
|
fa0e90f577 | ||
|
|
528a7645ca | ||
|
|
a5a1458148 | ||
|
|
8f1dd9ccda | ||
|
|
ee176347ac | ||
|
|
f7b918add3 | ||
|
|
c712d072eb | ||
|
|
f2b987aaa9 | ||
|
|
f5ade936e1 | ||
|
|
c8eec8c56f | ||
|
|
18c6860296 | ||
|
|
e9b3c36866 | ||
|
|
1dd3e001c5 | ||
|
|
fdb943e887 | ||
|
|
1651682020 | ||
|
|
cb8f6a6ef5 | ||
|
|
2fdc4ec1e6 | ||
|
|
bcda84141e | ||
|
|
b3979885e4 | ||
|
|
9e54bebf33 | ||
|
|
4bfd076cb8 | ||
|
|
6a17efcbf1 | ||
|
|
da8c82a6e4 | ||
|
|
6e2ace3ba8 | ||
|
|
4880b6ec16 | ||
|
|
59e219e138 | ||
|
|
5da1403bc0 | ||
|
|
1856fbe0df | ||
|
|
bb195ee95f | ||
|
|
6748221ed3 | ||
|
|
0f63c7186e | ||
|
|
483491d0d8 | ||
|
|
981573037a | ||
|
|
a0026a5923 | ||
|
|
63c3c7c88f | ||
|
|
0a9a3887b5 | ||
|
|
50b9839bb3 | ||
|
|
8618a387da | ||
|
|
bb7c580e4b | ||
|
|
ecc18ef3a6 | ||
|
|
414d3d3a64 | ||
|
|
fb70e9d70b | ||
|
|
746990b84d | ||
|
|
4962d19462 | ||
|
|
0cf3600e25 | ||
|
|
0cdcdfba7b | ||
|
|
0eefa85b04 | ||
|
|
1a93536a26 | ||
|
|
f1110f2bc5 | ||
|
|
eb69e0a0f8 | ||
|
|
8e8c0b4db3 | ||
|
|
e8fc686dcf | ||
|
|
b5ad05bc06 | ||
|
|
a88f8fcc21 | ||
|
|
330e1f7a4b | ||
|
|
8f98ae80bd | ||
|
|
2fe4ac1a30 | ||
|
|
50466ed281 | ||
|
|
29d2a756b0 | ||
|
|
401519ec6f | ||
|
|
12bf17b166 | ||
|
|
3ae966f158 | ||
|
|
b2556b4cd5 | ||
|
|
35ae41f618 | ||
|
|
bef7db465e | ||
|
|
0b8b0d2deb | ||
|
|
551807cd91 | ||
|
|
a6037d66c0 | ||
|
|
859761eea7 | ||
|
|
541a992a56 | ||
|
|
d00871acdd | ||
|
|
58ec298ded | ||
|
|
99e4cd6aec | ||
|
|
b54a70bc8e | ||
|
|
6eff4bd02a | ||
|
|
d6a0b1bd3e | ||
|
|
ef339a32ac | ||
|
|
4d5eb5a92f | ||
|
|
69775dea68 | ||
|
|
fff756ff5f | ||
|
|
bcb82a518b | ||
|
|
c63c8b6c04 | ||
|
|
24f58c20e1 | ||
|
|
abb2763a66 | ||
|
|
7582ab7481 | ||
|
|
455ea58b10 | ||
|
|
e1a46cc419 | ||
|
|
90511c3261 | ||
|
|
8e496966cf | ||
|
|
dc8be3fcfd | ||
|
|
acc0c5a216 | ||
|
|
144c67f054 | ||
|
|
ad92793a47 | ||
|
|
d90e1b2a9e | ||
|
|
54eadefeca | ||
|
|
8e2d65298a | ||
|
|
e0ab15907f | ||
|
|
4f85be834c | ||
|
|
fa12a715e0 | ||
|
|
e93d24021f | ||
|
|
9e6bc99816 | ||
|
|
0c0fc38be6 | ||
|
|
f648edacdb | ||
|
|
2ba3a84331 | ||
|
|
547745271e | ||
|
|
d2aca99190 | ||
|
|
499ab69f65 | ||
|
|
199d9433d5 | ||
|
|
568963e894 | ||
|
|
5c2b03dbfc | ||
|
|
55d2511608 | ||
|
|
94e4ddb032 | ||
|
|
d28b8f3591 |
@@ -1,5 +1,6 @@
|
||||
components/**/*.js
|
||||
components/**/*.jsx
|
||||
components/*/__tests__/type.tsx
|
||||
!.eslintrc.js
|
||||
!components/*/__tests__/*
|
||||
!components/*/__tests__/**/*.js
|
||||
!components/*/demo/*
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -36,3 +36,4 @@ components/**/*.js
|
||||
components/**/*.jsx
|
||||
!components/**/__tests__/*.js
|
||||
!components/**/__tests__/*.js.snap
|
||||
/.history
|
||||
|
||||
13
.jest.js
13
.jest.js
@@ -2,13 +2,9 @@ const libDir = process.env.LIB_DIR;
|
||||
|
||||
const transformIgnorePatterns = [
|
||||
'/dist/',
|
||||
'/node_modules/reqwest',
|
||||
'node_modules\/[^/]+?\/(?!(es|node_modules)\/)', // Ignore modules without es dir
|
||||
];
|
||||
|
||||
if (libDir !== 'es') {
|
||||
transformIgnorePatterns.push('/node_modules/');
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
setupFiles: [
|
||||
'./tests/setup.js',
|
||||
@@ -30,9 +26,9 @@ module.exports = {
|
||||
'node',
|
||||
],
|
||||
transform: {
|
||||
'\\.tsx?$': './node_modules/typescript-babel-jest',
|
||||
'\\.js$': './node_modules/babel-jest',
|
||||
'\\.md$': './node_modules/antd-demo-jest',
|
||||
'\\.tsx?$': './node_modules/antd-tools/lib/jest/codePreprocessor',
|
||||
'\\.js$': './node_modules/antd-tools/lib/jest/codePreprocessor',
|
||||
'\\.md$': './node_modules/antd-tools/lib/jest/demoPreprocessor',
|
||||
},
|
||||
testRegex: libDir === 'dist' ? 'demo\\.test\\.js$' : '.*\\.test\\.js$',
|
||||
collectCoverageFrom: [
|
||||
@@ -40,6 +36,7 @@ module.exports = {
|
||||
'!components/*/style/index.tsx',
|
||||
'!components/style/index.tsx',
|
||||
'!components/*/locale/index.tsx',
|
||||
'!components/*/__tests__/**/type.tsx',
|
||||
],
|
||||
transformIgnorePatterns,
|
||||
snapshotSerializers: [
|
||||
|
||||
@@ -9,9 +9,9 @@ module.exports = {
|
||||
'md',
|
||||
],
|
||||
transform: {
|
||||
'\\.tsx?$': './node_modules/typescript-babel-jest',
|
||||
'\\.js$': './node_modules/babel-jest',
|
||||
'\\.md$': './node_modules/antd-demo-jest',
|
||||
'\\.tsx?$': './node_modules/antd-tools/lib/jest/codePreprocessor',
|
||||
'\\.js$': './node_modules/antd-tools/lib/jest/codePreprocessor',
|
||||
'\\.md$': './node_modules/antd-tools/lib/jest/demoPreprocessor',
|
||||
},
|
||||
testRegex: 'demo\\.test\\.js$',
|
||||
testEnvironment: 'node',
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
{
|
||||
"extends": "stylelint-config-standard",
|
||||
"rules": {
|
||||
"at-rule-empty-line-before": null,
|
||||
"at-rule-name-space-after": null,
|
||||
"comment-empty-line-before": null,
|
||||
"declaration-bang-space-before": null,
|
||||
"declaration-empty-line-before": null,
|
||||
"function-comma-newline-after": null,
|
||||
"function-name-case": null,
|
||||
|
||||
@@ -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,209 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi
|
||||
|
||||
---
|
||||
|
||||
## 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`
|
||||
|
||||
- 📖 Rewrite the [Use in create-react-app](/docs/react/use-with-create-react-app) documentation without ejecting. [#7276](https://github.com/ant-design/ant-design/pull/7276)
|
||||
- 🌟 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
|
||||
|
||||
`2017-08-21`
|
||||
|
||||
- antd of Angular@4.0, [ng-zorro-antd](https://ng.ant.design) is open sourcing.
|
||||
- Affix supports more scenes. [01d4acb](https://github.com/ant-design/ant-design/commit/01d4acb7a9b030be3552b4ca19b4e899dc2bb7c7)
|
||||
- Fix that AutoComplete children ref doesn't work. [#6814](https://github.com/ant-design/ant-design/issues/6814)
|
||||
- Button
|
||||
- Improve the logic to insert space in Chinese characters. [59b11f3](https://github.com/ant-design/ant-design/commit/59b11f3b480d43cb32fb24e351cb4c4dd569243c)
|
||||
- Fix that `event.target` of click is not `button`. [#7034](https://github.com/ant-design/ant-design/issues/7034)
|
||||
- Fix that Carousel's `innerSlider` doesn't exist. [#7191](https://github.com/ant-design/ant-design/issues/7191)
|
||||
- Fix the style of button in DatePicker. [ad6dbcb](https://github.com/ant-design/ant-design/commit/ad6dbcb9c6dac407a38f2391d3e5fa1d8ae1cfab)
|
||||
- Fix TypeScript definition of Form.[#7245](https://github.com/ant-design/ant-design/pull/7245)
|
||||
- Fix TypeScript definition of InputNumber. [#7257](https://github.com/ant-design/ant-design/issues/7257)
|
||||
- Fix missing collapse animation of `Layout.Sider` in IE11. [#6349](https://github.com/ant-design/ant-design/issues/6349)
|
||||
- Fix typo of Spanish locale of LocaleProvider. [#7234](https://github.com/ant-design/ant-design/pull/7234) [@ramsesmoreno](https://github.com/ramsesmoreno)
|
||||
- Fix that notification's default placement should not be overrided. [#5895](https://github.com/ant-design/ant-design/issues/5895)
|
||||
- Fix disabled style of button in Pagination. [cf3c0aa](https://github.com/ant-design/ant-design/commit/cf3c0aac43e2825bfd85ca3b8abbf4742e504260)
|
||||
- Fix that wrong exports of Select which cause webpack build error. [#7222](https://github.com/ant-design/ant-design/issues/7222)
|
||||
- Fix that Tabs should show arrow buttons while resize its container. [#7231](https://github.com/ant-design/ant-design/issues/7231) [#7210](https://github.com/ant-design/ant-design/issues/7210)
|
||||
- Fix style of Timeline which has only one `Timeline.Item`. [#7214](https://github.com/ant-design/ant-design/issues/7214)
|
||||
- Fix wrong behavior of Upload when uid is 0. [#7269](https://github.com/ant-design/ant-design/issues/7269)
|
||||
|
||||
## 2.12.6
|
||||
|
||||
`2017-08-11`
|
||||
|
||||
- Fix Collapse arrow position in IE9/10/11. [af9dc73](https://github.com/ant-design/ant-design/commit/af9dc73eef2aac3e68fdfc99f9231153437f5068)
|
||||
- Fix empty Table scrollBar's position. [#7142](https://github.com/ant-design/ant-design/issues/7142)
|
||||
- Fix RangePicker Input's style of height. [47c5de2](https://github.com/ant-design/ant-design/commit/47c5de29f370a77fc19a6a8eda8ac57476f312a6)
|
||||
- Card
|
||||
- Improve Card.Grid style of collapse border. [807b573](https://github.com/ant-design/ant-design/commit/807b573bff43bc71115afeb086f565561807a32d)
|
||||
- Fix the `no-animation` type's className. [#7185](https://github.com/ant-design/ant-design/issues/7185)
|
||||
- Fix Input Safari text align. [#7135](https://github.com/ant-design/ant-design/issues/7135)
|
||||
- Layout
|
||||
- Fix stretched layout by content. [500b222](https://github.com/ant-design/ant-design/commit/500b2225567f03397d9faec5f4e60a8f35fc4d28)
|
||||
- Fix the collapse trigger's position. [f689ede](https://github.com/ant-design/ant-design/commit/f689ede0fa836dd0d99f4e4d96e0c43d0ff19742)
|
||||
- Fix Upload doesn't handle some error scenarios which response is not a string. [#6818](https://github.com/ant-design/ant-design/issues/6818)
|
||||
- Form
|
||||
- Add `validateFirst` prop of docs. [#6959](https://github.com/ant-design/ant-design/issues/6959)
|
||||
- Fix `wrappedComponentRef`. [#6545](https://github.com/ant-design/ant-design/issues/6545)
|
||||
- Add FormCreateOption's generic type. [#7119](https://github.com/ant-design/ant-design/pull/7119) [@djyde](https://github.com/djyde)
|
||||
- Fix `square` font size to `@form-feedback-icon-size`. [9bcde59](https://github.com/ant-design/ant-design/commit/9bcde590015855a12fdee851cf4e4836d0195cd7)
|
||||
|
||||
## 2.12.5
|
||||
|
||||
`2017-08-07`
|
||||
|
||||
- Fix the `SelectPropTypes not found` issue under es mode. [#7123](https://github.com/ant-design/ant-design/issues/7123)
|
||||
- Fix Row no wrap issue. [4f73a23](https://github.com/ant-design/ant-design/commit/4f73a23a103733a3c148bb04013493a042f90a8f)
|
||||
- Fix broken style of InputNumber and RangePicker. [#7117](https://github.com/ant-design/ant-design/issues/7117) [#7126](https://github.com/ant-design/ant-design/issues/7126)
|
||||
|
||||
## 2.12.4
|
||||
|
||||
`2017-08-06`
|
||||
|
||||
- Fix Affix throw invalid calling object in IE. [#7060](https://github.com/ant-design/ant-design/issues/7060)
|
||||
- Make optimization for title display behavior of Badge. [#7024](https://github.com/ant-design/ant-design/issues/7024)
|
||||
- Card
|
||||
- Fix `noHovering` API typo. [#7078](https://github.com/ant-design/ant-design/issues/7078)
|
||||
- Fix `children` type definitions. [pull/7030](https://github.com/ant-design/ant-design/pull/7030) [@djyde](https://github.com/djyde)
|
||||
- Fix Collapse `onChange` parameter type definitions. [pull/7084](https://github.com/ant-design/ant-design/pull/7084) [@davidctj](https://github.com/davidctj)
|
||||
- Dropdown
|
||||
- Fix Dropdown.Button align issue. [#7070](https://github.com/ant-design/ant-design/issues/7070)
|
||||
- Add `size` prop for docs. [pull/7071](https://github.com/ant-design/ant-design/pull/7071) [@hansnow](https://github.com/hansnow)
|
||||
- Input
|
||||
- Fix outline covered by addon. [commit/0f63c7](https://github.com/ant-design/ant-design/commit/0f63c7186ef3a5db36c01df9d9ebde9d5b3871ef)
|
||||
- Fix InputGroup demo. [pull/7089](https://github.com/ant-design/ant-design/pull/7089) [@jdz321](https://github.com/jdz321)
|
||||
- Fix InputNumber Formatter demo issue. [pull/7098](https://github.com/ant-design/ant-design/pull/7098) [@tim-soft](https://github.com/tim-soft)
|
||||
- Menu
|
||||
- Fix abnormal performance of inlineCollapsed Menu. [#7048](https://github.com/ant-design/ant-design/issues/7048) [#7063](https://github.com/ant-design/ant-design/issues/7063)
|
||||
- Fix SubMenu can't be highlighted if its children are selected. [pull/7042](https://github.com/ant-design/ant-design/pull/7042) [@atomgao](https://github.com/atomgao)
|
||||
- Fix notification `type` type definitions. [#7073](https://github.com/ant-design/ant-design/issues/7073) [@marswong](https://github.com/marswong)
|
||||
- Fix Pagination `showTotal` type definitions. [#7054](https://github.com/ant-design/ant-design/issues/7054)
|
||||
- Fix RangePicker throw error after clear. [#7077](https://github.com/ant-design/ant-design/issues/7077)
|
||||
- Adds `onFocus` and `onBlur` type definitions for Select. [pull/7082](https://github.com/ant-design/ant-design/pull/7082) [@troynt](https://github.com/troynt)
|
||||
- Fix Tabs `tabBarExtraContent` style issue in vertical mode. Upgrade rc-tabs to 9.0.2, refactor the dom structure of TabBar `extraContent`. [#6578](https://github.com/ant-design/ant-design/issues/6578)
|
||||
- Fix missing icon issue for TreeSelect. [#7020](https://github.com/ant-design/ant-design/issues/7020)
|
||||
- Fix `error TS7016: Could not find a declaration file for module 'rc-util/lib/Dom/addEventListener'`. [#7033](https://github.com/ant-design/ant-design/issues/7033) [@djyde](https://github.com/djyde)
|
||||
- Translate patterns/list. [list](https://ant.design/docs/pattern/list) [@zachguo](https://github.com/zachguo)
|
||||
|
||||
## 2.12.3
|
||||
|
||||
`2017-07-30`
|
||||
|
||||
- Fix indeterminate Checkbox style when it's disabled.
|
||||
- Fix Card `this.container` may not exists issue. [#6976](https://github.com/ant-design/ant-design/pull/6976) [@neekey](https://github.com/neekey)
|
||||
- Fix Button align issue when set base font to `14px`. [#7001](https://github.com/ant-design/ant-design/issues/7001)
|
||||
- Dropdown
|
||||
- Fix Menu can be multiple cicked. [#6314](https://github.com/ant-design/ant-design/issues/6314)
|
||||
- Fix Menu dispears if it's hovered before it's shown. [#6949](https://github.com/ant-design/ant-design/issues/6949)
|
||||
- Fix align issue.
|
||||
- Fix Grid Card padding.
|
||||
- Improve Menu animation.[#6955](https://github.com/ant-design/ant-design/pull/6955)
|
||||
- Twrak DatePicker icon position.
|
||||
- Add new less variables.[e1a46cc](https://github.com/ant-design/ant-design/commit/e1a46cc419fb4975ae1782ba793b378c8e584057)
|
||||
- Fix some issues of TypeScript definitions.
|
||||
|
||||
## 2.12.2
|
||||
|
||||
`2017-07-22`
|
||||
@@ -68,7 +271,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)
|
||||
@@ -83,7 +286,7 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi
|
||||
- Fix Select overflow issue. [#6621](https://github.com/ant-design/ant-design/issues/6621)
|
||||
- Slider
|
||||
- Improve styles. [#6665](https://github.com/ant-design/ant-design/issues/6665)
|
||||
- Upgrade rc-slider to 8.2.0, add `dotStyle`,`activeDotStyle` props. [rc-slider/pull/292](https://github.com/react-component/slider/pull/292)
|
||||
- Upgrade rc-slider to 8.2.0, add `dotStyle`, `activeDotStyle` props. [rc-slider/pull/292](https://github.com/react-component/slider/pull/292)
|
||||
- Fix Spin z-index issue. [#6759](https://github.com/ant-design/ant-design/issues/6759)
|
||||
- Fix nested Steps style issue. [#6754](https://github.com/ant-design/ant-design/issues/6754)
|
||||
- Table
|
||||
@@ -92,7 +295,7 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi
|
||||
- Make supplement for `loading` docs. [pull/6763](https://github.com/ant-design/ant-design/pull/6763) [@hansnow](https://github.com/hansnow)
|
||||
- Upgrade rc-table to 5.4.0, support `onRowMouseEnter` and `onRowMouseLeave`. [rc-table/0db582](https://github.com/react-component/table/commit/0db582a75dfa119715eb4db8a59eacfca744c5a0)
|
||||
- Improve TimePicker format support. [950c32](https://github.com/ant-design/ant-design/commit/950c321b25091ef31b130b83674478974590d7f3)
|
||||
- Make style improvement or tweaking for many components, includes [Checkbox](https://ant.design/components/checkbox/),[Radio](https://ant.design/components/radio/),[Tabs](https://ant.design/components/tabs/),[Card](https://ant.design/components/card/) and etc.
|
||||
- Make style improvement or tweaking for many components, includes [Checkbox](https://ant.design/components/checkbox/), [Radio](https://ant.design/components/radio/), [Tabs](https://ant.design/components/tabs/), [Card](https://ant.design/components/card/) and etc.
|
||||
- Now you can open demo in codepen. [#5140](https://github.com/ant-design/ant-design/issues/5140)
|
||||
|
||||
## 2.11.2
|
||||
@@ -484,7 +687,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)
|
||||
@@ -608,7 +811,7 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi
|
||||
* Fixed Badge misplace issue when browser zoom above 100%. [#4747](https://github.com/ant-design/ant-design/issues/4747) [#4290](https://github.com/ant-design/ant-design/issues/4290)
|
||||
* Fixed a mis-align issue of fixed header Table. [#4750](https://github.com/ant-design/ant-design/issues/4750)
|
||||
* Fixed Table scrolling lag issue in IE. [#4522](https://github.com/ant-design/ant-design/issues/4522)
|
||||
* Add icon aliases: `addfile` => `file-add`,`addfolder` => `folder-open`, and the old type names are still working. [#4758](https://github.com/ant-design/ant-design/issues/4758)
|
||||
* Add icon aliases: `addfile` => `file-add`, `addfolder` => `folder-open`, and the old type names are still working. [#4758](https://github.com/ant-design/ant-design/issues/4758)
|
||||
|
||||
## 2.6.4
|
||||
|
||||
|
||||
@@ -17,6 +17,208 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
## 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)
|
||||
- 🐞 修复了 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
|
||||
|
||||
`2017-08-21`
|
||||
|
||||
- Angular@4.0 版 antd [ng-zorro-antd](https://ng.ant.design) 开源。
|
||||
- 优化 Affix 支持的场景。[01d4acb](https://github.com/ant-design/ant-design/commit/01d4acb7a9b030be3552b4ca19b4e899dc2bb7c7)
|
||||
- 修复 AutoComplete children ref 失效的问题。[#6814](https://github.com/ant-design/ant-design/issues/6814)
|
||||
- Button
|
||||
- 优化自动在中文字符中间插入空格的逻辑。[59b11f3](https://github.com/ant-design/ant-design/commit/59b11f3b480d43cb32fb24e351cb4c4dd569243c)
|
||||
- 修复点击事件的 `event.target` 不是 button 的问题。[#7034](https://github.com/ant-design/ant-design/issues/7034)
|
||||
- 修复 Carousel 的 `innerSlider` 引用问题。[#7191](https://github.com/ant-design/ant-design/issues/7191)
|
||||
- 修复 DatePicker 中的按钮样式。[ad6dbcb](https://github.com/ant-design/ant-design/commit/ad6dbcb9c6dac407a38f2391d3e5fa1d8ae1cfab)
|
||||
- 修复 Form TypeScript definition。[#7245](https://github.com/ant-design/ant-design/pull/7245)
|
||||
- 修复 InputNumber 的 TypeScript definition。[#7257](https://github.com/ant-design/ant-design/issues/7257)
|
||||
- 修复 `Layout.Sider` 在 IE11 下没有折叠动画的问题。[#6349](https://github.com/ant-design/ant-design/issues/6349)
|
||||
- 修复 LocaleProvider 西班牙语的拼写问题。[#7234](https://github.com/ant-design/ant-design/pull/7234) [@ramsesmoreno](https://github.com/ramsesmoreno)
|
||||
- 修复 notification 默认 placement 会被覆盖的问题。[#5895](https://github.com/ant-design/ant-design/issues/5895)
|
||||
- 修复 Pagination 按钮的 disabled 样式。[cf3c0aa](https://github.com/ant-design/ant-design/commit/cf3c0aac43e2825bfd85ca3b8abbf4742e504260)
|
||||
- 修复 Select exports 导致的 webpack 构建错误的问题。[#7222](https://github.com/ant-design/ant-design/issues/7222)
|
||||
- 修复 Tabs 在父容器宽度动态变化时切换按钮没有出现的问题。[#7231](https://github.com/ant-design/ant-design/issues/7231) [#7210](https://github.com/ant-design/ant-design/issues/7210)
|
||||
- 修复 Timeline 在只有一个 `Timeline.Item` 时的样式问题。[#7214](https://github.com/ant-design/ant-design/issues/7214)
|
||||
- 修复 Upload 在 uid 为 0 时的错误行为。[#7269](https://github.com/ant-design/ant-design/issues/7269)
|
||||
|
||||
## 2.12.6
|
||||
|
||||
`2017-08-11`
|
||||
|
||||
- 修复了在 IE9/10/11 下 Collapse 的箭头位置不正确的问题。[af9dc73](https://github.com/ant-design/ant-design/commit/af9dc73eef2aac3e68fdfc99f9231153437f5068)
|
||||
- 修复了 Table 为空表格时滚动条展示位置不正确的问题。[#7142](https://github.com/ant-design/ant-design/issues/7142)
|
||||
- 修复了 RangePicker Input 的高度。[47c5de2](https://github.com/ant-design/ant-design/commit/47c5de29f370a77fc19a6a8eda8ac57476f312a6)
|
||||
- Card
|
||||
- 优化了 Card.Grid 边框覆盖的样式。[807b573](https://github.com/ant-design/ant-design/commit/807b573bff43bc71115afeb086f565561807a32d)
|
||||
- 修复了对应 `no-animation` 类型的 className。[#7185](https://github.com/ant-design/ant-design/issues/7185)
|
||||
- 修复了 Input Safari 下文本对齐的问题。[#7135](https://github.com/ant-design/ant-design/issues/7135)
|
||||
- Layout
|
||||
- 修复了组件的拉伸展示问题。[500b222](https://github.com/ant-design/ant-design/commit/500b2225567f03397d9faec5f4e60a8f35fc4d28)
|
||||
- 修复了折叠箭头的位置。[f689ede](https://github.com/ant-design/ant-design/commit/f689ede0fa836dd0d99f4e4d96e0c43d0ff19742)
|
||||
- 修复了 Upload 的 response 不是 string 的情况下没有处理错误提示信息的问题。[#6818](https://github.com/ant-design/ant-design/issues/6818)
|
||||
- Form
|
||||
- 补充了文档中缺少的 `validateFirst` 属性描述。[#6959](https://github.com/ant-design/ant-design/issues/6959)
|
||||
- 修复了 `wrappedComponentRef`。[#6545](https://github.com/ant-design/ant-design/issues/6545)
|
||||
- 补充了 FormCreateOption 的 `generic type`。[#7119](https://github.com/ant-design/ant-design/pull/7119) [@djyde](https://github.com/djyde)
|
||||
- 修改了 `square` 的字体大小为 `@form-feedback-icon-size`。[9bcde59](https://github.com/ant-design/ant-design/commit/9bcde590015855a12fdee851cf4e4836d0195cd7)
|
||||
|
||||
## 2.12.5
|
||||
|
||||
`2017-08-07`
|
||||
|
||||
- 修复 ES 模式下报 `SelectPropTypes not found` 的问题。[#7123](https://github.com/ant-design/ant-design/issues/7123)
|
||||
- 修复 Row 在 flex 模式下元素不换行的问题。[4f73a23](https://github.com/ant-design/ant-design/commit/4f73a23a103733a3c148bb04013493a042f90a8f)
|
||||
- 修复 InputNumber 和 RangePicker 的样式问题。[#7117](https://github.com/ant-design/ant-design/issues/7117) [#7126](https://github.com/ant-design/ant-design/issues/7126)
|
||||
|
||||
## 2.12.4
|
||||
|
||||
`2017-08-06`
|
||||
|
||||
- 修复了 Affix 在 IE 下调用对象无效的报错。[#7060](https://github.com/ant-design/ant-design/issues/7060)
|
||||
- 对 Badge 默认 title 的出现条件进行了优化。[#7024](https://github.com/ant-design/ant-design/issues/7024)
|
||||
- Card
|
||||
- 修改了文档中 `onHovering` 属性的错误描述。[#7078](https://github.com/ant-design/ant-design/issues/7078)
|
||||
- 修复了 `children` 的类型定义。[pull/7030](https://github.com/ant-design/ant-design/pull/7030) [@djyde](https://github.com/djyde)
|
||||
- 修复了 Collapse `onChange` 属性参数的类型定义。[pull/7084](https://github.com/ant-design/ant-design/pull/7084) [@davidctj](https://github.com/davidctj)
|
||||
- Dropdown
|
||||
- 修复了 Dropdown.Button 的对齐问题。[#7070](https://github.com/ant-design/ant-design/issues/7070)
|
||||
- 补充了文档中缺失的 `size` 属性。[pull/7071](https://github.com/ant-design/ant-design/pull/7071) [@hansnow](https://github.com/hansnow)
|
||||
- Input
|
||||
- 修复了 outline 被 addon 遮盖的问题。[commit/0f63c7](https://github.com/ant-design/ant-design/commit/0f63c7186ef3a5db36c01df9d9ebde9d5b3871ef)
|
||||
- 修复了 InputGroup 的示例问题。[pull/7089](https://github.com/ant-design/ant-design/pull/7089) [@jdz321](https://github.com/jdz321)
|
||||
- 修复了 InputNumber 格式化示例的报错问题。[pull/7098](https://github.com/ant-design/ant-design/pull/7098) [@tim-soft](https://github.com/tim-soft)
|
||||
- Menu
|
||||
- 修复了 Menu 折叠并缩起时的不正常表现。[#7048](https://github.com/ant-design/ant-design/issues/7048) [#7063](https://github.com/ant-design/ant-design/issues/7063)
|
||||
- 修复了子菜单被选中时 SubMenu 没有高亮的问题。[pull/7042](https://github.com/ant-design/ant-design/pull/7042) [@atomgao](https://github.com/atomgao)
|
||||
- 修复了 notification `type` 的类型定义。[#7073](https://github.com/ant-design/ant-design/issues/7073) [@marswong](https://github.com/marswong)
|
||||
- 修复了 Pagination `showTotal` 的类型定义。[#7054](https://github.com/ant-design/ant-design/issues/7054)
|
||||
- 修复了 RangePicker 在清空后的报错问题。[#7077](https://github.com/ant-design/ant-design/issues/7077)
|
||||
- 补充了 Select 缺失的 `onFocus` `onBlur` 类型定义。[pull/7082](https://github.com/ant-design/ant-design/pull/7082) [@troynt](https://github.com/troynt)
|
||||
- 修复了 Tabs 垂直模式下 `tabBarExtraContent` 样式错乱的问题。rc-tabs 升级到 9.0.2,对 TabBar 的 `extraContent` 的结构进行了重构。[#6578](https://github.com/ant-design/ant-design/issues/6578)
|
||||
- 修复了 TreeSelect 图标不能正常展示的问题。[#7020](https://github.com/ant-design/ant-design/issues/7020)
|
||||
- 修复了 `error TS7016: Could not find a declaration file for module 'rc-util/lib/Dom/addEventListener'` 的报错。[#7033](https://github.com/ant-design/ant-design/issues/7033) [@djyde](https://github.com/djyde)
|
||||
- 完成了『模式-列表』的文档翻译。[list](https://ant.design/docs/pattern/list) [@zachguo](https://github.com/zachguo)
|
||||
|
||||
## 2.12.3
|
||||
|
||||
`2017-07-30`
|
||||
|
||||
- 修复 Checkbox 半选状态禁用时的样式。
|
||||
- 修复 Card 会出现 `this.container` 不存在的问题。[#6976](https://github.com/ant-design/ant-design/pull/6976) [@neekey](https://github.com/neekey)
|
||||
- 修复基础字体改为 `14px` 时 Button 的对齐问题。[#7001](https://github.com/ant-design/ant-design/issues/7001)
|
||||
- 修复 Grid Card 的内边距。
|
||||
- Dropdown
|
||||
- 修复菜单可能被多次点击的问题。[#6314](https://github.com/ant-design/ant-design/issues/6314)
|
||||
- 修复在菜单显示前 hover 会导致菜单消失的问题。[#6949](https://github.com/ant-design/ant-design/issues/6949)
|
||||
- 修复菜单的错位问题。
|
||||
- 改进了 Menu 的动画效果。[#6955](https://github.com/ant-design/ant-design/pull/6955)
|
||||
- 调整了 DatePicker 中图标的位置。
|
||||
- 新增 less 变量。[e1a46cc](https://github.com/ant-design/ant-design/commit/e1a46cc419fb4975ae1782ba793b378c8e584057)
|
||||
- 修复了一些 TypeScript 定义问题。
|
||||
|
||||
## 2.12.2
|
||||
|
||||
`2017-07-22`
|
||||
@@ -68,7 +270,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)
|
||||
@@ -483,7 +685,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)
|
||||
|
||||
@@ -56,7 +56,7 @@ ReactDOM.render(<DatePicker />, mountNode);
|
||||
import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
|
||||
```
|
||||
|
||||
按需加载可通过此写法 `import DatePicker from 'antd/lib/date-picker'` 或使用插件 [babel-plugin-import](https://github.com/ant-design/babel-plugin-import)。
|
||||
按需加载可通过此写法 `import DatePicker from 'antd/lib/date-picker'` 或使用 Babel 插件 [babel-plugin-import](https://github.com/ant-design/babel-plugin-import),或使用 TypeScript 插件 [ts-import-plugin](https://github.com/Brooooooklyn/ts-import-plugin)。
|
||||
|
||||
## TypeScript
|
||||
|
||||
|
||||
35
README.md
35
README.md
@@ -35,7 +35,7 @@ An enterprise-class UI design language and React-based implementation.
|
||||
|
||||
## Let's build a better antd together [](http://makeapullrequest.com)
|
||||
|
||||
`antd` is an open source project, improvements are welcomed. If you are interested in contributing to `antd`, you can watch this repository, join in [discussion](https://github.com/ant-design/ant-design/issues?q=is%3Aopen+is%3Aissue+label%3ADiscussion), or try to implement some [features which have been accepted](https://github.com/ant-design/ant-design/issues?q=is%3Aopen+is%3Aissue+label%3A%22PR+welcome%22). Actually, there are [many ways](https://opensource.guide/how-to-contribute/) to contribute. And we are always happy to [offer collaborator permission](https://github.com/ant-design/ant-design/issues/3222) for some active contributors.
|
||||
`antd` is an open source project; improvements are welcomed. If you are interested in contributing to `antd`, you can watch this repository, join in [discussion](https://github.com/ant-design/ant-design/issues?q=is%3Aopen+is%3Aissue+label%3ADiscussion), or try to implement some [features which have been accepted](https://github.com/ant-design/ant-design/issues?q=is%3Aopen+is%3Aissue+label%3A%22PR+welcome%22). Actually, there are [many ways](https://opensource.guide/how-to-contribute/) to contribute. And we are always happy to [offer collaborator permission](https://github.com/ant-design/ant-design/issues/3222) for some active contributors.
|
||||
|
||||
## Install
|
||||
|
||||
@@ -58,7 +58,15 @@ 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
|
||||
@@ -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
|
||||
@@ -101,6 +101,19 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
|
||||
> - set `allowSyntheticDefaultImports` to prevent `error TS1192: Module 'react' has no default export`.
|
||||
> - Don't use @types/antd, antd provide a built-in ts definition already.
|
||||
|
||||
#### Use [ts-import-plugin](https://github.com/Brooooooklyn/ts-import-plugin) with modularized antd
|
||||
|
||||
```js
|
||||
{
|
||||
loader: "ts-loader", // or awesome-typescript-loader
|
||||
options {
|
||||
getCustomTransformers: () => ({
|
||||
before: [ tsImportPluginFactory({ libraryName: "antd", style: "css" }) ]
|
||||
})
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Internationalization
|
||||
|
||||
See [i18n](http://ant.design/docs/react/i18n).
|
||||
@@ -135,4 +148,4 @@ Open your browser and visit http://127.0.0.1:8001 , see more at https://github.c
|
||||
|
||||
## Contributing
|
||||
|
||||
We welcome all contributions, please read our [CONTRIBUTING.md](https://github.com/ant-design/ant-design/blob/master/.github/CONTRIBUTING.md) first. You can submit any ideas as [pull requests](https://github.com/ant-design/ant-design/pulls) or as [GitHub issues](https://github.com/ant-design/ant-design/issues). If you'd like to improve code, check out the [Development Instructions](https://github.com/ant-design/ant-design/wiki/Development) and have a good time! :)
|
||||
We welcome all contributions. Please read our [CONTRIBUTING.md](https://github.com/ant-design/ant-design/blob/master/.github/CONTRIBUTING.md) first. You can submit any ideas as [pull requests](https://github.com/ant-design/ant-design/pulls) or as [GitHub issues](https://github.com/ant-design/ant-design/issues). If you'd like to improve code, check out the [Development Instructions](https://github.com/ant-design/ant-design/wiki/Development) and have a good time! :)
|
||||
|
||||
@@ -16,7 +16,8 @@ export default function getRequestAnimationFrame() {
|
||||
return () => {};
|
||||
}
|
||||
if (window.requestAnimationFrame) {
|
||||
return window.requestAnimationFrame;
|
||||
// https://github.com/vuejs/vue/issues/4465
|
||||
return window.requestAnimationFrame.bind(window);
|
||||
}
|
||||
|
||||
const prefix = availablePrefixs.filter(key => `${key}RequestAnimationFrame` in window)[0];
|
||||
|
||||
@@ -4,7 +4,7 @@ type: Navigation
|
||||
title: Affix
|
||||
---
|
||||
|
||||
Make an element sticky to viewport.
|
||||
Make an element stick to viewport.
|
||||
|
||||
## When To Use
|
||||
|
||||
@@ -19,7 +19,7 @@ Please note that Affix should not cover other content on the page, especially wh
|
||||
| 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 | - |
|
||||
| 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`:
|
||||
|
||||
|
||||
@@ -73,6 +73,18 @@ export default class Affix extends React.Component<AffixProps, any> {
|
||||
fixedNode: HTMLElement;
|
||||
};
|
||||
|
||||
events = [
|
||||
'resize',
|
||||
'scroll',
|
||||
'touchstart',
|
||||
'touchmove',
|
||||
'touchend',
|
||||
'pageshow',
|
||||
'load',
|
||||
];
|
||||
|
||||
eventHandlers = {};
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
@@ -150,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 &&
|
||||
@@ -167,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;
|
||||
@@ -190,7 +202,7 @@ export default class Affix extends React.Component<AffixProps, any> {
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (this.props.target !== nextProps.target) {
|
||||
this.clearScrollEventListeners();
|
||||
this.clearEventListeners();
|
||||
this.setTargetEventListeners(nextProps.target);
|
||||
|
||||
// Mock Event object.
|
||||
@@ -199,7 +211,7 @@ export default class Affix extends React.Component<AffixProps, any> {
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.clearScrollEventListeners();
|
||||
this.clearEventListeners();
|
||||
clearTimeout(this.timeout);
|
||||
(this.updatePosition as any).cancel();
|
||||
}
|
||||
@@ -209,15 +221,18 @@ export default class Affix extends React.Component<AffixProps, any> {
|
||||
if (!target) {
|
||||
return;
|
||||
}
|
||||
this.clearScrollEventListeners();
|
||||
this.scrollEvent = addEventListener(target, 'scroll', this.updatePosition);
|
||||
this.resizeEvent = addEventListener(target, 'resize', this.updatePosition);
|
||||
this.clearEventListeners();
|
||||
|
||||
this.events.forEach(eventName => {
|
||||
this.eventHandlers[eventName] = addEventListener(target, eventName, this.updatePosition);
|
||||
});
|
||||
}
|
||||
|
||||
clearScrollEventListeners() {
|
||||
['scrollEvent', 'resizeEvent'].forEach((name) => {
|
||||
if (this[name]) {
|
||||
this[name].remove();
|
||||
clearEventListeners() {
|
||||
this.events.forEach(eventName => {
|
||||
const handler = this.eventHandlers[eventName];
|
||||
if (handler && handler.remove) {
|
||||
handler.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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` |
|
||||
| type | Type of Alert styles, options: `success`, `info`, `warning`, `error` | string | `info`, in `banner` mode default is `warning` |
|
||||
| closable | Whether Alert can be closed | boolean | - |
|
||||
| closeText | Close text to show | string\|ReactNode | - |
|
||||
| message | Content of Alert | string\|ReactNode | - |
|
||||
| description | Additional content of Alert | string\|ReactNode | - |
|
||||
| onClose | Callback when close Alert | Function | - |
|
||||
| showIcon | Whether to show icon | boolean | false, in `banner` mode it's true |
|
||||
| onClose | Callback when Alert is closed | Function | - |
|
||||
| showIcon | Whether to show icon | boolean | false, in `banner` mode default is true |
|
||||
| banner | Whether to show as banner | boolean | false |
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
border-radius: @border-radius-base;
|
||||
color: @alert-text-color;
|
||||
font-size: @font-size-base;
|
||||
line-height: @font-size-base + 4px;
|
||||
line-height: @line-height-base;
|
||||
|
||||
&&-no-icon {
|
||||
padding: 8px 48px 8px 16px;
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
&-icon {
|
||||
font-size: @font-size-lg;
|
||||
top: 9.5px;
|
||||
top: 8px + @font-size-base * @line-height-base / 2 - @font-size-lg / 2;
|
||||
left: 16px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import getScroll from '../_util/getScroll';
|
||||
import getRequestAnimationFrame from '../_util/getRequestAnimationFrame';
|
||||
|
||||
function getDefaultTarget() {
|
||||
return typeof window !== 'undefined' ? window : null;
|
||||
return window;
|
||||
}
|
||||
|
||||
function getOffsetTop(element: HTMLElement): number {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,17 @@ export default class InputElement extends React.Component<any, any> {
|
||||
blur = () => {
|
||||
this.ele.blur ? this.ele.blur() : (findDOMNode(this.ele) as HTMLInputElement).blur();
|
||||
}
|
||||
saveRef = (ele: HTMLInputElement) => {
|
||||
this.ele = ele;
|
||||
const childRef = this.props.children.ref;
|
||||
if (typeof childRef === 'function') {
|
||||
childRef(ele);
|
||||
}
|
||||
}
|
||||
render() {
|
||||
return React.cloneElement(this.props.children, {
|
||||
...this.props,
|
||||
ref: ele => this.ele = (ele as HTMLInputElement),
|
||||
ref: this.saveRef,
|
||||
}, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,4 +17,14 @@ describe('AutoComplete with Custom Input Element Render', () => {
|
||||
// should not filter data source defaultly
|
||||
expect(dropdownWrapper.find('MenuItem').length).toBe(3);
|
||||
});
|
||||
|
||||
it('child.ref should work', () => {
|
||||
const mockRef = jest.fn();
|
||||
mount(
|
||||
<AutoComplete dataSource={[]}>
|
||||
<input ref={mockRef} />
|
||||
</AutoComplete>
|
||||
);
|
||||
expect(mockRef).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -34,3 +34,4 @@ const dataSource = ['12345', '23456', '34567'];
|
||||
| children (for customize input element) | customize input element | HTMLInputElement / HTMLTextAreaElement / React.ReactElement<InputProps> | `<Input />` |
|
||||
| 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 |
|
||||
| backfill | backfill selected item the input when using keyboard | boolean | false |
|
||||
|
||||
@@ -52,7 +52,7 @@ export default class AutoComplete extends React.Component<AutoCompleteProps, any
|
||||
const element = children && React.isValidElement(children) && children.type !== Option ?
|
||||
React.Children.only(this.props.children) : <Input />;
|
||||
return (
|
||||
<InputElement {...element.props}>{element}</InputElement>
|
||||
<InputElement>{element}</InputElement>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,3 +35,4 @@ const dataSource = ['12345', '23456', '34567'];
|
||||
| children (自定义输入框) | 自定义输入框 | HTMLInputElement / HTMLTextAreaElement / React.ReactElement<InputProps> | `<Input />` |
|
||||
| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` |
|
||||
| filterOption | 是否根据输入项进行筛选。当其为一个函数时,会接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 `true`,反之则返回 `false`。 | boolean or function(inputValue, option) | true |
|
||||
| backfill | 使用键盘选择选项的时候把选中项回填到输入框中 | boolean | false |
|
||||
|
||||
@@ -33,6 +33,12 @@
|
||||
|
||||
.@{input-prefix-cls} {
|
||||
background: transparent;
|
||||
border-width: @border-width-base;
|
||||
line-height: @line-height-base;
|
||||
&:focus,
|
||||
&:hover {
|
||||
.hover;
|
||||
}
|
||||
}
|
||||
|
||||
&-lg {
|
||||
@@ -52,13 +58,5 @@
|
||||
.input-sm();
|
||||
}
|
||||
}
|
||||
|
||||
.@{input-prefix-cls} {
|
||||
border-width: @border-width-base;
|
||||
&:focus,
|
||||
&:hover {
|
||||
.hover;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ exports[`renders ./components/avatar/demo/badge.md correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-badge"
|
||||
title="1"
|
||||
>
|
||||
<span
|
||||
class="ant-avatar ant-avatar-square ant-avatar-icon"
|
||||
@@ -19,6 +18,7 @@ exports[`renders ./components/avatar/demo/badge.md correctly 1`] = `
|
||||
<sup
|
||||
class="ant-scroll-number ant-badge-count"
|
||||
data-show="true"
|
||||
title="1"
|
||||
>
|
||||
<span
|
||||
class="ant-scroll-number-only"
|
||||
|
||||
@@ -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 | - |
|
||||
| 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 | - |
|
||||
| icon | the `Icon` type for an icon avatar, see `Icon` Component | string | - |
|
||||
|
||||
@@ -18,7 +18,12 @@ export interface AvatarProps {
|
||||
children?: any;
|
||||
}
|
||||
|
||||
export default class Avatar extends React.Component<AvatarProps, any> {
|
||||
export interface AvatarState {
|
||||
scale: number;
|
||||
isImgExist: boolean;
|
||||
}
|
||||
|
||||
export default class Avatar extends React.Component<AvatarProps, AvatarState> {
|
||||
static defaultProps = {
|
||||
prefixCls: 'ant-avatar',
|
||||
shape: 'circle',
|
||||
@@ -27,7 +32,7 @@ export default class Avatar extends React.Component<AvatarProps, any> {
|
||||
|
||||
private avatarChildren: any;
|
||||
|
||||
constructor(props) {
|
||||
constructor(props: AvatarProps) {
|
||||
super(props);
|
||||
this.state = {
|
||||
scale: 1,
|
||||
@@ -39,7 +44,7 @@ export default class Avatar extends React.Component<AvatarProps, any> {
|
||||
this.setScale();
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps, prevState) {
|
||||
componentDidUpdate(prevProps: AvatarProps, prevState: AvatarState) {
|
||||
if (prevProps.children !== this.props.children
|
||||
|| (prevState.scale !== this.state.scale && this.state.scale === 1)) {
|
||||
this.setScale();
|
||||
|
||||
@@ -22,8 +22,7 @@ const easeInOutCubic = (t: number, b: number, c: number, d: number) => {
|
||||
function noop() { }
|
||||
|
||||
function getDefaultTarget() {
|
||||
return typeof window !== 'undefined' ?
|
||||
window : null;
|
||||
return window;
|
||||
}
|
||||
|
||||
export interface BackTopProps {
|
||||
@@ -50,7 +49,8 @@ export default class BackTop extends React.Component<BackTopProps, any> {
|
||||
}
|
||||
|
||||
getCurrentScrollTop = () => {
|
||||
const targetNode = (this.props.target || getDefaultTarget)();
|
||||
const getTarget = this.props.target || getDefaultTarget;
|
||||
const targetNode = getTarget();
|
||||
if (targetNode === window) {
|
||||
return window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
|
||||
}
|
||||
@@ -73,7 +73,8 @@ export default class BackTop extends React.Component<BackTopProps, any> {
|
||||
}
|
||||
|
||||
setScrollTop(value: number) {
|
||||
const targetNode = (this.props.target || getDefaultTarget)();
|
||||
const getTarget = this.props.target || getDefaultTarget;
|
||||
const targetNode = getTarget();
|
||||
if (targetNode === window) {
|
||||
document.body.scrollTop = value;
|
||||
document.documentElement.scrollTop = value;
|
||||
@@ -91,8 +92,9 @@ export default class BackTop extends React.Component<BackTopProps, any> {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const getTarget = this.props.target || getDefaultTarget;
|
||||
this.scrollEvent = addEventListener(getTarget(), 'scroll', this.handleScroll);
|
||||
this.handleScroll();
|
||||
this.scrollEvent = addEventListener((this.props.target || getDefaultTarget)(), 'scroll', this.handleScroll);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
||||
@@ -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, 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,10 +130,8 @@ export default class ScrollNumber extends Component<ScrollNumberProps, any> {
|
||||
]);
|
||||
const newProps = {
|
||||
...restProps,
|
||||
className: classNames({
|
||||
[`${prefixCls}`]: !!prefixCls,
|
||||
[`${className}`]: !!className,
|
||||
}),
|
||||
className: classNames(prefixCls, className),
|
||||
title: title as string,
|
||||
};
|
||||
// allow specify the border
|
||||
// mock border-color by box-shadow for compatible with old usage:
|
||||
|
||||
@@ -4,7 +4,6 @@ exports[`renders ./components/badge/demo/basic.md correctly 1`] = `
|
||||
<div>
|
||||
<span
|
||||
class="ant-badge"
|
||||
title="5"
|
||||
>
|
||||
<a
|
||||
class="head-example"
|
||||
@@ -13,6 +12,7 @@ exports[`renders ./components/badge/demo/basic.md correctly 1`] = `
|
||||
<sup
|
||||
class="ant-scroll-number ant-badge-count"
|
||||
data-show="true"
|
||||
title="5"
|
||||
>
|
||||
<span
|
||||
class="ant-scroll-number-only"
|
||||
@@ -173,7 +173,6 @@ exports[`renders ./components/badge/demo/basic.md correctly 1`] = `
|
||||
</span>
|
||||
<span
|
||||
class="ant-badge"
|
||||
title="0"
|
||||
>
|
||||
<a
|
||||
class="head-example"
|
||||
@@ -182,6 +181,7 @@ exports[`renders ./components/badge/demo/basic.md correctly 1`] = `
|
||||
<sup
|
||||
class="ant-scroll-number ant-badge-count"
|
||||
data-show="true"
|
||||
title="0"
|
||||
>
|
||||
0
|
||||
</sup>
|
||||
@@ -194,7 +194,6 @@ exports[`renders ./components/badge/demo/change.md correctly 1`] = `
|
||||
<div>
|
||||
<span
|
||||
class="ant-badge"
|
||||
title="5"
|
||||
>
|
||||
<a
|
||||
class="head-example"
|
||||
@@ -203,6 +202,7 @@ exports[`renders ./components/badge/demo/change.md correctly 1`] = `
|
||||
<sup
|
||||
class="ant-scroll-number ant-badge-count"
|
||||
data-show="true"
|
||||
title="5"
|
||||
>
|
||||
<span
|
||||
class="ant-scroll-number-only"
|
||||
@@ -398,7 +398,8 @@ exports[`renders ./components/badge/demo/change.md correctly 1`] = `
|
||||
/>
|
||||
</span>
|
||||
<span
|
||||
class="ant-switch"
|
||||
checked=""
|
||||
class="ant-switch ant-switch-checked"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
@@ -444,7 +445,6 @@ exports[`renders ./components/badge/demo/link.md correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-badge"
|
||||
title="5"
|
||||
>
|
||||
<span
|
||||
class="head-example"
|
||||
@@ -452,6 +452,7 @@ exports[`renders ./components/badge/demo/link.md correctly 1`] = `
|
||||
<sup
|
||||
class="ant-scroll-number ant-badge-count"
|
||||
data-show="true"
|
||||
title="5"
|
||||
>
|
||||
<span
|
||||
class="ant-scroll-number-only"
|
||||
@@ -617,11 +618,11 @@ exports[`renders ./components/badge/demo/no-wrapper.md correctly 1`] = `
|
||||
<div>
|
||||
<span
|
||||
class="ant-badge ant-badge-not-a-wrapper"
|
||||
title="25"
|
||||
>
|
||||
<sup
|
||||
class="ant-scroll-number ant-badge-count"
|
||||
data-show="true"
|
||||
title="25"
|
||||
>
|
||||
<span
|
||||
class="ant-scroll-number-only"
|
||||
@@ -937,12 +938,12 @@ exports[`renders ./components/badge/demo/no-wrapper.md correctly 1`] = `
|
||||
</span>
|
||||
<span
|
||||
class="ant-badge ant-badge-not-a-wrapper"
|
||||
title="4"
|
||||
>
|
||||
<sup
|
||||
class="ant-scroll-number ant-badge-count"
|
||||
data-show="true"
|
||||
style="background-color:#fff;color:#999;box-shadow:0 0 0 1px #d9d9d9 inset;"
|
||||
title="4"
|
||||
>
|
||||
<span
|
||||
class="ant-scroll-number-only"
|
||||
@@ -1103,12 +1104,12 @@ exports[`renders ./components/badge/demo/no-wrapper.md correctly 1`] = `
|
||||
</span>
|
||||
<span
|
||||
class="ant-badge ant-badge-not-a-wrapper"
|
||||
title="109"
|
||||
>
|
||||
<sup
|
||||
class="ant-scroll-number ant-badge-count"
|
||||
data-show="true"
|
||||
style="background-color:#87d068;"
|
||||
title="109"
|
||||
>
|
||||
99+
|
||||
</sup>
|
||||
@@ -1120,7 +1121,6 @@ exports[`renders ./components/badge/demo/overflow.md correctly 1`] = `
|
||||
<div>
|
||||
<span
|
||||
class="ant-badge"
|
||||
title="99"
|
||||
>
|
||||
<a
|
||||
class="head-example"
|
||||
@@ -1129,6 +1129,7 @@ exports[`renders ./components/badge/demo/overflow.md correctly 1`] = `
|
||||
<sup
|
||||
class="ant-scroll-number ant-badge-count"
|
||||
data-show="true"
|
||||
title="99"
|
||||
>
|
||||
<span
|
||||
class="ant-scroll-number-only"
|
||||
@@ -1444,7 +1445,6 @@ exports[`renders ./components/badge/demo/overflow.md correctly 1`] = `
|
||||
</span>
|
||||
<span
|
||||
class="ant-badge"
|
||||
title="100"
|
||||
>
|
||||
<a
|
||||
class="head-example"
|
||||
@@ -1453,13 +1453,13 @@ exports[`renders ./components/badge/demo/overflow.md correctly 1`] = `
|
||||
<sup
|
||||
class="ant-scroll-number ant-badge-count"
|
||||
data-show="true"
|
||||
title="100"
|
||||
>
|
||||
99+
|
||||
</sup>
|
||||
</span>
|
||||
<span
|
||||
class="ant-badge"
|
||||
title="99"
|
||||
>
|
||||
<a
|
||||
class="head-example"
|
||||
@@ -1468,13 +1468,13 @@ exports[`renders ./components/badge/demo/overflow.md correctly 1`] = `
|
||||
<sup
|
||||
class="ant-scroll-number ant-badge-count"
|
||||
data-show="true"
|
||||
title="99"
|
||||
>
|
||||
10+
|
||||
</sup>
|
||||
</span>
|
||||
<span
|
||||
class="ant-badge"
|
||||
title="1000"
|
||||
>
|
||||
<a
|
||||
class="head-example"
|
||||
@@ -1483,6 +1483,7 @@ exports[`renders ./components/badge/demo/overflow.md correctly 1`] = `
|
||||
<sup
|
||||
class="ant-scroll-number ant-badge-count"
|
||||
data-show="true"
|
||||
title="1000"
|
||||
>
|
||||
999+
|
||||
</sup>
|
||||
|
||||
@@ -60,7 +60,7 @@ class Demo extends React.Component {
|
||||
<Badge dot={this.state.show}>
|
||||
<a href="#" className="head-example" />
|
||||
</Badge>
|
||||
<Switch onChange={this.onChange} />
|
||||
<Switch onChange={this.onChange} checked={this.state.show} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -27,7 +27,7 @@ Badge normally appears in proximity to notification or head picture with eye-cat
|
||||
|----------------|-------------------------|------------|---------|
|
||||
| count | Number to show in badge | number | |
|
||||
| overflowCount | Max count to show | number | 99 |
|
||||
| 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 | '' |
|
||||
| showZero | Whether to show badge when `count` is zero | boolean | `false` |
|
||||
| dot | Whether to display a red dot instead of `count` | 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 | `''` |
|
||||
|
||||
@@ -95,6 +95,7 @@ export default class Badge extends React.Component<BadgeProps, any> {
|
||||
data-show={!hidden}
|
||||
className={scrollNumberCls}
|
||||
count={displayCount}
|
||||
title={count}
|
||||
style={style}
|
||||
/>
|
||||
);
|
||||
@@ -104,7 +105,7 @@ export default class Badge extends React.Component<BadgeProps, any> {
|
||||
);
|
||||
|
||||
return (
|
||||
<span {...restProps} className={badgeCls} title={count as string}>
|
||||
<span {...restProps} className={badgeCls}>
|
||||
{children}
|
||||
<Animate
|
||||
component=""
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
}
|
||||
&-text {
|
||||
color: @text-color;
|
||||
font-size: @badge-font-size;
|
||||
font-size: @font-size-base;
|
||||
margin-left: 8px;
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@
|
||||
top: auto;
|
||||
display: block;
|
||||
position: relative;
|
||||
transform: none!important;
|
||||
transform: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ describe('Breadcrumb', () => {
|
||||
});
|
||||
|
||||
// https://github.com/airbnb/enzyme/issues/875
|
||||
xit('warns on non-Breadcrumb.Item children', () => {
|
||||
it('warns on non-Breadcrumb.Item children', () => {
|
||||
const MyCom = () => <div>foo</div>;
|
||||
mount(
|
||||
<Breadcrumb>
|
||||
|
||||
@@ -18,15 +18,15 @@ A breadcrumb displays the current location within a hierarchy. It allows going b
|
||||
| Property | Description | Type | Optional | Default |
|
||||
|-----------|-----------------------------------|-----------------|---------|--------|
|
||||
| routes | The routing stack information of router | object[] | | - |
|
||||
| params | Routing parameter | object | | - |
|
||||
| separator | Custom separator | string\|ReactNode | | '/' |
|
||||
| params | Routing parameters | object | | - |
|
||||
| separator | Custom separator | string\|ReactNode | | `/` |
|
||||
| itemRender | Custom item renderer | (route, params, routes, paths) => ReactNode | | - |
|
||||
|
||||
> `linkRender` and `nameRender` were removed after `antd@2.0`, please use `itemRender` instead.
|
||||
|
||||
### 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';
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
}
|
||||
|
||||
& > span:last-child {
|
||||
font-weight: bold;
|
||||
font-weight: 500;
|
||||
color: @text-color;
|
||||
}
|
||||
|
||||
|
||||
@@ -480,12 +480,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 +499,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 +538,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 +579,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 +589,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"
|
||||
|
||||
@@ -122,13 +122,6 @@ export default class Button extends React.Component<ButtonProps, any> {
|
||||
}
|
||||
}
|
||||
|
||||
// Handle auto focus when click button in Chrome
|
||||
handleMouseUp = (e: React.MouseEvent<HTMLButtonElement>) => {
|
||||
if (this.props.onMouseUp) {
|
||||
this.props.onMouseUp(e);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
type, shape, size = '', className, htmlType, children, icon, prefixCls, ghost, ...others,
|
||||
@@ -153,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,
|
||||
@@ -161,7 +154,7 @@ export default class Button extends React.Component<ButtonProps, any> {
|
||||
|
||||
const iconType = loading ? 'loading' : icon;
|
||||
const iconNode = iconType ? <Icon type={iconType} /> : null;
|
||||
const needInserted = React.Children.count(children) === 1 && !iconType;
|
||||
const needInserted = React.Children.count(children) === 1 && (!iconType || iconType === 'loading');
|
||||
const kids = React.Children.map(children, child => insertSpace(child, needInserted));
|
||||
|
||||
return (
|
||||
@@ -169,7 +162,6 @@ export default class Button extends React.Component<ButtonProps, any> {
|
||||
{...omit(others, ['loading', 'clicked'])}
|
||||
type={htmlType || 'button'}
|
||||
className={classes}
|
||||
onMouseUp={this.handleMouseUp}
|
||||
onClick={this.handleClick}
|
||||
>
|
||||
{iconNode}{kids}
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -16,14 +16,14 @@ 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`
|
||||
type | can be set to `primary` `ghost` `dashed` `danger`(added in 2.7) or omitted (meaning `default`) | string | `default`
|
||||
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 | -
|
||||
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`
|
||||
loading | 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
|
||||
ghost | make background transparent and invert text and border colors, added in 2.7 | boolean | false
|
||||
|
||||
`<Button>Hello world!</Button>` will be rendered into `<button>Hello world!</button>`, and all the properties which are not listed above will be transferred to the `<button>` tag.
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
@btn-prefix-cls: ~"@{ant-prefix}-btn";
|
||||
|
||||
// for compatibile
|
||||
@btn-ghost-color : @text-color;
|
||||
@btn-ghost-bg : transparent;
|
||||
@btn-ghost-border : @border-color-base;
|
||||
@btn-ghost-color: @text-color;
|
||||
@btn-ghost-bg: transparent;
|
||||
@btn-ghost-border: @border-color-base;
|
||||
|
||||
// Button styles
|
||||
// -----------------------------
|
||||
@@ -15,6 +15,13 @@
|
||||
.btn;
|
||||
.btn-default;
|
||||
|
||||
// Make sure that the target of Button's click event always be `button`
|
||||
// Ref: https://github.com/ant-design/ant-design/issues/7034
|
||||
> i,
|
||||
> span {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&-primary {
|
||||
.btn-primary;
|
||||
|
||||
@@ -86,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;
|
||||
@@ -95,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;
|
||||
@@ -142,7 +149,7 @@
|
||||
}
|
||||
|
||||
&-background-ghost {
|
||||
background: transparent!important;
|
||||
background: transparent !important;
|
||||
border-color: #fff;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
background-image: none;
|
||||
border: @border-width-base @border-style-base transparent;
|
||||
white-space: nowrap;
|
||||
line-height: @line-height-base;
|
||||
line-height: 1.15; // https://github.com/ant-design/ant-design/issues/7070
|
||||
.button-size(@btn-height-base; @btn-padding-base; @font-size-base; @btn-border-radius-base);
|
||||
user-select: none;
|
||||
transition: all .3s @ease-in-out;
|
||||
|
||||
@@ -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';
|
||||
@@ -32,15 +32,15 @@ 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 | 无 |
|
||||
| value | The current selected date | [moment](http://momentjs.com/) | current date |
|
||||
| defaultValue | The date selected by default | [moment](http://momentjs.com/) | default date |
|
||||
| mode | The display mode of the calendar | `month` \| `year` | `month` |
|
||||
| fullscreen | Whether to display in full-screen | boolean | `true` |
|
||||
| dateCellRender | Customize the display of the date cell, the returned content will be appended to the cell | function(date: moment): ReactNode | - |
|
||||
| monthCellRender | Customize the display of the month 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 | - |
|
||||
| monthFullCellRender | Customize the display of the month cell, the returned content will override the cell | function(date: moment): ReactNode | - |
|
||||
| locale | The calendar's locale | object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
|
||||
| onPanelChange| Callback for when panel changes | function(date: moment, mode: string) | - |
|
||||
| onSelect | Callback for when a date is selected | function(date: moment) | - |
|
||||
| disabledDate | Function that specifies the dates that cannot be selected | (currentDate: moment) => boolean | - |
|
||||
|
||||
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;
|
||||
@@ -8,20 +8,20 @@ exports[`renders ./components/card/demo/basic.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-head"
|
||||
>
|
||||
<h3
|
||||
<div
|
||||
class="ant-card-head-title"
|
||||
>
|
||||
Card title
|
||||
</h3>
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-extra"
|
||||
>
|
||||
<a
|
||||
href="#"
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-extra"
|
||||
>
|
||||
More
|
||||
</a>
|
||||
<a
|
||||
href="#"
|
||||
>
|
||||
More
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-body"
|
||||
@@ -50,11 +50,11 @@ exports[`renders ./components/card/demo/border-less.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-head"
|
||||
>
|
||||
<h3
|
||||
<div
|
||||
class="ant-card-head-title"
|
||||
>
|
||||
Card title
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-body"
|
||||
@@ -80,57 +80,56 @@ exports[`renders ./components/card/demo/grid-card.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-head"
|
||||
>
|
||||
<h3
|
||||
<div
|
||||
class="ant-card-head-title"
|
||||
>
|
||||
卡片标题
|
||||
</h3>
|
||||
Card Title
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-body"
|
||||
style="padding:0;"
|
||||
>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center;"
|
||||
>
|
||||
卡片内容
|
||||
Content
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center;"
|
||||
>
|
||||
卡片内容
|
||||
Content
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center;"
|
||||
>
|
||||
卡片内容
|
||||
Content
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center;"
|
||||
>
|
||||
卡片内容
|
||||
Content
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center;"
|
||||
>
|
||||
卡片内容
|
||||
Content
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center;"
|
||||
>
|
||||
卡片内容
|
||||
Content
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center;"
|
||||
>
|
||||
卡片内容
|
||||
Content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -154,11 +153,11 @@ exports[`renders ./components/card/demo/in-column.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-head"
|
||||
>
|
||||
<h3
|
||||
<div
|
||||
class="ant-card-head-title"
|
||||
>
|
||||
Card title
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-body"
|
||||
@@ -177,11 +176,11 @@ exports[`renders ./components/card/demo/in-column.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-head"
|
||||
>
|
||||
<h3
|
||||
<div
|
||||
class="ant-card-head-title"
|
||||
>
|
||||
Card title
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-body"
|
||||
@@ -200,11 +199,11 @@ exports[`renders ./components/card/demo/in-column.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-head"
|
||||
>
|
||||
<h3
|
||||
<div
|
||||
class="ant-card-head-title"
|
||||
>
|
||||
Card title
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-body"
|
||||
@@ -225,16 +224,18 @@ exports[`renders ./components/card/demo/loading.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-head"
|
||||
>
|
||||
<h3
|
||||
<div
|
||||
class="ant-card-head-title"
|
||||
>
|
||||
Card title
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
<div
|
||||
class="ant-card-loading-content"
|
||||
>
|
||||
<p
|
||||
class="ant-card-loading-block"
|
||||
style="width:94%;"
|
||||
|
||||
28
components/card/__tests__/index.test.js
Normal file
28
components/card/__tests__/index.test.js
Normal file
@@ -0,0 +1,28 @@
|
||||
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', () => {
|
||||
function fakeResizeWindowTo(wrapper, width) {
|
||||
Object.defineProperties(wrapper.node.container, {
|
||||
offsetWidth: {
|
||||
get() { return width; },
|
||||
configurable: true,
|
||||
},
|
||||
});
|
||||
window.resizeTo(width);
|
||||
}
|
||||
|
||||
testMethod('resize card will trigger different padding', async () => {
|
||||
const wrapper = mount(<Card title="xxx">xxx</Card>);
|
||||
fakeResizeWindowTo(wrapper, 1000);
|
||||
await delay(0);
|
||||
expect(wrapper.hasClass('ant-card-wider-padding')).toBe(true);
|
||||
fakeResizeWindowTo(wrapper, 800);
|
||||
await delay(0);
|
||||
expect(wrapper.hasClass('ant-card-wider-padding')).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -22,14 +22,14 @@ const gridStyle = {
|
||||
};
|
||||
|
||||
ReactDOM.render(
|
||||
<Card title="卡片标题" noHovering bodyStyle={{ padding: 0 }}>
|
||||
<Card.Grid style={gridStyle}>卡片内容</Card.Grid>
|
||||
<Card.Grid style={gridStyle}>卡片内容</Card.Grid>
|
||||
<Card.Grid style={gridStyle}>卡片内容</Card.Grid>
|
||||
<Card.Grid style={gridStyle}>卡片内容</Card.Grid>
|
||||
<Card.Grid style={gridStyle}>卡片内容</Card.Grid>
|
||||
<Card.Grid style={gridStyle}>卡片内容</Card.Grid>
|
||||
<Card.Grid style={gridStyle}>卡片内容</Card.Grid>
|
||||
<Card title="Card Title" noHovering>
|
||||
<Card.Grid style={gridStyle}>Content</Card.Grid>
|
||||
<Card.Grid style={gridStyle}>Content</Card.Grid>
|
||||
<Card.Grid style={gridStyle}>Content</Card.Grid>
|
||||
<Card.Grid style={gridStyle}>Content</Card.Grid>
|
||||
<Card.Grid style={gridStyle}>Content</Card.Grid>
|
||||
<Card.Grid style={gridStyle}>Content</Card.Grid>
|
||||
<Card.Grid style={gridStyle}>Content</Card.Grid>
|
||||
</Card>
|
||||
, mountNode);
|
||||
````
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -23,10 +23,10 @@ A card can be used to display content related to a single subject. The content c
|
||||
|----------|----------------|----------|--------------|
|
||||
| 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 |
|
||||
| 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 hovering when mouse over | boolean | true |
|
||||
| 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` |
|
||||
| loading | Shows a loading indicator while the contents of the card are being fetched | boolean | `false` |
|
||||
|
||||
### Card.Grid
|
||||
|
||||
|
||||
@@ -13,14 +13,14 @@ export interface CardProps {
|
||||
style?: React.CSSProperties;
|
||||
loading?: boolean;
|
||||
noHovering?: boolean;
|
||||
children?: any;
|
||||
children?: React.ReactNode;
|
||||
id?: string;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export default class Card extends Component<CardProps, any> {
|
||||
export default class Card extends Component<CardProps, {}> {
|
||||
static Grid: typeof Grid = Grid;
|
||||
container: any;
|
||||
container: HTMLDivElement;
|
||||
resizeEvent: any;
|
||||
updateWiderPaddingCalled: boolean;
|
||||
state = {
|
||||
@@ -34,9 +34,13 @@ export default class Card extends Component<CardProps, any> {
|
||||
if (this.resizeEvent) {
|
||||
this.resizeEvent.remove();
|
||||
}
|
||||
(this.updateWiderPadding as any).cancel();
|
||||
}
|
||||
@throttleByAnimationFrameDecorator()
|
||||
updateWiderPadding() {
|
||||
if (!this.container) {
|
||||
return;
|
||||
}
|
||||
// 936 is a magic card width pixer number indicated by designer
|
||||
const WIDTH_BOUDARY_PX = 936;
|
||||
if (this.container.offsetWidth >= WIDTH_BOUDARY_PX && !this.state.widerPadding) {
|
||||
@@ -50,12 +54,12 @@ export default class Card extends Component<CardProps, any> {
|
||||
});
|
||||
}
|
||||
}
|
||||
saveRef = (node) => {
|
||||
saveRef = (node: HTMLDivElement) => {
|
||||
this.container = node;
|
||||
}
|
||||
isContainGrid() {
|
||||
let containGrid;
|
||||
Children.forEach(this.props.children, (element: any) => {
|
||||
Children.forEach(this.props.children, (element: JSX.Element) => {
|
||||
if (element && element.type && element.type === Grid) {
|
||||
containGrid = true;
|
||||
}
|
||||
@@ -80,7 +84,7 @@ export default class Card extends Component<CardProps, any> {
|
||||
|
||||
if (loading) {
|
||||
children = (
|
||||
<div>
|
||||
<div className={`${prefixCls}-loading-content`}>
|
||||
<p className={`${prefixCls}-loading-block`} style={{ width: '94%' }} />
|
||||
<p>
|
||||
<span className={`${prefixCls}-loading-block`} style={{ width: '28%' }} />
|
||||
@@ -104,16 +108,11 @@ export default class Card extends Component<CardProps, any> {
|
||||
}
|
||||
|
||||
let head;
|
||||
if (!title) {
|
||||
head = null;
|
||||
} else {
|
||||
head = typeof title === 'string' ? (
|
||||
if (title || extra) {
|
||||
head = (
|
||||
<div className={`${prefixCls}-head`}>
|
||||
<h3 className={`${prefixCls}-head-title`}>{title}</h3>
|
||||
</div>
|
||||
) : (
|
||||
<div className={`${prefixCls}-head`}>
|
||||
<div className={`${prefixCls}-head-title`}>{title}</div>
|
||||
{title ? <div className={`${prefixCls}-head-title`}>{title}</div> : null}
|
||||
{extra ? <div className={`${prefixCls}-extra`}>{extra}</div> : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -121,7 +120,6 @@ export default class Card extends Component<CardProps, any> {
|
||||
return (
|
||||
<div {...others} className={classString} ref={this.saveRef}>
|
||||
{head}
|
||||
{extra ? <div className={`${prefixCls}-extra`}>{extra}</div> : null}
|
||||
<div className={`${prefixCls}-body`} style={bodyStyle}>{children}</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -26,7 +26,7 @@ cols: 1
|
||||
| extra | 卡片右上角的操作区域 | string\|ReactNode | - |
|
||||
| bordered | 是否有边框 | boolean | true |
|
||||
| bodyStyle | 内容区域自定义样式 | object | - |
|
||||
| noHovering | 鼠标移过时是否浮起 | boolean | true |
|
||||
| noHovering | 取消鼠标移过浮起 | boolean | false |
|
||||
| loading | 当卡片内容还在加载中时,可以用 loading 展示一个占位 | boolean | false |
|
||||
|
||||
### Card.Grid
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
@import "../../style/mixins/index";
|
||||
|
||||
@card-prefix-cls: ~"@{ant-prefix}-card";
|
||||
@card-padding-base: 24px;
|
||||
@card-padding-wider: 32px;
|
||||
|
||||
.@{card-prefix-cls} {
|
||||
background: @component-background;
|
||||
@@ -24,34 +26,44 @@
|
||||
line-height: @card-head-height;
|
||||
background: @card-head-background;
|
||||
border-bottom: @border-width-base @border-style-base @border-color-split;
|
||||
padding: 0 24px;
|
||||
padding: 0 @card-padding-base;
|
||||
border-radius: @border-radius-sm @border-radius-sm 0 0;
|
||||
.clearfix;
|
||||
margin-bottom: -1px; // Fix card grid overflow bug: https://gw.alipayobjects.com/zos/rmsportal/XonYxBikwpgbqIQBeuhk.png
|
||||
display: flex;
|
||||
|
||||
&-title {
|
||||
font-size: @font-size-lg;
|
||||
display: inline-block;
|
||||
text-overflow: ellipsis;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
color: @card-head-color;
|
||||
font-weight: 500;
|
||||
display: inline-block;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&-extra {
|
||||
position: absolute;
|
||||
right: 24px;
|
||||
top: 14px;
|
||||
float: right;
|
||||
text-align: right;
|
||||
// https://stackoverflow.com/a/22429853/3040605
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
&-body {
|
||||
padding: 24px;
|
||||
padding: @card-padding-base;
|
||||
.clearfix;
|
||||
}
|
||||
|
||||
&-loading &-body {
|
||||
user-select: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
&-loading-content {
|
||||
padding: @card-padding-base;
|
||||
}
|
||||
|
||||
&-loading-block {
|
||||
@@ -65,16 +77,17 @@
|
||||
}
|
||||
|
||||
&-contain-grid &-body {
|
||||
margin: -0.5px;
|
||||
margin: -1px 0 0 -1px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
&-grid {
|
||||
border-radius: 0;
|
||||
border: 0;
|
||||
box-shadow: 0 0 0 0.5px @border-color-split, 0 0 0 0.5px @border-color-split inset;
|
||||
box-shadow: 1px 0 0 0 @border-color-split, 0 1px 0 0 @border-color-split, 1px 1px 0 0 @border-color-split, 1px 0 0 0 @border-color-split inset, 0 1px 0 0 @border-color-split inset;
|
||||
width: 33.33%;
|
||||
float: left;
|
||||
padding: 24px;
|
||||
padding: @card-padding-base;
|
||||
transition: all .3s;
|
||||
&:hover {
|
||||
position: relative;
|
||||
@@ -84,15 +97,15 @@
|
||||
}
|
||||
|
||||
&-wider-padding &-head {
|
||||
padding: 0 32px;
|
||||
padding: 0 @card-padding-wider;
|
||||
}
|
||||
|
||||
&-wider-padding &-body {
|
||||
padding: 24px 32px;
|
||||
padding: @card-padding-base @card-padding-wider;
|
||||
}
|
||||
|
||||
&-wider-padding &-extra {
|
||||
right: 32px;
|
||||
right: @card-padding-wider;
|
||||
}
|
||||
|
||||
&-padding-transition &-head,
|
||||
|
||||
@@ -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>
|
||||
|
||||
13
components/carousel/__tests__/index.test.js
Normal file
13
components/carousel/__tests__/index.test.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import Carousel from '..';
|
||||
|
||||
describe('Carousel', () => {
|
||||
it('should has innerSlider', () => {
|
||||
const wrapper = mount(<Carousel><div /></Carousel>);
|
||||
const innerSlider = wrapper.node.innerSlider;
|
||||
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) |
|
||||
| effect | Transition effect | `scrollx` \| `fade` | `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 interpolation function 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) | - |
|
||||
|
||||
For more info on the parameters, refer to the https://github.com/akiran/react-slick
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// matchMedia polyfill for
|
||||
// https://github.com/WickyNilliams/enquire.js/issues/82
|
||||
import React from 'react';
|
||||
import debounce from 'lodash.debounce';
|
||||
|
||||
// matchMedia polyfill for
|
||||
// https://github.com/WickyNilliams/enquire.js/issues/82
|
||||
if (typeof window !== 'undefined') {
|
||||
const matchMediaPolyfill = (mediaQuery: string): MediaQueryList => {
|
||||
return {
|
||||
@@ -15,9 +16,11 @@ if (typeof window !== 'undefined') {
|
||||
};
|
||||
window.matchMedia = window.matchMedia || matchMediaPolyfill;
|
||||
}
|
||||
|
||||
import SlickCarousel from 'react-slick';
|
||||
import React from 'react';
|
||||
// Use require over import (will be lifted up)
|
||||
// make sure matchMedia polyfill run before require('react-slick')
|
||||
// Fix https://github.com/ant-design/ant-design/issues/6560
|
||||
// Fix https://github.com/ant-design/ant-design/issues/3308
|
||||
const SlickCarousel = require('react-slick').default;
|
||||
|
||||
export type CarouselEffect = 'scrollx' | 'fade';
|
||||
// Carousel
|
||||
@@ -75,6 +78,8 @@ export default class Carousel extends React.Component<CarouselProps, any> {
|
||||
slick: any,
|
||||
};
|
||||
|
||||
innerSlider: any;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.onWindowResized = debounce(this.onWindowResized, 500, {
|
||||
@@ -87,6 +92,9 @@ export default class Carousel extends React.Component<CarouselProps, any> {
|
||||
if (autoplay) {
|
||||
window.addEventListener('resize', this.onWindowResized);
|
||||
}
|
||||
const { slick } = this.refs;
|
||||
// https://github.com/ant-design/ant-design/issues/7191
|
||||
this.innerSlider = slick && slick.innerSlider;
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
||||
@@ -22,7 +22,7 @@ subtitle: 走马灯
|
||||
| vertical | 垂直显示 | boolean | false |
|
||||
| autoplay | 是否自动切换 | boolean | false |
|
||||
| easing | 动画效果 | string | linear |
|
||||
| beforeChange | 切换面板的回调 | function(from, to) | 无
|
||||
| afterChange | 切换面板的回调 | function(current) | 无
|
||||
| beforeChange | 切换面板的回调 | function(from, to) | 无 |
|
||||
| afterChange | 切换面板的回调 | function(current) | 无 |
|
||||
|
||||
更多参数可参考:https://github.com/akiran/react-slick
|
||||
|
||||
@@ -25,6 +25,7 @@ Cascade selection box.
|
||||
| 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 | - |
|
||||
| className | additional css class | string | - |
|
||||
|
||||
@@ -26,6 +26,7 @@ subtitle: 级联选择
|
||||
| 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 | - |
|
||||
| className | 自定义类名 | string | - |
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
&-input.@{ant-prefix}-input {
|
||||
// Add important to fix https://github.com/ant-design/ant-design/issues/5078
|
||||
// because input.less will compile after cascader.less
|
||||
background-color: transparent!important;
|
||||
background-color: transparent !important;
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
display: block;
|
||||
@@ -174,11 +174,12 @@
|
||||
&,
|
||||
&:hover {
|
||||
background: @background-color-base;
|
||||
font-weight: bold;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
&-expand {
|
||||
position: relative;
|
||||
padding-right: 24px;
|
||||
&:after {
|
||||
.iconfont-font("\e61f");
|
||||
.iconfont-size-under-12px(8px);
|
||||
|
||||
@@ -12,11 +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.ReactNode;
|
||||
}
|
||||
|
||||
export interface CheckboxProps extends AbstractCheckboxProps {
|
||||
@@ -57,7 +58,7 @@ export default class Checkbox extends React.Component<CheckboxProps, any> {
|
||||
if (checkboxGroup) {
|
||||
checkboxProps.onChange = () => checkboxGroup.toggleOption({ label: children, value: props.value });
|
||||
checkboxProps.checked = checkboxGroup.value.indexOf(props.value) !== -1;
|
||||
checkboxProps.disabled = 'disabled' in props ? props.disabled : checkboxGroup.disabled;
|
||||
checkboxProps.disabled = props.disabled || checkboxGroup.disabled;
|
||||
}
|
||||
const classString = classNames(className, {
|
||||
[`${prefixCls}-wrapper`]: true,
|
||||
|
||||
@@ -363,10 +363,11 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
|
||||
class="ant-checkbox-group-item ant-checkbox-wrapper"
|
||||
>
|
||||
<span
|
||||
class="ant-checkbox"
|
||||
class="ant-checkbox ant-checkbox-disabled"
|
||||
>
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
disabled=""
|
||||
type="checkbox"
|
||||
/>
|
||||
<span
|
||||
|
||||
23
components/checkbox/__tests__/checkbox.test.js
Normal file
23
components/checkbox/__tests__/checkbox.test.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import Checkbox from '..';
|
||||
|
||||
describe('Checkbox', () => {
|
||||
it('responses hover events', () => {
|
||||
const onMouseEnter = jest.fn();
|
||||
const onMouseLeave = jest.fn();
|
||||
|
||||
const wrapper = shallow(
|
||||
<Checkbox
|
||||
onMouseEnter={onMouseEnter}
|
||||
onMouseLeave={onMouseLeave}
|
||||
/>
|
||||
);
|
||||
|
||||
wrapper.simulate('mouseenter');
|
||||
expect(onMouseEnter).toHaveBeenCalled();
|
||||
|
||||
wrapper.simulate('mouseleave');
|
||||
expect(onMouseLeave).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
54
components/checkbox/__tests__/group.test.js
Normal file
54
components/checkbox/__tests__/group.test.js
Normal file
@@ -0,0 +1,54 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import Checkbox from '../index';
|
||||
|
||||
describe('CheckboxGroup', () => {
|
||||
it('should work basically', () => {
|
||||
const onChange = jest.fn();
|
||||
const wrapper = mount(
|
||||
<Checkbox.Group options={['Apple', 'Pear', 'Orange']} onChange={onChange} />
|
||||
);
|
||||
wrapper.find('.ant-checkbox-input').at(0).simulate('change');
|
||||
expect(onChange).toBeCalledWith(['Apple']);
|
||||
wrapper.find('.ant-checkbox-input').at(1).simulate('change');
|
||||
expect(onChange).toBeCalledWith(['Apple', 'Pear']);
|
||||
wrapper.find('.ant-checkbox-input').at(2).simulate('change');
|
||||
expect(onChange).toBeCalledWith(['Apple', 'Pear', 'Orange']);
|
||||
wrapper.find('.ant-checkbox-input').at(1).simulate('change');
|
||||
expect(onChange).toBeCalledWith(['Apple', 'Orange']);
|
||||
});
|
||||
|
||||
it('does not trigger onChange callback of both Checkbox and CheckboxGroup when CheckboxGroup is disabled', () => {
|
||||
const onChangeGroup = jest.fn();
|
||||
|
||||
const options = [
|
||||
{ label: 'Apple', value: 'Apple' },
|
||||
{ label: 'Pear', value: 'Pear' },
|
||||
];
|
||||
|
||||
const groupWrapper = mount(
|
||||
<Checkbox.Group options={options} onChange={onChangeGroup} disabled />
|
||||
);
|
||||
groupWrapper.find('.ant-checkbox-input').at(0).simulate('change');
|
||||
expect(onChangeGroup).not.toBeCalled();
|
||||
groupWrapper.find('.ant-checkbox-input').at(1).simulate('change');
|
||||
expect(onChangeGroup).not.toBeCalled();
|
||||
});
|
||||
|
||||
it('does not prevent onChange callback from Checkbox when CheckboxGroup is not disabled', () => {
|
||||
const onChangeGroup = jest.fn();
|
||||
|
||||
const options = [
|
||||
{ label: 'Apple', value: 'Apple' },
|
||||
{ label: 'Orange', value: 'Orange', disabled: true },
|
||||
];
|
||||
|
||||
const groupWrapper = mount(
|
||||
<Checkbox.Group options={options} onChange={onChangeGroup} />
|
||||
);
|
||||
groupWrapper.find('.ant-checkbox-input').at(0).simulate('change');
|
||||
expect(onChangeGroup).toBeCalledWith(['Apple']);
|
||||
groupWrapper.find('.ant-checkbox-input').at(1).simulate('change');
|
||||
expect(onChangeGroup).toBeCalledWith(['Apple']);
|
||||
});
|
||||
});
|
||||
@@ -1,38 +0,0 @@
|
||||
import React from 'react';
|
||||
import { shallow, mount } from 'enzyme';
|
||||
import Checkbox from '..';
|
||||
|
||||
describe('Checkbox', () => {
|
||||
it('responses hover events', () => {
|
||||
const onMouseEnter = jest.fn();
|
||||
const onMouseLeave = jest.fn();
|
||||
|
||||
const wrapper = shallow(
|
||||
<Checkbox
|
||||
onMouseEnter={onMouseEnter}
|
||||
onMouseLeave={onMouseLeave}
|
||||
/>
|
||||
);
|
||||
|
||||
wrapper.simulate('mouseenter');
|
||||
expect(onMouseEnter).toHaveBeenCalled();
|
||||
|
||||
wrapper.simulate('mouseleave');
|
||||
expect(onMouseLeave).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('CheckGroup should work', () => {
|
||||
const onChange = jest.fn();
|
||||
const wrapper = mount(
|
||||
<Checkbox.Group options={['Apple', 'Pear', 'Orange']} onChange={onChange} />
|
||||
);
|
||||
wrapper.find('.ant-checkbox-input').at(0).simulate('change');
|
||||
expect(onChange).toBeCalledWith(['Apple']);
|
||||
wrapper.find('.ant-checkbox-input').at(1).simulate('change');
|
||||
expect(onChange).toBeCalledWith(['Apple', 'Pear']);
|
||||
wrapper.find('.ant-checkbox-input').at(2).simulate('change');
|
||||
expect(onChange).toBeCalledWith(['Apple', 'Pear', 'Orange']);
|
||||
wrapper.find('.ant-checkbox-input').at(1).simulate('change');
|
||||
expect(onChange).toBeCalledWith(['Apple', 'Orange']);
|
||||
});
|
||||
});
|
||||
@@ -20,7 +20,7 @@ Checkbox.
|
||||
| checked | Specifies whether the checkbox is selected. | boolean | false |
|
||||
| defaultChecked | Specifies the initial state: whether or not the checkbox is selected. | boolean | false |
|
||||
| onChange | The callback function that is triggered when the state changes. | Function(e:Event) | - |
|
||||
| disabled | Disable checkbox | boolean | | false|
|
||||
| disabled | Disable checkbox | boolean | false|
|
||||
|
||||
### Checkbox Group
|
||||
|
||||
@@ -30,4 +30,4 @@ Checkbox.
|
||||
| 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) | - |
|
||||
| disabled | Disable all checkboxes | boolean | | false |
|
||||
| disabled | Disable all checkboxes | boolean | false |
|
||||
|
||||
@@ -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,24 +83,26 @@
|
||||
|
||||
// 半选状态
|
||||
.@{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 {
|
||||
border-color: @disabled-color;
|
||||
}
|
||||
|
||||
// 选中状态
|
||||
.@{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;
|
||||
@@ -129,7 +133,7 @@
|
||||
}
|
||||
|
||||
.@{checkbox-inner-prefix-cls} {
|
||||
border-color: @border-color-base!important;
|
||||
border-color: @border-color-base !important;
|
||||
background-color: @input-disabled-bg;
|
||||
&:after {
|
||||
animation-name: none;
|
||||
@@ -147,8 +151,8 @@
|
||||
cursor: pointer;
|
||||
font-size: @font-size-base;
|
||||
display: inline-block;
|
||||
&:not(:last-child) {
|
||||
margin-right: 8px;
|
||||
& + & {
|
||||
margin-left: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ export interface CollapseProps {
|
||||
defaultActiveKey?: Array<string>;
|
||||
/** 手风琴效果 */
|
||||
accordion?: boolean;
|
||||
onChange?: (key: string) => void;
|
||||
onChange?: (key: string | string[]) => void;
|
||||
style?: React.CSSProperties;
|
||||
className?: string;
|
||||
bordered?: boolean;
|
||||
|
||||
@@ -185,7 +185,7 @@ 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;"
|
||||
style="background:#f7f7f7;border-radius:4px;margin-bottom:24px;border:0;overflow:hidden;"
|
||||
>
|
||||
<div
|
||||
aria-expanded="true"
|
||||
@@ -216,7 +216,7 @@ 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;"
|
||||
style="background:#f7f7f7;border-radius:4px;margin-bottom:24px;border:0;overflow:hidden;"
|
||||
>
|
||||
<div
|
||||
aria-expanded="false"
|
||||
@@ -231,7 +231,7 @@ 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;"
|
||||
style="background:#f7f7f7;border-radius:4px;margin-bottom:24px;border:0;overflow:hidden;"
|
||||
>
|
||||
<div
|
||||
aria-expanded="false"
|
||||
|
||||
@@ -28,6 +28,7 @@ const customPanelStyle = {
|
||||
borderRadius: 4,
|
||||
marginBottom: 24,
|
||||
border: 0,
|
||||
overflow: 'hidden',
|
||||
};
|
||||
|
||||
ReactDOM.render(
|
||||
|
||||
@@ -18,14 +18,14 @@ A content area which can be collapsed and expanded.
|
||||
|
||||
| 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 | - |
|
||||
| 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 |
|
||||
| key | Unique key identifying the panel from among its siblings | string | - |
|
||||
| header | Title of the panel | string\|ReactNode | - |
|
||||
| disabled | If `true`, panel cannot be opened or closed | boolean | `false` |
|
||||
|
||||
@@ -21,6 +21,14 @@
|
||||
|
||||
& > &-item {
|
||||
border-bottom: @border-width-base @border-style-base @border-color-base;
|
||||
|
||||
&:last-child {
|
||||
&,
|
||||
& > .@{collapse-prefix-cls}-header {
|
||||
border-radius: 0 0 @border-radius-base @border-radius-base;
|
||||
}
|
||||
}
|
||||
|
||||
> .@{collapse-prefix-cls}-header {
|
||||
line-height: 22px;
|
||||
padding: 8px 0 8px 32px;
|
||||
@@ -37,14 +45,10 @@
|
||||
display: inline-block;
|
||||
font-weight: bold;
|
||||
line-height: 40px;
|
||||
vertical-align: middle;
|
||||
vertical-align: top;
|
||||
transition: transform 0.24s;
|
||||
top: 0;
|
||||
left: 16px;
|
||||
/* stylelint-disable declaration-block-no-duplicate-properties */
|
||||
top: ~"16px \9";
|
||||
left: ~"0 \9";
|
||||
/* stylelint-enable declaration-block-no-duplicate-properties */
|
||||
&:before {
|
||||
content: "\E61F";
|
||||
}
|
||||
@@ -89,6 +93,11 @@
|
||||
border: 0;
|
||||
}
|
||||
|
||||
&-borderless > &-item:last-child,
|
||||
&-borderless > &-item:last-child &-header {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
&-borderless > &-item-active {
|
||||
border: 0;
|
||||
}
|
||||
@@ -114,7 +123,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
& > &-item > .@{collapse-prefix-cls}-header:active {
|
||||
& > &-item:not(&-item-disabled) > .@{collapse-prefix-cls}-header:active {
|
||||
background-color: @collapse-active-bg;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { getLocaleCode } from '../_util/getLocale';
|
||||
import warning from '../_util/warning';
|
||||
|
||||
function getShowDateFromValue(value: moment.Moment[]): moment.Moment[] | undefined {
|
||||
const [ start, end ] = value;
|
||||
const [start, end] = value;
|
||||
// value could be an empty array, then we should not reset showDate
|
||||
if (!start && !end) {
|
||||
return;
|
||||
@@ -24,7 +24,9 @@ function formatValue(value: moment.Moment | undefined, format: string): string {
|
||||
}
|
||||
|
||||
function pickerValueAdapter(value?: moment.Moment | moment.Moment[]): moment.Moment[] | undefined {
|
||||
if (!value) { return; }
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
return value;
|
||||
}
|
||||
@@ -97,7 +99,10 @@ export default class RangePicker extends React.Component<any, any> {
|
||||
handleChange = (value: moment.Moment[]) => {
|
||||
const props = this.props;
|
||||
if (!('value' in props)) {
|
||||
this.setState({ value, showDate: getShowDateFromValue(value) });
|
||||
this.setState(({ showDate }) => ({
|
||||
value,
|
||||
showDate: getShowDateFromValue(value) || showDate,
|
||||
}));
|
||||
}
|
||||
props.onChange(value, [
|
||||
formatValue(value[0], props.format),
|
||||
|
||||
@@ -75,4 +75,21 @@ describe('RangePicker', () => {
|
||||
expect(() => rangeCalendarWrapper.find('.ant-calendar-cell').at(15).simulate('click').simulate('click'))
|
||||
.not.toThrow();
|
||||
});
|
||||
|
||||
// issue: https://github.com/ant-design/ant-design/issues/7077
|
||||
it('should not throw error when select after clear', () => {
|
||||
const wrapper = mount(
|
||||
<RangePicker
|
||||
getCalendarContainer={trigger => trigger}
|
||||
open
|
||||
/>
|
||||
);
|
||||
let rangeCalendarWrapper = mount(wrapper.find('Trigger').node.getComponent());
|
||||
rangeCalendarWrapper.find('.ant-calendar-cell').at(15).simulate('click').simulate('click');
|
||||
wrapper.find('.ant-calendar-picker-clear').simulate('click');
|
||||
wrapper.find('.ant-calendar-picker-input').simulate('click');
|
||||
rangeCalendarWrapper = mount(wrapper.find('Trigger').node.getComponent());
|
||||
expect(() => rangeCalendarWrapper.find('.ant-calendar-cell').at(15).simulate('click').simulate('click'))
|
||||
.not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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[],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
@@ -110,6 +110,7 @@
|
||||
height: 22px;
|
||||
color: @input-color;
|
||||
background: @input-bg;
|
||||
.placeholder;
|
||||
}
|
||||
|
||||
&-week-number {
|
||||
@@ -320,6 +321,7 @@
|
||||
.btn;
|
||||
.btn-primary;
|
||||
.button-size(@btn-height-sm; @btn-padding-sm; @font-size-base; @border-radius-base);
|
||||
line-height: @btn-height-sm - 2px;
|
||||
|
||||
&-disabled {
|
||||
.button-color(@btn-disable-color; @btn-disable-bg; @btn-disable-border);
|
||||
|
||||
@@ -51,10 +51,9 @@
|
||||
right: 8px;
|
||||
top: 50%;
|
||||
margin-top: -7px;
|
||||
line-height: 1em;
|
||||
line-height: 14px;
|
||||
font-size: @font-size-base;
|
||||
transition: all .3s;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@@ -64,6 +63,7 @@
|
||||
color: @disabled-color;
|
||||
background: @input-bg;
|
||||
pointer-events: none;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
color: @text-color-secondary;
|
||||
}
|
||||
@@ -83,7 +83,6 @@
|
||||
color: @text-color-secondary;
|
||||
display: inline-block;
|
||||
line-height: 1;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
.@{calendar-prefix-cls}-range-picker-input {
|
||||
background-color: transparent;
|
||||
border: 0;
|
||||
height: 100%;
|
||||
height: 99%;
|
||||
outline: 0;
|
||||
width: 43%;
|
||||
text-align: center;
|
||||
@@ -17,9 +17,10 @@
|
||||
|
||||
.@{calendar-prefix-cls}-range-picker-separator {
|
||||
color: @text-color-secondary;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
margin-top: -10px;
|
||||
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
|
||||
|
||||
@@ -10,9 +10,11 @@ export interface DropDownProps {
|
||||
style?: React.CSSProperties;
|
||||
onVisibleChange?: (visible?: boolean) => void;
|
||||
visible?: boolean;
|
||||
disabled?: boolean;
|
||||
align?: Object;
|
||||
getPopupContainer?: (triggerNode: Element) => HTMLElement;
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
placement?: 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
|
||||
}
|
||||
|
||||
@@ -43,17 +45,24 @@ export default class Dropdown extends React.Component<DropDownProps, any> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { children, prefixCls, overlay } = this.props;
|
||||
const { children, prefixCls, overlay, trigger, disabled } = this.props;
|
||||
const dropdownTrigger = cloneElement(children as any, {
|
||||
className: classNames((children as any).props.className, `${prefixCls}-trigger`),
|
||||
disabled,
|
||||
});
|
||||
// menu cannot be selectable in dropdown defaultly
|
||||
const overlayProps = overlay && (overlay as any).props;
|
||||
const selectable = (overlayProps && 'selectable' in overlayProps)
|
||||
? overlayProps.selectable : false;
|
||||
const fixedModeOverlay = cloneElement(overlay as any, {
|
||||
mode: 'vertical',
|
||||
selectable,
|
||||
});
|
||||
return (
|
||||
<RcDropdown
|
||||
transitionName={this.getTransitionName()}
|
||||
{...this.props}
|
||||
transitionName={this.getTransitionName()}
|
||||
trigger={disabled ? [] : trigger}
|
||||
overlay={fixedModeOverlay}
|
||||
>
|
||||
{dropdownTrigger}
|
||||
|
||||
@@ -16,25 +16,30 @@ If there are too many operations to display, you can wrap them in a `Dropdown`.
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|--------------|----------------|----------|--------------|
|
||||
| trigger | the trigger mode which can execute the drop-down action | Array<'click'\|'hover'> | ['hover'] |
|
||||
| trigger | the trigger mode which executes the drop-down action | Array<`click`\|`hover`> | [`hover`] |
|
||||
| overlay | the dropdown menu | [Menu](/components/menu) | - |
|
||||
| getPopupContainer | to set the container of the dropdown menu. The default is to create a `div` element in `body`, you can reset it to the scrolling area and make a relative reposition. [example](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
|
||||
| visible | determine whether the dropdown menu is visible | boolean | - |
|
||||
| onVisibleChange | a callback function takes an argument: `visible`, can be executed when the visible state is changing | Function(visible) | - |
|
||||
| visible | whether the dropdown menu is visible | boolean | - |
|
||||
| disabled| whether the dropdown menu is disabled| boolean | - |
|
||||
| onVisibleChange | a callback function takes an argument: `visible`, is executed when the visible state is changed | Function(visible) | - |
|
||||
| placement | placement of pop menu: `bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
|
||||
|
||||
You can get the menu list by `antd.Menu`, and set a callback function `onSelect` for it if you need. The menu items and the dividers are also available, by using `antd.Menu.Item` and `antd.Menu.Divider` respectively.
|
||||
You can get the menu list by `antd.Menu`, and set a callback function `onSelect` for it if you need. The menu items and the dividers are also available, by using `Menu.Item` and `Menu.Divider` respectively.
|
||||
|
||||
> Warning: You must set a unique `key` for `Menu.Item`.
|
||||
|
||||
> Menu of Dropdown is unselectable by default, you can make it selectable via `<Menu selectable>`.
|
||||
|
||||
### Dropdown.Button
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|--------------|----------------|----------|--------------|
|
||||
| type | type of the button, the same as [Button](/components/button) | string | 'default' |
|
||||
| type | type of the button, the same as [Button](/components/button) | string | `default` |
|
||||
| size | size of the button, the same as [Button](/components/button) | string | `default` |
|
||||
| onClick | a callback function, the same as [Button](/components/button), which will be executed when you click the button on the left | Function | - |
|
||||
| trigger | the trigger mode which can execute the drop-down action | Array<'click'\|'hover'> | ['hover'] |
|
||||
| trigger | the trigger mode which executes the drop-down action | Array<'click'\|`hover`> | [`hover`] |
|
||||
| overlay | the dropdown menu | [Menu](/components/menu) | - |
|
||||
| visible | determine whether the dropdown menu is visible | boolean | - |
|
||||
| onVisibleChange | a callback function takes an argument: `visible`, can be executed when the visible state is changing | Function | - |
|
||||
| visible | whether the dropdown menu is visible | boolean | - |
|
||||
| disabled | whether the dropdown menu is disabled| boolean | - |
|
||||
| onVisibleChange | a callback function takes an argument: `visible`, is executed when the visible state is changed | Function | - |
|
||||
| placement | placement of pop menu: `bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
|
||||
|
||||
@@ -21,21 +21,26 @@ title: Dropdown
|
||||
| overlay | 菜单 | [Menu](/components/menu) | - |
|
||||
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
|
||||
| visible | 菜单是否显示 | boolean | - |
|
||||
| disabled | 菜单是否禁用 | boolean | - |
|
||||
| onVisibleChange | 菜单显示状态改变时调用,参数为 visible | Function(visible) | - |
|
||||
| placement | 菜单弹出位置:`bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
|
||||
|
||||
菜单可由 `antd.Menu` 取得,可设置 `onSelect` 回调,菜单还包括菜单项 `antd.Menu.Item`,分割线 `antd.Menu.Divider`。
|
||||
菜单可由 `antd.Menu` 取得,可设置 `onSelect` 回调,菜单还包括菜单项 `Menu.Item`,分割线 `Menu.Divider`。
|
||||
|
||||
> 注意: Menu.Item 必须设置唯一的 key 属性。
|
||||
|
||||
> Dropdown 下的 Menu 默认不可选中。如果需要菜单可选中,可以指定 `<Menu selectable>`.
|
||||
|
||||
### Dropdown.Button
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|-------------|------------------|--------------------|--------------|
|
||||
| type | 按钮类型,和 [Button](/components/button/) 一致 | string | 'default' |
|
||||
| size | 按钮大小,和 [Button](/components/button/) 一致 | string | 'default' |
|
||||
| onClick | 点击左侧按钮的回调,和 [Button](/components/button/) 一致 | Function | - |
|
||||
| trigger | 触发下拉的行为 | Array<'click'\|'hover'> | ['hover'] |
|
||||
| overlay | 菜单 | [Menu](/components/menu/) | - |
|
||||
| visible | 菜单是否显示 | boolean | - |
|
||||
| disabled | 菜单是否禁用 | boolean | - |
|
||||
| onVisibleChange | 菜单显示状态改变时调用,参数为 visible | Function | - |
|
||||
| placement | 菜单弹出位置:`bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
|
||||
|
||||
@@ -48,6 +48,12 @@
|
||||
box-shadow: @box-shadow-base;
|
||||
background-clip: padding-box;
|
||||
|
||||
&-item-group-title {
|
||||
color: @text-color-secondary;
|
||||
padding: 6px 8px;
|
||||
transition: all .3s;
|
||||
}
|
||||
|
||||
&-item,
|
||||
&-submenu-title {
|
||||
padding: 7px 8px;
|
||||
|
||||
@@ -9,10 +9,10 @@ import warning from '../_util/warning';
|
||||
import FormItem from './FormItem';
|
||||
import { FIELD_META_PROP } from './constants';
|
||||
|
||||
export interface FormCreateOption {
|
||||
onFieldsChange?: (props: any, fields: Array<any>) => void;
|
||||
onValuesChange?: (props: any, values: any) => void;
|
||||
mapPropsToFields?: (props: any) => void;
|
||||
export interface FormCreateOption<T> {
|
||||
onFieldsChange?: (props: T, fields: Array<any>) => void;
|
||||
onValuesChange?: (props: T, values: any) => void;
|
||||
mapPropsToFields?: (props: T) => void;
|
||||
withRef?: boolean;
|
||||
}
|
||||
|
||||
@@ -71,6 +71,10 @@ export type GetFieldDecoratorOptions = {
|
||||
rules?: ValidationRule[];
|
||||
/** 是否和其他控件互斥,特别用于 Radio 单选控件 */
|
||||
exclusive?: boolean;
|
||||
/** Normalize value to form component */
|
||||
normalize?: (value: any, prevValue: any, allValues: any) => any;
|
||||
/** Whether stop validate on first rule of error for this field. */
|
||||
validateFirst?: boolean;
|
||||
};
|
||||
|
||||
// function create
|
||||
@@ -110,9 +114,14 @@ export interface FormComponentProps {
|
||||
form: WrappedFormUtils;
|
||||
}
|
||||
|
||||
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/9951
|
||||
export type Diff<T extends string, U extends string> =
|
||||
({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T];
|
||||
export type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;
|
||||
|
||||
export interface ComponentDecorator<TOwnProps> {
|
||||
(component: React.ComponentClass<FormComponentProps & TOwnProps>): React.ComponentClass<TOwnProps>;
|
||||
<P extends FormComponentProps>(
|
||||
component: React.ComponentClass<P>,
|
||||
): React.ComponentClass<Omit<P, keyof FormComponentProps> & TOwnProps>;
|
||||
}
|
||||
|
||||
export default class Form extends React.Component<FormProps, any> {
|
||||
@@ -139,7 +148,7 @@ export default class Form extends React.Component<FormProps, any> {
|
||||
|
||||
static Item = FormItem;
|
||||
|
||||
static create = function<TOwnProps>(options?: FormCreateOption): ComponentDecorator<TOwnProps> {
|
||||
static create = function<TOwnProps>(options: FormCreateOption<TOwnProps> = {}): ComponentDecorator<TOwnProps> {
|
||||
const formWrapper = createDOMForm({
|
||||
fieldNameProp: 'id',
|
||||
...options,
|
||||
@@ -174,8 +183,10 @@ export default class Form extends React.Component<FormProps, any> {
|
||||
this.props.form.getFieldProps = this.deprecatedGetFieldProps;
|
||||
|
||||
const withRef: any = {};
|
||||
if (options && options.withRef) {
|
||||
if (options.withRef) {
|
||||
withRef.ref = 'formWrappedComponent';
|
||||
} else if (this.props.wrappedComponentRef) {
|
||||
withRef.ref = this.props.wrappedComponentRef;
|
||||
}
|
||||
return <Component {...this.props} {...withRef} />;
|
||||
},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import React from 'react';
|
||||
import { findDOMNode } from 'react-dom';
|
||||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import PureRenderMixin from 'rc-util/lib/PureRenderMixin';
|
||||
@@ -168,7 +169,7 @@ export default class FormItem extends React.Component<FormItemProps, any> {
|
||||
if (validateStatus) {
|
||||
classes = classNames(
|
||||
{
|
||||
'has-feedback': props.hasFeedback,
|
||||
'has-feedback': props.hasFeedback || validateStatus === 'validating',
|
||||
'has-success': validateStatus === 'success',
|
||||
'has-warning': validateStatus === 'warning',
|
||||
'has-error': validateStatus === 'error',
|
||||
@@ -212,6 +213,23 @@ export default class FormItem extends React.Component<FormItemProps, any> {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resolve duplicated ids bug between different forms
|
||||
// https://github.com/ant-design/ant-design/issues/7351
|
||||
onLabelClick = (e) => {
|
||||
const id = this.props.id || this.getId();
|
||||
if (!id) {
|
||||
return;
|
||||
}
|
||||
const controls = document.querySelectorAll(`[id="${id}"]`);
|
||||
if (controls.length !== 1) {
|
||||
e.preventDefault();
|
||||
const control = findDOMNode(this).querySelector(`[id="${id}"]`) as HTMLElement;
|
||||
if (control && control.focus) {
|
||||
control.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
renderLabel() {
|
||||
const { prefixCls, label, labelCol, colon, id } = this.props;
|
||||
const context = this.context;
|
||||
@@ -239,6 +257,7 @@ export default class FormItem extends React.Component<FormItemProps, any> {
|
||||
htmlFor={id || this.getId()}
|
||||
className={labelClassName}
|
||||
title={typeof label === 'string' ? label : ''}
|
||||
onClick={this.onLabelClick}
|
||||
>
|
||||
{labelChildren}
|
||||
</label>
|
||||
|
||||
@@ -827,7 +827,7 @@ exports[`renders ./components/form/demo/global-state.md correctly 1`] = `
|
||||
data-__meta="[object Object]"
|
||||
id="username"
|
||||
type="text"
|
||||
value="BENJYCUI"
|
||||
value="benjycui"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2085,6 +2085,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
|
||||
class="ant-select-search__field__wrap"
|
||||
>
|
||||
<input
|
||||
autocomplete="off"
|
||||
class="ant-select-search__field"
|
||||
id="select-multiple"
|
||||
value=""
|
||||
@@ -2167,6 +2168,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
|
||||
id="input-number"
|
||||
max="10"
|
||||
min="1"
|
||||
step="1"
|
||||
value="3"
|
||||
/>
|
||||
</div>
|
||||
@@ -2278,6 +2280,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
|
||||
class="ant-slider-handle"
|
||||
role="slider"
|
||||
style="left:0%;"
|
||||
tabindex="0"
|
||||
/>
|
||||
<div
|
||||
class="ant-slider-mark"
|
||||
@@ -2771,8 +2774,185 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-row ant-form-item"
|
||||
>
|
||||
<div
|
||||
class="ant-form-item-label ant-col-xs-24 ant-col-sm-5"
|
||||
>
|
||||
<label
|
||||
class=""
|
||||
title="Success"
|
||||
>
|
||||
Success
|
||||
</label>
|
||||
</div>
|
||||
<div
|
||||
class="ant-form-item-control-wrapper ant-col-xs-24 ant-col-sm-12"
|
||||
>
|
||||
<div
|
||||
class="ant-form-item-control has-feedback has-success"
|
||||
>
|
||||
<span
|
||||
class="ant-calendar-picker"
|
||||
style="width:100%;"
|
||||
>
|
||||
<div>
|
||||
<input
|
||||
class="ant-calendar-picker-input ant-input ant-input-lg"
|
||||
placeholder="请选择日期"
|
||||
readonly=""
|
||||
value=""
|
||||
/>
|
||||
<span
|
||||
class="ant-calendar-picker-icon"
|
||||
/>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-row ant-form-item"
|
||||
>
|
||||
<div
|
||||
class="ant-form-item-label ant-col-xs-24 ant-col-sm-5"
|
||||
>
|
||||
<label
|
||||
class=""
|
||||
title="Warning"
|
||||
>
|
||||
Warning
|
||||
</label>
|
||||
</div>
|
||||
<div
|
||||
class="ant-form-item-control-wrapper ant-col-xs-24 ant-col-sm-12"
|
||||
>
|
||||
<div
|
||||
class="ant-form-item-control has-feedback has-warning"
|
||||
>
|
||||
<span
|
||||
class="ant-time-picker ant-time-picker-large"
|
||||
style="width:100%;"
|
||||
>
|
||||
<input
|
||||
class="ant-time-picker-input"
|
||||
placeholder="请选择时间"
|
||||
readonly=""
|
||||
type="text"
|
||||
value=""
|
||||
/>
|
||||
<span
|
||||
class="ant-time-picker-icon"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-row ant-form-item"
|
||||
>
|
||||
<div
|
||||
class="ant-form-item-label ant-col-xs-24 ant-col-sm-5"
|
||||
>
|
||||
<label
|
||||
class=""
|
||||
title="Error"
|
||||
>
|
||||
Error
|
||||
</label>
|
||||
</div>
|
||||
<div
|
||||
class="ant-form-item-control-wrapper ant-col-xs-24 ant-col-sm-12"
|
||||
>
|
||||
<div
|
||||
class="ant-form-item-control has-feedback has-error"
|
||||
>
|
||||
<div
|
||||
class="ant-select-lg ant-select ant-select-enabled"
|
||||
>
|
||||
<div
|
||||
aria-autocomplete="list"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
class="ant-select-selection
|
||||
ant-select-selection--single"
|
||||
role="combobox"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
class="ant-select-selection__rendered"
|
||||
>
|
||||
<div
|
||||
class="ant-select-selection-selected-value"
|
||||
style="display:block;opacity:1;"
|
||||
title="Option 1"
|
||||
>
|
||||
Option 1
|
||||
</div>
|
||||
</div>
|
||||
<span
|
||||
class="ant-select-arrow"
|
||||
style="user-select:none;-webkit-user-select:none;"
|
||||
unselectable="unselectable"
|
||||
>
|
||||
<b />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-row ant-form-item ant-form-item-with-help"
|
||||
>
|
||||
<div
|
||||
class="ant-form-item-label ant-col-xs-24 ant-col-sm-5"
|
||||
>
|
||||
<label
|
||||
class=""
|
||||
title="Validating"
|
||||
>
|
||||
Validating
|
||||
</label>
|
||||
</div>
|
||||
<div
|
||||
class="ant-form-item-control-wrapper ant-col-xs-24 ant-col-sm-12"
|
||||
>
|
||||
<div
|
||||
class="ant-form-item-control has-feedback is-validating"
|
||||
>
|
||||
<span
|
||||
class="ant-cascader-picker"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="ant-cascader-picker-label"
|
||||
/>
|
||||
<input
|
||||
autocomplete="off"
|
||||
class="ant-input ant-cascader-input ant-input-lg"
|
||||
readonly=""
|
||||
type="text"
|
||||
value=""
|
||||
/>
|
||||
<i
|
||||
class="anticon anticon-cross-circle ant-cascader-picker-clear"
|
||||
/>
|
||||
<i
|
||||
class="anticon anticon-down ant-cascader-picker-arrow"
|
||||
/>
|
||||
</span>
|
||||
<div
|
||||
class="ant-form-explain"
|
||||
>
|
||||
The information is being validated...
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-row ant-form-item"
|
||||
>
|
||||
<div
|
||||
class="ant-form-item-label ant-col-xs-24 ant-col-sm-5"
|
||||
@@ -2785,13 +2965,13 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
|
||||
</label>
|
||||
</div>
|
||||
<div
|
||||
class="ant-form-item-control-wrapper ant-col-xs-24 ant-col-sm-19"
|
||||
class="ant-form-item-control-wrapper ant-col-xs-24 ant-col-sm-12"
|
||||
>
|
||||
<div
|
||||
class="ant-form-item-control "
|
||||
>
|
||||
<div
|
||||
class="ant-col-6"
|
||||
class="ant-col-11"
|
||||
>
|
||||
<div
|
||||
class="ant-row ant-form-item ant-form-item-with-help"
|
||||
@@ -2827,16 +3007,16 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-col-1"
|
||||
class="ant-col-2"
|
||||
>
|
||||
<p
|
||||
class="ant-form-split"
|
||||
<span
|
||||
style="display:inline-block;width:100%;text-align:center;"
|
||||
>
|
||||
-
|
||||
</p>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="ant-col-6"
|
||||
class="ant-col-11"
|
||||
>
|
||||
<div
|
||||
class="ant-row ant-form-item"
|
||||
@@ -2866,9 +3046,76 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-row ant-form-item"
|
||||
>
|
||||
<div
|
||||
class="ant-form-item-label ant-col-xs-24 ant-col-sm-5"
|
||||
>
|
||||
<label
|
||||
class=""
|
||||
title="Success"
|
||||
>
|
||||
Success
|
||||
</label>
|
||||
</div>
|
||||
<div
|
||||
class="ant-form-item-control-wrapper ant-col-xs-24 ant-col-sm-12"
|
||||
>
|
||||
<div
|
||||
class="ant-form-item-control has-feedback has-success"
|
||||
>
|
||||
<div
|
||||
class="ant-form-explain"
|
||||
/>
|
||||
class="ant-input-number ant-input-number-lg"
|
||||
style="width:100%;"
|
||||
>
|
||||
<div
|
||||
class="ant-input-number-handler-wrap"
|
||||
>
|
||||
<span
|
||||
aria-disabled="false"
|
||||
aria-label="Increase Value"
|
||||
class="ant-input-number-handler ant-input-number-handler-up "
|
||||
role="button"
|
||||
unselectable="unselectable"
|
||||
>
|
||||
<span
|
||||
class="ant-input-number-handler-up-inner"
|
||||
unselectable="unselectable"
|
||||
/>
|
||||
</span>
|
||||
<span
|
||||
aria-disabled="false"
|
||||
aria-label="Decrease Value"
|
||||
class="ant-input-number-handler ant-input-number-handler-down "
|
||||
role="button"
|
||||
unselectable="unselectable"
|
||||
>
|
||||
<span
|
||||
class="ant-input-number-handler-down-inner"
|
||||
unselectable="unselectable"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
aria-valuemax="9007199254740991"
|
||||
aria-valuemin="-9007199254740991"
|
||||
class="ant-input-number-input-wrap"
|
||||
role="spinbutton"
|
||||
>
|
||||
<input
|
||||
autocomplete="off"
|
||||
class="ant-input-number-input"
|
||||
max="9007199254740991"
|
||||
min="-9007199254740991"
|
||||
step="1"
|
||||
value=""
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2941,6 +3188,7 @@ exports[`renders ./components/form/demo/without-form-create.md correctly 1`] = `
|
||||
class="ant-input-number-input"
|
||||
max="12"
|
||||
min="8"
|
||||
step="1"
|
||||
value="11"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -50,4 +50,43 @@ describe('Form', () => {
|
||||
expect(wrapper.find('.ant-form-item-control-wrapper').length).toBe(2);
|
||||
expect(wrapper.find('.ant-form-item-control-wrapper.ant-col-14').length).toBe(1);
|
||||
});
|
||||
|
||||
// https://github.com/ant-design/ant-design/issues/7351
|
||||
it('focus correct input when click label', () => {
|
||||
const Form1 = Form.create()(({ form }) => (
|
||||
<Form>
|
||||
<Form.Item label="label 1">
|
||||
{form.getFieldDecorator('test')(<input />)}
|
||||
</Form.Item>
|
||||
</Form>
|
||||
));
|
||||
const Form2 = Form.create()(({ form }) => (
|
||||
<Form>
|
||||
<Form.Item label="label 2">
|
||||
{form.getFieldDecorator('test2')(<input />)}
|
||||
</Form.Item>
|
||||
</Form>
|
||||
));
|
||||
const wrapper = mount(<div><Form1 /><Form2 /></div>);
|
||||
wrapper.find('Form label').at(0).simulate('click');
|
||||
expect(wrapper.find('Form input').at(0).node).toBe(document.activeElement);
|
||||
wrapper.find('Form label').at(1).simulate('click');
|
||||
expect(wrapper.find('Form input').at(1).node).toBe(document.activeElement);
|
||||
});
|
||||
|
||||
// https://github.com/ant-design/ant-design/issues/7693
|
||||
it('should not throw error when is not a valid id', () => {
|
||||
const Form1 = Form.create()(({ form }) => (
|
||||
<Form>
|
||||
<Form.Item label="label 1">
|
||||
{form.getFieldDecorator('member[0].name.firstname')(<input />)}
|
||||
</Form.Item>
|
||||
</Form>
|
||||
));
|
||||
const wrapper = mount(<Form1 />);
|
||||
expect(() => {
|
||||
wrapper.find('Form label').at(0).simulate('click');
|
||||
}).not.toThrow();
|
||||
expect(wrapper.find('Form input').at(0).node).toBe(document.activeElement);
|
||||
});
|
||||
});
|
||||
|
||||
36
components/form/__tests__/type.tsx
Normal file
36
components/form/__tests__/type.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
/* tslint:disable */
|
||||
import React from 'react';
|
||||
import Form, { FormComponentProps } from '../Form';
|
||||
|
||||
// test Form.create on component without own props
|
||||
class WithoutOwnProps extends React.Component<any, any> {
|
||||
state = {
|
||||
foo: 'bar',
|
||||
};
|
||||
render() {
|
||||
return <div>foo</div>;
|
||||
}
|
||||
}
|
||||
|
||||
const WithoutOwnPropsForm = Form.create()(WithoutOwnProps);
|
||||
|
||||
<WithoutOwnPropsForm />;
|
||||
|
||||
// test Form.create on component with own props
|
||||
interface WithOwnPropsProps extends FormComponentProps {
|
||||
name: string;
|
||||
}
|
||||
|
||||
class WithOwnProps extends React.Component<WithOwnPropsProps, any> {
|
||||
state = {
|
||||
foo: 'bar',
|
||||
};
|
||||
|
||||
render() {
|
||||
return <div>foo</div>;
|
||||
}
|
||||
}
|
||||
|
||||
const WithOwnPropsForm = Form.create()(WithOwnProps);
|
||||
|
||||
<WithOwnPropsForm name="foo" />;
|
||||
@@ -25,7 +25,7 @@ const CustomizedForm = Form.create({
|
||||
return {
|
||||
username: {
|
||||
...props.username,
|
||||
value: props.username.value.toUpperCase(),
|
||||
value: props.username.value,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -22,8 +22,9 @@ We provide properties like `validateStatus` `help` `hasFeedback` to customize yo
|
||||
3. `help`: display validate message.
|
||||
|
||||
````jsx
|
||||
import { Form, Input, DatePicker, Col } from 'antd';
|
||||
import { Form, Input, DatePicker, Col, TimePicker, Select, Cascader, InputNumber } from 'antd';
|
||||
const FormItem = Form.Item;
|
||||
const Option = Select.Option;
|
||||
|
||||
const formItemLayout = {
|
||||
labelCol: {
|
||||
@@ -94,31 +95,75 @@ ReactDOM.render(
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="inline"
|
||||
labelCol={{
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
}}
|
||||
wrapperCol={{
|
||||
xs: { span: 24 },
|
||||
sm: { span: 19 },
|
||||
}}
|
||||
help
|
||||
{...formItemLayout}
|
||||
label="Success"
|
||||
hasFeedback
|
||||
validateStatus="success"
|
||||
>
|
||||
<Col span={6}>
|
||||
<DatePicker style={{ width: '100%' }} />
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="Warning"
|
||||
hasFeedback
|
||||
validateStatus="warning"
|
||||
>
|
||||
<TimePicker style={{ width: '100%' }} />
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="Error"
|
||||
hasFeedback
|
||||
validateStatus="error"
|
||||
>
|
||||
<Select defaultValue="1">
|
||||
<Option value="1">Option 1</Option>
|
||||
<Option value="2">Option 2</Option>
|
||||
<Option value="3">Option 3</Option>
|
||||
</Select>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="Validating"
|
||||
hasFeedback
|
||||
validateStatus="validating"
|
||||
help="The information is being validated..."
|
||||
>
|
||||
<Cascader defaultValue={['1']} options={[]} />
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="inline"
|
||||
{...formItemLayout}
|
||||
>
|
||||
<Col span={11}>
|
||||
<FormItem validateStatus="error" help="Please select the correct date">
|
||||
<DatePicker />
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col span={1}>
|
||||
<p className="ant-form-split">-</p>
|
||||
<Col span={2}>
|
||||
<span style={{ display: 'inline-block', width: '100%', textAlign: 'center' }}>
|
||||
-
|
||||
</span>
|
||||
</Col>
|
||||
<Col span={6}>
|
||||
<Col span={11}>
|
||||
<FormItem>
|
||||
<DatePicker />
|
||||
</FormItem>
|
||||
</Col>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="Success"
|
||||
hasFeedback
|
||||
validateStatus="success"
|
||||
>
|
||||
<InputNumber style={{ width: '100%' }} />
|
||||
</FormItem>
|
||||
</Form>
|
||||
, mountNode);
|
||||
````
|
||||
|
||||
@@ -59,14 +59,14 @@ The following `options` are available:
|
||||
| Property | Description | Type |
|
||||
|-----------|------------------------------------------|------------|
|
||||
| onFieldsChange | Specify a function that will be called when the value a `Form.Item` gets changed. Usage example: saving the field's value to Redux store. | Function(props, fields) |
|
||||
| mapPropsToFields | Convert props to corresponding field value. Usage example: reading the values from Redux store. | Function(props): Object{ fieldName: Object{ value } } |
|
||||
| mapPropsToFields | Convert props to field value. Usage example: reading the values from Redux store. | Function(props): Object{ fieldName: Object{ value } } |
|
||||
| onValuesChange | A handler while value of any field is changed | (props, values) => void |
|
||||
|
||||
If the form has been decorated by `Form.create` then it has `this.props.form` property. `this.props.form` provides some APIs as follows:
|
||||
|
||||
> Note: Before using `getFieldsValue` `getFieldValue` `setFieldsValue` and so on, please make sure that corresponding field had been registered with `getFieldDecorator`.
|
||||
|
||||
| Property | Description | Type |
|
||||
| Method | Description | Type |
|
||||
|-----------|------------------------------------------|------------|
|
||||
| getFieldsValue | Get the specified fields' values. If you don't specify a parameter, you will get all fields' values. | Function([fieldNames: string[]]) |
|
||||
| getFieldValue | Get the value of a field. | Function(fieldName: string) |
|
||||
@@ -83,17 +83,28 @@ If the form has been decorated by `Form.create` then it has `this.props.form` pr
|
||||
| resetFields | Reset the specified fields' value(to `initialValue`) and status. If you don't specify a parameter, all the fields will be reset. | Function([names: string[]]) |
|
||||
| getFieldDecorator | Two-way binding for form, please read below for details. | |
|
||||
|
||||
### this.props.form.validateFields/validateFieldsAndScroll([fieldNames: string[]], [options: object], callback: Function(errors, values))
|
||||
|
||||
| Method | Description | Type | Default |
|
||||
|-----|-----|------|-------|
|
||||
| options.first | If `true`, every field will stop validation at first failed rule | boolean | false |
|
||||
| options.firstFields | Those fields will stop validation at first failed rule | String[] | [] |
|
||||
| options.force | Should validate validated field again when `validateTrigger` is been triggered again | boolean | false |
|
||||
| options.scroll | Config scroll behavior of `validateFieldsAndScroll`, more: [dom-scroll-into-view's config](https://github.com/yiminghe/dom-scroll-into-view#function-parameter) | Object | {} |
|
||||
|
||||
|
||||
### this.props.form.getFieldDecorator(id, options)
|
||||
|
||||
After wrapped by `getFieldDecorator`, `value`(or other property defined by `valuePropName`) `onChange`(or other property defined by `trigger`) props will be added to form controls,the flow of form data will be handled by Form which will cause:
|
||||
|
||||
1. You don't need to use `onChange` to collect data, but you still can listen to `onChange`(and so on) events.
|
||||
1. You shouldn't to use `onChange` to collect data, but you still can listen to `onChange`(and so on) events.
|
||||
2. You can not set value of form control via `value` `defaultValue` prop, and you should set default value with `initialValue` in `getFieldDecorator` instead.
|
||||
3. You don't need to call `setState` manually, please use `this.props.form.setFieldsValue` to change value programmatically.
|
||||
3. You shouldn't to call `setState` manually, please use `this.props.form.setFieldsValue` to change value programmatically.
|
||||
|
||||
#### Special attention
|
||||
|
||||
If you use `react@<15.3.0`, then, you can't use `getFieldDecorator` in stateless component: https://github.com/facebook/react/pull/6534
|
||||
1. `getFieldDecorator` can not be used to decorate stateless component.
|
||||
1. If you use `react@<15.3.0`, then, you can't use `getFieldDecorator` in stateless component: https://github.com/facebook/react/pull/6534
|
||||
|
||||
#### getFieldDecorator(id, options) parameters
|
||||
|
||||
@@ -106,6 +117,7 @@ If you use `react@<15.3.0`, then, you can't use `getFieldDecorator` in stateless
|
||||
| options.getValueFromEvent | Specify how to get value from event or other onChange arguments | function(..args) | [reference](https://github.com/react-component/form#option-object) |
|
||||
| options.validateTrigger | When to validate the value of children node. | string\|string[] | 'onChange' |
|
||||
| options.rules | Includes validation rules. Please refer to "Validation Rules" part for details. | object[] | n/a |
|
||||
| options.validateFirst | Whether stop validate on first rule of error for this field. | boolean | false |
|
||||
| options.exclusive | Whether it is exclusive with other controls, particularly for Radio. | boolean | false |
|
||||
| options.normalize | Normalize value to form component, [a select-all example](https://codepen.io/afc163/pen/JJVXzG?editors=001) | function(value, prevValue, allValues): any | - |
|
||||
|
||||
@@ -152,3 +164,20 @@ See more advanced usage at [async-validator](https://github.com/yiminghe/async-v
|
||||
max-width: 540px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
## Using in TypeScript
|
||||
|
||||
```jsx
|
||||
import { Form } from 'antd';
|
||||
import { FormComponentProps } from 'antd/lib/form/Form';
|
||||
|
||||
interface UserFormProps extends FormComponentProps {
|
||||
age: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
class UserForm extends React.Component<UserFormProps, any> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -61,14 +61,14 @@ CustomizedForm = Form.create({})(CustomizedForm);
|
||||
| 参数 | 说明 | 类型 |
|
||||
|-----------|------------------------------------------|------------|
|
||||
| onFieldsChange | 当 `Form.Item` 子节点的值发生改变时触发,可以把对应的值转存到 Redux store | Function(props, fields) |
|
||||
| mapPropsToFields | 把 props 转为对应的值,可用于把 Redux store 中的值读出 | Function(props): Object{ fieldName: Object{ value } } |
|
||||
| mapPropsToFields | 把父组件的属性映射到表单项上(可用于把 Redux store 中的值读出) | Function(props): Object{ fieldName: Object{ value } } |
|
||||
| onValuesChange | 任一表单域的值发生改变时的回调 | (props, values) => void |
|
||||
|
||||
经过 `Form.create` 包装的组件将会自带 `this.props.form` 属性,`this.props.form` 提供的 API 如下:
|
||||
|
||||
> 注意:使用 `getFieldsValue` `getFieldValue` `setFieldsValue` 等时,应确保对应的 field 已经用 `getFieldDecorator` 注册过了。
|
||||
|
||||
| 参数 | 说明 | 类型 |
|
||||
| 方法 | 说明 | 类型 |
|
||||
|-----------|------------------------------------------|------------|
|
||||
| getFieldsValue | 获取一组输入控件的值,如不传入参数,则获取全部组件的值 | Function([fieldNames: string[]]) |
|
||||
| getFieldValue | 获取一个输入控件的值 | Function(fieldName: string) |
|
||||
@@ -84,17 +84,27 @@ CustomizedForm = Form.create({})(CustomizedForm);
|
||||
| resetFields | 重置一组输入控件的值(为 `initialValue`)与状态,如不传入参数,则重置所有组件 | Function([names: string[]]) |
|
||||
| getFieldDecorator | 用于和表单进行双向绑定,详见下方描述 | |
|
||||
|
||||
### this.props.form.validateFields/validateFieldsAndScroll([fieldNames: string[]], [options: object], callback: Function(errors, values))
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|-----|-----|------|-------|
|
||||
| options.first | 若为 true,则每一表单域的都会在碰到第一个失败了的校验规则后停止校验 | boolean | false |
|
||||
| options.firstFields | 指定表单域会在碰到第一个失败了的校验规则后停止校验 | String[] | [] |
|
||||
| options.force | 对已经校验过的表单域,在 validateTrigger 再次被触发时是否再次校验 | boolean | false |
|
||||
| options.scroll | 定义 validateFieldsAndScroll 的滚动行为,详细配置见 [dom-scroll-into-view config](https://github.com/yiminghe/dom-scroll-into-view#function-parameter) | Object | {} |
|
||||
|
||||
### this.props.form.getFieldDecorator(id, options)
|
||||
|
||||
经过 `getFieldDecorator` 包装的控件,表单控件会自动添加 `value`(或 `valuePropName` 指定的其他属性) `onChange`(或 `trigger` 指定的其他属性),数据同步将被 Form 接管,这会导致以下结果:
|
||||
|
||||
1. 你不再需要用 `onChange` 来做同步,但还是可以继续监听 `onChange` 等事件。
|
||||
1. 你**不再需要也不应该**用 `onChange` 来做同步,但还是可以继续监听 `onChange` 等事件。
|
||||
2. 你不能用控件的 `value` `defaultValue` 等属性来设置表单域的值,默认值可以用 `getFieldDecorator` 里的 `initialValue`。
|
||||
3. 你不需要用 `setState`,可以使用 `this.props.form.setFieldsValue` 来动态改变表单值。
|
||||
3. 你不应该用 `setState`,可以使用 `this.props.form.setFieldsValue` 来动态改变表单值。
|
||||
|
||||
#### 特别注意
|
||||
|
||||
如果使用的是 `react@<15.3.0`,则 `getFieldDecorator` 调用不能位于纯函数组件中: https://github.com/facebook/react/pull/6534
|
||||
1. `getFieldDecorator` 不能用于装饰纯函数组件。
|
||||
1. 如果使用的是 `react@<15.3.0`,则 `getFieldDecorator` 调用不能位于纯函数组件中: https://github.com/facebook/react/pull/6534
|
||||
|
||||
#### getFieldDecorator(id, options) 参数
|
||||
|
||||
@@ -107,6 +117,7 @@ CustomizedForm = Form.create({})(CustomizedForm);
|
||||
| options.getValueFromEvent | 可以把 onChange 的参数(如 event)转化为控件的值 | function(..args) | [reference](https://github.com/react-component/form#option-object) |
|
||||
| options.validateTrigger | 校验子节点值的时机 | string\|string[] | 'onChange' |
|
||||
| options.rules | 校验规则,参考下方文档 | object[] | |
|
||||
| options.validateFirst | 当某一规则校验不通过时,是否停止剩下的规则的校验 | boolean | false |
|
||||
| options.exclusive | 是否和其他控件互斥,特别用于 Radio 单选控件 | boolean | false |
|
||||
| options.normalize | 转换默认的 value 给控件,[一个选择全部的例子](https://codepen.io/afc163/pen/JJVXzG?editors=001) | function(value, prevValue, allValues): any | - |
|
||||
|
||||
@@ -153,3 +164,19 @@ validator | 自定义校验(注意,[callback 必须被调用](https://github
|
||||
max-width: 540px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
## 在 TypeScript 中使用
|
||||
|
||||
```jsx
|
||||
import { Form } from 'antd';
|
||||
import { FormComponentProps } from 'antd/lib/form/Form';
|
||||
|
||||
interface UserFormProps extends FormComponentProps {
|
||||
age: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
class UserForm extends React.Component<UserFormProps, any> {
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user