mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-16 14:22:28 +08:00
Compare commits
265 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e051e8ae32 | ||
|
|
9558aa2c64 | ||
|
|
d10639590b | ||
|
|
0283819565 | ||
|
|
5e89806520 | ||
|
|
91882a2376 | ||
|
|
5ed813bdca | ||
|
|
259fb98d87 | ||
|
|
5fba136826 | ||
|
|
5be40a9c7f | ||
|
|
f99a77b3e5 | ||
|
|
0c8c2ec727 | ||
|
|
2e0c67f214 | ||
|
|
0a543b30f6 | ||
|
|
2b381e55c0 | ||
|
|
6827a33112 | ||
|
|
31d0f2093c | ||
|
|
0dbfa049a1 | ||
|
|
98ce55fcab | ||
|
|
70669371c0 | ||
|
|
c8a1885b0d | ||
|
|
2f0ad39dcc | ||
|
|
f45a3ed1e9 | ||
|
|
4f6824dc27 | ||
|
|
95e754ad60 | ||
|
|
aa17690b65 | ||
|
|
c1bd5d4ecb | ||
|
|
81dad0452f | ||
|
|
a05b4e6747 | ||
|
|
b98a8cef88 | ||
|
|
50682fadf1 | ||
|
|
7d131a3b64 | ||
|
|
afacd6c07a | ||
|
|
6c8a7b7944 | ||
|
|
4a08e0188d | ||
|
|
3bdacbc9bc | ||
|
|
f9929c25ce | ||
|
|
a243d32dff | ||
|
|
c9be22adf3 | ||
|
|
59625b1c3f | ||
|
|
b15a4e3165 | ||
|
|
058af3cb0d | ||
|
|
d70637022d | ||
|
|
4d81deb1bc | ||
|
|
7f909e750b | ||
|
|
9294dba6a5 | ||
|
|
55ab71853f | ||
|
|
489cc44a59 | ||
|
|
28d0cf86ea | ||
|
|
777692a207 | ||
|
|
af83b2aade | ||
|
|
1688a8724b | ||
|
|
680a5b7120 | ||
|
|
d03d6721bf | ||
|
|
0e3dbc69a7 | ||
|
|
d7e1794711 | ||
|
|
fc55cf6919 | ||
|
|
8dff727a27 | ||
|
|
ea93dabefc | ||
|
|
8b6153686e | ||
|
|
d0532db3d7 | ||
|
|
1a961f2adc | ||
|
|
7cb1fb02b8 | ||
|
|
4b00e05cfb | ||
|
|
d15121493f | ||
|
|
972c3f3d41 | ||
|
|
16c4ce09d7 | ||
|
|
fb1e1cc8fc | ||
|
|
d8ad0b1993 | ||
|
|
248f1bd00f | ||
|
|
09855467b5 | ||
|
|
faf0c8b9da | ||
|
|
c3e57af521 | ||
|
|
a84ce59d31 | ||
|
|
23b8099449 | ||
|
|
9cab6543ac | ||
|
|
13fc8c9a3a | ||
|
|
7a72f4ad4e | ||
|
|
7a5ba669e7 | ||
|
|
9c28420468 | ||
|
|
7a53b39af2 | ||
|
|
b94bca7cf1 | ||
|
|
c4c834b529 | ||
|
|
c40655d3a6 | ||
|
|
dff87da25a | ||
|
|
5a87d219d7 | ||
|
|
ec916e5f72 | ||
|
|
4500f2e9ee | ||
|
|
ff31a5b555 | ||
|
|
b7f1c4077b | ||
|
|
7bed6d89b5 | ||
|
|
014152f17f | ||
|
|
7a07b128d1 | ||
|
|
dfc92fbf4f | ||
|
|
c4054d0019 | ||
|
|
8566c25682 | ||
|
|
2d0d70efcb | ||
|
|
a6e38f8479 | ||
|
|
95222a51fa | ||
|
|
38f9864732 | ||
|
|
4afb1cc6dd | ||
|
|
0d0b6b0a32 | ||
|
|
6e59cae163 | ||
|
|
7017c9e5d1 | ||
|
|
1a9708febf | ||
|
|
6bd299000a | ||
|
|
a97e54e253 | ||
|
|
0ab1d56817 | ||
|
|
e389e6b795 | ||
|
|
a031271384 | ||
|
|
73eeec6236 | ||
|
|
ddd2b33d56 | ||
|
|
aa3ffbe025 | ||
|
|
c02dfb48fc | ||
|
|
7a5c6d51af | ||
|
|
4938c25782 | ||
|
|
b3ab13e551 | ||
|
|
ea5e74b348 | ||
|
|
a940547aff | ||
|
|
37e376df11 | ||
|
|
447d167222 | ||
|
|
f920e4a9d0 | ||
|
|
2ab6879b12 | ||
|
|
3c98d3f80f | ||
|
|
8de1a5cf58 | ||
|
|
fbf7da7d83 | ||
|
|
972b528ee1 | ||
|
|
780377a5d6 | ||
|
|
dbdd5c5da0 | ||
|
|
6799ee278f | ||
|
|
56f4f0688d | ||
|
|
b2f6407560 | ||
|
|
b8e196f178 | ||
|
|
2f25084fa6 | ||
|
|
c4454dea04 | ||
|
|
38433f606b | ||
|
|
5b021a5e23 | ||
|
|
6f11e1fda0 | ||
|
|
ee1ed40a77 | ||
|
|
25d996d666 | ||
|
|
f22e682217 | ||
|
|
3206196a7b | ||
|
|
15bb865037 | ||
|
|
6c3d00368c | ||
|
|
f34854d667 | ||
|
|
bed556e900 | ||
|
|
ae7476a3f9 | ||
|
|
c5f574026e | ||
|
|
edc9014d13 | ||
|
|
c65a736714 | ||
|
|
1b9513e0eb | ||
|
|
ffbefffe6b | ||
|
|
620dc6fd7e | ||
|
|
1ab6c8d5fd | ||
|
|
3b89533001 | ||
|
|
dd33cb8f60 | ||
|
|
1260ab8353 | ||
|
|
41a8c17b2b | ||
|
|
7b5f843546 | ||
|
|
e185441b13 | ||
|
|
3ee8c0b604 | ||
|
|
706190f8f0 | ||
|
|
d6c0aa2e1c | ||
|
|
7c2ac50ca7 | ||
|
|
20b248a70d | ||
|
|
9b3b20ae3e | ||
|
|
145e0f5257 | ||
|
|
25c1dc1cde | ||
|
|
e78d424854 | ||
|
|
4ba3cd847d | ||
|
|
057713c889 | ||
|
|
a2736da2bd | ||
|
|
b06cdd08c3 | ||
|
|
b2cb8a0f01 | ||
|
|
5960ecab7a | ||
|
|
2464d2acfc | ||
|
|
43cf39d9a0 | ||
|
|
6944a8e7c1 | ||
|
|
74c0cb97ab | ||
|
|
a8fd9fc1ba | ||
|
|
800b6801e8 | ||
|
|
91a8712bfa | ||
|
|
102ae62f45 | ||
|
|
e524f16361 | ||
|
|
c9e8423c7e | ||
|
|
01705e264e | ||
|
|
115e064a5b | ||
|
|
4bdc02b5d2 | ||
|
|
d450db8bd4 | ||
|
|
f15a28c9f0 | ||
|
|
b9cbb21f55 | ||
|
|
5c9b4b4296 | ||
|
|
8ba9f0be54 | ||
|
|
57e5b4f382 | ||
|
|
6a1e7278fa | ||
|
|
25acdfd29a | ||
|
|
b15ae59101 | ||
|
|
568e79d878 | ||
|
|
05c67d6f01 | ||
|
|
a73e28ca6c | ||
|
|
a5c50ec1c7 | ||
|
|
02ce67d44c | ||
|
|
0fc1cebd5b | ||
|
|
239eaca72c | ||
|
|
f1817e1a9e | ||
|
|
069ce42565 | ||
|
|
813feaa860 | ||
|
|
e3ba415822 | ||
|
|
a3d4e7a696 | ||
|
|
a8bae305db | ||
|
|
f294bf4674 | ||
|
|
e5c8e71ea6 | ||
|
|
7d4f0cfc51 | ||
|
|
67dd935045 | ||
|
|
3e1483ae8f | ||
|
|
016d911274 | ||
|
|
e07e7d03eb | ||
|
|
a2f40306b8 | ||
|
|
288d5ff2bc | ||
|
|
1ab292e335 | ||
|
|
af53f393bf | ||
|
|
23b8c44d39 | ||
|
|
3ea39835b1 | ||
|
|
ff2c26f7eb | ||
|
|
7fc830394d | ||
|
|
8abe21bccb | ||
|
|
bb6c922eab | ||
|
|
c4f4745a83 | ||
|
|
f8257d2756 | ||
|
|
45f06e25f0 | ||
|
|
1f59ab5370 | ||
|
|
37e053aa37 | ||
|
|
da36159669 | ||
|
|
d9b2b51558 | ||
|
|
5675faf621 | ||
|
|
4b359a8fbc | ||
|
|
a91b9a3457 | ||
|
|
2650d81a49 | ||
|
|
6ba61fc41e | ||
|
|
9c312ecd94 | ||
|
|
9d60a87855 | ||
|
|
863ecbd6d4 | ||
|
|
f35a81a862 | ||
|
|
b346949e97 | ||
|
|
85fcb20e43 | ||
|
|
070a8ce62a | ||
|
|
701282e2db | ||
|
|
8e95892b04 | ||
|
|
d94997a1dc | ||
|
|
52ca21feec | ||
|
|
3cf6696dad | ||
|
|
c8e1d300bf | ||
|
|
9d2a0f5d5b | ||
|
|
87d1843bff | ||
|
|
1c46bbe1a6 | ||
|
|
8357b525f2 | ||
|
|
bf72bc349a | ||
|
|
fcdea2931b | ||
|
|
d3a592764c | ||
|
|
93006bc348 | ||
|
|
3ba785630b | ||
|
|
b1d7b7b15f | ||
|
|
5827e45f52 | ||
|
|
9468b24b62 | ||
|
|
7e2633a5dc |
30
.github/ISSUE_TEMPLATE.md
vendored
30
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,5 +1,3 @@
|
||||
> 特别提示:报告 bug 前请确保你的问题是可复现的,并务必提供复现步骤,否则恕难解决。
|
||||
|
||||
If you want to ask a question, please read [some tips](https://github.com/ant-design/ant-design/blob/master/.github/CONTRIBUTING.md#do-your-homework-before-asking-a-question) first :-)
|
||||
|
||||
If you are going to report a bug, please answer the following questions, thank you!
|
||||
@@ -25,3 +23,31 @@ If you are going to report a bug, please answer the following questions, thank y
|
||||
- The version of antd(e.g. 0.12.0):
|
||||
- Your operating system and it's version(e.g. OSX 10.11.0):
|
||||
- Your browser and it's version(e.g. Chrome 48.0.0.0(64-bit)):
|
||||
|
||||
---
|
||||
|
||||
提问之前,建议先阅读[这份提示](https://github.com/ant-design/ant-design/blob/master/.github/CONTRIBUTING.md#do-your-homework-before-asking-a-question)。:-)
|
||||
|
||||
如果是报告 bug,请按照下列格式编辑问题,务必提供复现步骤,否则恕难解决,非常感谢!
|
||||
|
||||
## 你做了什么?
|
||||
|
||||
(例如,我吃了一个汉堡)
|
||||
|
||||
## 你期待的结果是:
|
||||
|
||||
(例如,我应该饱了)
|
||||
|
||||
## 实际上的结果和抱怨:
|
||||
|
||||
(例如,我还是饿的,肯定是哪里出问题了)
|
||||
|
||||
## 可重现的在线演示
|
||||
|
||||
(e.g. http://codepen.io/anon/pen/wGOWGW?editors=001)
|
||||
|
||||
## 本地环境信息
|
||||
|
||||
- antd 版本:
|
||||
- 操作系统及其版本:
|
||||
- 浏览器及其版本:
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -23,6 +23,7 @@ nohup.out
|
||||
_site
|
||||
_data
|
||||
dist
|
||||
lib
|
||||
/lib
|
||||
elasticsearch-*
|
||||
config/base.yaml
|
||||
typings
|
||||
|
||||
9
404.html
9
404.html
@@ -1,9 +0,0 @@
|
||||
<script>
|
||||
var prefix = /^\/components/.test(location.pathname) ? location.pathname.replace(/^\//, '').split('/').join('-') : '';
|
||||
var scrollToString = location.hash ? '?scrollTo=' + prefix + location.hash : '';
|
||||
if (location.pathname === '/changelog') {
|
||||
location.href = '/#/docs/react/changelog' + scrollToString;
|
||||
} else {
|
||||
location.href = '/#' + location.pathname.replace(/\/$/, '') + scrollToString;
|
||||
}
|
||||
</script>
|
||||
68
CHANGELOG.md
68
CHANGELOG.md
@@ -9,11 +9,65 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
## 1.3.2
|
||||
|
||||
`2016-06-06`
|
||||
|
||||
- 修复全局模式下引用 antd,IE8 环境报错的问题。 [#1970](https://github.com/ant-design/ant-design/issues/1970)
|
||||
|
||||
## 1.3.1
|
||||
|
||||
`2016-06-06`
|
||||
|
||||
- 修复 `Message` `Notification` 找不到的问题。 [#1968](https://github.com/ant-design/ant-design/issues/1968)
|
||||
|
||||
## 1.3.0
|
||||
|
||||
`2016-06-02`
|
||||
|
||||
- Transfer 组件增加 `rowKey` 属性,可自定义数据源主键。 [#1900](https://github.com/ant-design/ant-design/issues/1900)
|
||||
- Tag 组件 `default` 类型的样式增加边框,防止淹没在背景中。 [#1910](https://github.com/ant-design/ant-design/issues/1910)
|
||||
- Table
|
||||
- 修复筛选为单选时仍旧展示多选框的问题。 [#1880](https://github.com/ant-design/ant-design/issues/1880)
|
||||
- 修复 fixed left 的固定列会覆盖 rowSelection 的 Checkbox 的问题。 [#1829](https://github.com/ant-design/ant-design/issues/1829)
|
||||
- 升级 rc-table 依赖
|
||||
- 修复了 fixed 列中数据重复展示以及一些错位问题。 [#1898](https://github.com/ant-design/ant-design/issues/1898)
|
||||
- `dataIndex` 支持内嵌属性的写法。 [react-component/table#46](https://github.com/react-component/table/issues/46)
|
||||
- 修复了 v1.2.0 新增加的组件属性的 TypeScript 定义。 [#1933](https://github.com/ant-design/ant-design/issues/1933)
|
||||
- Form 修复 label中冒号的国际化问题,采用样式实现冒号,不再需要手动输入冒号。 [#1877](https://github.com/ant-design/ant-design/issues/1877)
|
||||
- 修复 DatePicker 组件点击『此刻』失效的问题,并进行了一些代码优化。 [#1902](https://github.com/ant-design/ant-design/issues/1902)
|
||||
- 升级 rc-upload 依赖,修复了 IE10 中第二次上传同一文件不触发 `onChange` 的问题。 [058af3c](https://github.com/ant-design/ant-design/commit/b15a4e3165be5e4db995d3fe75d4d557c7f21c61)
|
||||
- 文档使用 [bisheng](https://github.com/benjycui/bisheng) 重构。
|
||||
|
||||
## 1.2.1
|
||||
|
||||
`2016-05-27`
|
||||
|
||||
- 修复一个 Select 组件的文字重复问题。
|
||||
|
||||
## 1.2.0
|
||||
|
||||
`2016-05-26`
|
||||
|
||||
- Input 组件的文档现在和 Form 分离。 [3c98d3](https://github.com/ant-design/ant-design/commit/3c98d3f80f4ec80066756adc3b4108141d4383ca)
|
||||
- Affix
|
||||
- 新增了 `onChange` 属性。当固定状态改变时回调 [#1777](https://github.com/ant-design/ant-design/issues/1777)
|
||||
- 找回了从 affixStyle 中走失的 `width` 属性,修复固定后错位的问题。[#1820](https://github.com/ant-design/ant-design/issues/1820)
|
||||
- Table
|
||||
- 修复了 Table 组件的分页相关的一系列问题 [#1669](https://github.com/ant-design/ant-design/issues/1669) [#1842](https://github.com/ant-design/ant-design/issues/1842)
|
||||
- 修复了当有列固定在左边时,选择框不显示的问题 [#1829](https://github.com/ant-design/ant-design/issues/1829)
|
||||
- 修复了当 Checkbox 的 label 为数字 0 时, label 不显示的问题 [#1811](https://github.com/ant-design/ant-design/issues/1811)
|
||||
- 修复了 Tag 组件为 closeable 时,内部链接无法点击的问题 [#1862](https://github.com/ant-design/ant-design/issues/1862)
|
||||
- Tab 组件新增 `hideAdd` 属性,用于关闭右边的添加按钮 [#1750](https://github.com/ant-design/ant-design/issues/1750)
|
||||
- 修复了一个在某些情况下找不到 `normalize.css/normalize.css` 文件的问题。[ant-design/antd-init#52](https://github.com/ant-design/antd-init/issues/52)
|
||||
- 修复构建文件在 IE8 下报错的问题。[#1804](https://github.com/ant-design/ant-design/issues/1804)
|
||||
- 更新了第三方依赖。
|
||||
|
||||
## 1.1.0
|
||||
|
||||
`2016-05-18`
|
||||
|
||||
- Cascader 的 `displayRender` 方法增加了 `selectedOptions` 参数,以支持输入框中自定义节点。[#1726](https://github.com/ant-design/ant-design/issues/1726)
|
||||
- Cascader 的选择框支持自定义渲染节点,并给 `displayRender` 方法增加了 `selectedOptions` 参数。[#1726](https://github.com/ant-design/ant-design/issues/1726)
|
||||
- Input.Group 新增 `size` 属性,可设置控件尺寸。[#1732](https://github.com/ant-design/ant-design/issues/1732)
|
||||
- Layout 新增常用布局:侧边导航展开收起模式。[#1643](https://github.com/ant-design/ant-design/issues/1643)
|
||||
- Transfer 支持自定义渲染行数据。[#1664](https://github.com/ant-design/ant-design/issues/1664)
|
||||
@@ -21,8 +75,10 @@ timeline: true
|
||||
- Table
|
||||
- 修复 `filter` 过滤数据后显示错误分页的问题。[#1669](https://github.com/ant-design/ant-design/issues/1669)
|
||||
- 修复 `pagination` 不指定时显示错误分页的问题。[#1683](https://github.com/ant-design/ant-design/issues/1683)
|
||||
- 修复 Form 搜索输入框样式问题。[7b7f846](https://github.com/ant-design/ant-design/commit/7b7f8461611e53f4f96ae8d64d37fe28ee8d2553)
|
||||
- 修复 Modal 的关闭按钮获得焦点时的样式问题。[#1668](https://github.com/ant-design/ant-design/issues/1668)
|
||||
- Modal
|
||||
- 修复弹出时背景依然跟随滚动的问题。[#1751](https://github.com/ant-design/ant-design/issues/1751)
|
||||
- 修复关闭按钮获得焦点时的样式问题。[#1668](https://github.com/ant-design/ant-design/issues/1668)
|
||||
- 将搜索输入框相关样式移到 Input 组件下。[7b7f846](https://github.com/ant-design/ant-design/commit/7b7f8461611e53f4f96ae8d64d37fe28ee8d2553)
|
||||
- 修复 Select 获得焦点时的样式问题。[#1684](https://github.com/ant-design/ant-design/issues/1684)
|
||||
- 修复 TreeSelect 占位符样式问题。[#1657](https://github.com/ant-design/ant-design/issues/1657)
|
||||
- 修复了类型定义以更好地支持 `TypeScript`。[#1696](https://github.com/ant-design/ant-design/pull/1696) [@xujihui1985](https://github.com/xujihui1985)
|
||||
@@ -73,8 +129,10 @@ timeline: true
|
||||
|
||||
- 完全移除了 `0.12` 中废弃的 Validation 组件,可以直接 import [rc-form-validation](https://github.com/react-component/form-validation) 用以代替。[#1096](https://github.com/ant-design/ant-design/issues/1096)
|
||||
- Breadcrumb.Item 的 `href` 属性被移除,请直接用 `a` 标签包裹可点击的内容。
|
||||
- Modal 移除 了`align` 属性,现在可以使用 `style` 属性调整位置。
|
||||
- Modal 移除了 `align` 属性,现在可以使用 `style` 属性调整位置。
|
||||
- `Modal.confirm` 等方法的配置项 `iconClassName` 重命名为 `iconType`。
|
||||
- Select 移除了 `onChange` 中的 `label` 参数,新增了 `labelInValue` 属性。[#1695](https://github.com/ant-design/ant-design/issues/1695)
|
||||
- 移除了 `import { Form } from 'antd/lib/form';` 的用法,应统一为 `import { Form } from 'antd';` 或 `import Form from 'antd/lib/form';`。
|
||||
|
||||
#### 有兼容提示的改动
|
||||
|
||||
@@ -87,7 +145,6 @@ timeline: true
|
||||
- Progress.Circle 使用方式改为 `<Progress type="circle" />`。
|
||||
- Spin 的 `spining` 属性更正为 `spinning`。
|
||||
- Alert 的 type `warn` 重命名为 `warning`。[#1225](https://github.com/ant-design/ant-design/issues/1225)
|
||||
- `notification.warn`、`message.warn` 修改为 `notification.warning` 和 `message.warning`。[#1225](https://github.com/ant-design/ant-design/issues/1225)
|
||||
- Tree 的 `onExpand` 参数从 `function(node, expanded, expandedKeys)` 调整为 `function(expandedKeys, {expanded, node})`。
|
||||
|
||||
### Bug 修复
|
||||
@@ -106,6 +163,7 @@ timeline: true
|
||||
### 其他改进
|
||||
|
||||
- 样式变量梳理,去除了部分无用的变量,另外还有大量样式细节问题修复。
|
||||
- 依赖的 normalize.css 升级到 [4.x](https://github.com/necolas/normalize.css/blob/4.1.1/CHANGELOG.md)。
|
||||
- 使用 ES2016 classes 重构了代码。[@waywardmonkeys](https://github.com/waywardmonkeys)
|
||||
- Popover、Popconfirm 和 Tooltip 组件根据不同的弹出位置有了更精准方向的弹出动画。
|
||||
- 补充 Select TreeSelect Switch Radio Checkbox 等组件的 `focus` 表现,增强表单组件的可用性。[#1358](https://github.com/ant-design/ant-design/issues/1358)
|
||||
|
||||
53
README.md
53
README.md
@@ -8,6 +8,10 @@
|
||||
|
||||
An enterprise-class UI design language and React-based implementation.
|
||||
|
||||
## :loudspeaker: Document Translation Recruitment
|
||||
|
||||
We are now working on translate components document to English, and we need some translator and reviewer. https://github.com/ant-design/ant-design/issues/1471
|
||||
|
||||
## Features
|
||||
|
||||
- An enterprise-class design language and high quality UI style.
|
||||
@@ -20,7 +24,7 @@ An enterprise-class UI design language and React-based implementation.
|
||||
npm install antd
|
||||
```
|
||||
|
||||
## Usage example
|
||||
## Usage
|
||||
|
||||
### Use prebuilt bundle
|
||||
|
||||
@@ -29,7 +33,7 @@ import { DatePicker } from 'antd';
|
||||
ReactDOM.render(<DatePicker />, mountNode);
|
||||
```
|
||||
|
||||
Import style:
|
||||
And import style manually:
|
||||
|
||||
```jsx
|
||||
import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
|
||||
@@ -37,23 +41,28 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
|
||||
|
||||
### Use modularized antd
|
||||
|
||||
```jsx
|
||||
import DatePicker from 'antd/lib/date-picker'; // just for js
|
||||
```
|
||||
- Use [babel-plugin-antd](https://github.com/ant-design/babel-plugin-antd) (Recommended)
|
||||
|
||||
We recommend use [babel-plugin-antd](https://github.com/ant-design/babel-plugin-antd) with config:
|
||||
```js
|
||||
// .babelrc
|
||||
{
|
||||
"plugins": [["antd", { style: "css" }]]
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
['antd', {
|
||||
style: 'css'
|
||||
}]
|
||||
```
|
||||
Then you can import components from antd directly.
|
||||
|
||||
```jsx
|
||||
import { DatePicker } from 'antd'; // automatically parse and require js and css modularly
|
||||
```
|
||||
```jsx
|
||||
// import js and css modularly, parsed by babel-plugin-antd
|
||||
import { DatePicker } from 'antd';
|
||||
```
|
||||
|
||||
- Manually import
|
||||
|
||||
```jsx
|
||||
import DatePicker from 'antd/lib/date-picker'; // just for js
|
||||
```
|
||||
|
||||
No need to import style manually.
|
||||
|
||||
## Browser Support
|
||||
|
||||
@@ -63,9 +72,15 @@ Normal browsers and Internet Explorer 8+.
|
||||
|
||||
## TypeScript
|
||||
|
||||
```js
|
||||
///<reference path='./node_modules/antd/type-definitions/antd.d.ts'/>
|
||||
...
|
||||
tsconfig.json
|
||||
|
||||
```
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node",
|
||||
"jsx": "preserve"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Links
|
||||
@@ -81,7 +96,7 @@ Normal browsers and Internet Explorer 8+.
|
||||
- [Developer Instruction](https://github.com/ant-design/ant-design/wiki/Development)
|
||||
- [Versioning Release Note](https://github.com/ant-design/ant-design/wiki/%E7%89%88%E6%9C%AC%E5%8F%91%E5%B8%83%E6%B5%81%E7%A8%8B)
|
||||
- [FAQ](https://github.com/ant-design/ant-design/wiki/FAQ)
|
||||
|
||||
- [CodePen boilerplate](http://codepen.io/anon/pen/wGOWGW?editors=001) for bug reports
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
24
components/_util/isCssAnimationSupported.js
Normal file
24
components/_util/isCssAnimationSupported.js
Normal file
@@ -0,0 +1,24 @@
|
||||
let animation;
|
||||
|
||||
function isCssAnimationSupported() {
|
||||
if (animation !== undefined) {
|
||||
return animation;
|
||||
}
|
||||
const domPrefixes = 'Webkit Moz O ms Khtml'.split(' ');
|
||||
const elm = document.createElement('div');
|
||||
if (elm.style.animationName !== undefined) {
|
||||
animation = true;
|
||||
}
|
||||
if (animation !== undefined) {
|
||||
for (let i = 0; i < domPrefixes.length; i++) {
|
||||
if (elm.style[`${domPrefixes[i]}AnimationName`] !== undefined) {
|
||||
animation = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
animation = animation || false;
|
||||
return animation;
|
||||
}
|
||||
|
||||
export default isCssAnimationSupported;
|
||||
21
components/affix/demo/on-change.md
Normal file
21
components/affix/demo/on-change.md
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
order: 3
|
||||
title: 固定状态改变的回调
|
||||
---
|
||||
|
||||
可以获得是否固定的状态。
|
||||
|
||||
````jsx
|
||||
import { Affix, Button } from 'antd';
|
||||
|
||||
|
||||
const onChange = function (affixed) {
|
||||
console.log(affixed); // true or false
|
||||
};
|
||||
|
||||
ReactDOM.render(
|
||||
<Affix offsetTop={120} onChange={onChange}>
|
||||
<Button>固定在距离顶部 120px 的位置</Button>
|
||||
</Affix>
|
||||
, mountNode);
|
||||
````
|
||||
@@ -39,6 +39,10 @@ export default class Affix extends React.Component {
|
||||
offsetBottom: React.PropTypes.number,
|
||||
}
|
||||
|
||||
static defaultProps = {
|
||||
onChange() {},
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
@@ -51,7 +55,6 @@ export default class Affix extends React.Component {
|
||||
|
||||
// Backwards support
|
||||
offsetTop = offsetTop || offset;
|
||||
|
||||
const scrollTop = getScroll(window, true);
|
||||
const elemOffset = getOffset(ReactDOM.findDOMNode(this));
|
||||
const elemSize = {
|
||||
@@ -76,8 +79,9 @@ export default class Affix extends React.Component {
|
||||
position: 'fixed',
|
||||
top: offsetTop,
|
||||
left: elemOffset.left,
|
||||
width: ReactDOM.findDOMNode(this).offsetWidth,
|
||||
},
|
||||
});
|
||||
}, () => this.props.onChange(!!this.state.affixStyle));
|
||||
}
|
||||
} else if (scrollTop < elemOffset.top + elemSize.height + offsetBottom - window.innerHeight &&
|
||||
offsetMode.bottom) {
|
||||
@@ -88,13 +92,14 @@ export default class Affix extends React.Component {
|
||||
position: 'fixed',
|
||||
bottom: offsetBottom,
|
||||
left: elemOffset.left,
|
||||
width: ReactDOM.findDOMNode(this).offsetWidth,
|
||||
},
|
||||
});
|
||||
}, () => this.props.onChange(!!this.state.affixStyle));
|
||||
}
|
||||
} else if (this.state.affixStyle) {
|
||||
this.setState({
|
||||
affixStyle: null,
|
||||
});
|
||||
}, () => this.props.onChange(!!this.state.affixStyle));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,3 +20,4 @@ english: Affix
|
||||
|-------------|----------------|--------------------|--------------|
|
||||
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | Number | |
|
||||
| offsetBottom | 距离窗口底部达到指定偏移量后触发 | Number | |
|
||||
| onChange | 固定状态改变时触发的回调函数 | Function | 无 |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { createElement } from 'react';
|
||||
import { findDOMNode } from 'react-dom';
|
||||
import { isCssAnimationSupported } from 'css-animation';
|
||||
import isCssAnimationSupported from '../_util/isCssAnimationSupported';
|
||||
|
||||
function getNumberArray(num) {
|
||||
return num ?
|
||||
@@ -38,7 +38,7 @@ export default class ScrollNumber extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (!isCssAnimationSupported) {
|
||||
if (!isCssAnimationSupported()) {
|
||||
findDOMNode(this).className += ' not-support-css-animation';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,15 @@ export default class Button extends React.Component {
|
||||
icon: React.PropTypes.string,
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (this.clickedTimeout) {
|
||||
clearTimeout(this.clickedTimeout);
|
||||
}
|
||||
if (this.timeout) {
|
||||
clearTimeout(this.timeout);
|
||||
}
|
||||
}
|
||||
|
||||
clearButton = (button) => {
|
||||
button.className = button.className.replace(` ${this.props.prefixCls}-clicked`, '');
|
||||
}
|
||||
@@ -50,7 +59,7 @@ export default class Button extends React.Component {
|
||||
// Add click effect
|
||||
const buttonNode = findDOMNode(this);
|
||||
this.clearButton(buttonNode);
|
||||
setTimeout(() => buttonNode.className += ` ${this.props.prefixCls}-clicked`, 10);
|
||||
this.clickedTimeout = setTimeout(() => buttonNode.className += ` ${this.props.prefixCls}-clicked`, 10);
|
||||
clearTimeout(this.timeout);
|
||||
this.timeout = setTimeout(() => this.clearButton(buttonNode), 500);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ title: Button
|
||||
|
||||
To trigger an operation.
|
||||
|
||||
## Occasion
|
||||
## When To Use
|
||||
|
||||
A button means an operation(or a series of operations). Click a button will trigger corresponding business logic.
|
||||
|
||||
|
||||
@@ -35,6 +35,20 @@
|
||||
color: @color;
|
||||
background-color: @background;
|
||||
border-color: @border;
|
||||
// a inside Button which only work in Chrome
|
||||
// http://stackoverflow.com/a/17253457
|
||||
> a:only-child {
|
||||
color: currentColor;
|
||||
&:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.button-group-base(@btnClassName) {
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
---
|
||||
order: 0
|
||||
title: 基本
|
||||
title:
|
||||
zh-CN: 基本
|
||||
en-US: Basic
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
||||
一个通用的日历面板,支持年/月切换。
|
||||
|
||||
|
||||
## en-US
|
||||
|
||||
A basic calendar component with Year/Month switch.
|
||||
|
||||
````jsx
|
||||
import { Calendar } from 'antd';
|
||||
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
---
|
||||
order: 10
|
||||
title: 卡片模式
|
||||
title:
|
||||
zh-CN: 卡片模式
|
||||
en-US: Card
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
||||
用于嵌套在空间有限的容器中。
|
||||
|
||||
## en-US
|
||||
|
||||
Nested inside a container element for rendering in limited space.
|
||||
|
||||
````jsx
|
||||
import { Calendar } from 'antd';
|
||||
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
---
|
||||
order: 1
|
||||
title: 自定义渲染
|
||||
title:
|
||||
zh-CN: 自定义渲染
|
||||
en-US: Custom Render
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
||||
用 `dateCellRender` 和 `monthCellRender` 函数来自定义需要渲染的数据。
|
||||
|
||||
## en-US
|
||||
|
||||
This component can be rendered by using `dateCellRender` and `monthCellRender` with the data you need.
|
||||
|
||||
````jsx
|
||||
import { Calendar } from 'antd';
|
||||
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
---
|
||||
order: 4
|
||||
title: 国际化
|
||||
title:
|
||||
zh-CN: 国际化
|
||||
en-US: locale
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
||||
通过 `locale` 配置时区、语言等, 默认支持 en_US, zh_CN
|
||||
|
||||
## en_US
|
||||
|
||||
To set the properties like time zone, language and etc. en_US, zh_CN are supported by default.
|
||||
|
||||
````jsx
|
||||
import { Calendar } from 'antd';
|
||||
import enUS from 'antd/lib/calendar/locale/en_US';
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
---
|
||||
order: 2
|
||||
title: 通知事项日历演示
|
||||
title:
|
||||
zh-CN: 通知事项日历演示
|
||||
en-US: A demo of Notice Calendar
|
||||
---
|
||||
|
||||
一个复杂的应用实例。
|
||||
## zh-CN
|
||||
|
||||
一个复杂的应用示例。
|
||||
|
||||
## en_US
|
||||
|
||||
A complex application.
|
||||
|
||||
````jsx
|
||||
import { Calendar } from 'antd';
|
||||
|
||||
33
components/calendar/index.en-US.md
Normal file
33
components/calendar/index.en-US.md
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
category: Components
|
||||
type: Presentation
|
||||
cols: 1
|
||||
title: Calendar
|
||||
---
|
||||
|
||||
When to use container for displaying data in calendar form.
|
||||
|
||||
## When to use
|
||||
|
||||
When data is in the form of date, such as schedule, timetable, prices calendar, Lunar calendar. This component also supports Year/Month switch.
|
||||
|
||||
## API
|
||||
|
||||
```html
|
||||
<Calendar
|
||||
dateCellRender={dateCellRender}
|
||||
monthCellRender={monthCellRender}
|
||||
onPanelChange={onPanelChange}
|
||||
/>
|
||||
```
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|--------------|----------------|----------|--------------|
|
||||
| value | set date | Date | current date |
|
||||
| defaultValue | set default date | Date | current date |
|
||||
| mode | can be set to month or year | string | month |
|
||||
| fullscreen | to set whether full-screen display | bool | true |
|
||||
| dateCellRender | to set the way of renderer the date cell| function([GregorianCalendar](https://github.com/yiminghe/gregorian-calendar/))| - |
|
||||
| monthCellRender | to set the way of renderer the month cell | function([GregorianCalendar](https://github.com/yiminghe/gregorian-calendar/)) | - |
|
||||
| locale | set locale | object | [defualt](https://github.com/ant-design/ant-design/issues/424) |
|
||||
| onPanelChange| the callback when panel change | function(date, mode) | - |
|
||||
@@ -1,18 +1,26 @@
|
||||
---
|
||||
order: 0
|
||||
title: 典型卡片
|
||||
title:
|
||||
zh-CN: 典型卡片
|
||||
en-US: Basic card
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
||||
包含标题、内容、操作区域。
|
||||
|
||||
## en-US
|
||||
|
||||
A basic card containing a title, content and an extra corner content.
|
||||
|
||||
````jsx
|
||||
import { Card } from 'antd';
|
||||
|
||||
ReactDOM.render(
|
||||
<Card title="卡片标题" extra={<a href="#">更多</a>} style={{ width: 300 }}>
|
||||
<p>卡片的内容</p>
|
||||
<p>卡片的内容</p>
|
||||
<p>卡片的内容</p>
|
||||
<Card title="Card title" extra={<a href="#">More</a>} style={{ width: 300 }}>
|
||||
<p>Card content</p>
|
||||
<p>Card content</p>
|
||||
<p>Card content</p>
|
||||
</Card>
|
||||
, mountNode);
|
||||
````
|
||||
|
||||
@@ -1,19 +1,27 @@
|
||||
---
|
||||
order: 1
|
||||
title: 无边框
|
||||
title:
|
||||
zh-CN: 无边框
|
||||
en-US: No border
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
||||
在灰色背景上使用无边框的卡片。
|
||||
|
||||
## en-US
|
||||
|
||||
A borderless card on a gray background.
|
||||
|
||||
````jsx
|
||||
import { Card } from 'antd';
|
||||
|
||||
ReactDOM.render(
|
||||
<div style={{ background: '#ECECEC', padding: '30px' }}>
|
||||
<Card title="卡片标题" bordered={false} style={{ width: 300 }}>
|
||||
<p>卡片的内容</p>
|
||||
<p>卡片的内容</p>
|
||||
<p>卡片的内容</p>
|
||||
<Card title="Card title" bordered={false} style={{ width: 300 }}>
|
||||
<p>Card content</p>
|
||||
<p>Card content</p>
|
||||
<p>Card content</p>
|
||||
</Card>
|
||||
</div>
|
||||
, mountNode);
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
---
|
||||
order: 4
|
||||
title: 栅格卡片
|
||||
title:
|
||||
zh-CN: 栅格卡片
|
||||
en-US: Grid card
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
||||
在系统概览页面常常和栅格进行配合。
|
||||
|
||||
## en-US
|
||||
|
||||
Cards usually cooperate with grid layout in overview page.
|
||||
|
||||
````jsx
|
||||
import { Card, Col, Row } from 'antd';
|
||||
|
||||
@@ -12,13 +20,13 @@ ReactDOM.render(
|
||||
<div style={{ background: '#ECECEC', padding: '30px' }}>
|
||||
<Row>
|
||||
<Col span="8">
|
||||
<Card title="卡片标题" bordered={false}>卡片的内容</Card>
|
||||
<Card title="Card title" bordered={false}>Card content</Card>
|
||||
</Col>
|
||||
<Col span="8">
|
||||
<Card title="卡片标题" bordered={false}>卡片的内容</Card>
|
||||
<Card title="Card title" bordered={false}>Card content</Card>
|
||||
</Col>
|
||||
<Col span="8">
|
||||
<Card title="卡片标题" bordered={false}>卡片的内容</Card>
|
||||
<Card title="Card title" bordered={false}>Card content</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
@@ -26,7 +34,7 @@ ReactDOM.render(
|
||||
````
|
||||
|
||||
````css
|
||||
/* 增加 16px 栅格间距 */
|
||||
/* Increase grid spacing of 16px */
|
||||
.code-box-demo .row {
|
||||
margin-left: -8px;
|
||||
margin-right: -8px;
|
||||
|
||||
@@ -1,15 +1,23 @@
|
||||
---
|
||||
order: 5
|
||||
title: 预加载的卡片
|
||||
title:
|
||||
zh-CN: 预加载的卡片
|
||||
en-US: Loading card
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
||||
数据读入前会有文本块样式。
|
||||
|
||||
## en-US
|
||||
|
||||
Shows a loading indicator while the contents of the card are being fetched.
|
||||
|
||||
````jsx
|
||||
import { Card } from 'antd';
|
||||
|
||||
ReactDOM.render(
|
||||
<Card loading title="卡片标题" style={{ width: '34%' }}>
|
||||
<Card loading title="Card title" style={{ width: '34%' }}>
|
||||
Whatever content
|
||||
</Card>
|
||||
, mountNode);
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
---
|
||||
order: 3
|
||||
title: 更灵活的内容展示
|
||||
title:
|
||||
zh-CN: 更灵活的内容展示
|
||||
en-US: Customized content
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
||||
可以调整默认边距,设定宽度。
|
||||
|
||||
## en-US
|
||||
|
||||
Customizing default width and margin.
|
||||
|
||||
|
||||
````jsx
|
||||
import { Card } from 'antd';
|
||||
|
||||
@@ -14,7 +23,7 @@ ReactDOM.render(
|
||||
<img alt="example" width="100%" src="https://os.alipayobjects.com/rmsportal/QBnOOoLaAfKPirc.png" />
|
||||
</div>
|
||||
<div className="custom-card">
|
||||
<h3>欧美街拍</h3>
|
||||
<h3>Europe Street beat</h3>
|
||||
<p>www.instagram.com</p>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
@@ -1,18 +1,26 @@
|
||||
---
|
||||
order: 2
|
||||
title: 简洁卡片
|
||||
title:
|
||||
zh-CN: 简洁卡片
|
||||
en-US: Simple card
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
||||
只包含内容区域。
|
||||
|
||||
## en-US
|
||||
|
||||
A simple card only containing a content area.
|
||||
|
||||
````jsx
|
||||
import { Card } from 'antd';
|
||||
|
||||
ReactDOM.render(
|
||||
<Card style={{ width: 300 }}>
|
||||
<p>卡片的内容</p>
|
||||
<p>卡片的内容</p>
|
||||
<p>卡片的内容</p>
|
||||
<p>Card content</p>
|
||||
<p>Card content</p>
|
||||
<p>Card content</p>
|
||||
</Card>
|
||||
, mountNode);
|
||||
````
|
||||
|
||||
24
components/card/index.en-US.md
Normal file
24
components/card/index.en-US.md
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
category: Components
|
||||
type: Presentation
|
||||
title: Card
|
||||
---
|
||||
|
||||
Common card container.
|
||||
|
||||
## When to use
|
||||
|
||||
The most basic card container. You can use it to contain text, lists, pictures and paragraphs.
|
||||
|
||||
## API
|
||||
|
||||
```html
|
||||
<Card title="Card title">Card content</Card>
|
||||
```
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
|----------|----------------|----------|--------------|
|
||||
| title | Card title | React.Element | - |
|
||||
| extra | Corner content of card | React.Element | - |
|
||||
| bordered | Whether a border is set | Boolean | true |
|
||||
| bodyStyle | Custom style for content area | Object | - |
|
||||
@@ -1,9 +1,8 @@
|
||||
---
|
||||
category: Components
|
||||
chinese: 卡片
|
||||
type: Presentation
|
||||
cols: 1
|
||||
english: Card
|
||||
title: Card
|
||||
subtitle: 卡片
|
||||
---
|
||||
|
||||
通用卡片容器。
|
||||
@@ -17,7 +17,7 @@ export default class Checkbox extends React.Component {
|
||||
return (
|
||||
<label className={classString} style={style}>
|
||||
<RcCheckbox {...restProps} prefixCls={prefixCls} children={null} />
|
||||
{children ? <span>{children}</span> : null}
|
||||
{children !== undefined ? <span>{children}</span> : null}
|
||||
</label>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -50,25 +50,6 @@ export default function createPicker(TheCalendar) {
|
||||
'ant-calendar-month': MonthCalendar === TheCalendar,
|
||||
});
|
||||
|
||||
let pickerChangeHandler = {
|
||||
onChange: this.handleChange,
|
||||
};
|
||||
|
||||
let calendarHandler = {
|
||||
onOk: this.handleChange,
|
||||
};
|
||||
|
||||
if (props.showTime) {
|
||||
pickerChangeHandler.onChange = (value) => {
|
||||
// Click clear button
|
||||
if (value === null) {
|
||||
this.handleChange(value);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
calendarHandler = {};
|
||||
}
|
||||
|
||||
const calendar = (
|
||||
<TheCalendar
|
||||
formatter={props.getFormatter()}
|
||||
@@ -80,7 +61,7 @@ export default function createPicker(TheCalendar) {
|
||||
dateInputPlaceholder={placeholder}
|
||||
prefixCls="ant-calendar"
|
||||
className={calendarClassName}
|
||||
{...calendarHandler} />
|
||||
/>
|
||||
);
|
||||
|
||||
// default width for showTime
|
||||
@@ -102,7 +83,7 @@ export default function createPicker(TheCalendar) {
|
||||
getCalendarContainer={props.getCalendarContainer}
|
||||
onOpen={props.toggleOpen}
|
||||
onClose={props.toggleOpen}
|
||||
{...pickerChangeHandler}
|
||||
onChange={this.handleChange}
|
||||
>
|
||||
{
|
||||
({ value }) => {
|
||||
|
||||
@@ -35,6 +35,7 @@ english: DatePicker
|
||||
| size | 输入框大小,`large` 高度为 32px,`small` 为 22px,默认是 28px | string | 无 |
|
||||
| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/issues/424) |
|
||||
| onOk | 点击确定按钮的回调 | function(Date value) | 无 |
|
||||
| toggleOpen | 弹出日历和关闭日历的回调 | function(status) | 无 |
|
||||
| getCalendarContainer | 定义浮层的容器,默认为 body 上新建 div | function(trigger) | 无 |
|
||||
| showTime | 增加时间选择功能 | Object or Boolean | [TimePicker Options](http://ant.design/components/time-picker/#api) |
|
||||
|
||||
@@ -45,6 +46,7 @@ english: DatePicker
|
||||
| value | 日期 | string or Date | 无 |
|
||||
| defaultValue | 默认日期 | string or Date | 无 |
|
||||
| format | 展示的日期格式,配置参考 [GregorianCalendarFormat](https://github.com/yiminghe/gregorian-calendar-format) | string | "yyyy-MM" |
|
||||
| disabledDate | 不可选择的日期 | function | 无 |
|
||||
| onChange | 时间发生变化的回调,发生在用户选择时间时 | function(Date value) | 无 |
|
||||
| disabled | 禁用 | bool | false |
|
||||
| style | 自定义输入框样式 | object | {} |
|
||||
|
||||
@@ -128,5 +128,6 @@
|
||||
.@{calendar-prefix-cls}-today-btn {
|
||||
margin: 8px 12px;
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ export default function wrapPicker(Picker, defaultFormat) {
|
||||
popupStyle: {},
|
||||
onChange() {},
|
||||
onOk() {},
|
||||
toggleOpen() {},
|
||||
locale: {},
|
||||
align: {
|
||||
offset: [0, -9],
|
||||
@@ -69,6 +70,7 @@ export default function wrapPicker(Picker, defaultFormat) {
|
||||
this.setState({
|
||||
open: e.open,
|
||||
});
|
||||
this.props.toggleOpen(e);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -18,8 +18,10 @@ english: Dropdown
|
||||
| 成员 | 说明 | 类型 | 默认值 |
|
||||
|-------------|------------------|--------------------|--------------|
|
||||
| trigger | 触发下拉的行为 | ['click'] or ['hover'] | ['hover'] |
|
||||
| overlay | 菜单节点 | [Menu](/components/menu) | 无 |
|
||||
| overlay | 菜单 | [Menu](/components/menu) | - |
|
||||
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
|
||||
| visible | 菜单是否显示 | Bool | 无 |
|
||||
| onVisibleChange | 菜单显示状态改变时调用,参数为 { visible } | Function | - |
|
||||
|
||||
菜单可由 `antd.Menu` 取得,可设置 `onSelect` 回调,菜单还包括菜单项 `antd.Menu.Item`,分割线 `antd.Menu.Divider`。
|
||||
|
||||
@@ -29,9 +31,9 @@ english: Dropdown
|
||||
|
||||
| 成员 | 说明 | 类型 | 默认值 |
|
||||
|-------------|------------------|--------------------|--------------|
|
||||
| type | 按钮类型,和 [Button](/components/button) 一致 | String | 'default' |
|
||||
| onClick | 点击左侧按钮的回调,和 [Button](/components/button) 一致 | Function | 无 |
|
||||
| type | 按钮类型,和 [Button](/components/button) 一致 | String | 'default' |
|
||||
| onClick | 点击左侧按钮的回调,和 [Button](/components/button) 一致 | Function | - |
|
||||
| trigger | 触发下拉的行为 | "click" or "hover" | hover |
|
||||
| overlay | 菜单节点 | [Menu](/components/menu) | 无 |
|
||||
| visible | 菜单节点是否显示 | Bool | 无 |
|
||||
| onVisibleChange | 菜单节点显示状态改变时调用,参数为 {visible} | Function | 无 |
|
||||
| overlay | 菜单 | [Menu](/components/menu) | - |
|
||||
| visible | 菜单是否显示 | Bool | 无 |
|
||||
| onVisibleChange | 菜单显示状态改变时调用,参数为 { visible } | Function | - |
|
||||
|
||||
@@ -162,9 +162,15 @@ export default class FormItem extends React.Component {
|
||||
[`${props.prefixCls}-item-required`]: required,
|
||||
});
|
||||
|
||||
// remove user input colon
|
||||
let label = props.label;
|
||||
if (typeof props.label === 'string') {
|
||||
label = props.label.replace(/:|:$/, '');
|
||||
}
|
||||
|
||||
return props.label ? (
|
||||
<label htmlFor={props.id || this.getId()} className={className} key="label">
|
||||
{props.label}
|
||||
{label}
|
||||
</label>
|
||||
) : null;
|
||||
}
|
||||
|
||||
@@ -16,62 +16,62 @@ ReactDOM.render(
|
||||
<Row gutter={16}>
|
||||
<Col sm={8}>
|
||||
<FormItem
|
||||
label="搜索名称:"
|
||||
label="搜索名称"
|
||||
labelCol={{ span: 10 }}
|
||||
wrapperCol={{ span: 14 }}>
|
||||
<Input placeholder="请输入搜索名称" />
|
||||
<Input placeholder="请输入搜索名称" size="default" />
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="较长搜索名称:"
|
||||
label="较长搜索名称"
|
||||
labelCol={{ span: 10 }}
|
||||
wrapperCol={{ span: 14 }}>
|
||||
<DatePicker size="default" />
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="搜索名称:"
|
||||
label="搜索名称"
|
||||
labelCol={{ span: 10 }}
|
||||
wrapperCol={{ span: 14 }}>
|
||||
<Input placeholder="请输入搜索名称" />
|
||||
<Input placeholder="请输入搜索名称" size="default" />
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col sm={8}>
|
||||
<FormItem
|
||||
label="搜索名称:"
|
||||
label="搜索名称"
|
||||
labelCol={{ span: 10 }}
|
||||
wrapperCol={{ span: 14 }}>
|
||||
<Input placeholder="请输入搜索名称" />
|
||||
<Input placeholder="请输入搜索名称" size="default" />
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="较长搜索名称:"
|
||||
label="较长搜索名称"
|
||||
labelCol={{ span: 10 }}
|
||||
wrapperCol={{ span: 14 }}>
|
||||
<DatePicker size="default" />
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="搜索名称:"
|
||||
label="搜索名称"
|
||||
labelCol={{ span: 10 }}
|
||||
wrapperCol={{ span: 14 }}>
|
||||
<Input placeholder="请输入搜索名称" />
|
||||
<Input placeholder="请输入搜索名称" size="default" />
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col sm={8}>
|
||||
<FormItem
|
||||
label="搜索名称:"
|
||||
label="搜索名称"
|
||||
labelCol={{ span: 10 }}
|
||||
wrapperCol={{ span: 14 }}>
|
||||
<Input placeholder="请输入搜索名称" />
|
||||
<Input placeholder="请输入搜索名称" size="default" />
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="较长搜索名称:"
|
||||
label="较长搜索名称"
|
||||
labelCol={{ span: 10 }}
|
||||
wrapperCol={{ span: 14 }}>
|
||||
<DatePicker size="default" />
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="搜索名称:"
|
||||
label="搜索名称"
|
||||
labelCol={{ span: 10 }}
|
||||
wrapperCol={{ span: 14 }}>
|
||||
<Input placeholder="请输入搜索名称" />
|
||||
<Input placeholder="请输入搜索名称" size="default" />
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
@@ -52,7 +52,7 @@ let Demo = React.createClass({
|
||||
const formItems = getFieldValue('keys').map((k) => {
|
||||
return (
|
||||
<Form.Item {...formItemLayout} label={`好朋友${k}:`} key={k}>
|
||||
<Input {...getFieldProps(`name${k}`)} style={{ width: '80%', marginRight: 10 }} />
|
||||
<Input {...getFieldProps(`name${k}`)} style={{ width: '80%', marginRight: 8 }} />
|
||||
<Button onClick={() => this.remove(k)}>删除</Button>
|
||||
</Form.Item>
|
||||
);
|
||||
@@ -61,8 +61,7 @@ let Demo = React.createClass({
|
||||
<Form horizontal form={this.props.form}>
|
||||
{formItems}
|
||||
<Form.Item wrapperCol={{ span: 18, offset: 6 }}>
|
||||
<Button onClick={this.add}>新增好朋友</Button>
|
||||
|
||||
<Button onClick={this.add} style={{ marginRight: 8 }}>新增好朋友</Button>
|
||||
<Button type="primary" onClick={this.submit}>提交</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
|
||||
@@ -21,7 +21,7 @@ ReactDOM.render(
|
||||
<Form horizontal>
|
||||
<FormItem
|
||||
id="control-input"
|
||||
label="输入框:"
|
||||
label="输入框"
|
||||
labelCol={{ span: 6 }}
|
||||
wrapperCol={{ span: 14 }}>
|
||||
<Input id="control-input" placeholder="Please enter..." />
|
||||
@@ -29,7 +29,7 @@ ReactDOM.render(
|
||||
|
||||
<FormItem
|
||||
id="control-textarea"
|
||||
label="文本域:"
|
||||
label="文本域"
|
||||
labelCol={{ span: 6 }}
|
||||
wrapperCol={{ span: 14 }}>
|
||||
<Input type="textarea" id="control-textarea" rows="3" />
|
||||
@@ -37,7 +37,7 @@ ReactDOM.render(
|
||||
|
||||
<FormItem
|
||||
id="select"
|
||||
label="Select 选择器:"
|
||||
label="Select 选择器"
|
||||
labelCol={{ span: 6 }}
|
||||
wrapperCol={{ span: 14 }}>
|
||||
<Select id="select" size="large" defaultValue="lucy" style={{ width: 200 }} onChange={handleSelectChange}>
|
||||
@@ -49,7 +49,7 @@ ReactDOM.render(
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="Checkbox 多选框:"
|
||||
label="Checkbox 多选框"
|
||||
labelCol={{ span: 6 }}
|
||||
wrapperCol={{ span: 18 }} >
|
||||
<Checkbox className="ant-checkbox-vertical">选项一</Checkbox>
|
||||
@@ -58,7 +58,7 @@ ReactDOM.render(
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="Checkbox 多选框:"
|
||||
label="Checkbox 多选框"
|
||||
labelCol={{ span: 6 }}
|
||||
wrapperCol={{ span: 18 }} >
|
||||
<Checkbox className="ant-checkbox-inline">选项一</Checkbox>
|
||||
@@ -67,7 +67,7 @@ ReactDOM.render(
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="Radio 单选框:"
|
||||
label="Radio 单选框"
|
||||
labelCol={{ span: 6 }}
|
||||
wrapperCol={{ span: 18 }} >
|
||||
<RadioGroup defaultValue="b">
|
||||
|
||||
@@ -42,12 +42,12 @@ let Demo = React.createClass({
|
||||
<Form horizontal form={this.props.form}>
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="用户名:">
|
||||
label="用户名">
|
||||
<Input {...getFieldProps('username', {})} type="text" autoComplete="off" />
|
||||
</FormItem>
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="密码:">
|
||||
label="密码">
|
||||
<Input {...getFieldProps('password', {})} type="password" autoComplete="off" />
|
||||
</FormItem>
|
||||
</Form>
|
||||
|
||||
@@ -26,17 +26,17 @@ let Demo = React.createClass({
|
||||
<Form horizontal onSubmit={this.handleSubmit}>
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="用户名:">
|
||||
label="用户名">
|
||||
<p className="ant-form-text" id="userName" name="userName">大眼萌 minion</p>
|
||||
</FormItem>
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="密码:">
|
||||
label="密码">
|
||||
<Input type="password" {...getFieldProps('pass')} placeholder="请输入密码" />
|
||||
</FormItem>
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="您的性别:">
|
||||
label="您的性别">
|
||||
<RadioGroup {...getFieldProps('gender', { initialValue: 'female' })}>
|
||||
<Radio value="male">男的</Radio>
|
||||
<Radio value="female">女的</Radio>
|
||||
@@ -44,13 +44,13 @@ let Demo = React.createClass({
|
||||
</FormItem>
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="备注:"
|
||||
label="备注"
|
||||
help="随便写点什么">
|
||||
<Input type="textarea" placeholder="随便写" {...getFieldProps('remark')} />
|
||||
</FormItem>
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label={<span>卖身华府 <Tooltip title="我为秋香"><Icon type="question-circle-o" /></Tooltip> :</span>}>
|
||||
label={<span>卖身华府 <Tooltip title="我为秋香"><Icon type="question-circle-o" /></Tooltip></span>}>
|
||||
<Checkbox {...getFieldProps('agreement')}>同意</Checkbox>
|
||||
</FormItem>
|
||||
<FormItem wrapperCol={{ span: 16, offset: 6 }} style={{ marginTop: 24 }}>
|
||||
|
||||
@@ -20,12 +20,12 @@ let Demo = React.createClass({
|
||||
return (
|
||||
<Form inline onSubmit={this.handleSubmit}>
|
||||
<FormItem
|
||||
label="账户:">
|
||||
label="账户">
|
||||
<Input placeholder="请输入账户名"
|
||||
{...getFieldProps('userName')} />
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="密码:">
|
||||
label="密码">
|
||||
<Input type="password" placeholder="请输入密码"
|
||||
{...getFieldProps('password')} />
|
||||
</FormItem>
|
||||
|
||||
@@ -14,21 +14,22 @@ const Option = Select.Option;
|
||||
ReactDOM.render(
|
||||
<Form horizontal>
|
||||
<FormItem
|
||||
label="标签输入框:"
|
||||
label="标签输入框"
|
||||
labelCol={{ span: 6 }}
|
||||
wrapperCol={{ span: 16 }}>
|
||||
<Input addonBefore="Http://" defaultValue="mysite.com" id="site1" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="标签输入框:"
|
||||
label="标签输入框"
|
||||
labelCol={{ span: 6 }}
|
||||
validateStatus="success"
|
||||
wrapperCol={{ span: 16 }}>
|
||||
<Input addonBefore="Http://" addonAfter=".com" defaultValue="mysite" id="site2" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="select 标签输入框:"
|
||||
label="select 标签输入框"
|
||||
labelCol={{ span: 6 }}
|
||||
wrapperCol={{ span: 16 }}>
|
||||
<InputGroup>
|
||||
@@ -45,7 +46,7 @@ ReactDOM.render(
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="输入身份证:"
|
||||
label="输入身份证"
|
||||
labelCol={{ span: 6 }}
|
||||
wrapperCol={{ span: 16 }}>
|
||||
<InputGroup>
|
||||
@@ -65,7 +66,7 @@ ReactDOM.render(
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="电话号码:"
|
||||
label="电话号码"
|
||||
labelCol={{ span: 6 }}
|
||||
wrapperCol={{ span: 16 }}>
|
||||
<InputGroup>
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
---
|
||||
order: 0
|
||||
title: Input 输入框
|
||||
---
|
||||
|
||||
我们为 `<Input />` 输入框定义了三种尺寸(大、默认、小),具体使用详见 [API](/components/form/#input)。
|
||||
|
||||
注意: 在表单里面,我们只使用**大尺寸**, 即高度为 **32px**,作为唯一的尺寸。
|
||||
|
||||
````jsx
|
||||
import { Row, Col, Input } from 'antd';
|
||||
const InputGroup = Input.Group;
|
||||
|
||||
ReactDOM.render(
|
||||
<Row>
|
||||
<InputGroup>
|
||||
<Col span="6">
|
||||
<Input id="largeInput" size="large" placeholder="大尺寸" />
|
||||
</Col>
|
||||
<Col span="6">
|
||||
<Input id="defaultInput" placeholder="默认尺寸" />
|
||||
</Col>
|
||||
<Col span="6">
|
||||
<Input id="smallInput" placeholder="小尺寸" size="small" />
|
||||
</Col>
|
||||
</InputGroup>
|
||||
</Row>
|
||||
, mountNode);
|
||||
````
|
||||
@@ -44,7 +44,7 @@ let Demo = React.createClass({
|
||||
return (
|
||||
<Form horizontal onSubmit={this.handleSubmit} >
|
||||
<FormItem
|
||||
label="InputNumber 数字输入框:"
|
||||
label="InputNumber 数字输入框"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 10 }}>
|
||||
<InputNumber min={1} max={10} style={{ width: 100 }}
|
||||
@@ -53,7 +53,7 @@ let Demo = React.createClass({
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="我是标题:"
|
||||
label="我是标题"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 10 }}>
|
||||
<p className="ant-form-text" id="static" name="static">唧唧复唧唧木兰当户织呀</p>
|
||||
@@ -63,7 +63,7 @@ let Demo = React.createClass({
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="Switch 开关:"
|
||||
label="Switch 开关"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 10 }}
|
||||
required>
|
||||
@@ -71,7 +71,7 @@ let Demo = React.createClass({
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="Slider 滑动输入条:"
|
||||
label="Slider 滑动输入条"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 10 }}
|
||||
required>
|
||||
@@ -79,7 +79,7 @@ let Demo = React.createClass({
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="Select 选择器:"
|
||||
label="Select 选择器"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}
|
||||
required>
|
||||
@@ -93,7 +93,7 @@ let Demo = React.createClass({
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="级联选择:"
|
||||
label="级联选择"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}
|
||||
required
|
||||
@@ -102,22 +102,27 @@ let Demo = React.createClass({
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="DatePicker 日期选择框:"
|
||||
label="DatePicker 日期选择框"
|
||||
labelCol={{ span: 8 }}
|
||||
required>
|
||||
<Col span="6">
|
||||
<DatePicker {...getFieldProps('startDate')} />
|
||||
<FormItem>
|
||||
<DatePicker {...getFieldProps('startDate')} />
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col span="1">
|
||||
<p className="ant-form-split">-</p>
|
||||
</Col>
|
||||
<Col span="6">
|
||||
<DatePicker {...getFieldProps('endDate')} />
|
||||
<FormItem>
|
||||
<DatePicker {...getFieldProps('endDate')} />
|
||||
</FormItem>
|
||||
</Col>
|
||||
</FormItem>
|
||||
|
||||
|
||||
<FormItem
|
||||
label="TimePicker 时间选择器:"
|
||||
label="TimePicker 时间选择器"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}
|
||||
required>
|
||||
@@ -125,7 +130,7 @@ let Demo = React.createClass({
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="选项:"
|
||||
label="选项"
|
||||
labelCol={{ span: 8 }}>
|
||||
<RadioGroup {...getFieldProps('rg')}>
|
||||
<RadioButton value="a">选项一</RadioButton>
|
||||
@@ -135,7 +140,7 @@ let Demo = React.createClass({
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="logo图:"
|
||||
label="logo图"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}
|
||||
help="提示信息要长长长长长长长长长长长长长长">
|
||||
|
||||
@@ -112,7 +112,7 @@ let BasicDemo = React.createClass({
|
||||
<Form horizontal form={this.props.form}>
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="用户名:"
|
||||
label="用户名"
|
||||
hasFeedback
|
||||
help={isFieldValidating('name') ? '校验中...' : (getFieldError('name') || []).join(', ')}>
|
||||
<Input {...nameProps} placeholder="实时校验,输入 JasonWood 看看" />
|
||||
@@ -120,14 +120,14 @@ let BasicDemo = React.createClass({
|
||||
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="邮箱:"
|
||||
label="邮箱"
|
||||
hasFeedback>
|
||||
<Input {...emailProps} type="email" placeholder="onBlur 与 onChange 相结合" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="密码:"
|
||||
label="密码"
|
||||
hasFeedback>
|
||||
<Input {...passwdProps} type="password" autoComplete="off"
|
||||
onContextMenu={noop} onPaste={noop} onCopy={noop} onCut={noop} />
|
||||
@@ -135,7 +135,7 @@ let BasicDemo = React.createClass({
|
||||
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="确认密码:"
|
||||
label="确认密码"
|
||||
hasFeedback>
|
||||
<Input {...rePasswdProps} type="password" autoComplete="off" placeholder="两次输入密码保持一致"
|
||||
onContextMenu={noop} onPaste={noop} onCopy={noop} onCut={noop} />
|
||||
@@ -143,7 +143,7 @@ let BasicDemo = React.createClass({
|
||||
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="备注:">
|
||||
label="备注">
|
||||
<Input {...textareaProps} type="textarea" placeholder="随便写" id="textarea" name="textarea" />
|
||||
</FormItem>
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ let Demo = React.createClass({
|
||||
<Col span="18">
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="密码:">
|
||||
label="密码">
|
||||
<Input {...passProps} type="password"
|
||||
onContextMenu={noop} onPaste={noop} onCopy={noop} onCut={noop}
|
||||
autoComplete="off" id="pass"
|
||||
@@ -161,7 +161,7 @@ let Demo = React.createClass({
|
||||
<Col span="18">
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="确认密码:">
|
||||
label="确认密码">
|
||||
<Input {...rePassProps} type="password"
|
||||
onContextMenu={noop} onPaste={noop} onCopy={noop} onCut={noop}
|
||||
autoComplete="off" id="rePass"
|
||||
|
||||
@@ -6,7 +6,7 @@ title: 校验其他组件
|
||||
提供以下组件表单域的校验:`Select` `Radio` `DatePicker` `InputNumber` `Cascader`。在 submit 时使用 `validateFieldsAndScroll`,进行校验,可以自动把不在可见范围内的校验不通过的菜单域滚动进可见范围。
|
||||
|
||||
````jsx
|
||||
import { Select, Radio, Checkbox, Button, DatePicker, InputNumber, Form, Cascader, Icon } from 'antd';
|
||||
import { Select, Radio, Checkbox, Button, DatePicker, TimePicker, InputNumber, Form, Cascader, Icon } from 'antd';
|
||||
const Option = Select.Option;
|
||||
const RadioGroup = Radio.Group;
|
||||
const createForm = Form.create;
|
||||
@@ -84,12 +84,18 @@ let Demo = React.createClass({
|
||||
{
|
||||
required: true,
|
||||
type: 'date',
|
||||
message: '你的生日是什么呢?',
|
||||
message: '你的生日是什么呢?',
|
||||
}, {
|
||||
validator: this.checkBirthday,
|
||||
},
|
||||
],
|
||||
});
|
||||
const timeProps = getFieldProps('time', {
|
||||
getValueFromEvent: (value, timeString) => timeString,
|
||||
rules: [
|
||||
{ required: true, message: '请选择一个时间' },
|
||||
],
|
||||
});
|
||||
const primeNumberProps = getFieldProps('primeNumber', {
|
||||
rules: [{ validator: this.checkPrime }],
|
||||
});
|
||||
@@ -104,7 +110,7 @@ let Demo = React.createClass({
|
||||
<Form horizontal form={this.props.form}>
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="国籍:">
|
||||
label="国籍">
|
||||
<Select {...selectProps} placeholder="请选择国家" style={{ width: '100%' }}>
|
||||
<Option value="china">中国</Option>
|
||||
<Option value="use">美国</Option>
|
||||
@@ -116,7 +122,7 @@ let Demo = React.createClass({
|
||||
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="喜欢的颜色:">
|
||||
label="喜欢的颜色">
|
||||
<Select {...multiSelectProps} multiple placeholder="请选择颜色" style={{ width: '100%' }}>
|
||||
<Option value="red">红色</Option>
|
||||
<Option value="orange">橙色</Option>
|
||||
@@ -128,7 +134,7 @@ let Demo = React.createClass({
|
||||
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="性别:">
|
||||
label="性别">
|
||||
<RadioGroup {...radioProps}>
|
||||
<Radio value="male">男</Radio>
|
||||
<Radio value="female">女</Radio>
|
||||
@@ -138,7 +144,7 @@ let Demo = React.createClass({
|
||||
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="兴趣爱好:">
|
||||
label="兴趣爱好">
|
||||
<Checkbox {...getFieldProps('eat', {
|
||||
valuePropName: 'checked',
|
||||
})}>吃饭饭</Checkbox>
|
||||
@@ -152,19 +158,25 @@ let Demo = React.createClass({
|
||||
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="生日:">
|
||||
label="生日">
|
||||
<DatePicker {...birthdayProps} />
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="8~12间的质数:">
|
||||
label="选一个时间">
|
||||
<TimePicker {...timeProps} />
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="8~12间的质数">
|
||||
<InputNumber {...primeNumberProps} min={8} max={12} />
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="选择地址:">
|
||||
label="选择地址">
|
||||
<Cascader {...addressProps} options={address} />
|
||||
</FormItem>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ const FormItem = Form.Item;
|
||||
ReactDOM.render(
|
||||
<Form horizontal>
|
||||
<FormItem
|
||||
label="失败校验:"
|
||||
label="失败校验"
|
||||
labelCol={{ span: 5 }}
|
||||
wrapperCol={{ span: 12 }}
|
||||
validateStatus="error"
|
||||
@@ -27,7 +27,7 @@ ReactDOM.render(
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="警告校验:"
|
||||
label="警告校验"
|
||||
labelCol={{ span: 5 }}
|
||||
wrapperCol={{ span: 12 }}
|
||||
validateStatus="warning">
|
||||
@@ -35,7 +35,7 @@ ReactDOM.render(
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="校验中:"
|
||||
label="校验中"
|
||||
labelCol={{ span: 5 }}
|
||||
wrapperCol={{ span: 12 }}
|
||||
hasFeedback
|
||||
@@ -45,7 +45,7 @@ ReactDOM.render(
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="成功校验:"
|
||||
label="成功校验"
|
||||
labelCol={{ span: 5 }}
|
||||
wrapperCol={{ span: 12 }}
|
||||
hasFeedback
|
||||
@@ -54,7 +54,7 @@ ReactDOM.render(
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="警告校验:"
|
||||
label="警告校验"
|
||||
labelCol={{ span: 5 }}
|
||||
wrapperCol={{ span: 12 }}
|
||||
hasFeedback
|
||||
@@ -63,7 +63,7 @@ ReactDOM.render(
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="失败校验:"
|
||||
label="失败校验"
|
||||
labelCol={{ span: 5 }}
|
||||
wrapperCol={{ span: 12 }}
|
||||
hasFeedback
|
||||
@@ -73,7 +73,7 @@ ReactDOM.render(
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="Datepicker:"
|
||||
label="行内校验"
|
||||
labelCol={{ span: 5 }}
|
||||
help>
|
||||
<Col span="6">
|
||||
@@ -90,25 +90,6 @@ ReactDOM.render(
|
||||
</FormItem>
|
||||
</Col>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="Datepicker:"
|
||||
labelCol={{ span: 5 }}
|
||||
validateStatus="error"
|
||||
help>
|
||||
<Col span="6">
|
||||
<DatePicker />
|
||||
</Col>
|
||||
<Col span="1">
|
||||
<p className="ant-form-split">-</p>
|
||||
</Col>
|
||||
<Col span="6">
|
||||
<DatePicker />
|
||||
</Col>
|
||||
<Col span="19" offset="5">
|
||||
<p className="ant-form-explain">请选择正确日期</p>
|
||||
</Col>
|
||||
</FormItem>
|
||||
</Form>
|
||||
, mountNode);
|
||||
````
|
||||
|
||||
@@ -20,7 +20,7 @@ english: Form
|
||||
|
||||
表单一定会包含表单域,表单域可以是输入控件,标准表单域,标签,下拉菜单,文本域等。
|
||||
|
||||
这里我们分别封装了表单域 `<Form.Item />` 和输入控件 `<Input />`。
|
||||
这里我们封装了表单域 `<Form.Item />` 。
|
||||
|
||||
```jsx
|
||||
<Form.Item {...props}>
|
||||
@@ -28,12 +28,6 @@ english: Form
|
||||
</Form.Item>
|
||||
```
|
||||
|
||||
## Input 输入框
|
||||
|
||||
```jsx
|
||||
<Input {...props} />
|
||||
```
|
||||
|
||||
> 注:标准表单中一律使用大号控件。
|
||||
|
||||
## API
|
||||
@@ -44,11 +38,11 @@ english: Form
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|-----------|------------------------------------------|------------|-------|
|
||||
| form | 经 `Form.create()` 包装过的组件会自带 `this.props.form` 属性,直接传给 Form 即可 | object | 无 |
|
||||
| horizontal | 水平排列布局 | boolean | false |
|
||||
| inline | 行内排列布局 | boolean | false |
|
||||
| onSubmit | 数据验证成功后回调事件 | Function(e:Event) | |
|
||||
| prefixCls | 样式类名,默认为 ant-form,通常您不需要设置 | string | 'ant-form' |
|
||||
| form | 经 `Form.create()` 包装过的组件会自带 `this.props.form` 属性,直接传给 Form 即可 | object | 无 |
|
||||
| horizontal | 水平排列布局 | boolean | false |
|
||||
| inline | 行内排列布局 | boolean | false |
|
||||
| onSubmit | 数据验证成功后回调事件 | Function(e:Event) | |
|
||||
| prefixCls | 样式类名,默认为 ant-form,通常您不需要设置 | string | 'ant-form' |
|
||||
|
||||
### Form.create(options)
|
||||
|
||||
@@ -92,61 +86,33 @@ CustomizedForm = Form.create({})(CustomizedForm);
|
||||
|
||||
> 在表单中 `defaultValue` 也不应该被设置,请使用下面的 `initialValue`。
|
||||
|
||||
| 参数 | 说明 | 类型 |默认值 |
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|-----------|-----------------------------------------|-----|--------|
|
||||
| options.id | 必填输入控件唯一标志 | string | |
|
||||
| options.valuePropName | 子节点的值的属性,如 Switch 的是 'checked' | string | 'value' |
|
||||
| options.initialValue | 子节点的初始值,类型、可选值均由子节点决定 | | |
|
||||
| options.trigger | 收集子节点的值的时机 | string | 'onChange' |
|
||||
| options.getValueFromEvent | 可以把 onChange 的参数转化为控件的值,例如 DatePicker 可设为:`(date, dateString) => dateString` | function(..args) | [reference](https://github.com/react-component/form#optiongetvaluefromevent) |
|
||||
| options.validateTrigger | 校验子节点值的时机 | string | 'onChange' |
|
||||
| options.rules | 校验规则,参见 [async-validator](https://github.com/yiminghe/async-validator) | array | |
|
||||
| options.onXXX | 由于 `getFieldProps` 会占用 `onChange` 等事件(即你所设置的 `trigger` `validateTrigger`),所以如果仍需绑定事件,请在 `options` 内设置 | function | 无 |
|
||||
|
||||
|
||||
### Form.Item
|
||||
|
||||
> 一个 Form.Item 建议只放一个 child,有多个 child 时,`help` `required` `validateStatus` 无法自动生成。
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 |默认值 |
|
||||
|-----------|------------------------------------------|------------|-------|--------|
|
||||
| label | label 标签的文本 | string | | |
|
||||
| labelCol | label 标签布局,通 `<Col>` 组件,设置 `span` `offset` 值,如 `{span: 3, offset: 12}` | object | | |
|
||||
| wrapperCol | 需要为输入控件设置布局样式时,使用该属性,用法同 labelCol | object | | |
|
||||
| help | 提示信息,如不设置,则会根据校验规则自动生成 | string | | |
|
||||
| extra | 额外的提示信息,和 help 类似,当需要错误信息和提示文案同时出现时,可以使用这个。 | string | | |
|
||||
| required | 是否必填,如不设置,则会根据校验规则自动生成 | bool | | false |
|
||||
| validateStatus | 校验状态,如不设置,则会根据校验规则自动生成 | string | 'success' 'warning' 'error' 'validating' | |
|
||||
| hasFeedback | 配合 validateStatus 属性使用,是否展示校验状态图标 | bool | | false |
|
||||
| prefixCls | 样式类名,默认为 ant-form,通常您不需要设置 | string | | 'ant-form' |
|
||||
|
||||
### Input
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|-----------|------------------------------------------|------------|-------|--------|
|
||||
| type | 【必须】声明 input 类型,同原生 input 标签的 type 属性 | string | | 'text' |
|
||||
| id | id | number 或 string | | |
|
||||
| value | value 值 | any | | |
|
||||
| defaultValue | 设置初始默认值 | any | | |
|
||||
| size | 控件大小,默认值为 default 。注:标准表单内的输入框大小限制为 large。 | string | {'large','default','small'} | 'default' |
|
||||
| disabled | 是否禁用状态,默认为 false | bool | | false |
|
||||
| addonBefore | 带标签的 input,设置前置标签 | node | | |
|
||||
| addonAfter | 带标签的 input,设置后置标签 | node | | |
|
||||
| onPressEnter | 按下回车的回调 | function(e) | | |
|
||||
|-----------|------------------------------------------|-----------|-------|--------|
|
||||
| label | label 标签的文本 | string | | |
|
||||
| labelCol | label 标签布局,通 `<Col>` 组件,设置 `span` `offset` 值,如 `{span: 3, offset: 12}` | object | | |
|
||||
| wrapperCol | 需要为输入控件设置布局样式时,使用该属性,用法同 labelCol | object | | |
|
||||
| help | 提示信息,如不设置,则会根据校验规则自动生成 | string | | |
|
||||
| extra | 额外的提示信息,和 help 类似,当需要错误信息和提示文案同时出现时,可以使用这个。 | string | | |
|
||||
| required | 是否必填,如不设置,则会根据校验规则自动生成 | bool | | false |
|
||||
| validateStatus | 校验状态,如不设置,则会根据校验规则自动生成 | string | 'success' 'warning' 'error' 'validating' | |
|
||||
| hasFeedback | 配合 validateStatus 属性使用,展示校验状态图标,建议只配合 Input 组件使用 | bool | | false |
|
||||
| prefixCls | 样式类名,默认为 ant-form,通常您不需要设置 | string | | 'ant-form' |
|
||||
|
||||
> 如果 `Input` 在 `Form.Item` 内,并且 `Form.Item` 设置了 `id` 和 `options` 属性,则 `value` `defaultValue` 和 `id` 属性会被自动设置。
|
||||
|
||||
#### Input.Group
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|-----------|------------------------------------------|------------|-------|--------|
|
||||
| size | `Input.Group` 中所有的 `Input` 的大小 | string | {'large','default','small'} | 'default' |
|
||||
|
||||
```html
|
||||
<Input.Group className={string}>
|
||||
<Input />
|
||||
<Input />
|
||||
</Input.Group>
|
||||
```
|
||||
|
||||
<style>
|
||||
.code-box-demo .ant-form-horizontal {
|
||||
|
||||
@@ -27,11 +27,6 @@ label {
|
||||
color: @label-required-color;
|
||||
}
|
||||
|
||||
//== Style for input-group: input with label, with button or dropdown...
|
||||
.ant-input-group {
|
||||
.input-group(~"ant-input");
|
||||
}
|
||||
|
||||
// Radio && Checkbox
|
||||
input[type="radio"],
|
||||
input[type="checkbox"] {
|
||||
@@ -41,6 +36,7 @@ input[type="checkbox"] {
|
||||
cursor: @cursor-disabled;
|
||||
}
|
||||
}
|
||||
|
||||
// These classes are used directly on <label>s
|
||||
.ant-radio-inline,
|
||||
.ant-radio-vertical,
|
||||
@@ -69,12 +65,18 @@ input[type="checkbox"] {
|
||||
margin-bottom: @form-item-margin-bottom;
|
||||
color: #666;
|
||||
|
||||
// nested FormItem
|
||||
& & {
|
||||
margin-bottom: -@form-item-margin-bottom;
|
||||
}
|
||||
|
||||
&-control {
|
||||
line-height: 32px;
|
||||
position: relative;
|
||||
.clearfix;
|
||||
}
|
||||
|
||||
&.@{form-prefix-cls}-item-with-help {
|
||||
&-with-help {
|
||||
margin-bottom: @form-item-margin-bottom - @font-size-base * @line-height-base - 3;
|
||||
}
|
||||
|
||||
@@ -82,11 +84,13 @@ input[type="checkbox"] {
|
||||
color: @label-color;
|
||||
text-align: right;
|
||||
vertical-align: middle;
|
||||
padding-top: 7px;
|
||||
padding-bottom: 7px;
|
||||
padding: 7px 0;
|
||||
|
||||
&:lang(en) {
|
||||
padding-right: 8px;
|
||||
&:after {
|
||||
content: ":";
|
||||
margin: 0 8px 0 2px;
|
||||
position: relative;
|
||||
top: -0.5px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,40 +199,6 @@ form {
|
||||
}
|
||||
}
|
||||
|
||||
.ant-search-input-wrapper {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.ant-search-input {
|
||||
&.ant-input-group .ant-input:first-child {
|
||||
border-radius: @border-radius-base;
|
||||
position: absolute;
|
||||
top: -1px;
|
||||
}
|
||||
.ant-search-btn {
|
||||
.btn-default;
|
||||
border-radius: 0 @border-radius-base - 1 @border-radius-base - 1 0;
|
||||
left: -1px;
|
||||
position: relative;
|
||||
border-width: 0 0 0 1px;
|
||||
z-index: 2;
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
&:hover {
|
||||
border-color: @border-color-base;
|
||||
}
|
||||
form & {
|
||||
padding-top: 6px;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
}
|
||||
&&-focus .ant-search-btn-noempty,
|
||||
&:hover .ant-search-btn-noempty {
|
||||
.btn-primary;
|
||||
}
|
||||
}
|
||||
|
||||
// Form layout
|
||||
//== Horizontal Form
|
||||
.@{form-prefix-cls}-horizontal {
|
||||
@@ -237,8 +207,7 @@ form {
|
||||
}
|
||||
|
||||
.ant-radio-inline,
|
||||
.ant-checkbox-inline,
|
||||
.ant-input {
|
||||
.ant-checkbox-inline {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
}
|
||||
@@ -297,9 +266,10 @@ form {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
visibility: visible;
|
||||
font-family: "anticon" !important;
|
||||
.square(@input-height-lg);
|
||||
line-height: @input-height-lg;
|
||||
line-height: @input-height-lg + 2;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
animation: zoomIn .3s @ease-out-back;
|
||||
@@ -325,7 +295,6 @@ form {
|
||||
}
|
||||
|
||||
.has-success {
|
||||
.form-control-validation(@success-color; @input-hover-border-color;);
|
||||
.ant-input {
|
||||
border-color: @input-border-color;
|
||||
box-shadow: none;
|
||||
|
||||
@@ -40,8 +40,8 @@ english: Icon
|
||||
### 一. 方向性图标
|
||||
|
||||
```__react
|
||||
import IconSet from '../../site/component/IconSet';
|
||||
const icons1 = ['step-backward', 'step-forward', 'fast-backward', 'fast-forward', 'shrink', 'arrow-salt', 'down', 'up', 'left', 'right', 'caret-down', 'caret-up', 'caret-left', 'caret-right', 'caret-circle-right', 'caret-circle-left', 'caret-circle-o-right', 'caret-circle-o-left', 'circle-right', 'circle-left', 'circle-o-right', 'circle-o-left', 'double-right', 'double-left', 'verticle-right', 'verticle-left', 'forward', 'backward', 'rollback', 'retweet', 'swap', 'swap-left', 'swap-right', 'arrow-right', 'arrow-up', 'arrow-down', 'arrow-left', 'play-circle', 'play-circle-o', 'circle-up', 'circle-down', 'circle-o-up', 'circle-o-down', 'caret-circle-o-up', 'caret-circle-o-down', 'caret-circle-up', 'caret-circle-down'];
|
||||
import IconSet from 'site/theme/template/IconSet';
|
||||
const icons1 = ['step-backward', 'step-forward', 'fast-backward', 'fast-forward', 'shrink', 'arrow-salt', 'down', 'up', 'left', 'right', 'caret-down', 'caret-up', 'caret-left', 'caret-right', 'caret-circle-right', 'caret-circle-left', 'caret-circle-o-right', 'caret-circle-o-left', 'circle-right', 'circle-left', 'circle-o-right', 'circle-o-left', 'double-right', 'double-left', 'verticle-right', 'verticle-left', 'forward', 'backward', 'rollback', 'enter', 'retweet', 'swap', 'swap-left', 'swap-right', 'arrow-right', 'arrow-up', 'arrow-down', 'arrow-left', 'play-circle', 'play-circle-o', 'circle-up', 'circle-down', 'circle-o-up', 'circle-o-down', 'caret-circle-o-up', 'caret-circle-o-down', 'caret-circle-up', 'caret-circle-down'];
|
||||
|
||||
ReactDOM.render(<IconSet className="icons" icons={icons1} key="icons1" />, mountNode);
|
||||
```
|
||||
@@ -57,7 +57,7 @@ ReactDOM.render(<IconSet className="icons" icons={icons2} key="icons2" />, mount
|
||||
### 三. 网站通用图标
|
||||
|
||||
```__react
|
||||
const icons3 = ['lock', 'unlock', 'android', 'apple', 'area-chart', 'bar-chart', 'bars', 'book', 'calendar', 'cloud', 'cloud-download', 'code', 'copy', 'credit-card', 'delete', 'desktop', 'download', 'edit', 'ellipsis', 'file', 'file-text', 'file-unknown', 'folder', 'folder-open', 'github', 'hdd', 'frown', 'meh', 'inbox', 'laptop', 'appstore-o', 'appstore', 'line-chart', 'link', 'logout', 'mail', 'menu-fold', 'menu-unfold', 'mobile', 'notification', 'paper-clip', 'picture', 'pie-chart', 'poweroff', 'reload', 'search', 'setting', 'share-alt', 'shopping-cart', 'smile', 'tablet', 'tag', 'tags', 'to-top', 'upload', 'user', 'video-camera', 'windows', 'ie', 'chrome', 'home', 'loading', 'smile-circle', 'meh-circle', 'frown-circle', 'tags-o', 'tag-o', 'cloud-upload-o', 'cloud-download-o', 'cloud-upload', 'cloud-o', 'star-o', 'star', 'heart-o', 'heart', 'environment', 'environment-o', 'eye', 'eye-o', 'camera', 'camera-o', 'aliwangwang', 'aliwangwang-o', 'save', 'team', 'solution', 'phone', 'filter', 'exception', 'export', 'customerservice', 'qrcode', 'scan', 'like', 'dislike', 'message', 'pay-circle', 'pay-circle-o', 'calculator'];
|
||||
const icons3 = ['lock', 'unlock', 'android', 'apple', 'area-chart', 'bar-chart', 'bars', 'book', 'calendar', 'cloud', 'cloud-download', 'code', 'copy', 'credit-card', 'delete', 'desktop', 'download', 'edit', 'ellipsis', 'file', 'file-text', 'file-unknown', 'file-pdf','file-excel', 'file-jpg', 'file-ppt', 'folder', 'folder-open', 'github', 'hdd', 'frown', 'meh', 'inbox', 'laptop', 'appstore-o', 'appstore', 'line-chart', 'link', 'logout', 'mail', 'menu-fold', 'menu-unfold', 'mobile', 'notification', 'paper-clip', 'picture', 'pie-chart', 'poweroff', 'reload', 'search', 'setting', 'share-alt', 'shopping-cart', 'smile', 'tablet', 'tag', 'tags', 'to-top', 'upload', 'user', 'video-camera', 'windows', 'ie', 'chrome', 'home', 'loading', 'smile-circle', 'meh-circle', 'frown-circle', 'tags-o', 'tag-o', 'cloud-upload-o', 'cloud-download-o', 'cloud-upload', 'cloud-o', 'star-o', 'star', 'heart-o', 'heart', 'environment', 'environment-o', 'eye', 'eye-o', 'camera', 'camera-o', 'aliwangwang', 'aliwangwang-o', 'save', 'team', 'solution', 'phone', 'filter', 'exception', 'export', 'customerservice', 'qrcode', 'scan', 'like', 'dislike', 'message', 'pay-circle', 'pay-circle-o', 'calculator', 'pushpin', 'pushpin-o'];
|
||||
|
||||
ReactDOM.render(<IconSet className="icons" icons={icons3} key="icons3" />, mountNode);
|
||||
```
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
- order: 3
|
||||
- title: 小数
|
||||
order: 3
|
||||
title: 小数
|
||||
---
|
||||
|
||||
和原生的数字输入框一样,value 的精度由 step 的小数位数决定。
|
||||
|
||||
16
components/input/demo/add-on.md
Normal file
16
components/input/demo/add-on.md
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
order: 2
|
||||
title: 前置/后置标签
|
||||
---
|
||||
|
||||
用于配置一些固定组合。
|
||||
|
||||
````jsx
|
||||
import { Input } from 'antd';
|
||||
|
||||
ReactDOM.render(
|
||||
<Input addonBefore="Http://" addonAfter=".com" defaultValue="mysite" />
|
||||
, mountNode);
|
||||
````
|
||||
|
||||
|
||||
12
components/input/demo/basic.md
Normal file
12
components/input/demo/basic.md
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
order: 0
|
||||
title: 基本使用
|
||||
---
|
||||
|
||||
基本使用。
|
||||
|
||||
````jsx
|
||||
import { Input } from 'antd';
|
||||
|
||||
ReactDOM.render(<Input placeholder="基本使用" />, mountNode);
|
||||
````
|
||||
36
components/input/demo/group.md
Normal file
36
components/input/demo/group.md
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
order: 3
|
||||
title: 输入框组合
|
||||
---
|
||||
|
||||
各类输入框的组合展现。
|
||||
|
||||
````jsx
|
||||
import { Input, Select, Col } from 'antd';
|
||||
const InputGroup = Input.Group;
|
||||
const Option = Select.Option;
|
||||
|
||||
ReactDOM.render(
|
||||
<div>
|
||||
<InputGroup size="large">
|
||||
<Input placeholder="www.mysite" />
|
||||
<div className="ant-input-group-wrap">
|
||||
<Select defaultValue=".com" style={{ width: 70 }}>
|
||||
<Option value=".com">.com</Option>
|
||||
<Option value=".jp">.jp</Option>
|
||||
<Option value=".cn">.cn</Option>
|
||||
<Option value=".org">.org</Option>
|
||||
</Select>
|
||||
</div>
|
||||
</InputGroup>
|
||||
<InputGroup size="large" style={{ marginTop: 8 }}>
|
||||
<Col span="4">
|
||||
<Input defaultValue="0571" />
|
||||
</Col>
|
||||
<Col span="8">
|
||||
<Input defaultValue="26888888" />
|
||||
</Col>
|
||||
</InputGroup>
|
||||
</div>
|
||||
, mountNode);
|
||||
````
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
order: 10
|
||||
order: 4
|
||||
title: 搜索框
|
||||
---
|
||||
|
||||
带有搜索按钮。
|
||||
带有搜索按钮的输入框。
|
||||
|
||||
````jsx
|
||||
import { Input, Button } from 'antd';
|
||||
27
components/input/demo/size.md
Normal file
27
components/input/demo/size.md
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
order: 1
|
||||
title: 三种大小
|
||||
---
|
||||
|
||||
我们为 `<Input />` 输入框定义了三种尺寸(大、默认、小),高度分别为 `32px`、`28px` 和 `22px`。
|
||||
|
||||
注意: 在表单里面,我们只使用大尺寸的输入框。
|
||||
|
||||
````jsx
|
||||
import { Input } from 'antd';
|
||||
|
||||
ReactDOM.render(
|
||||
<div className="example-input">
|
||||
<Input size="large" placeholder="大尺寸" />
|
||||
<Input placeholder="默认尺寸" />
|
||||
<Input size="small" placeholder="小尺寸" />
|
||||
</div>
|
||||
, mountNode);
|
||||
````
|
||||
|
||||
````css
|
||||
.example-input .ant-input {
|
||||
width: 200px;
|
||||
margin: 0 8px 8px 0;
|
||||
}
|
||||
````
|
||||
12
components/input/demo/textarea.md
Normal file
12
components/input/demo/textarea.md
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
order: 5
|
||||
title: 文本域
|
||||
---
|
||||
|
||||
用于多行输入,指定 `type` 为一个特殊的 `textarea`。
|
||||
|
||||
````jsx
|
||||
import { Input } from 'antd';
|
||||
|
||||
ReactDOM.render(<Input type="textarea" rows={4} />, mountNode);
|
||||
````
|
||||
44
components/input/index.md
Normal file
44
components/input/index.md
Normal file
@@ -0,0 +1,44 @@
|
||||
---
|
||||
category: Components
|
||||
chinese: 输入框
|
||||
type: Form Control
|
||||
english: Input
|
||||
---
|
||||
|
||||
通过鼠标或键盘输入内容,是最基础的表单域的包装。
|
||||
|
||||
## 何时使用
|
||||
|
||||
- 需要用户输入表单域内容时。
|
||||
- 提供组合型输入框,带搜索的输入框,还可以进行大小选择。
|
||||
|
||||
## API
|
||||
|
||||
### Input
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|-----------|------------------------------------------|------------|-------|--------|
|
||||
| type | 【必须】声明 input 类型,同原生 input 标签的 type 属性。另外提供 `type="textarea"`。 | string | | 'text' |
|
||||
| id | id | number 或 string | | |
|
||||
| value | value 值 | any | | |
|
||||
| defaultValue | 设置初始默认值 | any | | |
|
||||
| size | 控件大小,默认值为 default 。注:标准表单内的输入框大小限制为 large。 | string | {'large','default','small'} | 'default' |
|
||||
| disabled | 是否禁用状态,默认为 false | bool | | false |
|
||||
| addonBefore | 带标签的 input,设置前置标签 | node | | |
|
||||
| addonAfter | 带标签的 input,设置后置标签 | node | | |
|
||||
| onPressEnter | 按下回车的回调 | function(e) | | |
|
||||
|
||||
> 如果 `Input` 在 `Form.Item` 内,并且 `Form.Item` 设置了 `id` 和 `options` 属性,则 `value` `defaultValue` 和 `id` 属性会被自动设置。
|
||||
|
||||
#### Input.Group
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|-----------|------------------------------------------|------------|-------|--------|
|
||||
| size | `Input.Group` 中所有的 `Input` 的大小 | string | {'large','default','small'} | 'default' |
|
||||
|
||||
```html
|
||||
<Input.Group className={string}>
|
||||
<Input />
|
||||
<Input />
|
||||
</Input.Group>
|
||||
```
|
||||
@@ -7,3 +7,8 @@
|
||||
.ant-input {
|
||||
.input;
|
||||
}
|
||||
|
||||
//== Style for input-group: input with label, with button or dropdown...
|
||||
.ant-input-group {
|
||||
.input-group(~"ant-input");
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@
|
||||
position: relative;
|
||||
display: table;
|
||||
border-collapse: separate;
|
||||
width: 100%;
|
||||
|
||||
// Undo padding and float of grid classes
|
||||
&[class*="col-"] {
|
||||
@@ -137,7 +138,7 @@
|
||||
}
|
||||
|
||||
&-wrap > * {
|
||||
display: block;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.@{inputClass} {
|
||||
|
||||
@@ -16,7 +16,7 @@ export default class Row extends React.Component {
|
||||
render() {
|
||||
const { type, justify, align, className, gutter, style, children, ...others } = this.props;
|
||||
const classes = classNames({
|
||||
row: true,
|
||||
row: !type,
|
||||
[`row-${type}`]: type,
|
||||
[`row-${type}-${justify}`]: justify,
|
||||
[`row-${type}-${align}`]: align,
|
||||
@@ -28,7 +28,7 @@ export default class Row extends React.Component {
|
||||
...style,
|
||||
} : style;
|
||||
const cols = Children.map(children, col => {
|
||||
if (col === null) return null;
|
||||
if (!col) return null;
|
||||
|
||||
return cloneElement(col, {
|
||||
style: gutter > 0 ? {
|
||||
|
||||
@@ -9,7 +9,6 @@ title: 所有组件
|
||||
import { LocaleProvider, Pagination, DatePicker, TimePicker, Calendar,
|
||||
Popconfirm, Table, Modal, Button, Select, Transfer, Radio } from 'antd';
|
||||
import enUS from 'antd/lib/locale-provider/en_US';
|
||||
import ruRU from 'antd/lib/locale-provider/ru_RU';
|
||||
const Option = Select.Option;
|
||||
const RangePicker = DatePicker.RangePicker;
|
||||
|
||||
@@ -110,7 +109,6 @@ const App = React.createClass({
|
||||
<span style={{ marginRight: 16 }}>Change locale of components: </span>
|
||||
<Radio.Group defaultValue={enUS} onChange={this.changeLocale}>
|
||||
<Radio.Button key="en" value={enUS}>English</Radio.Button>
|
||||
<Radio.Button key="ru" value={ruRU}>русский язык</Radio.Button>
|
||||
<Radio.Button key="cn">中文</Radio.Button>
|
||||
</Radio.Group>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import RcMenu, { Item, Divider, SubMenu, ItemGroup } from 'rc-menu';
|
||||
import animation from '../common/openAnimation';
|
||||
import animation from '../_util/openAnimation';
|
||||
|
||||
function noop() {
|
||||
}
|
||||
|
||||
@@ -366,6 +366,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
&-dark&-vertical &-item-selected {
|
||||
> a,
|
||||
> a:hover {
|
||||
color: @primary-color;
|
||||
}
|
||||
}
|
||||
|
||||
&-dark &-item-active,
|
||||
&-dark &-submenu-active,
|
||||
&-dark &-submenu-title:hover {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
import Notification from 'rc-notification';
|
||||
import Icon from '../icon';
|
||||
import warning from 'warning';
|
||||
|
||||
let defaultDuration = 1.5;
|
||||
let defaultTop;
|
||||
@@ -60,7 +59,6 @@ export default {
|
||||
},
|
||||
// Departed usage, please use warning()
|
||||
warn(content, duration, onClose) {
|
||||
warning(false, 'message.warn() is departed, please use message.warning()');
|
||||
return notice(content, duration, 'warning', onClose);
|
||||
},
|
||||
warning(content, duration, onClose) {
|
||||
|
||||
@@ -19,6 +19,7 @@ english: Message
|
||||
- `message.error(content, duration)`
|
||||
- `message.info(content, duration)`
|
||||
- `message.warning(content, duration)`
|
||||
- `message.warn(content, duration)`
|
||||
- `message.loading(content, duration)`
|
||||
|
||||
组件提供了四个静态方法,参数如下:
|
||||
|
||||
@@ -31,7 +31,7 @@ Modal.error = function (props) {
|
||||
return confirm(config);
|
||||
};
|
||||
|
||||
Modal.warning = function (props) {
|
||||
Modal.warning = Modal.warn = function (props) {
|
||||
const config = {
|
||||
type: 'warning',
|
||||
iconType: 'exclamation-circle',
|
||||
|
||||
@@ -41,6 +41,7 @@ english: Modal
|
||||
- `Modal.success`
|
||||
- `Modal.error`
|
||||
- `Modal.warning`
|
||||
- `Modal.warn`
|
||||
- `Modal.confirm`
|
||||
|
||||
以上均为一个函数,参数为 object,具体属性如下:
|
||||
|
||||
@@ -30,9 +30,6 @@
|
||||
position: relative;
|
||||
top: 5px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
.@{confirm-prefix-cls}-btns {
|
||||
|
||||
@@ -3,7 +3,7 @@ order: 0
|
||||
title: 基本
|
||||
---
|
||||
|
||||
最简单的用法,五秒后自动关闭。
|
||||
最简单的用法,4.5 秒后自动关闭。
|
||||
|
||||
````jsx
|
||||
import { Button, notification } from 'antd';
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import React from 'react';
|
||||
import Notification from 'rc-notification';
|
||||
import Icon from '../icon';
|
||||
import warning from 'warning';
|
||||
|
||||
let defaultTop = 24;
|
||||
let notificationInstance;
|
||||
let defaultDuration = 45;
|
||||
let defaultDuration = 4.5;
|
||||
|
||||
function getNotificationInstance() {
|
||||
if (notificationInstance) {
|
||||
@@ -95,10 +94,6 @@ const api = {
|
||||
api[type] = (args) => api.open({ ...args, icon: type });
|
||||
});
|
||||
|
||||
// warn: Departed usage, please use warning()
|
||||
api.warn = (...args) => {
|
||||
warning(false, 'notification.warn() is departed, please use notification.warning()');
|
||||
api.warning(...args);
|
||||
};
|
||||
api.warn = api.warning;
|
||||
|
||||
export default api;
|
||||
|
||||
@@ -22,6 +22,7 @@ english: Notification
|
||||
- `notification.error(config)`
|
||||
- `notification.info(config)`
|
||||
- `notification.warning(config)`
|
||||
- `notification.warn(config)`
|
||||
- `notification.close(key: String)`
|
||||
- `notification.destroy()`
|
||||
|
||||
|
||||
@@ -10,15 +10,13 @@ english: QueueAnim
|
||||
## 何时使用
|
||||
|
||||
- 从内容A到内容B的转变过程时能有效的吸引用户注意力,突出视觉中心,提高整体视觉效果。
|
||||
|
||||
- 小的信息元素排布或块状较多的情况下,根据一定的路径层次依次进场,区分维度层级,来凸显量级,使页面转场更加流畅和舒适,提高整体视觉效果和产品的质感。
|
||||
|
||||
- 特别适合首页和需要视觉展示效果的宣传页,以及单页应用的切换页面动效。
|
||||
|
||||
|
||||
## API
|
||||
|
||||
> 此组件 `antd@1.0.0+` 后标记为废弃,您可以直接使用 `import QueueAnim from 'rc-queue-anim'` 来代替。文档后续会移到 [ant-motioin](http://motion.ant.design/#/component/queue-anim)。
|
||||
> 此组件 `antd@1.0.0+` 后标记为废弃,您可以直接使用 `import QueueAnim from 'rc-queue-anim'` 来代替,相关文档也已移到 [ant-motioin](http://motion.ant.design/#/components/queue-anim)。
|
||||
|
||||
> [ant-motioin](http://motion.ant.design/) 是一个动效设计语言,欢迎关注。
|
||||
|
||||
|
||||
26
components/select/demo/label-in-value.md
Normal file
26
components/select/demo/label-in-value.md
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
order: 10
|
||||
title: 获得选项的文本
|
||||
---
|
||||
|
||||
默认情况下 `onChange` 里只能拿到 value,如果需要拿到选中的节点文本 label,可以使用 `labelInValue` 属性。
|
||||
|
||||
选中项的 label 会被包装到 value 中传递给 `onChange` 等函数,此时 value 是一个对象。
|
||||
|
||||
````jsx
|
||||
import { Select } from 'antd';
|
||||
const Option = Select.Option;
|
||||
|
||||
function handleChange(value) {
|
||||
console.log(value); // { key: "lucy", label: "Lucy (101)" }
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<div>
|
||||
<Select labelInValue defaultValue={{ key: 'lucy' }} style={{ width: 120 }} onChange={handleChange}>
|
||||
<Option value="jack">Jack (100)</Option>
|
||||
<Option value="lucy">Lucy (101)</Option>
|
||||
</Select>
|
||||
</div>
|
||||
, mountNode);
|
||||
````
|
||||
@@ -20,7 +20,7 @@ function handleChange(value) {
|
||||
|
||||
ReactDOM.render(
|
||||
<Select multiple
|
||||
style={{ width: 400 }}
|
||||
style={{ width: '100%' }}
|
||||
placeholder="Please select"
|
||||
defaultValue={['a10', 'c12']} onChange={handleChange}>
|
||||
{children}
|
||||
|
||||
@@ -9,7 +9,6 @@ export default class Select extends React.Component {
|
||||
static defaultProps = {
|
||||
prefixCls: 'ant-select',
|
||||
transitionName: 'slide-up',
|
||||
optionLabelProp: 'children',
|
||||
choiceTransitionName: 'zoom',
|
||||
showSearch: false,
|
||||
}
|
||||
@@ -38,13 +37,13 @@ export default class Select extends React.Component {
|
||||
if (combobox) {
|
||||
notFoundContent = null;
|
||||
// children 带 dom 结构时,无法填入输入框
|
||||
optionLabelProp = 'value';
|
||||
optionLabelProp = optionLabelProp || 'value';
|
||||
}
|
||||
|
||||
return (
|
||||
<RcSelect {...this.props}
|
||||
className={cls}
|
||||
optionLabelProp={optionLabelProp}
|
||||
optionLabelProp={optionLabelProp || 'children'}
|
||||
notFoundContent={notFoundContent} />
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,26 +23,28 @@ english: Select
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|----------|----------------|----------|--------------|
|
||||
| value | 指定当前选中的条目 | string/Array<String> | 无 |
|
||||
| defaultValue | 指定默认选中的条目 | string/Array<String> | 无 |
|
||||
| value | 指定当前选中的条目 | String/Array<String>/{key: String, label: React.Node}/Array<{key, label}> | 无 |
|
||||
| defaultValue | 指定默认选中的条目 | String/Array<String>/{key: String, label: React.Node}/Array<{key, label}> | 无 |
|
||||
| multiple | 支持多选 | boolean | false |
|
||||
| allowClear | 支持清除, 单选模式有效 | boolean | false |
|
||||
| filterOption | 是否根据输入项进行筛选。当其为一个函数时,会接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 `true`,反之则返回 `false`。 | boolean or function(inputValue, option) | true |
|
||||
| tags | 可以把随意输入的条目作为 tag,输入项不需要与下拉选项匹配 | boolean |false |
|
||||
| onSelect | 被选中时调用,参数为选中项的 value 值 | function(value, option) | 无 |
|
||||
| onDeselect | 取消选中时调用,参数为选中项的 option value 值,仅在 multiple 或 tags 模式下生效 | function(value) | 无 |
|
||||
| onChange | 选中option,或input的value变化(combobox 模式下)时,调用此函数 | function(value, label) | 无 |
|
||||
| onChange | 选中 option,或 input 的 value 变化(combobox 模式下)时,调用此函数 | function(value) | 无 |
|
||||
| onSearch | 文本框值变化时回调 | function(value: String) | |
|
||||
| placeholder | 选择框默认文字 | string | 无 |
|
||||
| notFoundContent | 当下拉列表为空时显示的内容 | string | 'Not Found' |
|
||||
| dropdownMatchSelectWidth | 下拉菜单和选择器同宽 | boolean | true |
|
||||
| optionFilterProp | 搜索时过滤对应的 option 属性,如设置为 children 表示对内嵌内容进行搜索 | string | value |
|
||||
| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` |
|
||||
| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` (combobox 模式下为 `value`) |
|
||||
| combobox | 输入框自动提示模式 | boolean | false |
|
||||
| size | 选择框大小,可选 `large` `small` | String | default |
|
||||
| showSearch | 在选择框中显示搜索框 | boolean | false |
|
||||
| disabled | 是否禁用 | boolean | false |
|
||||
| defaultActiveFirstOption | 是否默认高亮第一个选项。 | boolean | true
|
||||
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
|
||||
| labelInValue | 是否把每个选项的 label 包装到 value 中,决定 Select 的 value 类型。 | boolean | false |
|
||||
|
||||
### Option props
|
||||
|
||||
|
||||
@@ -115,6 +115,8 @@
|
||||
|
||||
&__clear {
|
||||
display: none;
|
||||
visibility: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +136,6 @@
|
||||
|
||||
.@{select-prefix-cls}-selection__rendered {
|
||||
height: 26px;
|
||||
position: relative;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@@ -231,6 +232,15 @@
|
||||
outline: 0;
|
||||
border-radius: @border-radius-base;
|
||||
}
|
||||
|
||||
.@{select-prefix-cls}-search__field__mirror {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 9999px;
|
||||
white-space: pre;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
> i {
|
||||
float: right;
|
||||
}
|
||||
|
||||
@@ -13,18 +13,18 @@ english: Slider
|
||||
|
||||
## API
|
||||
|
||||
| 参数 | 类型 | 默认值 |说明 |
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|------------|----------------|-------------|--------------|
|
||||
| range | Boolean | false | 双滑块模式
|
||||
| min | Number | 0 | 最小值
|
||||
| max | Number | 100 | 最大值
|
||||
| step | Number or null | 1 | 步长,取值必须大于 0,并且可被 (max - min) 整除。当 `marks` 不为空对象时,可以设置 `step` 为 `null`,此时 Slider 的可选值仅有 marks 标出来的部分。
|
||||
| marks | Object{Number: String|React.Component} or Object{Number: { style, label}} | {} | 刻度标记,key 的类型必须为 `Number` 且取值在闭区间 [min, max] 内,每个标签可以单独设置样式
|
||||
| dots | Boolean | false | 是否只能拖拽到刻度上
|
||||
| value | Number or [Number, Number]| | 设置当前取值。当 `range` 为 `false` 时,使用 `Number`,否则用 `[Number, Number]`
|
||||
| defaultValue | Number or [Number, Number]| 0 or [0, 0] | 设置初始取值。当 `range` 为 `false` 时,使用 `Number`,否则用 `[Number, Number]`
|
||||
| included | Boolean | true | `marks` 不为空对象时有效,值为 true 时表示值为包含关系,false 表示并列
|
||||
| disabled | Boolean | false | 值为 `true` 时,滑块为禁用状态
|
||||
| onChange | Function | NOOP | 当 Slider 的值发生改变时,会触发 onChange 事件,并把改变后的值作为参数传入。
|
||||
| onAfterChange | Function | NOOP | 与 `onmouseup` 触发时机一致,把当前值作为参数传入。
|
||||
| tipFormatter | Function or null | IDENTITY | Slider 会把当前值传给 `tipFormatter`,并在 Tooltip 中显示 `tipFormatter` 的返回值,若为 null,则隐藏 Tooltip。
|
||||
| range | 双滑块模式 | Boolean | false
|
||||
| min | 最小值 | Number | 0
|
||||
| max | 最大值 | Number | 100
|
||||
| step | 步长,取值必须大于 0,并且可被 (max - min) 整除。当 `marks` 不为空对象时,可以设置 `step` 为 `null`,此时 Slider 的可选值仅有 marks 标出来的部分。 | Number or null | 1
|
||||
| marks | 刻度标记,key 的类型必须为 `Number` 且取值在闭区间 [min, max] 内,每个标签可以单独设置样式 | Object{} | Object{Number: String or React.Component} or Object{Number: { style, label}}
|
||||
| dots | 是否只能拖拽到刻度上 | Boolean | false
|
||||
| value | 设置当前取值。当 `range` 为 `false` 时,使用 `Number`,否则用 `[Number, Number]` | Number or [Number, Number] |
|
||||
| defaultValue | 设置初始取值。当 `range` 为 `false` 时,使用 `Number`,否则用 `[Number, Number]` | Number or [Number, Number] | 0 or [0, 0]
|
||||
| included | `marks` 不为空对象时有效,值为 true 时表示值为包含关系,false 表示并列 | Boolean | true
|
||||
| disabled | 值为 `true` 时,滑块为禁用状态 | Boolean | false
|
||||
| onChange | 当 Slider 的值发生改变时,会触发 onChange 事件,并把改变后的值作为参数传入。 | Function | NOOP
|
||||
| onAfterChange | 与 `onmouseup` 触发时机一致,把当前值作为参数传入。 | Function | NOOP
|
||||
| tipFormatter | Slider 会把当前值传给 `tipFormatter`,并在 Tooltip 中显示 `tipFormatter` 的返回值,若为 null,则隐藏 Tooltip。 | Function or null | IDENTITY
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { findDOMNode } from 'react-dom';
|
||||
import classNames from 'classnames';
|
||||
import { isCssAnimationSupported } from 'css-animation';
|
||||
import isCssAnimationSupported from '../_util/isCssAnimationSupported';
|
||||
import warning from 'warning';
|
||||
|
||||
export default class Spin extends React.Component {
|
||||
@@ -17,6 +17,7 @@ export default class Spin extends React.Component {
|
||||
spinning,
|
||||
};
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
className: React.PropTypes.string,
|
||||
size: React.PropTypes.oneOf(['small', 'default', 'large']),
|
||||
@@ -28,7 +29,7 @@ export default class Spin extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
warning(!('spining' in this.props), '`spining` property of Popover is a spell mistake, use `spinning` instead.');
|
||||
if (!isCssAnimationSupported) {
|
||||
if (!isCssAnimationSupported()) {
|
||||
// Show text in IE8/9
|
||||
findDOMNode(this).className += ` ${this.props.prefixCls}-show-text`;
|
||||
}
|
||||
@@ -62,20 +63,20 @@ export default class Spin extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { className, size, prefixCls, tip } = this.props;
|
||||
const { className, size, prefixCls, tip, ...restProps } = this.props;
|
||||
const { spinning } = this.state;
|
||||
|
||||
const spinClassName = classNames({
|
||||
[prefixCls]: true,
|
||||
[`${prefixCls}-sm`]: size === 'small',
|
||||
[`${prefixCls}-lg`]: size === 'large',
|
||||
[className]: !!className,
|
||||
[`${prefixCls}-spinning`]: spinning,
|
||||
[`${prefixCls}-show-text`]: !!this.props.tip,
|
||||
[className]: !!className,
|
||||
});
|
||||
|
||||
const spinElement = (
|
||||
<div className={spinClassName}>
|
||||
<div {...restProps} className={spinClassName}>
|
||||
<span className={`${prefixCls}-dot ${prefixCls}-dot-first`} />
|
||||
<span className={`${prefixCls}-dot ${prefixCls}-dot-second`} />
|
||||
<span className={`${prefixCls}-dot ${prefixCls}-dot-third`} />
|
||||
@@ -85,7 +86,7 @@ export default class Spin extends React.Component {
|
||||
|
||||
if (this.isNestedPattern()) {
|
||||
return (
|
||||
<div className={spinning ? (`${prefixCls}-nested-loading`) : ''}>
|
||||
<div {...restProps} className={spinning ? (`${prefixCls}-nested-loading`) : ''}>
|
||||
{spinElement}
|
||||
<div className={`${prefixCls}-container`}>
|
||||
{this.props.children}
|
||||
|
||||
@@ -48,7 +48,16 @@
|
||||
-webkit-filter: blur(1px);
|
||||
filter: blur(1px);
|
||||
filter: ~"progid\:DXImageTransform\.Microsoft\.Blur(PixelRadius\=1, MakeShadow\=false)"; /* IE6~IE9 */
|
||||
pointer-events: none;
|
||||
position: relative;
|
||||
&:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
// tip
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "~normalize.css/normalize.css";
|
||||
@import "./normalize.less";
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
|
||||
@@ -84,6 +84,11 @@
|
||||
.@{iconfont-css-prefix}-filter:before {content:"\e66f";}
|
||||
.@{iconfont-css-prefix}-file-text:before {content:"\e66c";}
|
||||
.@{iconfont-css-prefix}-file:before {content:"\e66b";}
|
||||
.@{iconfont-css-prefix}-file-unknown:before {content:"\e6a6";}
|
||||
.@{iconfont-css-prefix}-file-excel:before {content:"\e6ac";}
|
||||
.@{iconfont-css-prefix}-file-pdf:before {content:"\e6ab";}
|
||||
.@{iconfont-css-prefix}-file-jpg:before {content:"\e6aa";}
|
||||
.@{iconfont-css-prefix}-file-ppt:before {content:"\e6a7";}
|
||||
.@{iconfont-css-prefix}-exception:before {content:"\e66a";}
|
||||
.@{iconfont-css-prefix}-export:before {content:"\e669";}
|
||||
.@{iconfont-css-prefix}-desktop:before {content:"\e662";}
|
||||
@@ -135,6 +140,7 @@
|
||||
.@{iconfont-css-prefix}-verticle-right:before {content:"\e62c";}
|
||||
.@{iconfont-css-prefix}-verticle-left:before {content:"\e62b";}
|
||||
.@{iconfont-css-prefix}-rollback:before {content:"\e62a";}
|
||||
.@{iconfont-css-prefix}-enter:before {content:"\e6b6";}
|
||||
.@{iconfont-css-prefix}-retweet:before {content:"\e627";}
|
||||
.@{iconfont-css-prefix}-shrink:before {content:"\e628";}
|
||||
.@{iconfont-css-prefix}-arrow-salt:before {content:"\e629";}
|
||||
@@ -183,10 +189,11 @@
|
||||
.@{iconfont-css-prefix}-pay-circle:before {content:"\e6a8";}
|
||||
.@{iconfont-css-prefix}-pay-circle-o:before {content:"\e6a9";}
|
||||
.@{iconfont-css-prefix}-message:before {content:"\e6a4";}
|
||||
.@{iconfont-css-prefix}-file-unknown:before {content:"\e6a6";}
|
||||
.@{iconfont-css-prefix}-heart:before {content:"\e68c";}
|
||||
.@{iconfont-css-prefix}-heart-o:before {content:"\e6b0";}
|
||||
.@{iconfont-css-prefix}-calculator:before {content:"\e6b1";}
|
||||
.@{iconfont-css-prefix}-pushpin:before {content:"\e6b5";}
|
||||
.@{iconfont-css-prefix}-pushpin-o:before {content:"\e6b3";}
|
||||
.@{iconfont-css-prefix}-loading:before {
|
||||
display: inline-block;
|
||||
animation: loadingCircle 1s infinite linear;
|
||||
|
||||
419
components/style/core/normalize.less
vendored
Normal file
419
components/style/core/normalize.less
vendored
Normal file
@@ -0,0 +1,419 @@
|
||||
/*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */
|
||||
|
||||
/**
|
||||
* 1. Change the default font family in all browsers (opinionated).
|
||||
* 2. Prevent adjustments of font size after orientation changes in IE and iOS.
|
||||
*/
|
||||
|
||||
html {
|
||||
font-family: sans-serif; /* 1 */
|
||||
-ms-text-size-adjust: 100%; /* 2 */
|
||||
-webkit-text-size-adjust: 100%; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the margin in all browsers (opinionated).
|
||||
*/
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* HTML5 display definitions
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Add the correct display in IE 9-.
|
||||
* 1. Add the correct display in Edge, IE, and Firefox.
|
||||
* 2. Add the correct display in IE.
|
||||
*/
|
||||
|
||||
article,
|
||||
aside,
|
||||
details, /* 1 */
|
||||
figcaption,
|
||||
figure,
|
||||
footer,
|
||||
header,
|
||||
main, /* 2 */
|
||||
menu,
|
||||
nav,
|
||||
section,
|
||||
summary { /* 1 */
|
||||
display: block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct display in IE 9-.
|
||||
*/
|
||||
|
||||
audio,
|
||||
canvas,
|
||||
progress,
|
||||
video {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct display in iOS 4-7.
|
||||
*/
|
||||
|
||||
audio:not([controls]) {
|
||||
display: none;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
|
||||
*/
|
||||
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct display in IE 10-.
|
||||
* 1. Add the correct display in IE.
|
||||
*/
|
||||
|
||||
template, /* 1 */
|
||||
[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Links
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Remove the gray background on active links in IE 10.
|
||||
* 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
|
||||
*/
|
||||
|
||||
a {
|
||||
background-color: transparent; /* 1 */
|
||||
-webkit-text-decoration-skip: objects; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the outline on focused links when they are also active or hovered
|
||||
* in all browsers (opinionated).
|
||||
*/
|
||||
|
||||
a:active,
|
||||
a:hover {
|
||||
outline-width: 0;
|
||||
}
|
||||
|
||||
/* Text-level semantics
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Remove the bottom border in Firefox 39-.
|
||||
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
|
||||
*/
|
||||
|
||||
abbr[title] {
|
||||
border-bottom: none; /* 1 */
|
||||
text-decoration: underline; /* 2 */
|
||||
text-decoration: underline dotted; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent the duplicate application of `bolder` by the next rule in Safari 6.
|
||||
*/
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: inherit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct font weight in Chrome, Edge, and Safari.
|
||||
*/
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct font style in Android 4.3-.
|
||||
*/
|
||||
|
||||
dfn {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the font size and margin on `h1` elements within `section` and
|
||||
* `article` contexts in Chrome, Firefox, and Safari.
|
||||
*/
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin: 0.67em 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct background and color in IE 9-.
|
||||
*/
|
||||
|
||||
mark {
|
||||
background-color: #ff0;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct font size in all browsers.
|
||||
*/
|
||||
|
||||
small {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent `sub` and `sup` elements from affecting the line height in
|
||||
* all browsers.
|
||||
*/
|
||||
|
||||
sub,
|
||||
sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
/* Embedded content
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove the border on images inside links in IE 10-.
|
||||
*/
|
||||
|
||||
img {
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide the overflow in IE.
|
||||
*/
|
||||
|
||||
svg:not(:root) {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Grouping content
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Correct the inheritance and scaling of font size in all browsers.
|
||||
* 2. Correct the odd `em` font sizing in all browsers.
|
||||
*/
|
||||
|
||||
code,
|
||||
kbd,
|
||||
pre,
|
||||
samp {
|
||||
font-family: monospace, monospace; /* 1 */
|
||||
font-size: 1em; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct margin in IE 8.
|
||||
*/
|
||||
|
||||
figure {
|
||||
margin: 1em 40px;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Add the correct box sizing in Firefox.
|
||||
* 2. Show the overflow in Edge and IE.
|
||||
*/
|
||||
|
||||
hr {
|
||||
box-sizing: content-box; /* 1 */
|
||||
height: 0; /* 1 */
|
||||
overflow: visible; /* 2 */
|
||||
}
|
||||
|
||||
/* Forms
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Change font properties to `inherit` in all browsers (opinionated).
|
||||
* 2. Remove the margin in Firefox and Safari.
|
||||
*/
|
||||
|
||||
button,
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
font: inherit; /* 1 */
|
||||
margin: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the font weight unset by the previous rule.
|
||||
*/
|
||||
|
||||
optgroup {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the overflow in IE.
|
||||
* 1. Show the overflow in Edge.
|
||||
*/
|
||||
|
||||
button,
|
||||
input { /* 1 */
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inheritance of text transform in Edge, Firefox, and IE.
|
||||
* 1. Remove the inheritance of text transform in Firefox.
|
||||
*/
|
||||
|
||||
button,
|
||||
select { /* 1 */
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
|
||||
* controls in Android 4.
|
||||
* 2. Correct the inability to style clickable types in iOS and Safari.
|
||||
*/
|
||||
|
||||
button,
|
||||
html [type="button"], /* 1 */
|
||||
[type="reset"],
|
||||
[type="submit"] {
|
||||
-webkit-appearance: button; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inner border and padding in Firefox.
|
||||
*/
|
||||
|
||||
button::-moz-focus-inner,
|
||||
[type="button"]::-moz-focus-inner,
|
||||
[type="reset"]::-moz-focus-inner,
|
||||
[type="submit"]::-moz-focus-inner {
|
||||
border-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the focus styles unset by the previous rule.
|
||||
*/
|
||||
|
||||
button:-moz-focusring,
|
||||
[type="button"]:-moz-focusring,
|
||||
[type="reset"]:-moz-focusring,
|
||||
[type="submit"]:-moz-focusring {
|
||||
outline: 1px dotted ButtonText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the border, margin, and padding in all browsers (opinionated).
|
||||
*/
|
||||
|
||||
fieldset {
|
||||
border: 1px solid #c0c0c0;
|
||||
margin: 0 2px;
|
||||
padding: 0.35em 0.625em 0.75em;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the text wrapping in Edge and IE.
|
||||
* 2. Correct the color inheritance from `fieldset` elements in IE.
|
||||
* 3. Remove the padding so developers are not caught out when they zero out
|
||||
* `fieldset` elements in all browsers.
|
||||
*/
|
||||
|
||||
legend {
|
||||
box-sizing: border-box; /* 1 */
|
||||
color: inherit; /* 2 */
|
||||
display: table; /* 1 */
|
||||
max-width: 100%; /* 1 */
|
||||
padding: 0; /* 3 */
|
||||
white-space: normal; /* 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the default vertical scrollbar in IE.
|
||||
*/
|
||||
|
||||
textarea {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Add the correct box sizing in IE 10-.
|
||||
* 2. Remove the padding in IE 10-.
|
||||
*/
|
||||
|
||||
[type="checkbox"],
|
||||
[type="radio"] {
|
||||
box-sizing: border-box; /* 1 */
|
||||
padding: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the cursor style of increment and decrement buttons in Chrome.
|
||||
*/
|
||||
|
||||
[type="number"]::-webkit-inner-spin-button,
|
||||
[type="number"]::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the odd appearance in Chrome and Safari.
|
||||
* 2. Correct the outline style in Safari.
|
||||
*/
|
||||
|
||||
[type="search"] {
|
||||
-webkit-appearance: textfield; /* 1 */
|
||||
outline-offset: -2px; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inner padding and cancel buttons in Chrome and Safari on OS X.
|
||||
*/
|
||||
|
||||
[type="search"]::-webkit-search-cancel-button,
|
||||
[type="search"]::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the text style of placeholders in Chrome, Edge, and Safari.
|
||||
*/
|
||||
|
||||
::-webkit-input-placeholder {
|
||||
color: inherit;
|
||||
opacity: 0.54;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the inability to style clickable types in iOS and Safari.
|
||||
* 2. Change font properties to `inherit` in Safari.
|
||||
*/
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
-webkit-appearance: button; /* 1 */
|
||||
font: inherit; /* 2 */
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
import 'normalize.css/normalize.css';
|
||||
import './index.less';
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
// ICONFONT
|
||||
@iconfont-css-prefix : anticon;
|
||||
@icon-url : "https://at.alicdn.com/t/font_1461567603_8950496";
|
||||
@icon-url : "https://at.alicdn.com/t/font_1463992151_360388";
|
||||
|
||||
// LINK
|
||||
@link-color : #2db7f5;
|
||||
|
||||
@@ -9,7 +9,7 @@ title: 远程加载数据
|
||||
|
||||
另外,本例也展示了筛选排序功能如何交给服务端实现,列不需要指定具体的 `onFilter` 和 `sorter` 函数,而是在把筛选和排序的参数发到服务端来处理。
|
||||
|
||||
**注意,此示例是静态数据模拟,展示数据不会变化,请打开网络面板查看请求。**
|
||||
**注意,此示例使用 [模拟接口](https://randomuser.me),展示数据可能不准确,请打开网络面板查看请求。**
|
||||
|
||||
````jsx
|
||||
import { Table } from 'antd';
|
||||
@@ -18,17 +18,20 @@ import reqwest from 'reqwest';
|
||||
const columns = [{
|
||||
title: '姓名',
|
||||
dataIndex: 'name',
|
||||
filters: [
|
||||
{ text: '姓李的', value: '李' },
|
||||
{ text: '姓胡的', value: '胡' },
|
||||
],
|
||||
}, {
|
||||
title: '年龄',
|
||||
dataIndex: 'age',
|
||||
sorter: true,
|
||||
render: name => `${name.first} ${name.last}`,
|
||||
width: '20%',
|
||||
}, {
|
||||
title: '住址',
|
||||
dataIndex: 'address',
|
||||
title: '性别',
|
||||
dataIndex: 'gender',
|
||||
filters: [
|
||||
{ text: 'Male', value: 'male' },
|
||||
{ text: 'Female', value: 'female' },
|
||||
],
|
||||
width: '20%',
|
||||
}, {
|
||||
title: '邮箱',
|
||||
dataIndex: 'email',
|
||||
}];
|
||||
|
||||
const Test = React.createClass({
|
||||
@@ -46,8 +49,8 @@ const Test = React.createClass({
|
||||
pagination: pager,
|
||||
});
|
||||
this.fetch({
|
||||
pageSize: pagination.pageSize,
|
||||
currentPage: pagination.current,
|
||||
results: pagination.pageSize,
|
||||
page: pagination.current,
|
||||
sortField: sorter.field,
|
||||
sortOrder: sorter.order,
|
||||
...filters,
|
||||
@@ -57,19 +60,23 @@ const Test = React.createClass({
|
||||
console.log('请求参数:', params);
|
||||
this.setState({ loading: true });
|
||||
reqwest({
|
||||
url: '/components/table/demo/data.json',
|
||||
url: 'http://api.randomuser.me',
|
||||
method: 'get',
|
||||
data: params,
|
||||
type: 'json',
|
||||
success: (result) => {
|
||||
const pagination = this.state.pagination;
|
||||
pagination.total = result.totalCount;
|
||||
this.setState({
|
||||
loading: false,
|
||||
data: result.data,
|
||||
pagination,
|
||||
});
|
||||
data: {
|
||||
results: 10,
|
||||
...params,
|
||||
},
|
||||
type: 'json',
|
||||
}).then(data => {
|
||||
const pagination = this.state.pagination;
|
||||
// Read total count from server
|
||||
// pagination.total = data.totalCount;
|
||||
pagination.total = 200;
|
||||
this.setState({
|
||||
loading: false,
|
||||
data: data.results,
|
||||
pagination,
|
||||
});
|
||||
});
|
||||
},
|
||||
componentDidMount() {
|
||||
@@ -78,6 +85,7 @@ const Test = React.createClass({
|
||||
render() {
|
||||
return (
|
||||
<Table columns={columns}
|
||||
rowKey={record => record.registered}
|
||||
dataSource={this.state.data}
|
||||
pagination={this.state.pagination}
|
||||
loading={this.state.loading}
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
{
|
||||
"data": [{
|
||||
"key": "1",
|
||||
"name": "胡彦斌ajax1",
|
||||
"age": 32,
|
||||
"address": "西湖区湖底公园1号"
|
||||
}, {
|
||||
"key": "2",
|
||||
"name": "胡彦祖ajax2",
|
||||
"age": 42,
|
||||
"address": "西湖区湖底公园1号"
|
||||
}, {
|
||||
"key": "3",
|
||||
"name": "李大嘴ajax3",
|
||||
"age": 32,
|
||||
"address": "西湖区湖底公园1号"
|
||||
}, {
|
||||
"key": "4",
|
||||
"name": "李大嘴ajax4",
|
||||
"age": 32,
|
||||
"address": "西湖区湖底公园1号"
|
||||
}, {
|
||||
"key": "5",
|
||||
"name": "李大嘴ajax5",
|
||||
"age": 32,
|
||||
"address": "西湖区湖底公园1号"
|
||||
}, {
|
||||
"key": "6",
|
||||
"name": "李大嘴ajax6",
|
||||
"age": 32,
|
||||
"address": "西湖区湖底公园1号"
|
||||
}, {
|
||||
"key": "7",
|
||||
"name": "李大嘴ajax7",
|
||||
"age": 32,
|
||||
"address": "西湖区湖底公园1号"
|
||||
}, {
|
||||
"key": "8",
|
||||
"name": "李大嘴ajax8",
|
||||
"age": 32,
|
||||
"address": "西湖区湖底公园1号"
|
||||
}, {
|
||||
"key": "9",
|
||||
"name": "李大嘴ajax9",
|
||||
"age": 32,
|
||||
"address": "西湖区湖底公园1号"
|
||||
}, {
|
||||
"key": "10",
|
||||
"name": "李大嘴ajax10",
|
||||
"age": 32,
|
||||
"address": "西湖区湖底公园1号"
|
||||
}],
|
||||
"totalCount": 35,
|
||||
"pageSize": 10,
|
||||
"currentPage": 1
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
order: 16
|
||||
order: 15
|
||||
title: 树形数据展示
|
||||
---
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@ title: 固定头和列
|
||||
|
||||
适合同时展示有大量数据和数据列。
|
||||
|
||||
> 需要指定 scroll.x 为宽度,或者指定每列宽度 `width`,否则可能有错位问题。
|
||||
> 若未指定每列的宽度,则建议指定 scroll.x 为固定宽度。
|
||||
|
||||
> 若列头与内容不对齐,请指定每列宽度 `width`。
|
||||
|
||||
````jsx
|
||||
import { Table } from 'antd';
|
||||
@@ -13,14 +15,14 @@ import { Table } from 'antd';
|
||||
const columns = [
|
||||
{ title: '姓名', width: 100, dataIndex: 'name', key: 'name', fixed: 'left' },
|
||||
{ title: '年龄', width: 100, dataIndex: 'age', key: 'age', fixed: 'left' },
|
||||
{ title: '列1', dataIndex: 'age', key: '1' },
|
||||
{ title: '列2', dataIndex: 'age', key: '2' },
|
||||
{ title: '列3', dataIndex: 'age', key: '3' },
|
||||
{ title: '列4', dataIndex: 'age', key: '4' },
|
||||
{ title: '列5', dataIndex: 'age', key: '5' },
|
||||
{ title: '列6', dataIndex: 'age', key: '6' },
|
||||
{ title: '列7', dataIndex: 'age', key: '7' },
|
||||
{ title: '列8', dataIndex: 'age', key: '8' },
|
||||
{ title: '列1', dataIndex: 'address', key: '1', width: 150 },
|
||||
{ title: '列2', dataIndex: 'address', key: '2', width: 150 },
|
||||
{ title: '列3', dataIndex: 'address', key: '3', width: 150 },
|
||||
{ title: '列4', dataIndex: 'address', key: '4', width: 150 },
|
||||
{ title: '列5', dataIndex: 'address', key: '5', width: 150 },
|
||||
{ title: '列6', dataIndex: 'address', key: '6', width: 150 },
|
||||
{ title: '列7', dataIndex: 'address', key: '7', width: 150 },
|
||||
{ title: '列8', dataIndex: 'address', key: '8', width: 150 },
|
||||
{
|
||||
title: '操作',
|
||||
key: 'operation',
|
||||
@@ -41,7 +43,7 @@ for (let i = 0; i < 100; i++) {
|
||||
}
|
||||
|
||||
function App() {
|
||||
return <Table columns={columns} dataSource={data} scroll={{ x: 1000, y: 300 }} />;
|
||||
return <Table columns={columns} dataSource={data} scroll={{ x: true, y: 300 }} />;
|
||||
}
|
||||
|
||||
ReactDOM.render(<App />, mountNode);
|
||||
|
||||
@@ -5,7 +5,9 @@ title: 固定列
|
||||
|
||||
对于列数很多的数据,可以固定前后的列,横向滚动查看其它数据,需要和 `scroll.x` 配合使用。
|
||||
|
||||
> 需要指定 scroll.x 为宽度,或者指定每列宽度 `width`,否则可能有错位问题。
|
||||
> 若未指定每列的宽度,则建议指定 scroll.x 为固定宽度。
|
||||
|
||||
> 若列头与内容不对齐,请指定每列宽度 `width`。
|
||||
|
||||
````jsx
|
||||
import { Table } from 'antd';
|
||||
@@ -13,14 +15,14 @@ import { Table } from 'antd';
|
||||
const columns = [
|
||||
{ title: '姓名', width: 100, dataIndex: 'name', key: 'name', fixed: 'left' },
|
||||
{ title: '年龄', width: 100, dataIndex: 'age', key: 'age', fixed: 'left' },
|
||||
{ title: '列1', dataIndex: 'age', key: '1' },
|
||||
{ title: '列2', dataIndex: 'age', key: '2' },
|
||||
{ title: '列3', dataIndex: 'age', key: '3' },
|
||||
{ title: '列4', dataIndex: 'age', key: '4' },
|
||||
{ title: '列5', dataIndex: 'age', key: '5' },
|
||||
{ title: '列6', dataIndex: 'age', key: '6' },
|
||||
{ title: '列7', dataIndex: 'age', key: '7' },
|
||||
{ title: '列8', dataIndex: 'age', key: '8' },
|
||||
{ title: '列1', dataIndex: 'address', key: '1' },
|
||||
{ title: '列2', dataIndex: 'address', key: '2' },
|
||||
{ title: '列3', dataIndex: 'address', key: '3' },
|
||||
{ title: '列4', dataIndex: 'address', key: '4' },
|
||||
{ title: '列5', dataIndex: 'address', key: '5' },
|
||||
{ title: '列6', dataIndex: 'address', key: '6' },
|
||||
{ title: '列7', dataIndex: 'address', key: '7' },
|
||||
{ title: '列8', dataIndex: 'address', key: '8' },
|
||||
{
|
||||
title: '操作',
|
||||
key: 'operation',
|
||||
@@ -34,14 +36,16 @@ const data = [{
|
||||
key: '1',
|
||||
name: '胡彦斌',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园0号',
|
||||
}, {
|
||||
key: '2',
|
||||
name: '胡彦祖',
|
||||
age: 42,
|
||||
age: 40,
|
||||
address: '西湖区湖底公园1号',
|
||||
}];
|
||||
|
||||
function App() {
|
||||
return <Table columns={columns} dataSource={data} scroll={{ x: 1000 }} />;
|
||||
return <Table columns={columns} dataSource={data} scroll={{ x: true }} />;
|
||||
}
|
||||
|
||||
ReactDOM.render(<App />, mountNode);
|
||||
|
||||
@@ -3,6 +3,7 @@ import Menu, { SubMenu, Item as MenuItem } from 'rc-menu';
|
||||
import Dropdown from '../dropdown';
|
||||
import Icon from '../icon';
|
||||
import Checkbox from '../checkbox';
|
||||
import Radio from '../radio';
|
||||
|
||||
export default class FilterMenu extends React.Component {
|
||||
static defaultProps = {
|
||||
@@ -53,22 +54,27 @@ export default class FilterMenu extends React.Component {
|
||||
}
|
||||
|
||||
renderMenuItem(item) {
|
||||
const { column } = this.props;
|
||||
const multiple = ('filterMultiple' in column) ? column.filterMultiple : true;
|
||||
return (
|
||||
<MenuItem key={item.value}>
|
||||
<Checkbox checked={this.state.selectedKeys.indexOf(item.value.toString()) >= 0} />
|
||||
{
|
||||
multiple
|
||||
? <Checkbox checked={this.state.selectedKeys.indexOf(item.value.toString()) >= 0} />
|
||||
: <Radio checked={this.state.selectedKeys.indexOf(item.value.toString()) >= 0} />
|
||||
}
|
||||
<span>{item.text}</span>
|
||||
</MenuItem>
|
||||
);
|
||||
}
|
||||
|
||||
renderMenus(items) {
|
||||
let menuItems = items.map(item => {
|
||||
return items.map(item => {
|
||||
if (item.children && item.children.length > 0) {
|
||||
const keyPathOfSelectedItem = this.state.keyPathOfSelectedItem;
|
||||
const containSelected = Object.keys(keyPathOfSelectedItem).some(key => {
|
||||
const keyPath = keyPathOfSelectedItem[key];
|
||||
return keyPath.indexOf(item.value) >= 0;
|
||||
});
|
||||
const { keyPathOfSelectedItem } = this.state;
|
||||
const containSelected = Object.keys(keyPathOfSelectedItem).some(
|
||||
key => keyPathOfSelectedItem[key].indexOf(item.value) >= 0
|
||||
);
|
||||
const subMenuCls = containSelected ? 'ant-dropdown-submenu-contain-selected' : '';
|
||||
return (
|
||||
<SubMenu title={item.text} className={subMenuCls} key={item.value.toString()}>
|
||||
@@ -78,7 +84,6 @@ export default class FilterMenu extends React.Component {
|
||||
}
|
||||
return this.renderMenuItem(item);
|
||||
});
|
||||
return menuItems;
|
||||
}
|
||||
|
||||
handleMenuItemClick = (info) => {
|
||||
@@ -97,13 +102,11 @@ export default class FilterMenu extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
let { column, locale } = this.props;
|
||||
const { column, locale } = this.props;
|
||||
// default multiple selection in filter dropdown
|
||||
let multiple = true;
|
||||
if ('filterMultiple' in column) {
|
||||
multiple = column.filterMultiple;
|
||||
}
|
||||
let menus = (
|
||||
const multiple = ('filterMultiple' in column) ? column.filterMultiple : true;
|
||||
|
||||
const menus = (
|
||||
<div className="ant-table-filter-dropdown">
|
||||
<Menu multiple={multiple}
|
||||
onClick={this.handleMenuItemClick}
|
||||
@@ -126,10 +129,8 @@ export default class FilterMenu extends React.Component {
|
||||
</div>
|
||||
);
|
||||
|
||||
let dropdownSelectedClass = '';
|
||||
if (this.props.selectedKeys.length > 0) {
|
||||
dropdownSelectedClass = 'ant-table-filter-selected';
|
||||
}
|
||||
const dropdownSelectedClass = (this.props.selectedKeys.length > 0)
|
||||
? 'ant-table-filter-selected' : '';
|
||||
|
||||
return (
|
||||
<Dropdown trigger={['click']}
|
||||
|
||||
@@ -21,7 +21,7 @@ const defaultLocale = {
|
||||
filterTitle: '筛选',
|
||||
filterConfirm: '确定',
|
||||
filterReset: '重置',
|
||||
emptyText: '暂无数据',
|
||||
emptyText: <span><Icon type="frown" />暂无数据</span>,
|
||||
};
|
||||
|
||||
const defaultPagination = {
|
||||
@@ -262,9 +262,11 @@ export default class Table extends React.Component {
|
||||
}
|
||||
});
|
||||
|
||||
// Reset current prop
|
||||
pagination.current = 1;
|
||||
pagination.onChange(pagination.current);
|
||||
if (props.pagination) {
|
||||
// Reset current prop
|
||||
pagination.current = 1;
|
||||
pagination.onChange(pagination.current);
|
||||
}
|
||||
|
||||
const newState = {
|
||||
selectionDirty: false,
|
||||
@@ -505,6 +507,9 @@ export default class Table extends React.Component {
|
||||
className: 'ant-table-selection-column',
|
||||
};
|
||||
}
|
||||
if (columns.some(column => column.fixed === 'left' || column.fixed === true)) {
|
||||
selectionColumn.fixed = 'left';
|
||||
}
|
||||
if (columns[0] && columns[0].key === 'selection-column') {
|
||||
columns[0] = selectionColumn;
|
||||
} else {
|
||||
@@ -711,7 +716,7 @@ export default class Table extends React.Component {
|
||||
if (!data || data.length === 0) {
|
||||
emptyText = (
|
||||
<div className="ant-table-placeholder">
|
||||
<Icon type="frown" />{locale.emptyText}
|
||||
{locale.emptyText}
|
||||
</div>
|
||||
);
|
||||
emptyClass = 'ant-table-empty';
|
||||
@@ -737,7 +742,7 @@ export default class Table extends React.Component {
|
||||
table = <Spin className={spinClassName} spinning={this.props.loading}>{table}</Spin>;
|
||||
return (
|
||||
<div className={`${emptyClass} ${className} clearfix`} style={style}>
|
||||
{<Spin className={spinClassName} spinning={this.props.loading}>{table}</Spin>}
|
||||
{table}
|
||||
{this.renderPagination()}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -76,19 +76,18 @@ const columns = [{
|
||||
| footer | 表格底部自定义渲染函数 | Function(currentPageData) | |
|
||||
| scroll | 横向或纵向支持滚动,也可用于指定滚动区域的宽高度:`{{ x: true, y: 300 }}` | Object | - |
|
||||
|
||||
|
||||
### Column
|
||||
|
||||
列描述数据对象,是 columns 中的一项。
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|-----------|----------------------------|-----------------|---------|
|
||||
| title | 列头显示文字 | String or React.Element | |
|
||||
| key | React 需要的 key,建议设置 | String | |
|
||||
| dataIndex | 列数据在数据项中对应的 key | String | |
|
||||
| render | 生成复杂数据的渲染函数,参数分别为当前行的值,当前行数据,行索引,@return里面可以设置表格[行/列合并](#demo-colspan-rowspan) | Function(text, record, index) {} | |
|
||||
| filters | 表头的筛选菜单项 | Array | |
|
||||
| onFilter | 本地模式下,确定筛选的运行函数 | Function | |
|
||||
| title | 列头显示文字 | String or React.Element | - |
|
||||
| key | React 需要的 key,建议设置 | String | - |
|
||||
| dataIndex | 列数据在数据项中对应的 key,支持 `a.b.c` 的嵌套写法 | String | - |
|
||||
| render | 生成复杂数据的渲染函数,参数分别为当前行的值,当前行数据,行索引,@return里面可以设置表格[行/列合并](#demo-colspan-rowspan) | Function(text, record, index) {} | - |
|
||||
| filters | 表头的筛选菜单项 | Array | - |
|
||||
| onFilter | 本地模式下,确定筛选的运行函数 | Function | - |
|
||||
| filterMultiple | 是否多选 | Boolean | true |
|
||||
| sorter | 排序函数,本地排序使用一个函数,需要服务端排序可设为 true | Function or Boolean | - |
|
||||
| colSpan | 表头列合并,设置为 0 时,不渲染 | Number | |
|
||||
@@ -111,7 +110,6 @@ const columns = [{
|
||||
| onSelect | 用户手动选择/取消选择某列的回调 | Function(record, selected, selectedRows) | - |
|
||||
| onSelectAll | 用户手动选择/取消选择所有列的回调 | Function(selected, selectedRows, changeRows) | - |
|
||||
|
||||
|
||||
## 注意
|
||||
|
||||
按照 React 的[规范](http://facebook.github.io/react/docs/multiple-components.html#dynamic-children),所有的组件数组必须绑定 key。在 Table 中,`dataSource` 和 `columns` 里的数据值都需要指定 `key` 值。对于 `dataSource` 默认将每列数据的 `key` 属性作为唯一的标识。
|
||||
|
||||
@@ -191,11 +191,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
&.@{table-prefix-cls}-bordered {
|
||||
&-bordered {
|
||||
table {
|
||||
border: 1px solid @border-color-split;
|
||||
}
|
||||
|
||||
&.@{table-prefix-cls}-fixed-header {
|
||||
border: 1px solid @border-color-split;
|
||||
table {
|
||||
border: 0;
|
||||
}
|
||||
}
|
||||
|
||||
th {
|
||||
border-bottom: 1px solid @border-color-split;
|
||||
}
|
||||
@@ -259,6 +266,10 @@
|
||||
box-shadow: none;
|
||||
border-radius: @border-radius-base @border-radius-base 0 0;
|
||||
|
||||
&-item > label + span {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
&-sub {
|
||||
border-radius: @border-radius-base;
|
||||
border: 1px solid @border-color-base;
|
||||
@@ -306,12 +317,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
&-expand-icon-th {
|
||||
width: 34px;
|
||||
}
|
||||
|
||||
&-row {
|
||||
&-expand-icon {
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
width: 17px;
|
||||
height: 17px;
|
||||
text-align: center;
|
||||
line-height: 15px;
|
||||
border: 1px solid @border-color-split;
|
||||
@@ -355,18 +370,19 @@
|
||||
|
||||
&-scroll {
|
||||
overflow: auto;
|
||||
table {
|
||||
width: auto;
|
||||
min-width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
&-body-inner {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
&-fixed-header &-body-inner {
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
&-fixed {
|
||||
table-layout: fixed;
|
||||
&-fixed-header &-body-inner,
|
||||
&-fixed-header &-header {
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
&-fixed-left,
|
||||
@@ -383,19 +399,53 @@
|
||||
}
|
||||
}
|
||||
|
||||
&-fixed-left,
|
||||
&-fixed-right,
|
||||
&-scroll {
|
||||
th,
|
||||
td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
&-fixed-left &-fixed,
|
||||
&-fixed-right &-fixed {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
&-fixed-left {
|
||||
left: 0;
|
||||
box-shadow: @shadow-1-right;
|
||||
border-radius: @border-radius-base 0 0 0;
|
||||
& .@{table-prefix-cls}-body-inner {
|
||||
.@{table-prefix-cls}-header {
|
||||
overflow-y: hidden;
|
||||
}
|
||||
// hide scrollbar in left fixed columns
|
||||
.@{table-prefix-cls}-body-inner {
|
||||
margin-right: -20px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
.@{table-prefix-cls}-fixed-header & .@{table-prefix-cls}-body-inner {
|
||||
padding-right: 0;
|
||||
}
|
||||
&,
|
||||
table {
|
||||
border-radius: @border-radius-base 0 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
&-fixed-right {
|
||||
right: 0;
|
||||
box-shadow: @shadow-1-left;
|
||||
border-radius: 0 @border-radius-base 0 0;
|
||||
&,
|
||||
table {
|
||||
border-radius: 0 @border-radius-base 0 0;
|
||||
}
|
||||
// hide expand row content in right-fixed Table
|
||||
// https://github.com/ant-design/ant-design/issues/1898
|
||||
.@{table-prefix-cls}-expanded-row {
|
||||
color: transparent;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
&&-scroll-position-left &-fixed-left {
|
||||
|
||||
66
components/tabs/demo/custom-add-trigger.md
Normal file
66
components/tabs/demo/custom-add-trigger.md
Normal file
@@ -0,0 +1,66 @@
|
||||
---
|
||||
order: 11
|
||||
title: 自定义新增页签触发器
|
||||
---
|
||||
|
||||
隐藏默认的页签增加图标,给自定义触发器绑定事件。
|
||||
|
||||
````jsx
|
||||
import { Tabs, Button } from 'antd';
|
||||
const TabPane = Tabs.TabPane;
|
||||
|
||||
const Demo = React.createClass({
|
||||
getInitialState() {
|
||||
this.newTabIndex = 0;
|
||||
const panes = [
|
||||
<TabPane tab="选项卡" key="1">选项卡一内容</TabPane>,
|
||||
<TabPane tab="选项卡" key="2">选项卡二内容</TabPane>,
|
||||
];
|
||||
return {
|
||||
activeKey: panes[0].key,
|
||||
panes,
|
||||
};
|
||||
},
|
||||
onChange(activeKey) {
|
||||
this.setState({ activeKey });
|
||||
},
|
||||
onEdit(targetKey, action) {
|
||||
this[action](targetKey);
|
||||
},
|
||||
add() {
|
||||
const panes = this.state.panes;
|
||||
const activeKey = `newTab${this.newTabIndex++}`;
|
||||
panes.push(<TabPane tab="新建页签" key={activeKey}>新页面</TabPane>);
|
||||
this.setState({ panes, activeKey });
|
||||
},
|
||||
remove(targetKey) {
|
||||
let activeKey = this.state.activeKey;
|
||||
let lastIndex;
|
||||
this.state.panes.forEach((pane, i) => {
|
||||
if (pane.key === targetKey) {
|
||||
lastIndex = i - 1;
|
||||
}
|
||||
});
|
||||
const panes = this.state.panes.filter(pane => pane.key !== targetKey);
|
||||
if (lastIndex >= 0 && activeKey === targetKey) {
|
||||
activeKey = panes[lastIndex].key;
|
||||
}
|
||||
this.setState({ panes, activeKey });
|
||||
},
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<Button type="ghost" onClick={this.add}>新增</Button>
|
||||
</div>
|
||||
<Tabs hideAdd onChange={this.onChange} activeKey={this.state.activeKey}
|
||||
type="editable-card" onEdit={this.onEdit}>
|
||||
{this.state.panes}
|
||||
</Tabs>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
ReactDOM.render(<Demo />, mountNode);
|
||||
````
|
||||
@@ -12,6 +12,7 @@ export default class Tabs extends React.Component {
|
||||
type: 'line', // or 'card' 'editable-card'
|
||||
onChange() {},
|
||||
onEdit() {},
|
||||
hideAdd: false,
|
||||
}
|
||||
|
||||
createNewTab = (targetKey) => {
|
||||
@@ -32,7 +33,7 @@ export default class Tabs extends React.Component {
|
||||
|
||||
render() {
|
||||
let { prefixCls, size, tabPosition, animation, type,
|
||||
children, tabBarExtraContent } = this.props;
|
||||
children, tabBarExtraContent, hideAdd } = this.props;
|
||||
let className = classNames({
|
||||
[this.props.className]: !!this.props.className,
|
||||
[`${prefixCls}-mini`]: size === 'small' || size === 'mini',
|
||||
@@ -55,12 +56,14 @@ export default class Tabs extends React.Component {
|
||||
});
|
||||
});
|
||||
// Add new tab handler
|
||||
tabBarExtraContent = (
|
||||
<span>
|
||||
<Icon type="plus" className={`${prefixCls}-new-tab`} onClick={this.createNewTab} />
|
||||
{tabBarExtraContent}
|
||||
</span>
|
||||
);
|
||||
if (!hideAdd) {
|
||||
tabBarExtraContent = (
|
||||
<span>
|
||||
<Icon type="plus" className={`${prefixCls}-new-tab`} onClick={this.createNewTab} />
|
||||
{tabBarExtraContent}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
tabBarExtraContent = tabBarExtraContent ? (
|
||||
|
||||
@@ -32,6 +32,7 @@ Ant Design 依次提供了三级选项卡,分别用于不同的场景。
|
||||
| size | 大小,提供 `default` 和 `small` 两种大小 | String | 'default' |
|
||||
| tabPosition | 页签位置,可选值有 `top` `right` `bottom` `left` | String | 'top' |
|
||||
| onEdit | 新增和删除页签的回调,在 `type="editable-card"` 时有效 | Function(targetKey, action) | 无 |
|
||||
| hideAdd | 是否隐藏加号图标,在 `type="editable-card"` 时有效 | Boolean | false |
|
||||
|
||||
### Tabs.TabPane
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user