mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-17 06:42:28 +08:00
Compare commits
319 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee1c726447 | ||
|
|
548c694c40 | ||
|
|
f5652f8e57 | ||
|
|
9f76f1c276 | ||
|
|
b9992f4a08 | ||
|
|
36f396f86f | ||
|
|
fbf1a35249 | ||
|
|
611f6e1f8f | ||
|
|
968371b22a | ||
|
|
e91f67b87c | ||
|
|
e29a88b704 | ||
|
|
0f503b50f7 | ||
|
|
6cb6f5c83e | ||
|
|
67145a777e | ||
|
|
4c5d66228d | ||
|
|
cc02ebf9d4 | ||
|
|
522b70e698 | ||
|
|
61284e2c9a | ||
|
|
691a98d25b | ||
|
|
b95d8aedd2 | ||
|
|
91a7318999 | ||
|
|
435d793d60 | ||
|
|
c25e8de736 | ||
|
|
d87899784b | ||
|
|
6503bace42 | ||
|
|
1c5f8f1901 | ||
|
|
66940db794 | ||
|
|
827da01e05 | ||
|
|
101fdc7241 | ||
|
|
0337b69893 | ||
|
|
cd5cbafdf0 | ||
|
|
007c7d0ef7 | ||
|
|
c3e50c268d | ||
|
|
c1daf5bad2 | ||
|
|
a29a0ff78d | ||
|
|
f728fbe5ab | ||
|
|
f796618a15 | ||
|
|
d0c684e925 | ||
|
|
cb961cdf01 | ||
|
|
608f631b64 | ||
|
|
2cd863929a | ||
|
|
57a2fc667e | ||
|
|
88981fef22 | ||
|
|
881cef5abf | ||
|
|
8c7dfe45c6 | ||
|
|
430381f28f | ||
|
|
60c2860e09 | ||
|
|
6be189aa0f | ||
|
|
18d85141e1 | ||
|
|
b4e0c48ed5 | ||
|
|
2756d587d7 | ||
|
|
37ba3bcd7c | ||
|
|
7dd5270831 | ||
|
|
d441c815a9 | ||
|
|
c045b79e62 | ||
|
|
2ad0bc0395 | ||
|
|
361b94fb0f | ||
|
|
e2b9e5d832 | ||
|
|
f22353cd2b | ||
|
|
ecc2293229 | ||
|
|
ed7630053e | ||
|
|
96d8fc45f1 | ||
|
|
12b99970f3 | ||
|
|
1d924300e7 | ||
|
|
825d770254 | ||
|
|
782abe7bb6 | ||
|
|
e7242f4924 | ||
|
|
a2c4b03d45 | ||
|
|
f7db1788df | ||
|
|
fc7c64ce06 | ||
|
|
308cb046e4 | ||
|
|
c696757793 | ||
|
|
e6c4c6667d | ||
|
|
9c792d52a8 | ||
|
|
705e57f7e8 | ||
|
|
57c072d1b8 | ||
|
|
a0f5044189 | ||
|
|
2cacfe78ea | ||
|
|
152cae4d9f | ||
|
|
14e0cc0161 | ||
|
|
d2c34e32a1 | ||
|
|
11f0f14cb2 | ||
|
|
f337d2f4e4 | ||
|
|
31b2517261 | ||
|
|
1f15df4f14 | ||
|
|
a5723386ed | ||
|
|
6872131321 | ||
|
|
159b09342d | ||
|
|
d4c9a1deea | ||
|
|
ee6ef28ec6 | ||
|
|
6fe9ca201e | ||
|
|
f1570c01ea | ||
|
|
5c7f9feecb | ||
|
|
125d0df3e0 | ||
|
|
0ee58eb3d4 | ||
|
|
2cffe4f858 | ||
|
|
9ad0114102 | ||
|
|
01f2dee77b | ||
|
|
dba4b8c3c9 | ||
|
|
441b90e488 | ||
|
|
50271732b1 | ||
|
|
06d5ff6bbe | ||
|
|
007c8dfc91 | ||
|
|
c8217e0bad | ||
|
|
78e8ab55b5 | ||
|
|
0f2be7308b | ||
|
|
2be8248552 | ||
|
|
b91a367b4f | ||
|
|
cc59ef4cbf | ||
|
|
186e69cea3 | ||
|
|
0f22cd69c3 | ||
|
|
2e3d131d74 | ||
|
|
c863b2d758 | ||
|
|
65e73c5f3b | ||
|
|
ce4624c69a | ||
|
|
510dad58bf | ||
|
|
1f25b1042b | ||
|
|
115f518985 | ||
|
|
172759177f | ||
|
|
e8394eca6f | ||
|
|
d2856392b6 | ||
|
|
9e12476f68 | ||
|
|
1f3d6584ff | ||
|
|
7801f2459c | ||
|
|
68da7f2078 | ||
|
|
306389273a | ||
|
|
73674f53c3 | ||
|
|
ab8a05605a | ||
|
|
bc76ae51ac | ||
|
|
8c476ada26 | ||
|
|
7757926666 | ||
|
|
af5cde61d1 | ||
|
|
fee00e3841 | ||
|
|
86655c0ebc | ||
|
|
de5b89a612 | ||
|
|
8c3386f00c | ||
|
|
61a7731270 | ||
|
|
cbbe4035e2 | ||
|
|
42de00137f | ||
|
|
13393d8987 | ||
|
|
4ed787296b | ||
|
|
bccd871eca | ||
|
|
e1e6523452 | ||
|
|
5732b6e2b2 | ||
|
|
c380186e79 | ||
|
|
0e3b67e999 | ||
|
|
0b50a75093 | ||
|
|
db4a5edf8e | ||
|
|
8eb8c686ce | ||
|
|
44ea5b2998 | ||
|
|
00afce3a4b | ||
|
|
722b24b813 | ||
|
|
2d5949f31d | ||
|
|
690804d310 | ||
|
|
46add091ca | ||
|
|
4b045fc43f | ||
|
|
e3ef74c3e7 | ||
|
|
ea42973ace | ||
|
|
47884320ef | ||
|
|
e47b82d22a | ||
|
|
9f1c8bc184 | ||
|
|
af49a1806b | ||
|
|
b3f4e5e3da | ||
|
|
52d736a0ee | ||
|
|
779abfaf9f | ||
|
|
435558b63e | ||
|
|
77af31da7d | ||
|
|
591e00edc1 | ||
|
|
6a405463d1 | ||
|
|
903f3f6770 | ||
|
|
1c31efe392 | ||
|
|
6d7ac58550 | ||
|
|
31c07d8372 | ||
|
|
5980cf957a | ||
|
|
0c4d356e54 | ||
|
|
cde8bc8361 | ||
|
|
4aabc53744 | ||
|
|
60ebb434c1 | ||
|
|
8607c58abc | ||
|
|
d4c95e6f18 | ||
|
|
004561ba1f | ||
|
|
450a3142ee | ||
|
|
0f2fea2d78 | ||
|
|
1af4392ae9 | ||
|
|
59cc3a8b6c | ||
|
|
ee1f450e04 | ||
|
|
8c156afb39 | ||
|
|
915a64feae | ||
|
|
fb96c9db35 | ||
|
|
7123a6da59 | ||
|
|
5fe25d9c23 | ||
|
|
a516358298 | ||
|
|
a3e245731b | ||
|
|
553901dfb8 | ||
|
|
7d038d1aee | ||
|
|
e906117731 | ||
|
|
fcc055b390 | ||
|
|
763d32ac68 | ||
|
|
567eaf9ff4 | ||
|
|
47621acb6c | ||
|
|
6ff7dd8fb9 | ||
|
|
ddfe8ad48a | ||
|
|
4d5d3c142e | ||
|
|
27c3093487 | ||
|
|
fd06baa9d7 | ||
|
|
d88a8f6920 | ||
|
|
31014e94ba | ||
|
|
cde2a6b6f0 | ||
|
|
4cf18eaae8 | ||
|
|
11dba9c305 | ||
|
|
3eee357bfb | ||
|
|
f2e22e702e | ||
|
|
c55fabc7b4 | ||
|
|
60e3cfa37a | ||
|
|
01233b15c5 | ||
|
|
33c5d3b330 | ||
|
|
5554b75bc1 | ||
|
|
0ea8047546 | ||
|
|
817ee3e9e1 | ||
|
|
1010a4fe19 | ||
|
|
46735a9f6b | ||
|
|
63b4dc5157 | ||
|
|
bf5b6ae1f3 | ||
|
|
babbbdd4e5 | ||
|
|
0981ef06a4 | ||
|
|
56020cda39 | ||
|
|
009ed08580 | ||
|
|
6a0b4f1d27 | ||
|
|
50475e8063 | ||
|
|
e2b359e9c3 | ||
|
|
0d09dbafdd | ||
|
|
1850699588 | ||
|
|
c8a1442e38 | ||
|
|
8931591734 | ||
|
|
c9be66f8e7 | ||
|
|
9523a1b528 | ||
|
|
bcef7ca32e | ||
|
|
77fcbca04d | ||
|
|
04c0013e58 | ||
|
|
e63f9d4beb | ||
|
|
f0b684de6a | ||
|
|
20348614d5 | ||
|
|
354cc7303e | ||
|
|
6de4b00815 | ||
|
|
5eaa03b4ea | ||
|
|
53046a454a | ||
|
|
f80961b946 | ||
|
|
b374297ca6 | ||
|
|
aa580beb8b | ||
|
|
2d2aceb9d3 | ||
|
|
5302400e62 | ||
|
|
d11d44e413 | ||
|
|
653ec40b30 | ||
|
|
fc224525da | ||
|
|
71846acaa1 | ||
|
|
9f16d066af | ||
|
|
a614a525c4 | ||
|
|
7fc1483fe1 | ||
|
|
ff70654ffe | ||
|
|
3fb478e743 | ||
|
|
126bb42ddd | ||
|
|
2ce3ffd6f4 | ||
|
|
904fd0a358 | ||
|
|
68a110afa3 | ||
|
|
ac9368298f | ||
|
|
17da353575 | ||
|
|
b7879e909f | ||
|
|
e7fa6ca7eb | ||
|
|
7fe027bfcf | ||
|
|
dd3490e4ef | ||
|
|
d6ee287924 | ||
|
|
919e25d6d9 | ||
|
|
39b4ff438f | ||
|
|
be8520de3c | ||
|
|
8e8b991ba7 | ||
|
|
b1d60f5ce1 | ||
|
|
5903fdb19f | ||
|
|
4b5d54671a | ||
|
|
5ab265a009 | ||
|
|
c540ceb8eb | ||
|
|
450a497412 | ||
|
|
4bf9114ee9 | ||
|
|
a9c8998aea | ||
|
|
c96805254f | ||
|
|
7958860c95 | ||
|
|
1c2385de98 | ||
|
|
4ac0277813 | ||
|
|
a5ff8e5de0 | ||
|
|
07e06709f8 | ||
|
|
980e2b1427 | ||
|
|
713a0bcdc5 | ||
|
|
37ec04b21a | ||
|
|
c403bd9738 | ||
|
|
01460c0297 | ||
|
|
16e42601d6 | ||
|
|
637f30e6e3 | ||
|
|
f44584845b | ||
|
|
f883a6f351 | ||
|
|
b3ed289904 | ||
|
|
fd96967c87 | ||
|
|
99d6e4c96c | ||
|
|
f36c6195b8 | ||
|
|
ee0a7ce3bb | ||
|
|
619b0ed628 | ||
|
|
99cad890ef | ||
|
|
9aea9ddf58 | ||
|
|
7e2ba7e6d3 | ||
|
|
c488aca05e | ||
|
|
f2fddff3fd | ||
|
|
89f3b253a4 | ||
|
|
2025a10a06 | ||
|
|
e51b043737 | ||
|
|
4b360b5139 | ||
|
|
77ad1e457b | ||
|
|
8f449861cf | ||
|
|
68b207e186 | ||
|
|
8e60a591fd | ||
|
|
a825ed4e66 | ||
|
|
ff24f1a978 |
221
.circleci/config.yml
Normal file
221
.circleci/config.yml
Normal file
@@ -0,0 +1,221 @@
|
||||
version: 2
|
||||
|
||||
references:
|
||||
container_config: &container_config
|
||||
docker:
|
||||
- image: circleci/node:8
|
||||
working_directory: ~/ant-design
|
||||
|
||||
attach_workspace: &attach_workspace
|
||||
attach_workspace:
|
||||
at: ~/ant-design
|
||||
|
||||
install_react: &install_react
|
||||
run: REACT=15 ./scripts/install-react.sh
|
||||
|
||||
react_15: &react_15
|
||||
environment:
|
||||
REACT: 15
|
||||
|
||||
react_16: &react_16
|
||||
environment:
|
||||
REACT: 16
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
<<: *container_config
|
||||
steps:
|
||||
- checkout
|
||||
- run: node -v
|
||||
- run: npm -v
|
||||
- run: npm install
|
||||
- run:
|
||||
command: |
|
||||
set +eo
|
||||
npm ls
|
||||
true
|
||||
- persist_to_workspace:
|
||||
root: ~/ant-design
|
||||
paths:
|
||||
- node_modules
|
||||
|
||||
dist:
|
||||
<<: *container_config
|
||||
steps:
|
||||
- checkout
|
||||
- *attach_workspace
|
||||
- run: npm run dist
|
||||
- run: node ./tests/dekko/dist.test.js
|
||||
- persist_to_workspace:
|
||||
root: ~/ant-design
|
||||
paths:
|
||||
- dist
|
||||
|
||||
compile:
|
||||
<<: *container_config
|
||||
steps:
|
||||
- checkout
|
||||
- *attach_workspace
|
||||
- run: npm run compile
|
||||
- run: node ./tests/dekko/lib.test.js
|
||||
- persist_to_workspace:
|
||||
root: ~/ant-design
|
||||
paths:
|
||||
- lib
|
||||
- es
|
||||
|
||||
lint:
|
||||
<<: *container_config
|
||||
steps:
|
||||
- checkout
|
||||
- *attach_workspace
|
||||
- run: npm run lint
|
||||
|
||||
test_dist:
|
||||
<<: *container_config
|
||||
<<: *react_16
|
||||
steps:
|
||||
- checkout
|
||||
- *attach_workspace
|
||||
- run:
|
||||
command: npm test -- -w 2
|
||||
environment:
|
||||
LIB_DIR: dist
|
||||
|
||||
test_lib:
|
||||
<<: *container_config
|
||||
<<: *react_16
|
||||
steps:
|
||||
- checkout
|
||||
- *attach_workspace
|
||||
- run:
|
||||
command: npm test -- -w 2
|
||||
environment:
|
||||
LIB_DIR: lib
|
||||
|
||||
test_es:
|
||||
<<: *container_config
|
||||
<<: *react_16
|
||||
steps:
|
||||
- checkout
|
||||
- *attach_workspace
|
||||
- run:
|
||||
command: npm test -- -w 2
|
||||
environment:
|
||||
LIB_DIR: es
|
||||
|
||||
test_dom:
|
||||
<<: *container_config
|
||||
<<: *react_16
|
||||
steps:
|
||||
- checkout
|
||||
- *attach_workspace
|
||||
- run: npm test -- -w 2 --coverage
|
||||
- run: bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
test_node:
|
||||
<<: *container_config
|
||||
<<: *react_16
|
||||
steps:
|
||||
- checkout
|
||||
- *attach_workspace
|
||||
- run: npm run test-node -- -w 2
|
||||
|
||||
test_dist_15:
|
||||
<<: *container_config
|
||||
<<: *react_15
|
||||
steps:
|
||||
- checkout
|
||||
- *attach_workspace
|
||||
- *install_react
|
||||
- run:
|
||||
command: npm test -- -w 2 -u
|
||||
environment:
|
||||
LIB_DIR: dist
|
||||
|
||||
test_lib_15:
|
||||
<<: *container_config
|
||||
<<: *react_15
|
||||
steps:
|
||||
- checkout
|
||||
- *attach_workspace
|
||||
- *install_react
|
||||
- run:
|
||||
command: npm test -- -w 2 -u
|
||||
environment:
|
||||
LIB_DIR: lib
|
||||
|
||||
test_es_15:
|
||||
<<: *container_config
|
||||
<<: *react_15
|
||||
steps:
|
||||
- checkout
|
||||
- *attach_workspace
|
||||
- *install_react
|
||||
- run:
|
||||
command: npm test -- -w 2 -u
|
||||
environment:
|
||||
LIB_DIR: es
|
||||
|
||||
test_dom_15:
|
||||
<<: *container_config
|
||||
<<: *react_15
|
||||
steps:
|
||||
- checkout
|
||||
- *attach_workspace
|
||||
- *install_react
|
||||
- run: npm test -- -w 2 -u
|
||||
|
||||
test_node_15:
|
||||
<<: *container_config
|
||||
<<: *react_15
|
||||
steps:
|
||||
- checkout
|
||||
- *attach_workspace
|
||||
- *install_react
|
||||
- run: npm run test-node -- -w 2 -u
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build-test:
|
||||
jobs:
|
||||
- setup
|
||||
- dist:
|
||||
requires:
|
||||
- setup
|
||||
- compile:
|
||||
requires:
|
||||
- setup
|
||||
- lint:
|
||||
requires:
|
||||
- setup
|
||||
- test_dist:
|
||||
requires:
|
||||
- dist
|
||||
- test_lib:
|
||||
requires:
|
||||
- compile
|
||||
- test_es:
|
||||
requires:
|
||||
- compile
|
||||
- test_dom:
|
||||
requires:
|
||||
- setup
|
||||
- test_node:
|
||||
requires:
|
||||
- setup
|
||||
- test_dist_15:
|
||||
requires:
|
||||
- dist
|
||||
- test_lib_15:
|
||||
requires:
|
||||
- compile
|
||||
- test_es_15:
|
||||
requires:
|
||||
- compile
|
||||
- test_dom_15:
|
||||
requires:
|
||||
- setup
|
||||
- test_node_15:
|
||||
requires:
|
||||
- setup
|
||||
11
.eslintrc.js
11
.eslintrc.js
@@ -8,13 +8,6 @@ const eslintrc = {
|
||||
es6: true,
|
||||
},
|
||||
parser: 'babel-eslint',
|
||||
parserOptions: {
|
||||
ecmaVersion: 6,
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
experimentalObjectRestSpread: true,
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
'markdown',
|
||||
'react',
|
||||
@@ -26,6 +19,8 @@ const eslintrc = {
|
||||
'react/sort-comp': 0,
|
||||
'react/prop-types': 0,
|
||||
'react/jsx-first-prop-new-line': 0,
|
||||
'react/jsx-one-expression-per-line': 0,
|
||||
'react/forbid-prop-types': 0,
|
||||
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx', '.md'] }],
|
||||
'import/extensions': 0,
|
||||
'import/no-unresolved': 0,
|
||||
@@ -63,6 +58,8 @@ if (process.env.RUN_ENV === 'DEMO') {
|
||||
'eol-last': 0,
|
||||
'no-script-url': 0,
|
||||
'prefer-rest-params': 0,
|
||||
'react/no-access-state-in-setstate': 0,
|
||||
'react/destructuring-assignment': 0,
|
||||
'react/no-multi-comp': 0,
|
||||
'react/prefer-stateless-function': 0,
|
||||
'jsx-a11y/href-no-hash': 0,
|
||||
|
||||
26
.travis.yml
26
.travis.yml
@@ -5,20 +5,24 @@ language: node_js
|
||||
node_js:
|
||||
- 8
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.npm
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- env: TEST_TYPE=lint
|
||||
- env: REACT=16 TEST_TYPE=test:dist
|
||||
- env: REACT=16 TEST_TYPE=test:lib
|
||||
- env: REACT=16 TEST_TYPE=test:es
|
||||
- env: REACT=16 TEST_TYPE=test:dom
|
||||
- env: REACT=16 TEST_TYPE=test:node
|
||||
- env: REACT=15 TEST_TYPE=test:dist
|
||||
- env: REACT=15 TEST_TYPE=test:lib
|
||||
- env: REACT=15 TEST_TYPE=test:es
|
||||
- env: REACT=15 TEST_TYPE=test:dom
|
||||
- env: REACT=15 TEST_TYPE=test:node
|
||||
- env: TEST_TYPE=lint
|
||||
- env: REACT=16 TEST_TYPE=test:dist
|
||||
- env: REACT=16 TEST_TYPE=test:lib
|
||||
- env: REACT=16 TEST_TYPE=test:es
|
||||
- env: REACT=16 TEST_TYPE=test:dom
|
||||
- env: REACT=16 TEST_TYPE=test:node
|
||||
- env: REACT=15 TEST_TYPE=test:dist
|
||||
- env: REACT=15 TEST_TYPE=test:lib
|
||||
- env: REACT=15 TEST_TYPE=test:es
|
||||
- env: REACT=15 TEST_TYPE=test:dom
|
||||
- env: REACT=15 TEST_TYPE=test:node
|
||||
|
||||
before_script:
|
||||
- scripts/install-react.sh
|
||||
|
||||
@@ -15,6 +15,138 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
## 3.7.2
|
||||
|
||||
`2018-07-25`
|
||||
|
||||
- DatePicker
|
||||
- 🐞 **Fix issue resulting in year and month can not be changed in control mode.** [b9992f4](https://github.com/ant-design/ant-design/commit/b9992f4a08574efb47b6e6cd80eb1e888b9a1ede)
|
||||
- 🐞 Fix warning of `getDerivedStateFromProp`. [#11398](https://github.com/ant-design/ant-design/pull/11398) [@yoyo837](https://github.com/yoyo837)
|
||||
- Drawer
|
||||
- 🐞 Fix close animation when setting `destroyOnClose`. [#11307](https://github.com/ant-design/ant-design/issues/11307)
|
||||
- 🐞 Fix display issue when using a `vw` value as `width`. [#11326](https://github.com/ant-design/ant-design/issues/11326)
|
||||
- 🐞 Fix `wrapClassName` now working.
|
||||
- 🐞 Fix text overflow of Tooltip. [#11402](https://github.com/ant-design/ant-design/pull/11402) [@weidapao](https://github.com/weidapao)
|
||||
- 🐞 Fix style issue of dark theme Menu in Layout.Header. [#11400](https://github.com/ant-design/ant-design/pull/11400) [@hongxuWei](https://github.com/hongxuWei)
|
||||
- 🐞 Fix the arrow buttons of InputNumber showing wrong positon in a fixed table. [#11408](https://github.com/ant-design/ant-design/issues/11408)
|
||||
- 🐞 Fix issue resulting in Select.Option shows wrong border radius in Select.OptGroup. [6cb6f5c](https://github.com/ant-design/ant-design/commit/6cb6f5c83ed634e67d5b5d0816d11aa0788a74d8)
|
||||
- 🐞 Fix issue resulting in `onChange` was trigged twice when click the filter icon of Table. [#11164](https://github.com/ant-design/ant-design/issues/11164) [@adybionka](https://github.com/adybionka)
|
||||
- 🐞 Fix issue resulting title of Model.confirm shows scrollbar on Firefox. [#11432](https://github.com/ant-design/ant-design/issues/11432)
|
||||
- TypeScript
|
||||
- 🐞 Fix type definition of Radio.Group. [#11409](https://github.com/ant-design/ant-design/pull/11409) [@eddiemoore](https://github.com/eddiemoore)
|
||||
- 🐞 Fix type definition of TreeSelect. [#11442](https://github.com/ant-design/ant-design/pull/11442) [@JribiBelhassen](https://github.com/JribiBelhassen)
|
||||
- 🐞 Fix type definition of Badge. [#11421](https://github.com/ant-design/ant-design/pull/11421) [@zongzi531](https://github.com/zongzi531)
|
||||
|
||||
## 3.7.1
|
||||
|
||||
`2018-07-21`
|
||||
|
||||
- 🐞 Fix popup content can't display in Drawer component.[#11304](https://github.com/ant-design/ant-design/issues/11304)
|
||||
- 🐞 Card using `tabList` support `disabled` prop.[#11212](https://github.com/ant-design/ant-design/issues/11212)
|
||||
- 🐞 Fix Link of Anchor not sync when `href` update.[#11287](https://github.com/ant-design/ant-design/pull/11287/files) [@tangjinzhou](https://github.com/tangjinzhou)
|
||||
- 🐞 Fix Menu component style.[#11299](https://github.com/ant-design/ant-design/issues/11299)
|
||||
- 🐞 Fix Drawer component don't have animation when `destroyOnClose` is set.[#11307](https://github.com/ant-design/ant-design/issues/11307)
|
||||
- 🐞 Fix DirectoryTree can't expand when `expandedKeys` is in control.[#11366](https://github.com/ant-design/ant-design/issues/11366)
|
||||
- 🐞 Fix Button with Tooltip under ButtonGroup style issue when Button is `disabled`.[11321](https://github.com/ant-design/ant-design/pull/11321) [@tangjinzhou](https://github.com/tangjinzhou)
|
||||
|
||||
## 3.7.0
|
||||
|
||||
3.7.0 is a heavy update that brings a lot of exciting changes and new features.
|
||||
Here are some highlights ✨:
|
||||
|
||||
- 🌟 Add drawer component : [Drawer](https://ant.design/components/drawer-cn/). [#10791](https://github.com/ant-design/ant-design/pull/10791)
|
||||
- 🌟 Add `Tree.DirectoryTree` component as the built-in directory tree. [#7749](https://github.com/ant-design/ant-design/issues/7749)
|
||||
|
||||
Component Fixes / Enhancements:
|
||||
|
||||
- Upgrade `rc-tree-select` to `2.0.5` for TreeSelect, refactored to fix the logic of the check.
|
||||
- 🌟 Add `autoClearSearchValue` prop to clear the value of search input when multiple select is selected or deselected. [10996](https://github.com/ant-design/ant-design/issues/10996)
|
||||
- 🌟 Add `searchValue` prop to set the value of search input. [6ff7dd8](https://github.com/ant-design/ant-design/commit/6ff7dd8fb953f079ee51ee638aaf4d832d0e10bf#diff-1e8e47abbdbe6e12d009aa61619ab22f)
|
||||
- 🌟 Add `maxTagCount` prop to set the max count of visible tags. [fb96c9d](https://github.com/ant-design/ant-design/commit/fb96c9db351e44a202f64f780470c6319a8a9626)
|
||||
- 🌟 Add `maxTagPlaceholder` prop to set the content when the tag is hidden. [fb96c9d](https://github.com/ant-design/ant-design/commit/fb96c9db351e44a202f64f780470c6319a8a9626)
|
||||
- 🌟 Search input now supports case sensitive search. [#10990](https://github.com/ant-design/ant-design/issues/10990)
|
||||
- 🗑 Remove `label` prop and use `title` prop instead in the `treeData`.
|
||||
- Upgrade `rc-upload` to `2.5.0` for Upload.
|
||||
- 🌟 Add `directory` prop to support folder uploading. [#7315](https://github.com/ant-design/ant-design/issues/7315)
|
||||
- 🌟 `action` prop supports to be the a function which returns a Promise object. [fd96967](https://github.com/ant-design/ant-design/commit/fd96967c872600b79bb608e9ddf9f8c38814a704)
|
||||
- Dropdown
|
||||
- 🌟 Provide default margin for icon in the menu item. [8e60a59](https://github.com/ant-design/ant-design/commit/8e60a591fd24f644de4f67d69c2210e9270be9cc)
|
||||
- 🌟 Be able to adjust the menu position for the trigger mode of `contextMenu` automatically. [16e4260](https://github.com/ant-design/ant-design/commit/16e42601d6772fc0830ee237a1e751a38a118676)
|
||||
- Upgrade `rc-table` to `6.2.2` for Table. [f2fddff](https://github.com/ant-design/ant-design/commit/f2fddff3fd0d6b36e8e6d8ee06bfcbcc85ead4f0)
|
||||
- 🌟 Add `expanded` as the fourth param of `expandedRowRender` prop to get the expanded state of current row. [#10379](https://github.com/ant-design/ant-design/issues/10379)
|
||||
- 🌟 Add the ability to override the filter menu without the fully controlled component. [59cc3a8](https://github.com/ant-design/ant-design/commit/59cc3a8b6c643f7206feedf2dc2c7154296ba3e3) [@chrvadala](https://github.com/chrvadala)
|
||||
- 🌟 `filterIcon` prop supports to be a render function which returns ReactNode. [1af4392](https://github.com/ant-design/ant-design/commit/1af4392ae9fbdaa6fcfbf2f0de5413100ef4a84a)
|
||||
- 🐞 Fix the row dislocation problem when the column is fixed. [#10392](https://github.com/ant-design/ant-design/issues/10392)
|
||||
- 🌟 Allow to pass `data-*`, `aria-*` and `role-*` props to the inner for Alert. [f0b684d](https://github.com/ant-design/ant-design/commit/f0b684de6a7c422f0de56e1ef72aeb35ab25a858)
|
||||
- 🌟 Add `alt` prop for Avatar to set the text when the image is unable to display. [#10798](https://github.com/ant-design/ant-design/pull/10798)
|
||||
- 🌟 Allow to pass `data-*`, `aria-*` and `role-*` props to the inner Input for DatePicker. [e63f9d4](https://github.com/ant-design/ant-design/commit/e63f9d4beb440de92c0b0ce8e6e83f7e24fef792)
|
||||
- 🌟 Add `event` object as the second param of `onSearch` prop for Input.Search. [#11015](https://github.com/ant-design/ant-design/issues/11015)
|
||||
- 🌟 Add `onBreakPoint` prop for Layout.Sider to be the callback function when breakpoint is triggered. [#10750](https://github.com/ant-design/ant-design/pull/10750) [@nuintun](https://github.com/nuintun)
|
||||
- 🌟 Add `okButtonProps` prop to set the props of ok button and add `cancelButtonProps` prop to set the props of cancal button for Modal. [#10955](https://github.com/ant-design/ant-design/pull/10955) [@djyde](https://github.com/djyde)
|
||||
- 🌟 Add `strokeColor` prop to set the color of progress bar for Progress. [#10725](https://github.com/ant-design/ant-design/issues/10725)
|
||||
- 🌟 Add `buttonStyle` prop whose optional value is `outline` or `solid` to set the Radio.Group style. [60e3cfa](https://github.com/ant-design/ant-design/commit/60e3cfa37ac0dae3a895e74c1fe5351c54536a07#diff-c2ee8b5a368a121e9d2cc2661212045d)
|
||||
- 🌟 Add `setDefaultIndicator` static function to set global indicator for Spin. [#10787](https://github.com/ant-design/ant-design/issues/10787)
|
||||
- 🌟 Add `visible` prop to set the visibility for `Tag`. [4ac0277](https://github.com/ant-design/ant-design/commit/4ac027781372dda08a5458bc73836fbc14dfe51f)
|
||||
- Upgrade `rc-tree` to `1.12.0` for Tree
|
||||
- 🌟 Add `loadedKeys` prop to set the loaded nodes, which usually works with loadData prop. [#10666](https://github.com/ant-design/ant-design/issues/10666)
|
||||
- 🌟 Add `onLoad` prop to be the callback function when all the nodes are loaded. [c488aca](https://github.com/ant-design/ant-design/commit/c488aca05e11d942d77c1b6bff45d12bbb1a2bd6)
|
||||
- 🗑 Deprecate `combobox` value for `Select[mode]` and please replace it with `AutoComplete`. [53046a4](https://github.com/ant-design/ant-design/commit/53046a454ad83ca03dc313e63f56474ed1173002)
|
||||
- 🐞 Cascader adds `fieldNames` and discards the misspelled `filedNames`. [#10896](https://github.com/ant-design/ant-design/issues/10896)
|
||||
- 🐞 Fix Timeline dot not working with Tooltip. [0e3b67e](https://github.com/ant-design/ant-design/commit/0e3b67e9999d867cc304f3be61a8a042a2ab92ee)
|
||||
- 🐞 Fix border radius when avatar has custom size. [e1e6523](https://github.com/ant-design/ant-design/commit/e1e6523452286ba56f20b73abad762a58ea7d7bc)
|
||||
- 🌟 Add `okButtonDisabled` and `cancelButtonDisabled` props to disable ok button and cancel button. [#10955](https://github.com/ant-design/ant-design/pull/10955)
|
||||
|
||||
|
||||
## 3.6.6
|
||||
|
||||
`2018-07-07`
|
||||
|
||||
- 🐞 Fix the style of the selected day for `DatePicker`. [#6146](https://github.com/ant-design/ant-design/issues/6146) [#9529](https://github.com/ant-design/ant-design/issues/9529)
|
||||
- 🐞 Fix the style of the selected day for `DatePicker.RangePicker`. [004561b](https://github.com/ant-design/ant-design/commit/004561ba1f3b894dc164225e9e27b0a90679d15c)
|
||||
- 🐞 Fix the alignment style wrapped by `Form.Item` for `Cascader`. [#9827](https://github.com/ant-design/ant-design/issues/9827) [#11133](https://github.com/ant-design/ant-design/issues/11133)
|
||||
- 🐞 Fix the background style of the `handler` for `InputNumber`. [4aabc53](https://github.com/ant-design/ant-design/commit/4aabc5374497359e13a958ef81ae4569db6164a7)
|
||||
- 🐞 Fix the header overflow in `FireFox` when the data is empty for `Table`. [#11135](https://github.com/ant-design/ant-design/issues/11135)
|
||||
|
||||
## 3.6.5
|
||||
|
||||
`2018-07-02`
|
||||
|
||||
- 🐞 Fixed wired `Transfer` repaint problem in IE or Edge. [#9697](https://github.com/ant-design/ant-design/issues/9697)
|
||||
- 🐞 Fixed `Card` background overflow when zoom in chrome. [#9085](https://github.com/ant-design/ant-design/issues/9085)
|
||||
- TypeScript
|
||||
- 🐞 Fixed `Table` incompatible type `size`. [bf5b6ae1](https://github.com/ant-design/ant-design/commit/bf5b6ae1f3b5da4629a7d10a2d1764eaa3fbbb04)
|
||||
- 🐞 Fixed `Select` missing showArrow option in types. [cde2a6b6](https://github.com/ant-design/ant-design/commit/cde2a6b6f011a5b3a367b3f58731def547bc98d8)
|
||||
- 🐞 Add custom local support in `Pagination`. [babbbdd4](https://github.com/ant-design/ant-design/commit/babbbdd4e5c33ca050f8ee08969185c8d3269b4c)
|
||||
- 🐞 Move max-width to ant-tooltip, so that it can be override by overlayStyle.maxWidth. [e2b359e9](https://github.com/ant-design/ant-design/commit/e2b359e9c3dae067eeba37a886f7896474c87e31)
|
||||
- 🐞 Adjust `Select` mirror style to avoid to long string. [#11035](https://github.com/ant-design/ant-design/issues/11035)
|
||||
|
||||
## 3.6.4
|
||||
|
||||
`2018-06-23`
|
||||
|
||||
- 🐞 Fixed `Steps` theme `@process-icon-color`. [#10973](https://github.com/ant-design/ant-design/issues/10973)
|
||||
- 🐞 Fixed style of RangePicker with preset ranges. [#10986](https://github.com/ant-design/ant-design/issues/10986)
|
||||
- 🐞 Fixed `Dropdown` non-boolean attribute warning. [#7798](https://github.com/ant-design/ant-design/issues/7798)
|
||||
- TypeScript
|
||||
- 🌟 Add `Tree` prop `className` definition. [#10950](https://github.com/ant-design/ant-design/issues/10950)
|
||||
- 🌟 Add `Tree` prop `selectable` definition. [3fb478e](https://github.com/ant-design/ant-design/commit/3fb478e743f3bad23dc300f501df11e5423468ba)
|
||||
|
||||
## 3.6.3
|
||||
|
||||
`2018-06-17`
|
||||
|
||||
- 🐞 Fixed that capitalized extension of Upload image url couldn't be recognaized. [#10928](https://github.com/ant-design/ant-design/pull/10928) [@sliwey](https://github.com/sliwey)
|
||||
- 🐞 Fixed missing border of InputNumber when browser is zoomed in. [#10562](https://github.com/ant-design/ant-design/issues/10562)
|
||||
- 🐞 Fixed that fixed element inside Spin cannot be fixed. [#10196](https://github.com/ant-design/ant-design/issues/10196)
|
||||
- 🐞 Fixed broken border style of small table. [#9754](https://github.com/ant-design/ant-design/issues/9754)
|
||||
- 🐞 Fixed missing `className` prop of Table's `filterIcon`. [#10937](https://github.com/ant-design/ant-design/issues/10937)
|
||||
- 🐞 Fixed that Affix `offsetTop` and `offsetBottom` cannot be updated. [#10874](https://github.com/ant-design/ant-design/issues/10874)
|
||||
- TypeScript
|
||||
- 🐞 Fixed TreeSelect `TS2339` error. [#10868](https://github.com/ant-design/ant-design/issues/10868)
|
||||
- 🌟 Added Form arguments definitions of `validateMessages` and `onFieldsChange`.
|
||||
- 🌟 Improved Button prop definitions. [#10877](https://github.com/ant-design/ant-design/pull/10877) [@zheeeng](https://github.com/zheeeng)
|
||||
- 🌟 Added `backfill` prop for AutoComplete. [#10909](https://github.com/ant-design/ant-design/pull/10909) [@zhanba](https://github.com/zhanba)
|
||||
|
||||
## 3.6.2
|
||||
|
||||
`2018-06-09`
|
||||
@@ -113,7 +245,7 @@ timeline: true
|
||||
- 🌟 Column `sorter` function is passed `sortOrder` as param. [#10306](https://github.com/ant-design/ant-design/pull/10306) [@kumarashwin](https://github.com/kumarashwin)
|
||||
- 🐞 Fix merged header cell border. [#10359](https://github.com/ant-design/ant-design/issues/10359)
|
||||
- 🐞 Fix lost of user selection on data updates. [#10332](https://github.com/ant-design/ant-design/pull/10332) [@chrvadala](https://github.com/chrvadala)
|
||||
- `Menu` upgrade `rc-menu` to `7.x` [#10305](https://github.com/ant-design/ant-design/pull/10305)
|
||||
- Menu upgrade `rc-menu` to `7.x` [#10305](https://github.com/ant-design/ant-design/pull/10305)
|
||||
- 🌟 Better aria-* attributes support. [react-component/menu#137](https://github.com/react-component/menu/pull/137)
|
||||
- 🌟 Improve Menu performance by avoiding unnecessary updates. [react-component/menu#133](https://github.com/react-component/menu/pull/133)
|
||||
- 🌟 Support passing props through to MenuItem list item. [react-component/menu#135](https://github.com/react-component/menu/pull/135)
|
||||
@@ -517,7 +649,7 @@ Learn more in the [Ant Design 3.0 announcement post](https://medium.com/ant-desi
|
||||
|
||||
We provide a [migration tool](https://github.com/ant-design/antd-migration-helper) to help you find deprecated usages in your codebase.
|
||||
|
||||
- Card's `noHovering` has been renamed to `hoverable`,and its default value now is `true`.
|
||||
- Card's `noHovering` has been renamed to `hoverable`, and its default value now is `true`.
|
||||
- Added new Grid breakpoints. [#7230](https://github.com/ant-design/ant-design/pull/7230)
|
||||
- Form `getFieldDecorator`'s `exclusive` option has been removeed.
|
||||
- Added `Form.createFormField`, and you must use it to wrap field data returned in `option.mapPropsToFields`:
|
||||
@@ -577,7 +709,7 @@ We provide a [migration tool](https://github.com/ant-design/antd-migration-helpe
|
||||
- 🌟 Input.Search added new `enterButton` prop to allow setting custom search button.[#7596](https://github.com/ant-design/ant-design/issues/7596)
|
||||
- 🌟 Mention added new `placement` prop to allow setting the popup direction.
|
||||
- 🌟 Carousel added new `next()`, `prev()`, `goTo(slideNumber)` methods to allow controlling slides programmatically.
|
||||
- 🌟 Button added link support,Button with `href` prop will render to `<a>`. [#8343](https://github.com/ant-design/ant-design/pull/8343)
|
||||
- 🌟 Button added link support, Button with `href` prop will render to `<a>`. [#8343](https://github.com/ant-design/ant-design/pull/8343)
|
||||
- 🌟 Steps was refactored, first rendering won't flash. [#6010](https://github.com/ant-design/ant-design/issues/6010)
|
||||
- 🌟 Switch added new `loading` prop to show a loading status.
|
||||
- Menu
|
||||
@@ -596,7 +728,7 @@ We provide a [migration tool](https://github.com/ant-design/antd-migration-helpe
|
||||
- 🌟 Added new `inner` type. [Demo](https://ant.design/components/card/#components-card-demo-inner)。
|
||||
- 🌟 Added `cover`, `actions` and a new `Meta` component. [Demo](https://ant.design/components/card/#components-card-demo-meta)。
|
||||
- DatePicker
|
||||
- 🌟 Added `mode` and `onPanelChange`,to allow controlling the panel mode. [Demo](https://ant.design/components/date-picker/#components-date-picker-demo-mode)。
|
||||
- 🌟 Added `mode` and `onPanelChange`, to allow controlling the panel mode. [Demo](https://ant.design/components/date-picker/#components-date-picker-demo-mode)。
|
||||
- 🌟 Added `WeekPicker` component. [Demo](https://ant.design/components/date-picker/#components-date-picker-demo-basic)
|
||||
- 🌟 Added new `dateRender` prop to allow customizing date cell.
|
||||
- TimePicker
|
||||
@@ -630,7 +762,7 @@ We provide a [migration tool](https://github.com/ant-design/antd-migration-helpe
|
||||
- 🌟 Added `column[defaultSortOrder]` to allow setting default sort order. [#8111](https://github.com/ant-design/ant-design/pull/8111) [@megawac](https://github.com/megawac)
|
||||
- 🌟 Added `rowSelection[fixed]` to allow fixing the selection column.。
|
||||
- 🙅 Deprecated `getBodyWrapper`, please use `components` instead.
|
||||
- 🙅 Deprecated `onRowClick`,`onRowDoubleClick`, `onRowContextMenu`, `onRowMouseEnter`, `onRowMouseLeave`, please use `onRow` instead.
|
||||
- 🙅 Deprecated `onRowClick`, `onRowDoubleClick`, `onRowContextMenu`, `onRowMouseEnter`, `onRowMouseLeave`, please use `onRow` instead.
|
||||
```javascript
|
||||
<Table onRow={(record) => ({
|
||||
onClick: () => {},
|
||||
|
||||
@@ -15,6 +15,140 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
## 3.7.2
|
||||
|
||||
`2018-07-25`
|
||||
|
||||
- DatePicker
|
||||
- 🐞 **修复在受控模式下不能切换年月的问题。**[b9992f4](https://github.com/ant-design/ant-design/commit/b9992f4a08574efb47b6e6cd80eb1e888b9a1ede)
|
||||
- 🐞 修复在 `getDerivedStateFromProp` 的警告。[#11398](https://github.com/ant-design/ant-design/pull/11398) [@yoyo837](https://github.com/yoyo837)
|
||||
- Drawer
|
||||
- 🐞 修复使用 `destroyOnClose` 时没有关闭动画的问题。[#11307](https://github.com/ant-design/ant-design/issues/11307)
|
||||
- 🐞 修复 `width` 以 `vw` 为单位时的显示错误。[#11326](https://github.com/ant-design/ant-design/issues/11326)
|
||||
- 🐞 修复 `wrapClassName` 属性无效的问题。
|
||||
- 🐞 修复 Tooltip 文字溢出的问题。[#11402](https://github.com/ant-design/ant-design/pull/11402) [@weidapao](https://github.com/weidapao)
|
||||
- 🐞 修复 Menu 在 `theme` 为 `dark` 是在 Layout.Header 里的样式问题。[#11400](https://github.com/ant-design/ant-design/pull/11400) [@hongxuWei](https://github.com/hongxuWei)
|
||||
- 🐞 修复 InputNumber 的箭头按钮在使用了固定列的 Table 里显示错位的问题。[#11408](https://github.com/ant-design/ant-design/issues/11408)
|
||||
- 🐞 修复 Select 使用分组时 Option 的圆角显示错误。[6cb6f5c](https://github.com/ant-design/ant-design/commit/6cb6f5c83ed634e67d5b5d0816d11aa0788a74d8)
|
||||
- 🐞 修复 Table 第一次点击过滤按钮的时候 `onChange` 会被触发两次的问题。[#11164](https://github.com/ant-design/ant-design/issues/11164) [@adybionka](https://github.com/adybionka)
|
||||
- 🐞 修复 Model.confirm 的标题在 Firefox 下会显示滚动条的问题。[#11432](https://github.com/ant-design/ant-design/issues/11432)
|
||||
- TypeScript
|
||||
- 🐞 修复 Radio.Group 类型定义。[#11409](https://github.com/ant-design/ant-design/pull/11409) [@eddiemoore](https://github.com/eddiemoore)
|
||||
- 🐞 修复 TreeSelect 类型定义。[#11442](https://github.com/ant-design/ant-design/pull/11442) [@JribiBelhassen](https://github.com/JribiBelhassen)
|
||||
- 🐞 修复 Badge 类型定义。[#11421](https://github.com/ant-design/ant-design/pull/11421) [@zongzi531](https://github.com/zongzi531)
|
||||
|
||||
## 3.7.1
|
||||
|
||||
`2018-07-21`
|
||||
|
||||
- 🐞 修复 Drawer 内无法显示弹层组件的问题。[#11304](https://github.com/ant-design/ant-design/issues/11304)
|
||||
- 🐞 带页签的卡片页签支持 disabled 属性。[#11212](https://github.com/ant-design/ant-design/issues/11212)
|
||||
- 🐞 修复锚点链接组件 href 改变不更新的问题。 [#11287](https://github.com/ant-design/ant-design/pull/11287/files) [@tangjinzhou](https://github.com/tangjinzhou)
|
||||
- 🐞 修复 Menu 样式细节问题。[#11299](https://github.com/ant-design/ant-design/issues/11299)
|
||||
- 🐞 修复 Drawer 组件设置 `destroyOnClose` 后关闭动画消失。[#11307](https://github.com/ant-design/ant-design/issues/11307)
|
||||
- 🐞 修复 DirectoryTree 在 `expandedKeys` 属性可控时点击无法展开的问题。[#11366](https://github.com/ant-design/ant-design/issues/11366)
|
||||
- 🐞 修复 ButtonGroup 中使用 Tooltip 的 Button 在 `disabled` 时样式不正确的问题。[11321](https://github.com/ant-design/ant-design/pull/11321) [@tangjinzhou](https://github.com/tangjinzhou)
|
||||
|
||||
## 3.7.0
|
||||
|
||||
3.7.0 是一个重磅更新,带来了很多激动人心的变化和新特性。
|
||||
以下是一些亮点✨:
|
||||
|
||||
- 🔥 增加抽屉组件 : [`Drawer`](https://ant.design/components/drawer-cn/) [#10791](https://github.com/ant-design/ant-design/pull/10791)
|
||||
- 🔥 新增 `Tree.DirectoryTree` 组件,作为内置的目录树。[#7749](https://github.com/ant-design/ant-design/issues/7749)
|
||||
|
||||
组件修复/功能增强:
|
||||
|
||||
- TreeSelect 组件升级 `rc-tree-select` 到 `2.0.5`,进行了重构,修复了 check 的逻辑。
|
||||
- 🌟 新增 `autoClearSearchValue` 属性,当多选模式下值被选择,用于自动清空搜索框。[10996](https://github.com/ant-design/ant-design/issues/10996)
|
||||
- 🌟 新增 `searchValue` 属性,用于设置搜索框的值。[6ff7dd8](https://github.com/ant-design/ant-design/commit/6ff7dd8fb953f079ee51ee638aaf4d832d0e10bf#diff-1e8e47abbdbe6e12d009aa61619ab22f)
|
||||
- 🌟 新增 `maxTagCount` 属性,用于设置显示标签的最大数量。[fb96c9d](https://github.com/ant-design/ant-design/commit/fb96c9db351e44a202f64f780470c6319a8a9626)
|
||||
- 🌟 新增 `maxTagPlaceholder` 属性,用于设置标签隐藏时显示的内容。[fb96c9d](https://github.com/ant-design/ant-design/commit/fb96c9db351e44a202f64f780470c6319a8a9626)
|
||||
- 🌟 搜索框支持大小写敏感。[#10990](https://github.com/ant-design/ant-design/issues/10990)
|
||||
- 🗑 `treeData` 数据格式中的 `label` 属性被废弃,使用 `title` 属性代替。
|
||||
- Upload 组件升级 `rc-upload` 到 `2.5.0`
|
||||
- 🌟 新增 `directory` 属性,支持上传一个文件夹。[#7315](https://github.com/ant-design/ant-design/issues/7315)
|
||||
- 🌟 `action` 属性支持作为一个返回 `Promise` 对象的函数,使用更加灵活。[fd96967](https://github.com/ant-design/ant-design/commit/fd96967c872600b79bb608e9ddf9f8c38814a704)
|
||||
- Dropdown 增加新特性,可以做为右键菜单来使用。
|
||||
- 🌟 给菜单项的 icon 提供默认的外间距样式。[8e60a59](https://github.com/ant-design/ant-design/commit/8e60a591fd24f644de4f67d69c2210e9270be9cc)
|
||||
- 🌟 触发方式为 `contextMenu` 时自动调整菜单的位置。[16e4260](https://github.com/ant-design/ant-design/commit/16e42601d6772fc0830ee237a1e751a38a118676)
|
||||
- Table 组件升级 `rc-table` 到 `6.2.2`。 [f2fddff](https://github.com/ant-design/ant-design/commit/f2fddff3fd0d6b36e8e6d8ee06bfcbcc85ead4f0)
|
||||
- 🌟 新增 `expanded` 作为 `expandedRowRender` 属性函数的第四个参数,用于获取当前行是否展开。[#10379](https://github.com/ant-design/ant-design/issues/10379)
|
||||
- 🌟 新增无须使用完全受控组件也能覆盖筛选菜单的能力。[59cc3a8](https://github.com/ant-design/ant-design/commit/59cc3a8b6c643f7206feedf2dc2c7154296ba3e3) [@chrvadala](https://github.com/chrvadala)
|
||||
- 🌟 `filterIcon` 属性支持作为一个返回 `ReactNode` 的函数。[1af4392](https://github.com/ant-design/ant-design/commit/1af4392ae9fbdaa6fcfbf2f0de5413100ef4a84a)
|
||||
- 🐞 修复在固定列时导致的行错位的问题。[#10392](https://github.com/ant-design/ant-design/issues/10392)
|
||||
- 🐞 修复在组件中使用 `combobox` 模式的 `Select` 导致的重影问题。[#10828](https://github.com/ant-design/ant-design/issues/10828)
|
||||
- 🐞 修复 components 属性值不能变化的问题。[c380186](https://github.com/ant-design/ant-design/commit/c380186e794a7735ae91e992f25a313158ee4984)
|
||||
- 🗑 Select 组件废弃了 `combobox` 模式,请使用 `AutoComplete` 组件代替。[53046a4](https://github.com/ant-design/ant-design/commit/53046a454ad83ca03dc313e63f56474ed1173002)
|
||||
- 🌟 Alert 组件允许传递 `data-*`、`aria-*` 和 `role-*` 属性到组件内部。[f0b684d](https://github.com/ant-design/ant-design/commit/f0b684de6a7c422f0de56e1ef72aeb35ab25a858)
|
||||
- 🌟 Avatar 组件新增 `alt` 属性,用于设置图像无法显示时的替代文本。[#10798](https://github.com/ant-design/ant-design/pull/10798)
|
||||
- 🌟 DatePicker 组件允许传递 `data-*`、`aria-*` 和 `role-*` 属性到组件内部的 `Input`。[e63f9d4](https://github.com/ant-design/ant-design/commit/e63f9d4beb440de92c0b0ce8e6e83f7e24fef792)
|
||||
- 🌟 Input.Search 组件新增 `event` 事件对象作为 `onSearch` 属性函数的第二个参数。[#11015](https://github.com/ant-design/ant-design/issues/11015)
|
||||
- 🌟 Layout.Sider 组件新增 `onBreakPoint` 属性,用作响应式布局的断点触发时的回调函数。[#10750](https://github.com/ant-design/ant-design/pull/10750) [@nuintun](https://github.com/nuintun)
|
||||
- 🌟 Modal 组件新增 `okButtonProps` 和 `cancelButtonProps` 属性,分别用于设置 `取消` 按钮和 `确定` 按钮的属性。[#10955](https://github.com/ant-design/ant-design/pull/10955) [@djyde](https://github.com/djyde)
|
||||
- 🌟 Progress 组件新增 `strokeColor` 属性,用于设置进度条的颜色。[#10725](https://github.com/ant-design/ant-design/issues/10725)
|
||||
- 🌟 Radio.Group 组件新增 `buttonStyle` 属性 (可选值 `outline | solid`),用于设置 `RadioButton` 的风格样式。[60e3cfa](https://github.com/ant-design/ant-design/commit/60e3cfa37ac0dae3a895e74c1fe5351c54536a07#diff-c2ee8b5a368a121e9d2cc2661212045d)
|
||||
- 🌟 Spin 组件新增 `setDefaultIndicator` 静态方法,用于设置全局的加载指示符。[#10787](https://github.com/ant-design/ant-design/issues/10787)
|
||||
- 🌟 Tag 组件新增 `visible` 属性,用于设置是否显示标签。[4ac0277](https://github.com/ant-design/ant-design/commit/4ac027781372dda08a5458bc73836fbc14dfe51f)
|
||||
- Tree 组件升级 `rc-tree` 到 `1.12.0`
|
||||
- 🌟 新增 `loadedKeys` 属性,用于设置已经加载的节点,需要配合 `loadData` 使用。[#10666](https://github.com/ant-design/ant-design/issues/10666)
|
||||
- 🌟 新增 `onLoad` 属性,作为节点加载完毕时的回调函数。[c488aca](https://github.com/ant-design/ant-design/commit/c488aca05e11d942d77c1b6bff45d12bbb1a2bd6)
|
||||
- 🌟 增加 `okButtonDisabled` and `cancelButtonDisabled` 属性用于禁用确定和取消按钮。[#10955](https://github.com/ant-design/ant-design/pull/10955)
|
||||
- 🌟 Cascader 新增 fieldNames 并废弃拼写错误的 filedNames。 [#10896](https://github.com/ant-design/ant-design/issues/10896)
|
||||
- 🐞 修复时间轴不能与`Tooltip`一起使用的问题。 [0e3b67e](https://github.com/ant-design/ant-design/commit/0e3b67e9999d867cc304f3be61a8a042a2ab92ee)
|
||||
- 🐞 修复当 Avatar 自定义大小时,圆角不改变的问题。[e1e6523](https://github.com/ant-design/ant-design/commit/e1e6523452286ba56f20b73abad762a58ea7d7bc)
|
||||
|
||||
## 3.6.6
|
||||
|
||||
`2018-07-07`
|
||||
|
||||
- 🐞 修复 `DatePicker` 组件被选中日期的样式问题。[#6146](https://github.com/ant-design/ant-design/issues/6146) [#9529](https://github.com/ant-design/ant-design/issues/9529)
|
||||
- 🐞 修复 `DatePicker.RangePicker` 组件中被选中日期的样式问题。[004561b](https://github.com/ant-design/ant-design/commit/004561ba1f3b894dc164225e9e27b0a90679d15c)
|
||||
- 🐞 修复 `Cascader` 组件在 `Form.Item` 下的对齐问题。[#9827](https://github.com/ant-design/ant-design/issues/9827) [#11133](https://github.com/ant-design/ant-design/issues/11133)
|
||||
- 🐞 修复 `InputNumber` 组件的 `handler` 的背景样式问题。[4aabc53](https://github.com/ant-design/ant-design/commit/4aabc5374497359e13a958ef81ae4569db6164a7)
|
||||
- 🐞 修复 `Table` 组件在 `FireFox` 浏览器下数据为空时的头部溢出的样式问题。[#11135](https://github.com/ant-design/ant-design/issues/11135)
|
||||
|
||||
## 3.6.5
|
||||
|
||||
`2018-07-02`
|
||||
|
||||
- 🐞 修复 `Transfer` 组件的文本 "Not Found" 在 IE 或 Edge 浏览器上显示异常。[#9697](https://github.com/ant-design/ant-design/issues/9697)
|
||||
- 🐞 修复 Chrome 在缩放模式下,`Card` 组件的边框被标题的背景色覆盖。[#9085](https://github.com/ant-design/ant-design/issues/9085)
|
||||
- TypeScript
|
||||
- 🐞 修复 `Table` 不兼容的类型 `size`。[bf5b6ae1](https://github.com/ant-design/ant-design/commit/bf5b6ae1f3b5da4629a7d10a2d1764eaa3fbbb04)
|
||||
- 🐞 修复 `Select` 组件的 `showArrow` 类型定义。[cde2a6b6](https://github.com/ant-design/ant-design/commit/cde2a6b6f011a5b3a367b3f58731def547bc98d8)
|
||||
- 🐞 修复 Pagination 全局 locale 设置不能被组件 locale 覆盖的问题。[babbbdd4](https://github.com/ant-design/ant-design/commit/babbbdd4e5c33ca050f8ee08969185c8d3269b4c)
|
||||
- 🐞 修复 `Tooltip` 组件的 `max-width` 样式,使 `overlayStyle.maxWidth` 可覆盖。[e2b359e9](https://github.com/ant-design/ant-design/commit/e2b359e9c3dae067eeba37a886f7896474c87e31)
|
||||
- 🐞 修复 `Select` 组件的样式,避免过长文本的溢出。[#11035](https://github.com/ant-design/ant-design/issues/11035)
|
||||
|
||||
## 3.6.4
|
||||
|
||||
`2018-06-23`
|
||||
|
||||
- 🐞 修复 `Steps` 组件的 `@process-icon-color` 样式定义。[#10973](https://github.com/ant-design/ant-design/issues/10973)
|
||||
- 🐞 修复 `RangePicker` 组件使用预置范围时的样式问题。[#10986]
|
||||
(https://github.com/ant-design/ant-design/issues/10986)
|
||||
- 🐞 修复 `Dropdown` 组件可能报出的 `non-boolean attribute` 的警告。[#7798](https://github.com/ant-design/ant-design/issues/7798)
|
||||
- TypeScript
|
||||
- 🌟 给 `Tree` 组件添加 `className` 的定义。[#10950](https://github.com/ant-design/ant-design/issues/10950)
|
||||
- 🌟 给 `Tree` 组件添加 `selectable` 的定义。[3fb478e](https://github.com/ant-design/ant-design/commit/3fb478e743f3bad23dc300f501df11e5423468ba)
|
||||
|
||||
## 3.6.3
|
||||
|
||||
`2018-06-17`
|
||||
|
||||
- 🐞 修复 Upload 图片文件后缀名为大写时无法正确识别的问题。[#10928](https://github.com/ant-design/ant-design/pull/10928) [@sliwey](https://github.com/sliwey)
|
||||
- 🐞 修复 InputNumber 在浏览器缩放时边框样式丢失的问题。[#10562](https://github.com/ant-design/ant-design/issues/10562)
|
||||
- 🐞 修复 Spin 内使用 `position: fixed` 的元素无法固定的问题。[#10196](https://github.com/ant-design/ant-design/issues/10196)
|
||||
- 🐞 修复小号表格下固定列的边框样式问题。[#9754](https://github.com/ant-design/ant-design/issues/9754)
|
||||
- 🐞 修复 Table `filterIcon` 的 `className` 属性失效的问题。[#10937](https://github.com/ant-design/ant-design/issues/10937)
|
||||
- 🐞 修复 Affix 的 `offsetTop` 和 `offsetBottom` 无法动态修改的问题。[#10874](https://github.com/ant-design/ant-design/issues/10874)
|
||||
- TypeScript
|
||||
- 🐞 修复 TreeSelect `TS2339` 错误。[#10868](https://github.com/ant-design/ant-design/issues/10868)
|
||||
- 🌟 补充 Form 的 `validateMessages` 和 `onFieldsChange` 参数的定义。
|
||||
- 🌟 优化 Button 的属性定义。[#10877](https://github.com/ant-design/ant-design/pull/10877) [@zheeeng](https://github.com/zheeeng)
|
||||
- 🌟 补充 AutoComplete 的 `backfill` 属性定义。[#10909](https://github.com/ant-design/ant-design/pull/10909) [@zhanba](https://github.com/zhanba)
|
||||
|
||||
## 3.6.2
|
||||
|
||||
`2018-06-09`
|
||||
@@ -61,7 +195,7 @@ timeline: true
|
||||
|
||||
`2018-05-20`
|
||||
|
||||
- 🐞 修复了 `Affix` 当 `offsetTop === 0`, 值将变为 `undefined` 的问题 [#10566](https://github.com/ant-design/ant-design/pull/10566)
|
||||
- 🐞 修复了 `Affix` 当 `offsetTop === 0`,值将变为 `undefined` 的问题 [#10566](https://github.com/ant-design/ant-design/pull/10566)
|
||||
- 🐞 修复了 `Menu` item 中的高亮链接颜色问题 [09d5e36](https://github.com/ant-design/ant-design/commit/09d5e36cfa27e371a7b4d4e68276a279698ea901)
|
||||
- 🐞 修复了 `Input.Group` 组件阴影被遮盖的问题 [#10230](https://github.com/ant-design/ant-design/issues/10230)
|
||||
- 🐞 修复了 `Transfer` 组件 checkbox 事件触发两次的问题 [`#10480`](https://github.com/ant-design/ant-design/issues/10480)
|
||||
@@ -433,7 +567,7 @@ timeline: true
|
||||
- 🐞 修复 Table 在设置 `size=small` 的情况下出现多余 padding 的问题。[#8724](https://github.com/ant-design/ant-design/issues/8724)
|
||||
- 🐞 修复 Checkbox.Group 在 Form 中和 label 的对齐问题。[#8739](https://github.com/ant-design/ant-design/issues/8739)
|
||||
- 🐞 修复 Affix 组件出现滚动条的问题。[#8606](https://github.com/ant-design/ant-design/issues/8606)
|
||||
- 🐞 修复组件 List "No Data" 和加载动画重叠的问题. [#8647](https://github.com/ant-design/ant-design/issues/8647)
|
||||
- 🐞 修复组件 List "No Data" 和加载动画重叠的问题。[#8647](https://github.com/ant-design/ant-design/issues/8647)
|
||||
- 🌟 为 Input 添加 onKeyUp。[#8705](https://github.com/ant-design/ant-design/issues/8705) [@delesseps](https://github.com/delesseps)
|
||||
- 🌟 折叠面板 Collapse 添加 `showArrow` 来支持隐藏箭头。[#8536](https://github.com/ant-design/ant-design/pull/8536) [@apieceofbart](https://github.com/apieceofbart)
|
||||
- 🌟 评分 Rate 组件添加 `allowClear`,支持再次点击后重置。[#8627](https://github.com/ant-design/ant-design/issues/8627)
|
||||
@@ -590,7 +724,7 @@ timeline: true
|
||||
- 🌟 Row 的 `gutter` 属性新增响应式断点的支持,可以使用诸如 `gutter={{ sm: 16, lg: 32 }}` 的设置。
|
||||
- 🌟 Spin 新增 `indicator` 属性,用于设置自定义的加载指示符。 [#7977](https://github.com/ant-design/ant-design/pull/7977) [@kossel](https://github.com/ant-design/ant-design/pull/7977)
|
||||
- 🌟 Input.Search 新增 `enterButton` 用于设置自定义的搜索图标。[#7596](https://github.com/ant-design/ant-design/issues/7596)
|
||||
- 🌟 Mention 新增 `placement`, 用于设置下拉框的弹出方向。
|
||||
- 🌟 Mention 新增 `placement`,用于设置下拉框的弹出方向。
|
||||
- 🌟 Carousel 新增 `next()`、`prev()`、`goTo(slideNumber)` 方法,用于控制面板展示。
|
||||
- 🌟 Button 新增链接支持,当提供 `href` 时会自动渲染为 `<a>`。[#8343](https://github.com/ant-design/ant-design/pull/8343)
|
||||
- 🌟 Steps 进行了重构,首次渲染的时候不会再闪烁。 [#6010](https://github.com/ant-design/ant-design/issues/6010)
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
[](https://travis-ci.org/ant-design/ant-design)
|
||||
[](https://codecov.io/gh/ant-design/ant-design/branch/master)
|
||||
[](https://david-dm.org/ant-design/ant-design)
|
||||
[](https://david-dm.org/ant-design/ant-design#info=devDependencies&view=list)
|
||||
[](https://david-dm.org/ant-design/ant-design)
|
||||
[](https://david-dm.org/ant-design/ant-design?type=dev)
|
||||
|
||||
[](https://www.npmjs.org/package/antd)
|
||||
[](http://www.npmtrends.com/antd)
|
||||
@@ -34,6 +34,10 @@
|
||||
* 支持服务端渲染。
|
||||
* [Electron](http://electron.atom.io/)
|
||||
|
||||
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png" alt="Opera" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Opera | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/electron/electron_48x48.png" alt="Electron" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Electron |
|
||||
| --------- | --------- | --------- | --------- | --------- | --------- |
|
||||
| IE9, IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions| last 2 versions| last 2 versions
|
||||
|
||||
## 参与共建 [](http://makeapullrequest.com)
|
||||
|
||||
请参考[贡献指南](https://ant.design/docs/react/contributing-cn).
|
||||
@@ -94,7 +98,7 @@ $ npm install
|
||||
$ npm start
|
||||
```
|
||||
|
||||
打开浏览器访问 http://127.0.0.1:8001 ,更多本地开发文档参见: https://github.com/ant-design/ant-design/wiki/Development 。
|
||||
打开浏览器访问 http://127.0.0.1:8001 ,更多[本地开发文档](https://github.com/ant-design/ant-design/wiki/Development)。
|
||||
|
||||
## 如何贡献
|
||||
|
||||
|
||||
11
README.md
11
README.md
@@ -6,10 +6,10 @@
|
||||
|
||||
# Ant Design
|
||||
|
||||
[](https://travis-ci.org/ant-design/ant-design)
|
||||
[](https://travis-ci.org/ant-design/ant-design)
|
||||
[](https://codecov.io/gh/ant-design/ant-design/branch/master)
|
||||
[](https://david-dm.org/ant-design/ant-design)
|
||||
[](https://david-dm.org/ant-design/ant-design#info=devDependencies&view=list)
|
||||
[](https://david-dm.org/ant-design/ant-design?type=dev)
|
||||
|
||||
[](https://www.npmjs.org/package/antd)
|
||||
[](http://www.npmtrends.com/antd)
|
||||
@@ -38,6 +38,10 @@ An enterprise-class UI design language and React-based implementation.
|
||||
* Server-side Rendering
|
||||
* [Electron](http://electron.atom.io/)
|
||||
|
||||
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png" alt="Opera" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Opera | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/electron/electron_48x48.png" alt="Electron" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Electron |
|
||||
| --------- | --------- | --------- | --------- | --------- | --------- |
|
||||
| IE9, IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions| last 2 versions| last 2 versions
|
||||
|
||||
## Let's build a better antd together [](http://makeapullrequest.com)
|
||||
|
||||
Read our [contributing guide](https://ant.design/docs/react/contributing).
|
||||
@@ -67,7 +71,6 @@ Or [import components on demand](https://ant.design/docs/react/getting-started#I
|
||||
|
||||
See [Use in TypeScript](https://ant.design/docs/react/use-in-typescript)
|
||||
|
||||
|
||||
## Internationalization
|
||||
|
||||
See [i18n](http://ant.design/docs/react/i18n).
|
||||
@@ -98,7 +101,7 @@ $ npm install
|
||||
$ npm start
|
||||
```
|
||||
|
||||
Open your browser and visit http://127.0.0.1:8001 , see more at https://github.com/ant-design/ant-design/wiki/Development .
|
||||
Open your browser and visit http://127.0.0.1:8001 , see more at [Development](https://github.com/ant-design/ant-design/wiki/Development).
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ Array [
|
||||
"DatePicker",
|
||||
"Divider",
|
||||
"Dropdown",
|
||||
"Drawer",
|
||||
"Form",
|
||||
"Icon",
|
||||
"Input",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import throttleByAnimationFrame from '../throttleByAnimationFrame';
|
||||
import getDataOrAriaProps from '../getDataOrAriaProps';
|
||||
|
||||
describe('Test utils function', () => {
|
||||
beforeAll(() => {
|
||||
@@ -32,4 +33,55 @@ describe('Test utils function', () => {
|
||||
jest.runAllTimers();
|
||||
expect(callback).not.toBeCalled();
|
||||
});
|
||||
|
||||
describe('getDataOrAriaProps', () => {
|
||||
it('returns all data-* properties from an object', () => {
|
||||
const props = {
|
||||
onClick: () => {},
|
||||
isOpen: true,
|
||||
'data-test': 'test-id',
|
||||
'data-id': 1234,
|
||||
};
|
||||
const results = getDataOrAriaProps(props);
|
||||
expect(results).toEqual({
|
||||
'data-test': 'test-id',
|
||||
'data-id': 1234,
|
||||
});
|
||||
});
|
||||
|
||||
it('does not return data-__ properties from an object', () => {
|
||||
const props = {
|
||||
onClick: () => {},
|
||||
isOpen: true,
|
||||
'data-__test': 'test-id',
|
||||
'data-__id': 1234,
|
||||
};
|
||||
const results = getDataOrAriaProps(props);
|
||||
expect(results).toEqual({});
|
||||
});
|
||||
|
||||
it('returns all aria-* properties from an object', () => {
|
||||
const props = {
|
||||
onClick: () => {},
|
||||
isOpen: true,
|
||||
'aria-labelledby': 'label-id',
|
||||
'aria-label': 'some-label',
|
||||
};
|
||||
const results = getDataOrAriaProps(props);
|
||||
expect(results).toEqual({
|
||||
'aria-labelledby': 'label-id',
|
||||
'aria-label': 'some-label',
|
||||
});
|
||||
});
|
||||
|
||||
it('returns role property from an object', () => {
|
||||
const props = {
|
||||
onClick: () => {},
|
||||
isOpen: true,
|
||||
role: 'search',
|
||||
};
|
||||
const results = getDataOrAriaProps(props);
|
||||
expect(results).toEqual({ role: 'search' });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
11
components/_util/getDataOrAriaProps.ts
Normal file
11
components/_util/getDataOrAriaProps.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export default function getDataOrAriaProps(props: any) {
|
||||
return Object.keys(props).reduce((prev: any, key: string) => {
|
||||
if (
|
||||
(key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-' || key === 'role') &&
|
||||
key.substr(0, 7) !== 'data-__'
|
||||
) {
|
||||
prev[key] = props[key];
|
||||
}
|
||||
return prev;
|
||||
}, {});
|
||||
}
|
||||
5
components/_util/isNumeric.ts
Normal file
5
components/_util/isNumeric.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
const isNumeric = (value: any): boolean => {
|
||||
return !isNaN(parseFloat(value)) && isFinite(value);
|
||||
};
|
||||
|
||||
export default isNumeric;
|
||||
@@ -11,9 +11,11 @@ class AffixMounter extends React.Component {
|
||||
events[event] = cb;
|
||||
});
|
||||
}
|
||||
|
||||
getTarget = () => {
|
||||
return this.container;
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div
|
||||
@@ -35,7 +37,7 @@ class AffixMounter extends React.Component {
|
||||
ref={ele => this.affix = ele}
|
||||
{...this.props}
|
||||
>
|
||||
<Button type="primary" >
|
||||
<Button type="primary">
|
||||
Fixed at the top of container
|
||||
</Button>
|
||||
</Affix>
|
||||
@@ -100,4 +102,19 @@ describe('Affix Render', () => {
|
||||
scrollTo(0);
|
||||
expect(wrapper.instance().affix.state.affixStyle).not.toBe(null);
|
||||
});
|
||||
|
||||
it('updatePosition when offsetTop changed', () => {
|
||||
document.body.innerHTML = '<div id="mounter" />';
|
||||
|
||||
wrapper = mount(<AffixMounter offsetTop={0} />, { attachTo: document.getElementById('mounter') });
|
||||
jest.runAllTimers();
|
||||
|
||||
scrollTo(100);
|
||||
expect(wrapper.instance().affix.state.affixStyle.top).toBe(0);
|
||||
wrapper.setProps({
|
||||
offsetTop: 10,
|
||||
});
|
||||
jest.runAllTimers();
|
||||
expect(wrapper.instance().affix.state.affixStyle.top).toBe(10);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -16,16 +16,44 @@ The simplest usage.
|
||||
````jsx
|
||||
import { Affix, Button } from 'antd';
|
||||
|
||||
ReactDOM.render(
|
||||
<div>
|
||||
<Affix>
|
||||
<Button type="primary">Affix top</Button>
|
||||
</Affix>
|
||||
<br />
|
||||
<Affix offsetBottom={0}>
|
||||
<Button type="primary">Affix bottom</Button>
|
||||
</Affix>
|
||||
</div>,
|
||||
mountNode
|
||||
);
|
||||
class Demo extends React.Component {
|
||||
state = {
|
||||
top: 10,
|
||||
bottom: 10,
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<Affix offsetTop={this.state.top}>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
this.setState({
|
||||
top: this.state.top + 10,
|
||||
});
|
||||
}}
|
||||
>
|
||||
Affix top
|
||||
</Button>
|
||||
</Affix>
|
||||
<br />
|
||||
<Affix offsetBottom={this.state.bottom}>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
this.setState({
|
||||
bottom: this.state.bottom + 10,
|
||||
});
|
||||
}}
|
||||
>
|
||||
Affix bottom
|
||||
</Button>
|
||||
</Affix>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ReactDOM.render(<Demo />, mountNode);
|
||||
````
|
||||
|
||||
@@ -233,6 +233,12 @@ export default class Affix extends React.Component<AffixProps, AffixState> {
|
||||
// Mock Event object.
|
||||
this.updatePosition({});
|
||||
}
|
||||
if (
|
||||
this.props.offsetTop !== nextProps.offsetTop ||
|
||||
this.props.offsetBottom !== nextProps.offsetBottom
|
||||
) {
|
||||
this.updatePosition({});
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
||||
@@ -28,4 +28,31 @@ describe('Alert', () => {
|
||||
jest.runAllTimers();
|
||||
expect(afterClose).toBeCalled();
|
||||
});
|
||||
|
||||
describe('data and aria props', () => {
|
||||
it('sets data attributes on input', () => {
|
||||
const wrapper = mount(
|
||||
<Alert data-test="test-id" data-id="12345" />
|
||||
);
|
||||
const input = wrapper.find('.ant-alert').getDOMNode();
|
||||
expect(input.getAttribute('data-test')).toBe('test-id');
|
||||
expect(input.getAttribute('data-id')).toBe('12345');
|
||||
});
|
||||
|
||||
it('sets aria attributes on input', () => {
|
||||
const wrapper = mount(
|
||||
<Alert aria-describedby="some-label" />
|
||||
);
|
||||
const input = wrapper.find('.ant-alert').getDOMNode();
|
||||
expect(input.getAttribute('aria-describedby')).toBe('some-label');
|
||||
});
|
||||
|
||||
it('sets role attribute on input', () => {
|
||||
const wrapper = mount(
|
||||
<Alert role="status" />
|
||||
);
|
||||
const input = wrapper.find('.ant-alert').getDOMNode();
|
||||
expect(input.getAttribute('role')).toBe('status');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -26,6 +26,6 @@ ReactDOM.render(
|
||||
<Alert showIcon={false} message="Warning text without icon" banner />
|
||||
<br />
|
||||
<Alert type="error" message="Error text" banner />
|
||||
</div>
|
||||
, mountNode);
|
||||
</div>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -17,8 +17,8 @@ The simplest usage for short messages.
|
||||
import { Alert } from 'antd';
|
||||
|
||||
ReactDOM.render(
|
||||
<Alert message="Success Text" type="success" />
|
||||
, mountNode);
|
||||
<Alert message="Success Text" type="success" />,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
<style>
|
||||
|
||||
@@ -35,6 +35,6 @@ ReactDOM.render(
|
||||
closable
|
||||
onClose={onClose}
|
||||
/>
|
||||
</div>
|
||||
, mountNode);
|
||||
</div>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -17,6 +17,6 @@ Replace the default icon with customized text.
|
||||
import { Alert } from 'antd';
|
||||
|
||||
ReactDOM.render(
|
||||
<Alert message="Info Text" type="info" closeText="Close Now" />
|
||||
, mountNode);
|
||||
<Alert message="Info Text" type="info" closeText="Close Now" />,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -38,6 +38,6 @@ ReactDOM.render(
|
||||
description="Error Description Error Description Error Description Error Description"
|
||||
type="error"
|
||||
/>
|
||||
</div>
|
||||
, mountNode);
|
||||
</div>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -46,6 +46,6 @@ ReactDOM.render(
|
||||
type="error"
|
||||
showIcon
|
||||
/>
|
||||
</div>
|
||||
, mountNode);
|
||||
</div>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -20,9 +20,11 @@ class App extends React.Component {
|
||||
state = {
|
||||
visible: true,
|
||||
}
|
||||
|
||||
handleClose = () => {
|
||||
this.setState({ visible: false });
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
@@ -43,6 +45,6 @@ class App extends React.Component {
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<App />
|
||||
, mountNode);
|
||||
<App />,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -22,6 +22,6 @@ ReactDOM.render(
|
||||
<Alert message="Info Text" type="info" />
|
||||
<Alert message="Warning Text" type="warning" />
|
||||
<Alert message="Error Text" type="error" />
|
||||
</div>
|
||||
, mountNode);
|
||||
</div>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -20,8 +20,8 @@ Alert component for feedback.
|
||||
| closable | Whether Alert can be closed | boolean | - |
|
||||
| closeText | Close text to show | string\|ReactNode | - |
|
||||
| description | Additional content of Alert | string\|ReactNode | - |
|
||||
| iconType | Icon type, effective when `showIcon` is `true` | string | - |
|
||||
| message | Content of Alert | string\|ReactNode | - |
|
||||
| showIcon | Whether to show icon | boolean | false, in `banner` mode default is true |
|
||||
| iconType | Icon type, effective when `showIcon` is `true` | string | - |
|
||||
| type | Type of Alert styles, options: `success`, `info`, `warning`, `error` | string | `info`, in `banner` mode default is `warning` |
|
||||
| onClose | Callback when Alert is closed | (e: MouseEvent) => void | - |
|
||||
|
||||
@@ -3,6 +3,7 @@ import * as ReactDOM from 'react-dom';
|
||||
import Animate from 'rc-animate';
|
||||
import Icon from '../icon';
|
||||
import classNames from 'classnames';
|
||||
import getDataOrAriaProps from '../_util/getDataOrAriaProps';
|
||||
|
||||
function noop() { }
|
||||
|
||||
@@ -114,6 +115,8 @@ export default class Alert extends React.Component<AlertProps, any> {
|
||||
</a>
|
||||
) : null;
|
||||
|
||||
const dataOrAriaProps = getDataOrAriaProps(this.props);
|
||||
|
||||
return this.state.closed ? null : (
|
||||
<Animate
|
||||
component=""
|
||||
@@ -121,7 +124,7 @@ export default class Alert extends React.Component<AlertProps, any> {
|
||||
transitionName={`${prefixCls}-slide-up`}
|
||||
onEnd={this.animationEnd}
|
||||
>
|
||||
<div data-show={this.state.closing} className={alertCls} style={style}>
|
||||
<div data-show={this.state.closing} className={alertCls} style={style} {...dataOrAriaProps}>
|
||||
{showIcon ? <Icon className={`${prefixCls}-icon`} type={iconType} /> : null}
|
||||
<span className={`${prefixCls}-message`}>{message}</span>
|
||||
<span className={`${prefixCls}-description`}>{description}</span>
|
||||
|
||||
@@ -21,8 +21,8 @@ title: Alert
|
||||
| closable | 默认不显示关闭按钮 | boolean | 无 |
|
||||
| closeText | 自定义关闭按钮 | string\|ReactNode | 无 |
|
||||
| description | 警告提示的辅助性文字介绍 | string\|ReactNode | 无 |
|
||||
| iconType | 自定义图标类型,`showIcon` 为 `true` 时有效 | string | - |
|
||||
| message | 警告提示内容 | string\|ReactNode | 无 |
|
||||
| showIcon | 是否显示辅助图标 | boolean | false,`banner` 模式下默认值为 true |
|
||||
| iconType | 自定义图标类型,`showIcon` 为 `true` 时有效 | string | - |
|
||||
| type | 指定警告提示的样式,有四种选择 `success`、`info`、`warning`、`error` | string | `info`,`banner` 模式下默认值为 `warning` |
|
||||
| onClose | 关闭时触发的回调函数 | (e: MouseEvent) => void | 无 |
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
@alert-message-color: @heading-color;
|
||||
@alert-text-color: @text-color;
|
||||
@alert-close-color: @text-color-secondary;
|
||||
|
||||
.@{alert-prefix-cls} {
|
||||
.reset-component;
|
||||
@@ -70,7 +71,7 @@
|
||||
cursor: pointer;
|
||||
|
||||
.@{iconfont-css-prefix}-cross {
|
||||
color: @text-color-secondary;
|
||||
color: @alert-close-color;
|
||||
transition: color .3s;
|
||||
&:hover {
|
||||
color: #404040;
|
||||
@@ -87,7 +88,7 @@
|
||||
padding: 15px 15px 15px 64px;
|
||||
position: relative;
|
||||
border-radius: @border-radius-base;
|
||||
color: @text-color;
|
||||
color: @alert-text-color;
|
||||
line-height: @line-height-base;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,14 @@ export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
|
||||
this.context.antAnchor.registerLink(this.props.href);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps: AnchorLinkProps) {
|
||||
const { href } = nextProps;
|
||||
if (this.props.href !== href) {
|
||||
this.context.antAnchor.unregisterLink(this.props.href);
|
||||
this.context.antAnchor.registerLink(href);
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.context.antAnchor.unregisterLink(this.props.href);
|
||||
}
|
||||
|
||||
@@ -90,4 +90,20 @@ describe('Anchor Render', () => {
|
||||
wrapper.setProps({ children: null });
|
||||
expect(wrapper.instance().links).toEqual([]);
|
||||
});
|
||||
|
||||
it('should update links when link href update', async () => {
|
||||
let anchorInstance = null;
|
||||
function AnchorUpdate({ href }) {
|
||||
return (
|
||||
<Anchor ref={c => anchorInstance = c}>
|
||||
<Link href={href} title="API" />
|
||||
</Anchor>
|
||||
);
|
||||
}
|
||||
const wrapper = mount(<AnchorUpdate href="#API" />);
|
||||
|
||||
expect(anchorInstance.links).toEqual(['#API']);
|
||||
wrapper.setProps({ href: '#API_1' });
|
||||
expect(anchorInstance.links).toEqual(['#API_1']);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -15,6 +15,7 @@ The simplest usage.
|
||||
|
||||
```jsx
|
||||
import { Anchor } from 'antd';
|
||||
|
||||
const { Link } = Anchor;
|
||||
|
||||
ReactDOM.render(
|
||||
@@ -25,8 +26,8 @@ ReactDOM.render(
|
||||
<Link href="#Anchor-Props" title="Anchor Props" />
|
||||
<Link href="#Link-Props" title="Link Props" />
|
||||
</Link>
|
||||
</Anchor>
|
||||
, mountNode);
|
||||
</Anchor>,
|
||||
mountNode);
|
||||
```
|
||||
|
||||
<style>
|
||||
|
||||
@@ -15,6 +15,7 @@ Do not change state when page is scrolling.
|
||||
|
||||
```jsx
|
||||
import { Anchor } from 'antd';
|
||||
|
||||
const { Link } = Anchor;
|
||||
|
||||
ReactDOM.render(
|
||||
@@ -25,6 +26,6 @@ ReactDOM.render(
|
||||
<Link href="#Anchor-Props" title="Anchor Props" />
|
||||
<Link href="#Link-Props" title="Link Props" />
|
||||
</Link>
|
||||
</Anchor>
|
||||
, mountNode);
|
||||
</Anchor>,
|
||||
mountNode);
|
||||
```
|
||||
|
||||
@@ -19,7 +19,7 @@ For displaying anchor hyperlinks on page and jumping between them.
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| affix | Fixed mode of Anchor | boolean | true |
|
||||
| bounds | Bounding distance of anchor area | number | 5(px) |
|
||||
| getContainer | Scrolling container | () => HTMLElement | () => window |
|
||||
| getContainer | Scrolling container | () => HTMLElement | () => window |
|
||||
| offsetBottom | Pixels to offset from bottom when calculating position of scroll | number | - |
|
||||
| offsetTop | Pixels to offset from top when calculating position of scroll | number | 0 |
|
||||
| showInkInFixed | Whether show ink-balls in Fixed mode | boolean | false |
|
||||
|
||||
@@ -16,6 +16,7 @@ Basic Usage, set datasource of autocomplete with `dataSource` property.
|
||||
|
||||
````jsx
|
||||
import { Icon, Input, AutoComplete } from 'antd';
|
||||
|
||||
const Option = AutoComplete.Option;
|
||||
const OptGroup = AutoComplete.OptGroup;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ Customize Input Component
|
||||
|
||||
````jsx
|
||||
import { AutoComplete, Input } from 'antd';
|
||||
|
||||
const { TextArea } = Input;
|
||||
|
||||
function onSelect(value) {
|
||||
|
||||
@@ -16,6 +16,7 @@ Basic Usage, set datasource of autocomplete with `dataSource` property.
|
||||
|
||||
````jsx
|
||||
import { Icon, Button, Input, AutoComplete } from 'antd';
|
||||
|
||||
const Option = AutoComplete.Option;
|
||||
|
||||
function onSelect(value) {
|
||||
|
||||
@@ -33,7 +33,9 @@ const dataSource = ['12345', '23456', '34567'];
|
||||
| optionLabelProp | Which prop value of option will render as content of select. | string | `children` |
|
||||
| placeholder | placeholder of input | string | - |
|
||||
| value | selected option | string\|string\[]\|{ key: string, label: string\|ReactNode }\|Array<{ key: string, label: string\|ReactNode }> | - |
|
||||
| onBlur | Called when leaving the component. | function() | - |
|
||||
| onChange | Called when select an option or input value change, or value of input is changed | function(value) | - |
|
||||
| onFocus | Called when entering the component | function() | - |
|
||||
| onSearch | Called when searching items. | function(value) | - |
|
||||
| onSelect | Called when a option is selected. param is option's value and option instance. | function(value, option) | - |
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ export interface AutoCompleteProps extends AbstractSelectProps {
|
||||
value?: SelectValue;
|
||||
defaultValue?: SelectValue;
|
||||
dataSource?: DataSourceItemType[];
|
||||
backfill?: boolean;
|
||||
optionLabelProp?: string;
|
||||
onChange?: (value: SelectValue) => void;
|
||||
onSelect?: (value: SelectValue, option: Object) => any;
|
||||
@@ -120,7 +121,7 @@ export default class AutoComplete extends React.Component<AutoCompleteProps, {}>
|
||||
<Select
|
||||
{...this.props}
|
||||
className={cls}
|
||||
mode="combobox"
|
||||
mode={Select.SECRET_COMBOBOX_MODE_DO_NOT_USE}
|
||||
optionLabelProp={optionLabelProp}
|
||||
getInputElement={this.getInputElement}
|
||||
notFoundContent={notFoundContent}
|
||||
|
||||
@@ -34,7 +34,9 @@ const dataSource = ['12345', '23456', '34567'];
|
||||
| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` |
|
||||
| placeholder | 输入框提示 | string | - |
|
||||
| value | 指定当前选中的条目 | string\|string\[]\|{ key: string, label: string\|ReactNode }\|Array<{ key: string, label: string\|ReactNode }> | 无 |
|
||||
| onBlur | 失去焦点时的回调 | function() | - |
|
||||
| onChange | 选中 option,或 input 的 value 变化时,调用此函数 | function(value) | 无 |
|
||||
| onFocus | 获得焦点时的回调 | function() | - |
|
||||
| onSearch | 搜索补全项的时候调用 | function(value) | 无 |
|
||||
| onSelect | 被选中时调用,参数为选中项的 value 值 | function(value, option) | 无 |
|
||||
|
||||
|
||||
@@ -24,6 +24,6 @@ ReactDOM.render(
|
||||
<span>
|
||||
<Badge dot><Avatar shape="square" icon="user" /></Badge>
|
||||
</span>
|
||||
</div>
|
||||
, mountNode);
|
||||
</div>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -28,8 +28,8 @@ ReactDOM.render(
|
||||
<Avatar shape="square" icon="user" />
|
||||
<Avatar shape="square" size="small" icon="user" />
|
||||
</div>
|
||||
</div>
|
||||
, mountNode);
|
||||
</div>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
<style>
|
||||
|
||||
@@ -27,6 +27,7 @@ class Autoset extends React.Component {
|
||||
color: colorList[0],
|
||||
};
|
||||
}
|
||||
|
||||
changeUser = () => {
|
||||
const index = UserList.indexOf(this.state.user);
|
||||
this.setState({
|
||||
@@ -34,6 +35,7 @@ class Autoset extends React.Component {
|
||||
color: index < colorList.length - 1 ? colorList[index + 1] : colorList[0],
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
@@ -48,6 +50,6 @@ class Autoset extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
ReactDOM.render(<Autoset />
|
||||
, mountNode);
|
||||
ReactDOM.render(<Autoset />,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -24,8 +24,8 @@ ReactDOM.render(
|
||||
<Avatar src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" />
|
||||
<Avatar style={{ color: '#f56a00', backgroundColor: '#fde3cf' }}>U</Avatar>
|
||||
<Avatar style={{ backgroundColor: '#87d068' }} icon="user" />
|
||||
</div>
|
||||
, mountNode);
|
||||
</div>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
<style>
|
||||
|
||||
@@ -14,3 +14,4 @@ Avatars can be used to represent people or objects. It supports images, `Icon`s,
|
||||
| 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 | - |
|
||||
| alt | This attribute defines the alternative text describing the image | string | - |
|
||||
@@ -16,6 +16,7 @@ export interface AvatarProps {
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
children?: any;
|
||||
alt?: string;
|
||||
}
|
||||
|
||||
export interface AvatarState {
|
||||
@@ -75,7 +76,7 @@ export default class Avatar extends React.Component<AvatarProps, AvatarState> {
|
||||
|
||||
render() {
|
||||
const {
|
||||
prefixCls, shape, size, src, icon, className, ...others
|
||||
prefixCls, shape, size, src, icon, className, alt, ...others
|
||||
} = this.props;
|
||||
|
||||
const sizeCls = classNames({
|
||||
@@ -95,6 +96,7 @@ export default class Avatar extends React.Component<AvatarProps, AvatarState> {
|
||||
<img
|
||||
src={src}
|
||||
onError={this.handleImgLoadError}
|
||||
alt={alt}
|
||||
/>
|
||||
);
|
||||
} else if (icon) {
|
||||
|
||||
@@ -15,3 +15,4 @@ title: Avatar
|
||||
| shape | 指定头像的形状 | Enum{ 'circle', 'square' } | `circle` |
|
||||
| size | 设置头像的大小 | Enum{ 'large', 'small', 'default' } | `default` |
|
||||
| src | 图片类头像的资源地址 | string | - |
|
||||
| alt | 图像无法显示时的替代文本 | string | - |
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
width: @size;
|
||||
height: @size;
|
||||
line-height: @size;
|
||||
border-radius: @size / 2;
|
||||
border-radius: 50%;
|
||||
|
||||
& > * {
|
||||
line-height: @size;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { createElement, Component } from 'react';
|
||||
import omit from 'omit.js';
|
||||
import classNames from 'classnames';
|
||||
|
||||
function getNumberArray(num: string | number | undefined) {
|
||||
function getNumberArray(num: string | number | undefined | null) {
|
||||
return num ?
|
||||
num.toString()
|
||||
.split('')
|
||||
@@ -14,16 +14,16 @@ function getNumberArray(num: string | number | undefined) {
|
||||
export interface ScrollNumberProps {
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
count?: string | number;
|
||||
count?: string | number | null;
|
||||
component?: string;
|
||||
onAnimated?: Function;
|
||||
style?: React.CSSProperties;
|
||||
title?: string | number;
|
||||
title?: string | number | null;
|
||||
}
|
||||
|
||||
export interface ScrollNumberState {
|
||||
animateStarted?: boolean;
|
||||
count?: string | number;
|
||||
count?: string | number | null;
|
||||
}
|
||||
|
||||
export default class ScrollNumber extends Component<ScrollNumberProps, ScrollNumberState> {
|
||||
|
||||
@@ -24,8 +24,8 @@ ReactDOM.render(
|
||||
<Badge count={0} showZero>
|
||||
<a href="#" className="head-example" />
|
||||
</Badge>
|
||||
</div>
|
||||
, mountNode);
|
||||
</div>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
<style>
|
||||
|
||||
@@ -15,6 +15,7 @@ The count will be animated as it changes.
|
||||
|
||||
````jsx
|
||||
import { Badge, Button, Icon, Switch } from 'antd';
|
||||
|
||||
const ButtonGroup = Button.Group;
|
||||
|
||||
class Demo extends React.Component {
|
||||
|
||||
@@ -28,8 +28,8 @@ ReactDOM.render(
|
||||
<Badge dot>
|
||||
<a href="#">Link something</a>
|
||||
</Badge>
|
||||
</div>
|
||||
, mountNode);
|
||||
</div>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
<style>
|
||||
|
||||
@@ -21,6 +21,6 @@ ReactDOM.render(
|
||||
<Badge count={5}>
|
||||
<span className="head-example" />
|
||||
</Badge>
|
||||
</a>
|
||||
, mountNode);
|
||||
</a>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -23,6 +23,6 @@ ReactDOM.render(
|
||||
<Badge count={25} />
|
||||
<Badge count={4} style={{ backgroundColor: '#fff', color: '#999', boxShadow: '0 0 0 1px #d9d9d9 inset' }} />
|
||||
<Badge count={109} style={{ backgroundColor: '#52c41a' }} />
|
||||
</div>
|
||||
, mountNode);
|
||||
</div>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -30,6 +30,6 @@ ReactDOM.render(
|
||||
<Badge count={1000} overflowCount={999}>
|
||||
<a href="#" className="head-example" />
|
||||
</Badge>
|
||||
</div>
|
||||
, mountNode);
|
||||
</div>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -33,6 +33,6 @@ ReactDOM.render(
|
||||
<Badge status="processing" text="Processing" />
|
||||
<br />
|
||||
<Badge status="warning" text="Warning" />
|
||||
</div>
|
||||
, mountNode);
|
||||
</div>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -21,8 +21,8 @@ ReactDOM.render(
|
||||
<Badge count={5} title="Custom hover text">
|
||||
<a href="#" className="head-example" />
|
||||
</Badge>
|
||||
</div>
|
||||
, mountNode);
|
||||
</div>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
<style>
|
||||
|
||||
@@ -8,7 +8,7 @@ export { ScrollNumberProps } from './ScrollNumber';
|
||||
|
||||
export interface BadgeProps {
|
||||
/** Number to show in badge */
|
||||
count?: number | string;
|
||||
count?: number | string | null;
|
||||
showZero?: boolean;
|
||||
/** Max count to show */
|
||||
overflowCount?: number;
|
||||
|
||||
@@ -25,7 +25,7 @@ title: Badge
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| count | 展示的数字,大于 overflowCount 时显示为 `${overflowCount}+`,为 0 时隐藏 | number\|ReactNode | |
|
||||
| count | 展示的数字,大于 overflowCount 时显示为 `${overflowCount}+`,为 0 时隐藏 | number\|ReactNode | |
|
||||
| dot | 不展示数字,只有一个小红点 | boolean | false |
|
||||
| offset | 设置状态点的位置偏移,格式为 `[x, y]` | `[number, number]` | - |
|
||||
| overflowCount | 展示封顶的数字值 | number | 99 |
|
||||
|
||||
@@ -22,6 +22,6 @@ ReactDOM.render(
|
||||
<Breadcrumb.Item><a href="">Application Center</a></Breadcrumb.Item>
|
||||
<Breadcrumb.Item><a href="">Application List</a></Breadcrumb.Item>
|
||||
<Breadcrumb.Item>An Application</Breadcrumb.Item>
|
||||
</Breadcrumb>
|
||||
, mountNode);
|
||||
</Breadcrumb>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -76,8 +76,8 @@ const Home = withRouter((props) => {
|
||||
ReactDOM.render(
|
||||
<Router>
|
||||
<Home />
|
||||
</Router>
|
||||
, mountNode);
|
||||
</Router>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
````css
|
||||
|
||||
@@ -51,8 +51,8 @@ ReactDOM.render(
|
||||
</Route>
|
||||
</Route>
|
||||
</Route>
|
||||
</Router>
|
||||
, mountNode);
|
||||
</Router>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
````css
|
||||
|
||||
@@ -22,6 +22,6 @@ ReactDOM.render(
|
||||
<Breadcrumb.Item href="">Application Center</Breadcrumb.Item>
|
||||
<Breadcrumb.Item href="">Application List</Breadcrumb.Item>
|
||||
<Breadcrumb.Item>An Application</Breadcrumb.Item>
|
||||
</Breadcrumb>
|
||||
, mountNode);
|
||||
</Breadcrumb>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -28,6 +28,6 @@ ReactDOM.render(
|
||||
<Breadcrumb.Item>
|
||||
Application
|
||||
</Breadcrumb.Item>
|
||||
</Breadcrumb>
|
||||
, mountNode);
|
||||
</Breadcrumb>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -472,7 +472,7 @@ exports[`renders ./components/button/demo/multiple.md correctly 1`] = `
|
||||
exports[`renders ./components/button/demo/size.md correctly 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="ant-radio-group"
|
||||
class="ant-radio-group ant-radio-group-outline"
|
||||
>
|
||||
<label
|
||||
class="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
|
||||
|
||||
@@ -44,7 +44,7 @@ describe('Button', () => {
|
||||
});
|
||||
|
||||
it('renders Chinese characters correctly in HOC', () => {
|
||||
const Text = props => <span>{props.children}</span>;
|
||||
const Text = ({ children }) => <span>{children}</span>;
|
||||
const wrapper = mount(
|
||||
<Button><Text>按钮</Text></Button>
|
||||
);
|
||||
@@ -61,7 +61,7 @@ describe('Button', () => {
|
||||
expect(wrapper.find('.ant-btn').hasClass('ant-btn-two-chinese-chars')).toBe(true);
|
||||
});
|
||||
|
||||
it('have static perperty for type detecting', () => {
|
||||
it('have static property for type detecting', () => {
|
||||
const wrapper = mount(
|
||||
<Button>Button Text</Button>
|
||||
);
|
||||
@@ -74,11 +74,14 @@ describe('Button', () => {
|
||||
state = {
|
||||
loading: false,
|
||||
};
|
||||
|
||||
enterLoading = () => {
|
||||
this.setState({ loading: true });
|
||||
}
|
||||
|
||||
render() {
|
||||
return <Button loading={this.state.loading} onClick={this.enterLoading}>Button</Button>;
|
||||
const { loading } = this.state;
|
||||
return <Button loading={loading} onClick={this.enterLoading}>Button</Button>;
|
||||
}
|
||||
}
|
||||
const wrapper = mount(
|
||||
@@ -94,11 +97,14 @@ describe('Button', () => {
|
||||
state = {
|
||||
loading: false,
|
||||
};
|
||||
|
||||
enterLoading = () => {
|
||||
this.setState({ loading: { delay: 1000 } });
|
||||
}
|
||||
|
||||
render() {
|
||||
return <Button loading={this.state.loading} onClick={this.enterLoading}>Button</Button>;
|
||||
const { loading } = this.state;
|
||||
return <Button loading={loading} onClick={this.enterLoading}>Button</Button>;
|
||||
}
|
||||
}
|
||||
const wrapper = mount(
|
||||
|
||||
@@ -2,7 +2,6 @@ import * as React from 'react';
|
||||
import { findDOMNode } from 'react-dom';
|
||||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import Icon from '../icon';
|
||||
import Group from './button-group';
|
||||
|
||||
@@ -37,10 +36,10 @@ function insertSpace(child: React.ReactChild, needInserted: boolean) {
|
||||
export type ButtonType = 'default' | 'primary' | 'ghost' | 'dashed' | 'danger';
|
||||
export type ButtonShape = 'circle' | 'circle-outline';
|
||||
export type ButtonSize = 'small' | 'default' | 'large';
|
||||
export type ButtonHTMLType = 'submit' | 'button' | 'reset';
|
||||
|
||||
export interface BaseButtonProps {
|
||||
type?: ButtonType;
|
||||
htmlType?: string;
|
||||
icon?: string;
|
||||
shape?: ButtonShape;
|
||||
size?: ButtonSize;
|
||||
@@ -50,9 +49,16 @@ export interface BaseButtonProps {
|
||||
ghost?: boolean;
|
||||
}
|
||||
|
||||
export type AnchorButtonProps = BaseButtonProps & React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
||||
export type AnchorButtonProps = {
|
||||
href: string;
|
||||
target?: string;
|
||||
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
||||
} & BaseButtonProps & React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
||||
|
||||
export type NativeButtonProps = BaseButtonProps & React.ButtonHTMLAttributes<HTMLButtonElement>;
|
||||
export type NativeButtonProps = {
|
||||
htmlType?: ButtonHTMLType;
|
||||
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
||||
} & BaseButtonProps & React.ButtonHTMLAttributes<HTMLButtonElement>;
|
||||
|
||||
export type ButtonProps = AnchorButtonProps | NativeButtonProps;
|
||||
|
||||
@@ -138,7 +144,7 @@ export default class Button extends React.Component<ButtonProps, any> {
|
||||
}
|
||||
}
|
||||
|
||||
handleClick = (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {
|
||||
handleClick: React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement> = e => {
|
||||
// Add click effect
|
||||
this.setState({ clicked: true });
|
||||
clearTimeout(this.timeout);
|
||||
@@ -146,7 +152,7 @@ export default class Button extends React.Component<ButtonProps, any> {
|
||||
|
||||
const onClick = this.props.onClick;
|
||||
if (onClick) {
|
||||
(onClick as (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void)(e);
|
||||
(onClick as React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>)(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +163,7 @@ export default class Button extends React.Component<ButtonProps, any> {
|
||||
|
||||
render() {
|
||||
const {
|
||||
type, shape, size, className, htmlType, children, icon, prefixCls, ghost, ...others
|
||||
type, shape, size, className, children, icon, prefixCls, ghost, loading: _loadingProp, ...rest
|
||||
} = this.props;
|
||||
|
||||
const { loading, clicked, hasTwoCNChar } = this.state;
|
||||
@@ -175,8 +181,6 @@ export default class Button extends React.Component<ButtonProps, any> {
|
||||
break;
|
||||
}
|
||||
|
||||
const ComponentProp = (others as AnchorButtonProps).href ? 'a' : 'button';
|
||||
|
||||
const classes = classNames(prefixCls, className, {
|
||||
[`${prefixCls}-${type}`]: type,
|
||||
[`${prefixCls}-${shape}`]: shape,
|
||||
@@ -193,15 +197,30 @@ export default class Button extends React.Component<ButtonProps, any> {
|
||||
const kids = (children || children === 0)
|
||||
? React.Children.map(children, child => insertSpace(child, this.isNeedInserted())) : null;
|
||||
|
||||
return (
|
||||
<ComponentProp
|
||||
{...omit(others, ['loading'])}
|
||||
type={(others as AnchorButtonProps).href ? undefined : (htmlType || 'button')}
|
||||
className={classes}
|
||||
onClick={this.handleClick}
|
||||
>
|
||||
{iconNode}{kids}
|
||||
</ComponentProp>
|
||||
);
|
||||
if ('href' in rest) {
|
||||
return (
|
||||
<a
|
||||
{...rest}
|
||||
className={classes}
|
||||
onClick={this.handleClick}
|
||||
>
|
||||
{iconNode}{kids}
|
||||
</a>
|
||||
);
|
||||
} else {
|
||||
// React does not recognize the `htmlType` prop on a DOM element. Here we pick it out of `rest`.
|
||||
const { htmlType, ...otherProps } = rest;
|
||||
|
||||
return (
|
||||
<button
|
||||
{...otherProps}
|
||||
type={htmlType || 'button'}
|
||||
className={classes}
|
||||
onClick={this.handleClick}
|
||||
>
|
||||
{iconNode}{kids}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,6 @@ ReactDOM.render(
|
||||
<Button>Default</Button>
|
||||
<Button type="dashed">Dashed</Button>
|
||||
<Button type="danger">Danger</Button>
|
||||
</div>
|
||||
, mountNode);
|
||||
</div>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -19,6 +19,7 @@ The `size` can be set to `large`, `small` or left unset resulting in a default s
|
||||
|
||||
````jsx
|
||||
import { Button, Icon } from 'antd';
|
||||
|
||||
const ButtonGroup = Button.Group;
|
||||
|
||||
ReactDOM.render(
|
||||
|
||||
@@ -22,6 +22,6 @@ ReactDOM.render(
|
||||
<Button ghost>Default</Button>
|
||||
<Button type="dashed" ghost>Dashed</Button>
|
||||
<Button type="danger" ghost>danger</Button>
|
||||
</div>
|
||||
, mountNode);
|
||||
</div>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -16,12 +16,12 @@ To get a customized button, just set `type`/`shape`/`size`/`loading`/`disabled`.
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| disabled | disabled state of button | boolean | `false` |
|
||||
| ghost | make background transparent and invert text and border colors, added in 2.7 | boolean | false |
|
||||
| href | redirect url of link button | string | - |
|
||||
| htmlType | set the original html `type` of `button`, see: [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) | string | `button` |
|
||||
| icon | set the icon of button, see: Icon component | string | - |
|
||||
| loading | set the loading status of button | boolean \| { delay: number } | false |
|
||||
| disabled | disabled state of button | boolean | `false` |
|
||||
| shape | can be set to `circle` or omitted | string | - |
|
||||
| size | can be set to `small` `large` or omitted | string | `default` |
|
||||
| target | same as target attribute of a, works when href is specified | string | - |
|
||||
|
||||
@@ -19,12 +19,12 @@ subtitle: 按钮
|
||||
|
||||
| 属性 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| disabled | 按钮失效状态 | boolean | `false` |
|
||||
| ghost | 幽灵属性,使按钮背景透明,版本 2.7 中增加 | boolean | false |
|
||||
| href | 点击跳转的地址,指定此属性 button 的行为和 a 链接一致 | string | - |
|
||||
| htmlType | 设置 `button` 原生的 `type` 值,可选值请参考 [HTML 标准](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) | string | `button` |
|
||||
| icon | 设置按钮的图标类型 | string | - |
|
||||
| loading | 设置按钮载入状态 | boolean \| { delay: number } | `false` |
|
||||
| disabled | 按钮失效状态 | boolean | `false` |
|
||||
| shape | 设置按钮形状,可选值为 `circle` 或者不设 | string | - |
|
||||
| size | 设置按钮大小,可选值为 `small` `large` 或者不设 | string | `default` |
|
||||
| target | 相当于 a 链接的 target 属性,href 存在时生效 | string | - |
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
@btn-prefix-cls: ~"@{ant-prefix}-btn";
|
||||
|
||||
// for compatibile
|
||||
// for compatible
|
||||
@btn-ghost-color: @text-color;
|
||||
@btn-ghost-bg: transparent;
|
||||
@btn-ghost-border: @border-color-base;
|
||||
|
||||
@@ -109,7 +109,8 @@
|
||||
.button-group-base(@btnClassName) {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
> .@{btnClassName} {
|
||||
> .@{btnClassName},
|
||||
> span > .@{btnClassName} {
|
||||
position: relative;
|
||||
line-height: @btn-height-base - 2px;
|
||||
|
||||
@@ -126,13 +127,15 @@
|
||||
}
|
||||
|
||||
// size
|
||||
&-lg > .@{btnClassName} {
|
||||
.button-size(@btn-height-lg; @btn-padding-lg; @btn-font-size-lg; @btn-border-radius-base);
|
||||
&-lg > .@{btnClassName},
|
||||
&-lg > span > .@{btnClassName} {
|
||||
.button-size(@btn-height-lg; @btn-padding-lg; @btn-font-size-lg; 0);
|
||||
line-height: @btn-height-lg - 2px;
|
||||
}
|
||||
|
||||
&-sm > .@{btnClassName} {
|
||||
.button-size(@btn-height-sm; @btn-padding-sm; @font-size-base; @btn-border-radius-sm);
|
||||
&-sm > .@{btnClassName},
|
||||
&-sm > span > .@{btnClassName} {
|
||||
.button-size(@btn-height-sm; @btn-padding-sm; @font-size-base; 0);
|
||||
line-height: @btn-height-sm - 2px;
|
||||
> .@{iconfont-css-prefix} {
|
||||
font-size: @font-size-base;
|
||||
@@ -260,7 +263,7 @@
|
||||
border-left-color: transparent;
|
||||
}
|
||||
|
||||
.@{btnClassName}:not(:first-child):not(:last-child) {
|
||||
.@{btnClassName} {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
@@ -268,17 +271,42 @@
|
||||
> span:first-child > .@{btnClassName} {
|
||||
margin-left: 0;
|
||||
}
|
||||
> .@{btnClassName}:only-child {
|
||||
border-radius: @btn-border-radius-base;
|
||||
}
|
||||
> span:only-child > .@{btnClassName} {
|
||||
border-radius: @btn-border-radius-base;
|
||||
}
|
||||
|
||||
> .@{btnClassName}:first-child:not(:last-child),
|
||||
> span:first-child:not(:last-child) > .@{btnClassName} {
|
||||
border-bottom-right-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-left-radius: @btn-border-radius-base;
|
||||
border-top-left-radius: @btn-border-radius-base;
|
||||
}
|
||||
|
||||
> .@{btnClassName}:last-child:not(:first-child),
|
||||
> span:last-child:not(:first-child) > .@{btnClassName} {
|
||||
border-bottom-left-radius: 0;
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-right-radius: @btn-border-radius-base;
|
||||
border-top-right-radius: @btn-border-radius-base;
|
||||
}
|
||||
|
||||
&-sm {
|
||||
> .@{btnClassName}:only-child {
|
||||
border-radius: @btn-border-radius-sm;
|
||||
}
|
||||
> span:only-child > .@{btnClassName} {
|
||||
border-radius: @btn-border-radius-sm;
|
||||
}
|
||||
> .@{btnClassName}:first-child:not(:last-child),
|
||||
> span:first-child:not(:last-child) > .@{btnClassName} {
|
||||
border-bottom-left-radius: @btn-border-radius-sm;
|
||||
border-top-left-radius: @btn-border-radius-sm;
|
||||
}
|
||||
> .@{btnClassName}:last-child:not(:first-child),
|
||||
> span:last-child:not(:first-child) > .@{btnClassName} {
|
||||
border-bottom-right-radius: @btn-border-radius-sm;
|
||||
border-top-right-radius: @btn-border-radius-sm;
|
||||
}
|
||||
}
|
||||
|
||||
& > & {
|
||||
|
||||
@@ -72,7 +72,7 @@ exports[`renders ./components/calendar/demo/basic.md correctly 1`] = `
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-radio-group ant-radio-group-default"
|
||||
class="ant-radio-group ant-radio-group-outline ant-radio-group-default"
|
||||
>
|
||||
<label
|
||||
class="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
|
||||
@@ -1081,7 +1081,7 @@ exports[`renders ./components/calendar/demo/card.md correctly 1`] = `
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-radio-group ant-radio-group-small"
|
||||
class="ant-radio-group ant-radio-group-outline ant-radio-group-small"
|
||||
>
|
||||
<label
|
||||
class="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
|
||||
@@ -2088,7 +2088,7 @@ exports[`renders ./components/calendar/demo/notice-calendar.md correctly 1`] = `
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-radio-group ant-radio-group-default"
|
||||
class="ant-radio-group ant-radio-group-outline ant-radio-group-default"
|
||||
>
|
||||
<label
|
||||
class="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
|
||||
@@ -3505,7 +3505,7 @@ exports[`renders ./components/calendar/demo/select.md correctly 1`] = `
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-radio-group ant-radio-group-default"
|
||||
class="ant-radio-group ant-radio-group-outline ant-radio-group-default"
|
||||
>
|
||||
<label
|
||||
class="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
|
||||
|
||||
@@ -21,6 +21,6 @@ function onPanelChange(value, mode) {
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<Calendar onPanelChange={onPanelChange} />
|
||||
, mountNode);
|
||||
<Calendar onPanelChange={onPanelChange} />,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -23,6 +23,6 @@ function onPanelChange(value, mode) {
|
||||
ReactDOM.render(
|
||||
<div style={{ width: 300, border: '1px solid #d9d9d9', borderRadius: 4 }}>
|
||||
<Calendar fullscreen={false} onPanelChange={onPanelChange} />
|
||||
</div>
|
||||
, mountNode);
|
||||
</div>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -76,8 +76,8 @@ function monthCellRender(value) {
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<Calendar dateCellRender={dateCellRender} monthCellRender={monthCellRender} />
|
||||
, mountNode);
|
||||
<Calendar dateCellRender={dateCellRender} monthCellRender={monthCellRender} />,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
````css
|
||||
|
||||
@@ -22,15 +22,18 @@ class App extends React.Component {
|
||||
value: moment('2017-01-25'),
|
||||
selectedValue: moment('2017-01-25'),
|
||||
}
|
||||
|
||||
onSelect = (value) => {
|
||||
this.setState({
|
||||
value,
|
||||
selectedValue: value,
|
||||
});
|
||||
}
|
||||
|
||||
onPanelChange = (value) => {
|
||||
this.setState({ value });
|
||||
}
|
||||
|
||||
render() {
|
||||
const { value, selectedValue } = this.state;
|
||||
return (
|
||||
|
||||
@@ -21,8 +21,8 @@ ReactDOM.render(
|
||||
<p>Card content</p>
|
||||
<p>Card content</p>
|
||||
<p>Card content</p>
|
||||
</Card>
|
||||
, mountNode);
|
||||
</Card>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
<style>
|
||||
|
||||
@@ -23,6 +23,6 @@ ReactDOM.render(
|
||||
<p>Card content</p>
|
||||
<p>Card content</p>
|
||||
</Card>
|
||||
</div>
|
||||
, mountNode);
|
||||
</div>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -16,6 +16,7 @@ You can use `Card.Meta` to support more flexible content.
|
||||
|
||||
````jsx
|
||||
import { Card } from 'antd';
|
||||
|
||||
const { Meta } = Card;
|
||||
|
||||
ReactDOM.render(
|
||||
@@ -28,6 +29,6 @@ ReactDOM.render(
|
||||
title="Europe Street beat"
|
||||
description="www.instagram.com"
|
||||
/>
|
||||
</Card>
|
||||
, mountNode);
|
||||
</Card>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -30,6 +30,6 @@ ReactDOM.render(
|
||||
<Card.Grid style={gridStyle}>Content</Card.Grid>
|
||||
<Card.Grid style={gridStyle}>Content</Card.Grid>
|
||||
<Card.Grid style={gridStyle}>Content</Card.Grid>
|
||||
</Card>
|
||||
, mountNode);
|
||||
</Card>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -29,6 +29,6 @@ ReactDOM.render(
|
||||
<Card title="Card title" bordered={false}>Card content</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
, mountNode);
|
||||
</div>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -43,6 +43,6 @@ ReactDOM.render(
|
||||
>
|
||||
Inner Card content
|
||||
</Card>
|
||||
</Card>
|
||||
, mountNode);
|
||||
</Card>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -38,6 +38,6 @@ class LoadingCard extends React.Component {
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<LoadingCard />
|
||||
, mountNode);
|
||||
<LoadingCard />,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -15,6 +15,7 @@ A Card that supports `cover`, `avatar`, `title` and `description`.
|
||||
|
||||
````jsx
|
||||
import { Card, Icon, Avatar } from 'antd';
|
||||
|
||||
const { Meta } = Card;
|
||||
|
||||
ReactDOM.render(
|
||||
@@ -28,6 +29,6 @@ ReactDOM.render(
|
||||
title="Card title"
|
||||
description="This is the description"
|
||||
/>
|
||||
</Card>
|
||||
, mountNode);
|
||||
</Card>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -21,6 +21,6 @@ ReactDOM.render(
|
||||
<p>Card content</p>
|
||||
<p>Card content</p>
|
||||
<p>Card content</p>
|
||||
</Card>
|
||||
, mountNode);
|
||||
</Card>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -51,10 +51,12 @@ class TabsCard extends React.Component {
|
||||
key: 'tab1',
|
||||
noTitleKey: 'app',
|
||||
}
|
||||
|
||||
onTabChange = (key, type) => {
|
||||
console.log(key, type);
|
||||
this.setState({ [type]: key });
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
@@ -82,6 +84,6 @@ class TabsCard extends React.Component {
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<TabsCard />
|
||||
, mountNode);
|
||||
<TabsCard />,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -22,15 +22,15 @@ A card can be used to display content related to a single subject. The content c
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| actions | The action list, shows at the bottom of the Card. | Array<ReactNode> | - |
|
||||
| activeTabKey | Current TabPane's key | string | - |
|
||||
| bodyStyle | Inline style to apply to the card content | object | - |
|
||||
| bordered | Toggles rendering of the border around the card | boolean | `true` |
|
||||
| cover | Card cover | ReactNode | - |
|
||||
| defaultActiveTabKey | Initial active TabPane's key, if `activeTabKey` is not set. | string | - |
|
||||
| extra | Content to render in the top-right corner of the card | string\|ReactNode | - |
|
||||
| hoverable | Lift up when hovering card | boolean | false |
|
||||
| loading | Shows a loading indicator while the contents of the card are being fetched | boolean | false |
|
||||
| tabList | List of TabPane's head. | Array<{key: string, tab: ReactNode}> | - |
|
||||
| activeTabKey | Current TabPane's key | string | - |
|
||||
| defaultActiveTabKey | Initial active TabPane's key, if `activeTabKey` is not set. | string | - |
|
||||
| title | Card title | string\|ReactNode | - |
|
||||
| type | Card style type, can be set to `inner` or not set | string | - |
|
||||
| onTabChange | Callback when tab is switched | (key) => void | - |
|
||||
|
||||
@@ -19,6 +19,7 @@ export type CardType = 'inner';
|
||||
export interface CardTabListType {
|
||||
key: string;
|
||||
tab: React.ReactNode;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
||||
@@ -225,7 +226,7 @@ export default class Card extends React.Component<CardProps, CardState> {
|
||||
size="large"
|
||||
onChange={this.onTabChange}
|
||||
>
|
||||
{tabList.map(item => <Tabs.TabPane tab={item.tab} key={item.key} />)}
|
||||
{tabList.map(item => <Tabs.TabPane tab={item.tab} disabled={item.disabled} key={item.key} />)}
|
||||
</Tabs>
|
||||
) : null;
|
||||
if (title || extra || tabs) {
|
||||
|
||||
@@ -23,15 +23,15 @@ cols: 1
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| actions | 卡片操作组,位置在卡片底部 | Array<ReactNode> | - |
|
||||
| activeTabKey | 当前激活页签的 key | string | - |
|
||||
| bodyStyle | 内容区域自定义样式 | object | - |
|
||||
| bordered | 是否有边框 | boolean | true |
|
||||
| cover | 卡片封面 | ReactNode | - |
|
||||
| defaultActiveTabKey | 初始化选中页签的 key,如果没有设置 activeTabKey | string | 第一个页签 |
|
||||
| extra | 卡片右上角的操作区域 | string\|ReactNode | - |
|
||||
| hoverable | 鼠标移过时可浮起 | boolean | false |
|
||||
| loading | 当卡片内容还在加载中时,可以用 loading 展示一个占位 | boolean | false |
|
||||
| tabList | 页签标题列表 | Array<{key: string, tab: ReactNode}> | - |
|
||||
| activeTabKey | 当前激活页签的 key | string | - |
|
||||
| defaultActiveTabKey | 初始化选中页签的 key,如果没有设置 activeTabKey | string | 第一个页签 |
|
||||
| title | 卡片标题 | string\|ReactNode | - |
|
||||
| type | 卡片类型,可设置为 `inner` 或 不设置 | string | - |
|
||||
| onTabChange | 页签切换的回调 | (key) => void | - |
|
||||
|
||||
@@ -22,8 +22,8 @@ ReactDOM.render(
|
||||
<div><h3>2</h3></div>
|
||||
<div><h3>3</h3></div>
|
||||
<div><h3>4</h3></div>
|
||||
</Carousel>
|
||||
, mountNode);
|
||||
</Carousel>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
````css
|
||||
|
||||
@@ -26,8 +26,8 @@ ReactDOM.render(
|
||||
<div><h3>2</h3></div>
|
||||
<div><h3>3</h3></div>
|
||||
<div><h3>4</h3></div>
|
||||
</Carousel>
|
||||
, mountNode);
|
||||
</Carousel>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
````css
|
||||
|
||||
@@ -22,8 +22,8 @@ ReactDOM.render(
|
||||
<div><h3>2</h3></div>
|
||||
<div><h3>3</h3></div>
|
||||
<div><h3>4</h3></div>
|
||||
</Carousel>
|
||||
, mountNode);
|
||||
</Carousel>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
````css
|
||||
|
||||
@@ -22,8 +22,8 @@ ReactDOM.render(
|
||||
<div><h3>2</h3></div>
|
||||
<div><h3>3</h3></div>
|
||||
<div><h3>4</h3></div>
|
||||
</Carousel>
|
||||
, mountNode);
|
||||
</Carousel>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
````css
|
||||
|
||||
@@ -381,7 +381,7 @@ exports[`Cascader should highlight keyword and filter when search in Cascader 1`
|
||||
},
|
||||
}
|
||||
}
|
||||
defaultFiledNames={
|
||||
defaultFieldNames={
|
||||
Object {
|
||||
"children": "children",
|
||||
"label": "label",
|
||||
@@ -395,7 +395,7 @@ exports[`Cascader should highlight keyword and filter when search in Cascader 1`
|
||||
}
|
||||
}
|
||||
expandTrigger="click"
|
||||
filedNames={
|
||||
fieldNames={
|
||||
Object {
|
||||
"children": "children",
|
||||
"label": "label",
|
||||
@@ -759,7 +759,7 @@ exports[`Cascader should render not found content 1`] = `
|
||||
},
|
||||
}
|
||||
}
|
||||
defaultFiledNames={
|
||||
defaultFieldNames={
|
||||
Object {
|
||||
"children": "children",
|
||||
"label": "label",
|
||||
@@ -774,7 +774,7 @@ exports[`Cascader should render not found content 1`] = `
|
||||
}
|
||||
}
|
||||
expandTrigger="click"
|
||||
filedNames={
|
||||
fieldNames={
|
||||
Object {
|
||||
"children": "children",
|
||||
"label": "label",
|
||||
|
||||
@@ -45,6 +45,6 @@ function onChange(value) {
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<Cascader options={options} onChange={onChange} placeholder="Please select" />
|
||||
, mountNode);
|
||||
<Cascader options={options} onChange={onChange} placeholder="Please select" />,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -45,6 +45,6 @@ function onChange(value) {
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<Cascader options={options} onChange={onChange} changeOnSelect />
|
||||
, mountNode);
|
||||
<Cascader options={options} onChange={onChange} changeOnSelect />,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -65,6 +65,6 @@ ReactDOM.render(
|
||||
defaultValue={['zhejiang', 'hangzhou', 'xihu']}
|
||||
displayRender={displayRender}
|
||||
style={{ width: '100%' }}
|
||||
/>
|
||||
, mountNode);
|
||||
/>,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
@@ -42,6 +42,7 @@ class CitySwitcher extends React.Component {
|
||||
text: selectedOptions.map(o => o.label).join(', '),
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<span>
|
||||
|
||||
@@ -45,6 +45,6 @@ function onChange(value) {
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<Cascader defaultValue={['zhejiang', 'hangzhou', 'xihu']} options={options} onChange={onChange} />
|
||||
, mountNode);
|
||||
<Cascader defaultValue={['zhejiang', 'hangzhou', 'xihu']} options={options} onChange={onChange} />,
|
||||
mountNode);
|
||||
````
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user