Compare commits

..

142 Commits

Author SHA1 Message Date
偏右
c6f4e1ad0f Update CHANGELOG.md 2017-02-17 00:06:07 +08:00
Benjy Cui
4178b0afd8 bump 1.11.6, close: #4580 2017-01-12 17:59:44 +08:00
Benjy Cui
640522cb73 bump 1.11.5 2017-01-09 11:38:57 +08:00
Justin
16ce494f92 fix: controlled filterDropdown props in antd@1.x (#4470)
* controlled filterDropdown props in antd@1.x

* code style

* sync #4462
2017-01-09 11:31:01 +08:00
afc163
8fdace7173 update 1.x changelog for 1.11.3 and 1.11.4 2017-01-05 11:25:22 +08:00
yiminghe
f7933cd2b6 fix pub 2016-11-26 00:04:08 +08:00
Benjy Cui
44fd5990f6 bump 1.11.4 2016-11-24 18:06:19 +08:00
Benjy Cui
d009cf0b76 fix: Upload should work without children 2016-11-24 18:04:57 +08:00
Benjy Cui
51b74b7daa bump 1.11.3 2016-11-23 14:08:17 +08:00
Justin
635bc8cedc fix: getComputedStyle for IE8 (#3965) 2016-11-23 13:56:25 +08:00
Midqiu
ff59663898 docs: missing comma (#3172) 2016-09-27 16:38:47 +08:00
Benjy Cui
9ec69e4a2b docs: add change log for 1.11.2 2016-09-26 15:58:29 +08:00
Benjy Cui
b093e8296a bump 1.11.2 2016-09-26 15:52:48 +08:00
afc163
f0de230192 fix wrong type of Step[icon] 2016-09-26 10:41:08 +08:00
afc163
8f41b66253 Fix strange button style bug in chrome 53, close #3031 2016-09-22 15:48:01 +08:00
afc163
11b019667c Fix badge props, close #3109 2016-09-21 21:52:43 +08:00
afc163
478dfd1767 fontstatic.useco.com => fonts.gstatic.com, close #3064 2016-09-19 00:37:10 +08:00
Benjy Cui
b983b5792f docs: fix change log 2016-09-14 15:05:45 +08:00
Benjy Cui
db3cbb7fd8 bump 1.11.1 2016-09-14 15:03:25 +08:00
afc163
63789c3838 remove text overflow in select, close #2927 2016-09-13 18:46:45 +08:00
afc163
be81b360fd Merge branch '1.x-stable' of github.com:ant-design/ant-design into 1.x-stable 2016-09-13 18:27:49 +08:00
afc163
d518e485b1 Improve Dropdown Button examples 2016-09-13 18:27:39 +08:00
afc163
0f986c07a2 update form index.md 2016-09-13 18:26:52 +08:00
ddcat1115
e19a0d500c fix: time-picker style, close #2973 (#3028) 2016-09-13 17:06:11 +08:00
afc163
c897243d33 Fix upload beforeUpload, close #3001 2016-09-12 15:19:44 +08:00
afc163
472821013c Fix Cascader hover style, close #3015 2016-09-12 14:31:29 +08:00
Benjy Cui
5361dd3687 site: fix colors.md 2016-09-11 15:07:05 +08:00
afc163
3f1960f233 fix fixed columns align bug in small Table, close #2933 2016-09-08 21:27:38 +08:00
afc163
ac97851b84 update axure library link 2016-09-08 14:55:58 +08:00
afc163
9331a3e6d1 fix lesshint
Conflicts:
	components/date-picker/style/RangePicker.less
2016-09-08 14:13:47 +08:00
afc163
87e6ec8940 fix date-picker demo 2016-09-08 14:09:36 +08:00
afc163
10862b30a2 Add missing prop open into document, close #2792 2016-09-08 14:07:38 +08:00
ddcat1115
dcd4477bb8 docs: Upload 修正老旧文档 close #2892 (#2941) 2016-09-07 10:19:51 +08:00
tianli.zhao
ff4348186e fix issue 2929:Menu 设置成 theme=dark 后,链接点击无效 (#2931) 2016-09-03 00:46:01 +08:00
afc163
6a9bbd7b9a update changelog 2016-09-01 18:28:10 +08:00
乐仪
6c9ccd12d5 Merge branch '1.x-stable' of https://github.com/ant-design/ant-design into 1.x-stable 2016-09-01 17:50:28 +08:00
乐仪
a8d506ad7b update CHANGELOG
version->1.11.0
2016-09-01 17:49:02 +08:00
ddcat1115
a1021decbc Merge pull request #2919 from ddcat1115/fix-2906_
fix ButtonGroup 'default' size warning
2016-09-01 17:35:43 +08:00
ddcat1115
5762b4139b fix ButtonGroup 'default' size warning
close #2906
2016-09-01 17:17:05 +08:00
afc163
7c99d5fb9e fix selector order, close #2916 2016-09-01 16:48:22 +08:00
afc163
822d233188 Merge branch '1.x-stable' of github.com:ant-design/ant-design into 1.x-stable 2016-09-01 12:23:41 +08:00
afc163
e9c551acb3 upgrade react-slick to 0.13 and fix pauseOnHover
ref https://github.com/akiran/react-slick/pull/452
2016-09-01 12:22:03 +08:00
Benjy Cui
96543d5360 docs: update cdn, close: #2896 2016-08-31 16:03:35 +08:00
afc163
67fc242c6b fix propTypes 2016-08-31 14:45:38 +08:00
afc163
b10ff61272 update builtInPlacements order 2016-08-31 14:34:26 +08:00
afc163
977e2e32fc Add arrowPointAtCenter to Tooltip Popover Popconfirm
修正默认对齐方式为边缘对齐,增加属性用于箭头指向中心的行为
2016-08-31 13:54:16 +08:00
afc163
6ba30bc485 Fix calendar card style 2016-08-30 21:30:55 +08:00
afc163
399b3d589a fix Form.create types, close #2885 2016-08-30 19:33:34 +08:00
ddcat1115
bffdf731cd fix #2812 (#2875) 2016-08-30 17:01:51 +08:00
feng zhi hao
61838ca6b9 补充index.d.ts中Form缺少的声明 (#2853) 2016-08-29 21:28:39 +08:00
afc163
c3c1d091c2 Fix InputNumber flush style in Chrome, close #2876 2016-08-29 20:57:42 +08:00
afc163
ee60b42d6d improve Modal code style 2016-08-29 20:48:47 +08:00
afc163
9ae07d5bc7 Fix defaultPageSize in Table.pagination, close #2874 2016-08-29 18:19:29 +08:00
afc163
93fec41219 Merge branch 'zation-apply_sorter_for_children' into 1.x-stable 2016-08-26 15:04:53 +08:00
afc163
96c9c11b55 Make children sort recursively 2016-08-26 15:04:19 +08:00
afc163
d257dde3d2 Merge branch 'apply_sorter_for_children' of https://github.com/zation/ant-design into zation-apply_sorter_for_children 2016-08-26 14:53:00 +08:00
Liu Yang
fb66e9c7e3 apply sorter for children 2016-08-25 21:12:23 +08:00
feng zhi hao
f8294e2332 补充index.d.ts中notification和Table缺少的声明 (#2842)
* 补充index.d.ts中notification缺少的声明

* 补充index.d.ts中Table缺少的声明
2016-08-25 20:44:28 +08:00
detailyang
ff05904b54 append slash on URI (#2834)
[http://ant.design/components/cascader](http://ant.design/components/cascader) is 404 but [http://ant.design/components/cascader/](http://ant.design/components/cascader/) is good well
2016-08-25 10:52:51 +08:00
afc163
37c3de6b83 remove indexForSort (#2501) until another stable sort problem is reported 2016-08-23 18:00:01 +08:00
afc163
47a3b04eb1 change layout chinese name 2016-08-22 14:51:24 +08:00
afc163
d60ea3c623 update changelog 2016-08-20 21:51:22 +08:00
afc163
07dd1d2089 bump 1.10.0 2016-08-20 21:37:48 +08:00
afc163
646e190c1d update edit button style 2016-08-20 20:36:56 +08:00
afc163
8d7a5a80a7 upgrade rc-cascader 2016-08-20 20:12:18 +08:00
afc163
9ec6cc90a5 Fix menu z-index
maybe it can close #2762 😄
2016-08-20 19:29:59 +08:00
afc163
2dae3363c2 update download.zh-CN.md 2016-08-20 17:52:36 +08:00
Benjy Cui
c92827324b site: update edit button style 2016-08-19 16:11:32 +08:00
ddcat1115
6289d1202b docs: LocaleProvider, DatePicker 补充时区说明 (#2761) 2016-08-18 15:39:57 +08:00
Benjy Cui
cf6643ae75 feat: support BackTop[target], ref: #2718 (#2735) 2016-08-18 11:28:00 +08:00
Benjy Cui
d28e193382 feat: support Affix[target], ref: #2718 (#2734) 2016-08-18 11:27:37 +08:00
afc163
c30839c9ac Fix ant.design site detail 2016-08-17 18:33:19 +08:00
然则
63a266c312 fix #2748 2016-08-17 18:10:33 +08:00
Jerry Bendy
3a12cad07a 链接 404 啦 (#2753)
有些链接没写最后面的 "/" 导致打不开
2016-08-17 18:09:24 +08:00
afc163
da9836c14a Merge branch '1.x-stable' of github.com:ant-design/ant-design into 1.x-stable 2016-08-17 14:04:11 +08:00
afc163
2ce9d94a66 Fix select input height in IE, close #2741 2016-08-17 13:57:42 +08:00
afc163
9645fdf3c4 use perfix varible in less 2016-08-17 13:47:23 +08:00
Benjy Cui
1b69accf2d site: add edit button for demo and doc, close: #2325 2016-08-17 12:06:38 +08:00
Benjy Cui
479056364a site: update header 2016-08-17 11:00:52 +08:00
Benjy Cui
4f2c12a640 site: move polyfill to html 2016-08-17 10:52:56 +08:00
afc163
1f670b84a9 fix Tabs children again (#2559) 2016-08-16 23:13:31 +08:00
afc163
9a62ca9a31 update site Footer 2016-08-16 19:20:03 +08:00
afc163
95846a767c update axure library file, close #2714 2016-08-17 16:28:50 +08:00
afc163
cfba6aa60e bump 1.9.1 2016-08-17 15:57:14 +08:00
afc163
0670b05e50 Improve code style 2016-08-17 15:47:29 +08:00
afc163
471743f4c7 Fix editable Tabs key error
close #2721 & #2725
2016-08-17 15:17:10 +08:00
afc163
6a86811e95 Fix table style, close #2723 2016-08-17 14:55:03 +08:00
乐仪
180916386e update CHANGELOG.md
update package.json -> 1.9.0
2016-08-15 19:01:52 +08:00
ddcat1115
2c76b19a1a fix #2688 避免对已经unmount的组件进行操作 (#2720) 2016-08-15 17:49:41 +08:00
Benjy Cui
3128b15ea5 docs: fix demo format 2016-08-15 11:42:44 +08:00
Benjy Cui
6884b4cd53 docs: fix demo format 2016-08-15 11:23:19 +08:00
afc163
ef23ee9d68 Make table styles more percise, fix DatePicker in Table
close #2675
2016-08-14 16:18:12 +08:00
ddcat1115
6b0a3e129c Fix 2663 有 title 时表格 empty 样式错位 (#2679)
* fix #2663

* fix #2663
2016-08-14 15:38:43 +08:00
ddcat1115
a5585bff77 fix #2571 #2518 #2645 增加disabled属性及取消上传时cancel请求 (#2690)
* fix #2571 #2518  use rc-upload@2.x abort
fix #2645  add `disabled`

* fix
2016-08-14 15:20:00 +08:00
afc163
7bbb26d441 Fix spin overflow, close #2652 2016-08-12 16:36:47 +08:00
afc163
8d439c48a5 Remove wrong placeholder cursor 2016-08-12 15:18:50 +08:00
afc163
8402439a71 Fix some hardcoded style, close #2424 2016-08-11 17:16:38 +08:00
afc163
35d3c6a86c update links 2016-08-11 16:45:15 +08:00
afc163
42298b60d4 Fix editable-card Tabs children map bug, close #2658 2016-08-11 16:36:12 +08:00
afc163
f2bb52e57b Fix autosize Input can not input chinese words
and lost cursor problems

close #2666, close #2239
2016-08-11 15:27:59 +08:00
afc163
f2a6b5342d update CHANGELOG 2016-08-10 19:36:28 +08:00
afc163
24d8016def update CHANGELOG 2016-08-10 17:48:10 +08:00
afc163
cd98aab871 Fix transfer list item overflow style, close #2674 2016-08-10 17:46:36 +08:00
afc163
8ae2936342 Fix nested Forms style 2016-08-10 14:38:35 +08:00
afc163
47311313ab Fix transfer line-height inside FormItem 2016-08-09 11:48:27 +08:00
afc163
0c21102fa7 update CHANGELOG 2016-08-08 14:06:21 +08:00
RaoHai
7f5bc38137 update changelog and version 2016-08-08 10:53:36 +08:00
然则
72f56cac8e fix show arrow when there is no children #2616 2016-08-07 20:34:19 +08:00
ddcat1115
2a9864c9ee fix #2604 (#2617)
* fix #2604

* fix
2016-08-06 13:16:38 +08:00
afc163
0ad3492fc9 fix markdown 2016-08-06 09:23:12 +08:00
afc163
a5fc35e56f Merge branch '1.x-stable' of github.com:ant-design/ant-design into 1.x-stable 2016-08-06 09:05:40 +08:00
afc163
a93a72e3b0 update layout doc for missing APIs, close #2629 2016-08-06 09:05:17 +08:00
Benjy Cui
a17dbf03e1 site: fix sidebar 2016-08-05 19:13:57 +08:00
陆离
33daca7962 Merge pull request #2601 from RaoHai/smallScreenDialog-stable
modal 添加小屏幕适配。
2016-08-05 11:34:16 +08:00
Benjy Cui
6687c12b82 feat: support Transfer[filterOption], close: #2324 2016-08-05 10:49:54 +08:00
afc163
f869943c5c fix link 2016-08-04 17:59:07 +08:00
afc163
0d84468925 Add link 2016-08-04 17:06:22 +08:00
afc163
a8d33b9fb2 update iconfont download url 2016-08-04 11:26:02 +08:00
Benjy Cui
2fedc25bfb site: improve load performance 2016-08-04 10:52:09 +08:00
afc163
9726122904 selectedRows should match selectedRowKeys, close #2566 2016-08-03 21:27:45 +08:00
afc163
2536dbee78 Improve Table select perfermance 2016-08-03 21:08:13 +08:00
afc163
32a587ba71 fix empty children inside Row, close #2603 2016-08-03 20:30:17 +08:00
afc163
c1607954db Merge branch '1.x-stable' of github.com:ant-design/ant-design into 1.x-stable 2016-08-03 19:57:32 +08:00
afc163
d140108656 Fix typo
close #2602
2016-08-03 19:56:27 +08:00
Benjy Cui
7c7a365960 site: improve performance 2016-08-03 17:51:33 +08:00
Benjy Cui
b0f28a218e site: fix search 2016-08-03 16:16:05 +08:00
Benjy Cui
dfc26727d8 site: unify link 2016-08-03 15:41:18 +08:00
RaoHai
3209edddca modal 添加小屏幕适配。
+ 加入 768px 断点。当屏幕小于 768 时,宽度 auto 且 margin:10。其他不变。
2016-08-03 15:25:33 +08:00
Benjy Cui
7ea4dfa501 site: merge demos in one file 2016-08-03 14:39:55 +08:00
afc163
9cee9f103a Fix TreeSelect not found style 2016-08-03 11:33:23 +08:00
Benjy Cui
86aaa2d1ed feat: support customized color for Tag, close: #2585 2016-08-03 09:55:16 +08:00
Benjy Cui
a4d91fb99a fix: should hide close button if not hover, close: #2584 2016-08-03 09:48:53 +08:00
afc163
8b0766937f Fix cascader disabled style 2016-08-02 17:19:54 +08:00
afc163
9ffdbc5c26 update cascader demo 2016-08-02 17:06:14 +08:00
afc163
4bbe2291ef Fix uploading picture style 2016-08-02 15:05:25 +08:00
偏右
ac6422419a Revert "修复 typescript 类型声明" (#2564) 2016-08-01 17:34:17 +08:00
陆离
4fbc909ac1 fix: children should be an array, close #2559 (#2563) 2016-08-01 13:53:11 +08:00
afc163
47bdd8d45d update changelog 2016-08-01 11:43:42 +08:00
Benjy Cui
08edb25ecc deps: update bisheng 2016-08-01 10:22:31 +08:00
Benjy Cui
ac9253ed73 docs: simplify CHANGELOG.md (#2556) 2016-07-30 15:13:01 +08:00
afc163
5bfcded8ec Merge branch '1.x-stable' of github.com:ant-design/ant-design into 1.x-stable 2016-07-30 14:32:38 +08:00
afc163
a139442307 Fix eslint 2016-07-30 14:31:36 +08:00
106 changed files with 1285 additions and 1307 deletions

View File

@@ -13,7 +13,7 @@ The following guidelines are about *How to avoid Homework Questions*.
### 1. Read the documentation.
It sad but true that someone just glance(not read) [Ant Design's documentation](http://ant.design/). Please read the documentation closely. What's more, you can modify and run our demo with [CodePen](http://codepen.io/anon/pen/wGOWGW?editors=001). It's helpful to understand our documentation.
It sad but true that someone just glance(not read) [Ant Design's documentation](http://ant.design/). Please read the documentation closely. What's more, you can modify and run our demo with [CodePen](http://codepen.io/benjycui/pen/KgPZrE?editors=001). It's helpful to understand our documentation.
Tips: choose the corresponding documentation with versions selector which in the bottom-right corner.
@@ -36,7 +36,7 @@ It is a good habit which will save maintainers' time. Thank you!
## Providing a demo while reporting a bug
It would be helpful to provide a demo which can re-produce the bug 100%. Please fork this [CodePen](http://codepen.io/anon/pen/wGOWGW?editors=001) and re-produce the bug you met. Then, create an issue. The most important thing is: double check before claiming that you have found a bug.
It would be helpful to provide a demo which can re-produce the bug 100%. Please fork this [CodePen](http://codepen.io/benjycui/pen/KgPZrE?editors=001) and re-produce the bug you met. Then, create an issue. The most important thing is: double check before claiming that you have found a bug.
## Tips about Feature Request

View File

@@ -24,4 +24,4 @@
#### 可重现的在线演示
<!-- 请修改并 Fork http://codepen.io/anon/pen/wGOWGW?editors=001 -->
<!-- 请修改并 Fork http://codepen.io/benjycui/pen/KgPZrE?editors=001 -->

View File

@@ -9,6 +9,8 @@
"duplicateProperty": false,
"importPath": false,
"finalNewline": false,
"newlineAfterBlock": false,
"maxCharPerLine": false,
"excludedFiles": [
"components/layout/style/mixin.less",
"components/style/core/base.less",

View File

@@ -5,10 +5,111 @@ toc: false
timeline: true
---
你也可以查看 GitHub 上的 [发布日志](https://github.com/ant-design/ant-design/releases)。
如果需要查看 `0.12.x` 及之前的更新日志,请移步 [GitHub](https://github.com/ant-design/ant-design/blob/0.12-stable/CHANGELOG.md)。
---
## 1.11.5
`2017-01-09`
* 修复 `Table[filterDropdown]` 显示不受控的问题。
## 1.11.4
`2016-11-24`
* 修复 Upload 的 children 不能为 `null` 的问题。
## 1.11.3
`2016-11-23`
* 修复 `Input[type=textarea]` 在 IE8 下面的兼容性问题。[#3946](https://github.com/ant-design/ant-design/issues/3946) [@codering](https://github.com/codering)
## 1.11.2
`2016-09-26`
- 修复 Popover 内嵌 Badge 后失效的问题。[#3109](https://github.com/ant-design/ant-design/issues/3109)
- 修复 Modal 内嵌的 Button 在某些情况下与 Modal 的滚动不同步的问题。[#3031](https://github.com/ant-design/ant-design/issues/3031)
## 1.11.1
`2016-09-14`
- 修复 Menu 设置成 `theme=dark` 后,链接点击无效的问题。[#2929](https://github.com/ant-design/ant-design/issues/2929)
- 修复迷你型 Table 表头与内容不对齐的问题。[#2933](https://github.com/ant-design/ant-design/issues/2933)
- 修复 Cascader hover 样式。[#3015](https://github.com/ant-design/ant-design/issues/3015)
- 修复 Upload 上传多个文件时,`onChange` 调用不正确的问题。[#3001](https://github.com/ant-design/ant-design/issues/3001)
- 修复 TimePicker 报错样式的问题。[#2973](https://github.com/ant-design/ant-design/issues/2973)
- 修复 Calendar 控件的年度选择下拉内容截断的问题。[#2927](https://github.com/ant-design/ant-design/issues/2927)
## 1.11.0
`2016-09-01`
- `Tooltip` `Popover` `Popconfirm` 修正默认对齐方式为边缘对齐,增加 arrowPointAtCenter 属性用于箭头指向中心的行为。[commit 977e2e3](https://github.com/ant-design/ant-design/commit/977e2e32fc40968846c8201ed72bdc3818375d2f)
- `Table`
- 移除数据中添加的 `indexForSort`。[#2501](https://github.com/ant-design/ant-design/issues/2501)
- 修复 `pagination` 属性中 `defaultPageSize` 不生效的问题。[#2874](https://github.com/ant-design/ant-design/issues/2874)
- 修复数据为空时固定列出现重复提示的问题。[#2812](https://github.com/ant-design/ant-design/issues/2812)
- 给树形子数据增加排序功能。[#2839](https://github.com/ant-design/ant-design/issues/2839)
- `InputNumber` 样式问题修复。[#2876](https://github.com/ant-design/ant-design/issues/2876)
- 修复手动导入 less 文件时 input error 样式被 focus 样式覆盖的问题。[#2916](https://github.com/ant-design/ant-design/issues/2916)
- index.d.ts 中补充了一些缺失的声明,修复 `Form` 中 typescript 语法检查报错的问题。[#2885](https://github.com/ant-design/ant-design/issues/2885)
- 升级 react-slick 依赖到 `0.13`
## 1.10.0
`2016-08-20`
- Affix 和 BackTop 新增 `target` 属性,支持指定滚动容器。[#2718](https://github.com/ant-design/ant-design/issues/2718)
- 文档页面加上编辑按钮,方便社区贡献。[#2325](https://github.com/ant-design/ant-design/issues/2325)
- 升级 rc-cascader 依赖,修复一个 `loadData` 属性和表单结合使用的问题。[#2767](https://github.com/ant-design/ant-design/issues/2767)
- 修复 `editable-card` 类型的 Tabs 没有关闭图标的问题。[#2747](https://github.com/ant-design/ant-design/issues/2747)
- Menu 修正默认 `z-index`。[#2762](https://github.com/ant-design/ant-design/issues/2762)
- 修正 Select 组件在 IE 下的一些样式问题。[#2741](https://github.com/ant-design/ant-design/issues/2741)
## 1.9.1
`2016-08-16`
- 修复 `editable-card` 类型的 Tabs 设置 `activeKey` 无效的问题。[#2725](https://github.com/ant-design/ant-design/issues/2725)
- 修复一个 Table 的样式兼容性问题。[#2723](https://github.com/ant-design/ant-design/issues/2723)
- 更新 axure 部件库。[#2714](https://github.com/ant-design/ant-design/issues/2714)
## 1.9.0
`2016-08-15`
- Transfer 修复在火狐下 item 文案过长时只显示省略号的问题。[#2674](https://github.com/ant-design/ant-design/issues/2674)
- Input 修复 `autosize` 模式下特定场景中不能输入中文及光标定位不准的问题。[#2666](https://github.com/ant-design/ant-design/issues/2666) [#2239](https://github.com/ant-design/ant-design/issues/2239)
- Tabs 修复 `type="editable-card"` 模式下的 `children` 解析问题。[#2658](https://github.com/ant-design/ant-design/issues/2658)
- Radio 修复若干 less 硬编码问题。[#2424](https://github.com/ant-design/ant-design/issues/2424)
- Upload 的 rc-upload 依赖升级至 2.x引入的变化有
- 增加 `disabled` 属性。[#2645](https://github.com/ant-design/ant-design/issues/2645)
- 取消上传时会自动 abort 上传请求。[#2571](https://github.com/ant-design/ant-design/issues/2571) [#2518](https://github.com/ant-design/ant-design/issues/2518)
- Table
- 修复 spin 在可滚动区域的定位问题。[#2652](https://github.com/ant-design/ant-design/issues/2652)
- 修复无数据时 提示样式错位的问题。[#2663](https://github.com/ant-design/ant-design/issues/2663)
- Popover 修复设定 `getTooltipContainer` 后会导致内嵌 DatePicker 样式失效的问题。[#2675](https://github.com/ant-design/ant-design/issues/2675)
- Modal 修复重复卸载组件导致的报错。[#2688](https://github.com/ant-design/ant-design/issues/2688)
- 升级 rc-slider 组件依赖。
## 1.8.0
`2016-08-08`
- 修复可关闭 Tabs 组件只有一个 Tab 的时候报错的问题。[#2559](https://github.com/ant-design/ant-design/issues/2559)
- 修复 Datepicker 在 IE8 下关闭图标。[#2584](https://github.com/ant-design/ant-design/issues/2584)
- Tags 支持自定义标签颜色。[#2585](https://github.com/ant-design/ant-design/issues/2585)
- TreeSelect 修复未找到内容时的样式。[9cee9f](https://github.com/ant-design/ant-design/commit/9cee9f103a4729572358206c81cba84e2fdc20f5)
- Modal 适配小屏幕。[#2597](https://github.com/ant-design/ant-design/issues/2597)
- 修复了 Row 组件在同一行闭合会报错的问题。[#2603](https://github.com/ant-design/ant-design/issues/2603)
- Table 的 `rowSelection.onChange` 的参数 `selectedRows` 现在和 `selectedRowKeys` 保持一致。[#2566](https://github.com/ant-design/ant-design/issues/2603)
- Checkbox 和 Radio 现在支持 `onClick` 属性。
## 1.7.0
`2016-07-30`
@@ -368,629 +469,4 @@ timeline: true
## 0.12.17
`2016-05-05`
- 修复 FormItem 校验时表单项高度跳动的问题。[#1557](https://github.com/ant-design/ant-design/issues/1557)
- 修复一个 Table 圆角样式的小问题。
## 0.12.16
`2016-04-27`
- 修复 Collapse 在 safari 中切换动画异常的问题。[#1494](https://github.com/ant-design/ant-design/issues/1494)
- 修复 Table 的 selectedRowKeys 在初次渲染时失效的问题。[#1501](https://github.com/ant-design/ant-design/issues/1501)
- Table 现在点击选择框时将不再触发 `onRowClick`。[#1470](https://github.com/ant-design/ant-design/issues/1470)
- 修复一个 Calender 服务端渲染时提示 `Option is not defined` 的问题。[#1521](https://github.com/ant-design/ant-design/issues/1521)
- 修复 Menu 动态切换模式时的一些细节问题。
- 优化了 export 导出图标。
- 修复 Form 的一些样式细节。
## 0.12.15
`2016-04-21`
- 升级 rc-collapse 修复一个性能问题。
- 修复一个 Collapse 内嵌 Tabs 的选中项样式问题。[#1451](https://github.com/ant-design/ant-design/issues/1451)
- 修复 Input 组件服务端渲染报错的问题。[#1321](https://github.com/ant-design/ant-design/issues/1321)
- 修复 Tag 组件调用了两次 afterClose 的问题。[#1435](https://github.com/ant-design/ant-design/issues/1435)
- 修复一个 Table 控制模式的问题。[#1434](https://github.com/ant-design/ant-design/issues/1434)
- 修复一个 Tabs 相互嵌套的样式问题。[#1435](https://github.com/ant-design/ant-design/issues/1435)
- 修复 Dropdown.Button 点击右边也触发 onClick 的问题。
- 修复 Radio.Button 在 IE8 下无法选择的问题。[#1459](https://github.com/ant-design/ant-design/issues/1459)
- 优化了 Button 点击后仍然有 focus 效果的问题。
## 0.12.14
`2016-04-13`
- Form 和 Form.Item 支持 style 属性。[#1290](https://github.com/ant-design/ant-design/issues/1290)
- 修正 IE9 下没有 prefix css3 属性的问题。
- 修正 Table 中指定了 pagination.current 时依然能响应用户操作的问题。[#1311](https://github.com/ant-design/ant-design/issues/1311)
- 修正 Table 的单选模式无法用 `selectedRowKeys` 控制的问题。[#1346](https://github.com/ant-design/ant-design/issues/1346)
- 修正 DatePicker 启用 showTime 时时区失效的问题。[#1356](https://github.com/ant-design/ant-design/issues/1356)
- 修正 Menu、Progress、Form、Table、Select、Pagination、Cascader 的样式细节问题。
- 修正 Breadcrumb 不支持 IndexRoute 的问题。[#1375](https://github.com/ant-design/ant-design/issues/1375)
- 修正 Table 的筛选菜单 filters 的 value 为数字时无法选中的问题。
- 修正 DatePicker 面板输入框的日期格式 format 和外面不一致的问题。[#1403](https://github.com/ant-design/ant-design/issues/1403)
## 0.12.13
`2016-03-29`
- 按照最新的规范修正 Message、Alert、Notification 的默认图标。
- 统一梳理和优化了各浮层组件的 `z-index`,并增加了对应的 less 变量。
- 修复一个 Breadcrumb 组件未指定 breadcrumbName 导致的解析问题。[#1251](https://github.com/ant-design/ant-design/pull/1251)
- 现在 Upload 服务端返回数据不是 JSON 格式时将不判断为出错。[#1248](https://github.com/ant-design/ant-design/issues/1248)
- 修复 Cascader 在 Chrome 下无法滚动菜单的问题。
- 修复 Select、Radio、Progress、Table、DatePicker 的一些样式细节。
## 0.12.12
`2016-03-18`
- 更新了设计资源文件 `Axure Components` 和 `Axure Box`。
- 修复 Popover 和 Popconfirm 箭头消失的问题。
- 修复一个 Table 切换分页长度时的页码溢出的问题。
## 0.12.11
`2016-03-16`
- 全新的设计文档 `语言` 部分。
- 修复 Popconfirm `onConfirm` 和 `onCancel` 时没有触发 `onVisibleChange` 的问题。
- TreeSelect 组件补充 `showCheckedStrategy` 属性,支持回填数据的不同展示方式。
- 补充 Modal `align` 属性的文档。
- 修复 Menu 弹出菜单 `z-index` 丢失的问题。
- Progress 的默认颜色固定,不再随着主色变化。
- 优化 Button 点击动画在 Chrome 下的效果。
- 修复一个 Affix 的 `z-index` 太低的问题。
- 修复 Table 树形数据的二级节点列前无法选择的问题。[#1212](https://github.com/ant-design/ant-design/issues/1212)
- 修复 Table 修改 `pageSize` 没有触发 `onChange` 的问题。[#1206](https://github.com/ant-design/ant-design/issues/1206)
- 修复 Table 指定 `rowKey` 时导致 `rowSelection.onChange` 的 `selectedRows` 参数为空的问题。
## 0.12.10
- 修复 0.12.9 版本 npm 包打包错误的问题。
## 0.12.9
`2016-03-11`
- Transfer
- 可以定义 `notFoundContent `。
- 修复 `searchPlaceholder` 使用了 `placeholder` 的值的问题。
- 修复 Popconfirm、Popover、Tooltip 的箭头位置未指向元素的问题。
- 修正 Badge 在搜狗等旧版 webkit 浏览器下无法使用的问题。
- 调整 Tabs 样式。
- 修复 Table 中的 Pagination 默认配置问题。
- 调整 Form.Item 在 inline 模式下的 `margin-bottom`。[#1141](https://github.com/ant-design/ant-design/issues/1141)
- 修复 DatePicker `style` 设置错误的问题。
- 优化 Popconfirm、Button 样式。
- Dropdown 增加默认的 mouseEnterDelay 延迟以优化体验。
- 修复 Dialog 样式问题。
- 修复 Upload 上传中的状态问题。[#1159](https://github.com/ant-design/ant-design/issues/1159)
- 优化 Menu、Tabs 在 Chorme 下的渲染问题。
- Form 默认阻止 submit 事件。
## 0.12.8
`2016-03-06`
- 新增 `heart` `calculator` 图标。
- Table 补充了 `showHeader` 和 `footer` 属性。
- Modal 补充了 `maskClosable` 属性。
- 修正一个 Tag 和 Popover 配合使用的问题。[#1111](https://github.com/ant-design/ant-design/issues/1111)
- 将 TreeSelect 的 `treeDefaultExpandAll` 默认属性设为 false并优化了性能。
- 修复 RadioGroup 无法垂直布局的问题。[#1119](https://github.com/ant-design/ant-design/issues/1119)
- 统一了 less 文件的部分变量。
- 修正部分组件的样式。
## 0.12.7
`2016-03-03`
- 修正 Table 的 `rowSelect.onSelectAll` 的第三个参数 `deselectedRows` 为 `changeRows`,记录每次变化的列。
## 0.12.6
`2016-03-02`
- 优化 Table 本地排序在 Chrome 下的稳定性问题。
- 修正 Pagination 的 pageSize 属性为受控属性,并补充了 `defaultPageSize` 属性。[#1087](https://github.com/ant-design/ant-design/issues/1087)
- 优化 Select 的 combobox 模式的交互体验。
- 升级 react-slick 依赖到 `0.11`,修复自动播放有时会失效的问题。[#1009](https://github.com/ant-design/ant-design/issues/1009)
- 修复 TreeSelect 的 allowClear 属性失效的问题。[#1084](https://github.com/ant-design/ant-design/issues/1084)
- 修复 Input 组件的 className 属性失效的问题。[#1103](https://github.com/ant-design/ant-design/issues/1103)
- 修复 Dropdown 的 onClick 属性失效的问题。[#1097](https://github.com/ant-design/ant-design/issues/1097)
- 修复多个 CheckboxGroup 选项互相影响的问题。[#1101](https://github.com/ant-design/ant-design/pull/1101)
- 修复 FormItem 的子元素为 `null` 时报错的问题。
- 修复 Table 组件的选择功能和展开功能配合使用的问题。[#1102](https://github.com/ant-design/ant-design/issues/1102)
- 增加了一个搜索框和提示功能结合的 [例子](http://ant.design/components/select/#demo-search-box)。
- 允许可编辑的 Tabs 删除最后一个页签。[#1071](https://github.com/ant-design/ant-design/issues/1071)
- Table 的 `rowSelect.onSelectAll` 补充了第三个参数 `deselectedRows`, `rowSelect.onChange` 补充了第二个参数 `selectedRows`。[#1105](https://github.com/ant-design/ant-design/issues/1105)
- 修正部分组件的样式。
## 0.12.5
`2016-02-25`
- Pagination 支持 `showTotal` 属性。[#1077](https://github.com/ant-design/ant-design/pull/1077)
- Cascader 添加 `allowClear` 属性,允许隐藏清除按钮。
- 补充了一个带图标的搜索建议框的例子。[#1067](https://github.com/ant-design/ant-design/issues/1067)
- 修复 Transfer 在不支持 Object.assign 的浏览器上报错的问题。
- 修复 Cascader 在 Safari 下错位的问题。[#1066](https://github.com/ant-design/ant-design/issues/1066)
- 移除对 Button 圆角的降级方案。
- 修复了部分组件样式的小问题。
## 0.12.4
`2016-02-22`
- Radio 的 value 支持更多类型。[#1043](https://github.com/ant-design/ant-design/pull/1043)
- 修复 Spin 组件的大小、居中等样式问题。
- FormItem 补充 extra 属性的文档。[#931](https://github.com/ant-design/ant-design/issues/931)
- 修复的 Table 下树形数据和选择框配合时的样式问题。
- 修复一个水平表单的错误提示的样式错位问题。[#1040](https://github.com/ant-design/ant-design/issues/1040)
- 添加了一个轻微的 Button 点击动效。
## 0.12.3
`2016-02-19`
- DatePicker 补充 allowClear 属性,支持单选的清空。
- 修复显示时间的 DatePicker 的清空按钮失效的问题。
- 优化 DatePicker 的 `确定` 按钮失效样式。
## 0.12.2
`2016-02-19`
- DatePicker 如果有 `确定` 按钮,现在只有点击 `确定` 按钮才会触发 onChange 事件。
- 修复带时间选择的 DatePicker 日期格式缺少时间部分的问题。[#1005](https://github.com/ant-design/ant-design/issues/1005)
- 修复 DatePicker 内输入框多余的时间展示的问题。[#953](https://github.com/ant-design/ant-design/issues/953)
- 升级依赖 react-slick 到 `0.10`。
- 支持表单校验错误时自动滚动到第一个错误项。[#993](https://github.com/ant-design/ant-design/issues/993)
- 优化了 Select 和 TreeSelect 多选禁用的样式。
- Upload 列表项支持链接展现形式。[#1013](https://github.com/ant-design/ant-design/issues/1013)
- 修复 Safari 下的样式警告信息。[#999](https://github.com/ant-design/ant-design/issues/999)
- Cascader 支持 popupPlacement 位置配置。
## 0.12.1
`2016-02-03`
- 依赖升级到 `rc-pagination@1.4`、`rc-menu@4.10`、`rc-form@0.12`。
- 修复 TreeSelect 的不可用样式。
- DatePicker 补充 `getCalendarContainer` 属性,用于解决问题 [#991](https://github.com/ant-design/ant-design/issues/991)。
- 修正 Modal `onCancel` 的参数为点击事件。[#980](https://github.com/ant-design/ant-design/issues/980)
- 修复一个 Tooltip 内嵌套 Popconfirm 的问题。[#977](https://github.com/ant-design/ant-design/issues/977)
- 修复 DatePicker 和 RangePicker 的 `onOk` 一直不可用的问题。
- 修复一个 Badge 的 count 无法切换的问题。[#983](https://github.com/ant-design/ant-design/issues/983)
## 0.12.0
`2016-02-01`
- 新增 [级联选择(Cascader)](http://ant.design/components/cascader/) 组件。
- 新增 [树选择控件(TreeSelect)](http://ant.design/components/tree-select/) 组件。
- Form 自身支持校验功能,废弃 Validation。[演示](http://ant.design/components/form/#demo-validate-basic)
- Tabs
- `activeKey` 修正为受控属性。
- 当前项现在会始终显示。[#815](https://github.com/ant-design/ant-design/issues/815)
- Modal 可以配置右上关闭按钮是否显示。
- Select
- 打开选项菜单时,自动滚动到选中项。
- `combobox` 模式时,可配置是否默认选中第一项。[rc-select#38](https://github.com/react-component/select/issues/38)
- Table
- filter 支持层级选择。
- 支持行点击事件 `onRowClick`。
- 支持多列的横向切换。[演示](http://ant.design/components/table/#demo-paging-columns)
- 更换 `dataSource` 和变换页面时不再默认清除选择数据,你可以用 `selectedRowKeys` 手动控制。`原来默认清除的行为会触发一个数据更新的死循环,而且难以实现跨页选择。`
- 支持固定表头。[演示](http://ant.design/components/table/#demo-fixed-header)
- Tag 去除 `href` 属性,默认标签名从 `a` 改为 `span`。
- Timeline 支持指定 pending 节点的内容。
- Tree
- 节点支持拖拽。
- 支持动态控制节点展开与否。[演示](http://ant.design/components/tree/#demo-basic-controlled)
- 可以监听节点展开/关闭事件 `onExpand`。
- `onCheck` `onSelect` 参数调整。
- `onDataLoaded` 改为 `loadData`。
- 新增 drag&drop 相关属性:
- `onDragStart`
- `onDragEnter`
- `onDragOver`
- `onDragLeave`
- `onDrop`
- 新增 TreeNode 节点属性:
- `disableCheckbox`
- `isLeaf`
- Transfer 给 `onChange` 增加参数。[#972](https://github.com/ant-design/ant-design/issues/972)
- DatePicker
- 修复 RangePicker 开始结束日期相同的 bug。[#822](https://github.com/ant-design/ant-design/issues/822)
- 修复 `format` 对浮层不生效问题。[#917](https://github.com/ant-design/ant-design/issues/917)
- TimePicker 修复一个 `value` 为 `null` 时没有进入受控模式的问题。
- Upload
- 可以用 `headers` 设置上传头部。
- 新增上传图片卡片样式。[演示](http://ant.design/components/upload/#demo-picture-card)
- Radio
- 更换 Radio.Button 的展现样式。
- 可以设置 Radio.Button 的大小。
- Progress
- `format` 属性现在支持自定义 function 的方式进行定义。[#893](https://github.com/ant-design/ant-design/issues/893)
- `format` 指定 string 和 React.Node 的方式被废弃。
- 支持 `style` 属性。[#895](https://github.com/ant-design/ant-design/issues/895)
- message && notification 现在可以销毁。
- Button
- 小号 Button 的圆角调整为 `4px`。
- 修复 Button.Group disabled 后的样式问题。[#926](https://github.com/ant-design/ant-design/issues/926)
- BreadCrumb
- 移除 `router` 属性,无需设置。
- 修复一个链接参数不对的问题。
## 0.11.3
`2016-01-19`
- 修复 TimePicker 受控模式点选即关闭面板的问题。[#818](https://github.com/ant-design/ant-design/issues/818)
- 修复一个两栏的 TimePicker 点击右边空白处无法关闭面板的问题。[#826](https://github.com/ant-design/ant-design/issues/826)
- 修复 Table `pagination.onChange` 指定无效的问题。[#824](https://github.com/ant-design/ant-design/issues/824)
- 修复 Transfer 搜索功能失效的问题。
- 修复 DatePicker 的 MonthPicker 样式错乱的问题。
- 修复 RangePicker 时区无法设置的问题。[#837](https://github.com/ant-design/ant-design/issues/837)
- 修复二维码图标,新增一个扫描图标。[#772](https://github.com/ant-design/ant-design/issues/772)
## 0.11.2
`2015-01-03`
- 新增了[贡献文档](https://github.com/ant-design/ant-design/blob/master/CONTRIBUTING.md)。
- 修复一个 DatePicker 中选择的国际化文案问题。[#771](https://github.com/ant-design/ant-design/issues/771)
- 增加了一个高级搜索类型表单的[演示](http://ant.design/components/form/#demo-advanced-search-form)。
- Dropdown 支持多级的下拉菜单。[演示](http://ant.design/components/dropdown/#demo-sub-menu)
- Table
- 新增 `rowSelection.onChange` 和 `rowSelection.selectedRowKeys`,完善选择功能。
- 更新 dataSource 时,选中项现在会被清空。
- 修复一个全选框和禁用的选择项配合的问题。
- 修复 `0.11.1`版本 menu 内嵌型菜单inline选中后关闭的问题。
- 修复 `0.11.1`版本对 React 版本要求太严的问题,对应的警告提示对于 `0.14.x` 将不再出现。
- 组件和文档的样式小调整。
## 0.11.1
`2015-12-29`
- 修复一个 Table 无法修改 pageSize 的问题。
- 修复一个 Table 子表格展开的对齐问题。
- 修复一个 Chrome 下部分图标左侧切边的问题。
- 修复搜索输入框在表单下使用的样式问题。[#762](https://github.com/ant-design/ant-design/issues/762)
## 0.11.0
`2015-12-28`
- **移除默认加载的样式文件,样式现在需要独立加载。**
- 按钮圆角调整为 `6px`。
- Modal、Popconfirm、Table、TimePicker 支持国际化配置。
- 新增虚线型按钮。
- 新增 [通用搜索框](http://ant.design/components/form/#demo-search-input) 样式。
- 新增图片上传列表样式[演示](http://ant.design/components/upload/#demo-picture-style)。
- **部分设计资源开放 [下载](http://ant.design/spec/tools),包括 Axure 组件库和 Iconfont 字体打包文件。**
- 新增 [吊顶规范](http://ant.design/spec/layout/#demo-ceiling)。
- 组件演示页面增加锚点。
- 新增穿梭框 [Transfer](http://ant.design/components/transfer/) 组件。
- 新增小尺寸的 Switch 开关组件。
- 增加更多的图标。[#](https://github.com/ant-design/ant-design/commit/087c64649d73206a4d62e52f9b3f6042c1d28608#diff-dc1a1f4794c1c4ee3b083381d4c50c47R180)
- 全局微调了警告和错误状态色。
- Select
- 选中样式进行了调整。
- 在标签/多选模式下,选中或删除选项增加了动画效果。
- Alert
- 默认样式不展示图标。
- 带描述的警告框图标改为描线图标。
- `type="warn"` 图标修改。
- Dropdown 新增带菜单触发的按钮 `Dropdown.Button`。[演示](http://ant.design/components/dropdown/#demo-dropdown-button)
- Menu
- 新增 `Menu.ItemGroup` 用于把菜单项分组。
- onOpen 和 onClose 函数的参数新增了 `keyPath` 数据,可用于制作手风琴类型的菜单。
- Badge
- 徽章可以独立使用。[演示](http://ant.design/components/badge/#demo-no-wrapper)
- 支持设置封顶的 `99+` 的数字。[演示](http://ant.design/components/badge/#demo-overflow)
- Slider
- 增加 `onAfterChange` 事件。[演示](http://ant.design/components/slider/#demo-event)
- 现在设置 `tipFormatter={null}` 可以隐藏 `Tooltip`。
- 双滑块拖动体验优化,一个滑块在拖动时可以直接跨过另一滑块。
- Breadcrumb 可以自定义分隔符。[演示](http://ant.design/components/breadcrumb/#demo-separator)
- Popconfirm 添加 `visible` 属性,使其可以控制是否显示。[演示](http://ant.design/components/popconfirm/#demo-dynamic-trigger)
- 修复 Icon `ref` 引起的报错。
- 修复 Calendar 组件无法切换年/月的问题。[#757](https://github.com/ant-design/ant-design/issues/757)
- Checkbox 新增 `Checkbox.Group`,现可以方便的 [生成一组选择框](http://ant.design/components/checkbox/#demo-group)
- Tabs
- 新增 [卡片式页签](http://ant.design/components/tabs/#demo-card)。
- 调整 [新增和关闭页签](http://ant.design/components/tabs/#demo-editable-card) 的样式。
- 现在支持页签的四个位置 `tabPosition="top|right|bottom|left"`。
- 移除 `animation` 属性,并在 `tabPosition="top|bottom"` 时默认启用切换动画。
- Timepicker
- **重命名为 TimePicker。**
- 国际化属性 `locale` 结构发生了 [变化](https://github.com/ant-design/ant-design/issues/1270#issuecomment-201181384)。
- 新增 `value` 属性。
- 新增属性 `disabledHours` `disabledMinutes` `disabledSeconds`。[演示](http://ant.design/components/time-picker/#picker-demo-disable-options)
- 移除 `hourOptions` `minuteOptions` `secondOptions`,新增 `hideDisabled` 属性用于替代。
- Datepicker
- **重命名为 DatePicker。**
- 新增 [日期范围选择控件](http://ant.design/components/date-picker/#picker-demo-range)。
- 修改 `showTime` 的交互。[演示](http://ant.design/components/date-picker/#picker-demo-time)
- 修正为受控组件。
- Table
- **移除 `dataSource` 的远程模式。**
- 新增 [紧凑型表格](http://ant.design/components/table/#demo-size)。
- 允许监听分页的 `onShowSizeChange`。[演示](http://ant.design/components/table/#demo-paging)
- 优化表格对树形数据的显示。[演示](http://ant.design/components/table/#demo-indent-size)
- 优化了筛选菜单的样式,并添加了最大高度。[演示](http://ant.design/components/table/#demo-head)。
- 修复 column.key 设置失效的问题。[#642](https://github.com/ant-design/ant-design/issues/642)
- 修复设置时 rowKey 时单选会导致全部选中的问题。[#697](https://github.com/ant-design/ant-design/issues/697)
- 修复一个列重新渲染导致选项错乱的问题。[#418](https://github.com/ant-design/ant-design/issues/418#issuecomment-163093580)
- 修复选择列无法设置宽度的问题。[#649](https://github.com/ant-design/ant-design/issues/649)
- Form
- 修复了 Textarea 无法输入的问题。[#646](https://github.com/ant-design/ant-design/issues/646)
- 修复了 Textarea 设置 `cols` 和 `rows` 属性失效的问题。[#694](https://github.com/ant-design/ant-design/issues/694)
- 修复无法设置 `className` 的问题。[#711](https://github.com/ant-design/ant-design/issues/711)
- 修复 Upload 组件在 `beforeUpload` 返回 `false` 后依然更新上传列表问题。[#757](https://github.com/ant-design/ant-design/issues/757)
- 工具
- 替换 `antd build` 为 [atool-build](https://github.com/ant-tool/atool-build),重构并改善了 webpack 配置的自定义方式。
- 替换 `antd server` 为 [dora](https://github.com/dora-js/dora),一个完全插件化的开发服务器,支持[代理转发和数据 Mock](https://github.com/dora-js/dora-plugin-proxy)、[atool-build](https://github.com/dora-js/dora-plugin-atool-build)、[热替换](https://github.com/dora-js/dora-plugin-hmr)。
- 新增 babel 插件 [babel-plugin-antd](https://github.com/ant-design/babel-plugin-antd),转换 `import {Button} from 'antd'` 为 `import Button from 'antd/lib/button'`。
- 发布了 `antd-init@0.6.x`,支持以上改动。
> [0.11 升级指南](http://ant.design/docs/react/upgrade-notes#0-10-gt-0-11)
## 0.10.5
`2016-01-04`
- 修复 Table 更新 dataSource 后,选中项没有置空的问题。[#793](https://github.com/ant-design/ant-design/issues/793)
## 0.10.4
`2015-11-30`
- 将 media-match 加入默认的 polyfill 文件中。[5626974](https://github.com/ant-design/ant-design/commit/562697423b1139eb324c1dceb051c143f4870ed7)
- 修复了 [MonthPicker](http://ant.design/components/datepicker/#demo-month-picker) 报错问题,并增加了相关演示。
- 修复 RadioGroup 中的 Radio/RadioButton 无法单独设置 disabled 的问题。[#603](https://github.com/ant-design/ant-design/issues/603)
- 修复今天是不可选日期时的一个展示问题。[#606](https://github.com/ant-design/ant-design/issues/606)
## 0.10.3
`2015-11-26`
- 和 0.9.x 保持一致默认引入 `antd/lib/index.css`(而非 less 文件),方便第三方引用。引用 less 文件进行变量配置的可自行 `import 'antd/style/index.less'`。[#593](https://github.com/ant-design/ant-design/issues/593)
- 升级 Pagination增加 `defaultCurrent` 属性,修正原来的 `current` 为[完全受控属性](https://facebook.github.io/react/docs/forms.html#controlled-components)。
- Pagination 的改动也修复了 Table 切换数据源后回到[第一页的例子](http://ant.design/components/table/#demo-ajax)。
- 对演示和样式代码增加了 lint 检查。
## 0.10.2
`2015-11-25`
- Slider 新增 `tipFormatter` 用于格式化 Tooltip 的内容。
- 优化 Badge 动画效果。
- 修复以下问题:
- 文本域的表单校验无法重置。
- 设置 Upload 的 `multiple` 为 `true` 时,未显示每个文件的上传进度。
- Breadcrumb 配合 Router 的时候如果没有 `breadcrumbName` 会抛错。
- InputNumber 同时设置 `size` `className` 时会有冲突。
## 0.10.1
`2015-11-20`
- 修改内部组件的引用结构,方便工具优化。[#566](https://github.com/ant-design/ant-design/pull/566)
- 移除了演示中没有使用过的 `antd.ButtonGroup`,依然用 `const ButtonGroup = Button.Group` 来使用。
- Form 和 Input 目录分离,`import { Form, Input } from 'ant/lib/form'` 的引用方式被废弃。
现在可以 `import Form from 'ant/lib/form'` 和 `import Input from 'ant/lib/input'`。
原有的 `import { Form, Input } from 'antd'` 则不受影响。
- 修复 Datepicker 的 `style` 和 `calendarStyle` 属性失效的问题,并将 `calendarStyle` 更名为 `popupStyle`。
## 0.10.0
`2015-11-20`
- 全面兼容 `react@0.14.x`。
- 新增 [时间选择 Timepicker](http://ant.design/components/timepicker/)、[日历 Calendar](http://ant.design/components/calendar/)、[加载中 Spin](http://ant.design/components/spin/) 组件。
- [Button](http://ant.design/components/button/)、[Iconfont](http://ant.design/components/icon/)、[Layout](http://ant.design/components/layout/)、[Form](http://ant.design/components/form/)、[Input](http://ant.design/components/form/#demo-input) 等样式模块改造为 React 组件。
- 新增 [Queue-anim](http://ant.design/components/queue-anim/) 组件,更换了原来的 enter-animation。
- 全新的[字体图标](/components/icon)。
- 全面更新视觉风格,补充更多图标。[#313](https://github.com/ant-design/ant-design/issues/313)
- 调整字体基线,告别对图标位置的特殊调节。(感谢 [iconfont.cn](http://iconfont.cn) 的鼎力支持)
- Datepicker、Dropdown、Select、Popover、Popconfirm 等浮层组件添加在空间不足的情况下自动调整位置功能。
- Popover、Tooltip、Popconfirm 组件支持 12 个方向。[#312](https://github.com/ant-design/ant-design/issues/312)
- 优先使用苹方字体。
- 统一 size 属性的可选值为 `small` `default` `large`。
- 开始初步补充[测试用例](https://github.com/ant-design/ant-design/tree/1a3a19793c0791201666fdcf0dbd12a30fad4be0/tests)。
- 提供主色系更换的[方案](https://github.com/ant-tool/xtool/tree/master/examples/customize-antd-theme)。[#384](https://github.com/ant-design/ant-design/issues/384)
- 添加[色彩换算工具](http://ant.design/spec/colors#色彩换算工具)。
- 添加布局和导航规范,以及[常用布局](http://ant.design/spec/layout/)。
- 文档支持标题和演示的锚点,方便分享文档和演示代码。
- 提供多版本的文档,在[主站](http://ant.design)的右下角提供切换按钮。
- [antd-bin](https://github.com/ant-tool/xtool) 升级到 `0.10`。
- 拆分出 [antd-init](https://github.com/ant-design/antd-init) 和 [antd-build](https://github.com/ant-design/antd-build)。
- 提供代理功能。
- 提供 UI 测试功能。
#### 组件变更
- Table
- 支持单选。[演示](http://ant.design/components/table/#demo-row-selection-radio-props)
- 选择模式支持默认选中和不可用效果。[演示](/components/table/#demo-row-selection-props)
- 列支持了 `colSpan` 和 `rowSpan` 配置。[演示](/components/table/#demo-colspan-rowspan)
- 新增 `loading` 属性。
- 筛选增加 `filterMultiple` 属性,支持单选的配置。
- Datepicker
- 添加国际化支持。
- 添加手动输入和清除功能。
- 优化了视觉样式。
- 修复不标准的日期格式导致显示错误的问题。
- 用 `onChange` 属性代替 `onSelect` 属性。
- Validation 修复了 对 Datepicker、Input-number、Select 的支持,并添加了相关演示。
- Carousel 的依赖 react-slick 升级到 0.9.x相关 API 也相应更新。
- Tree 组件支持完全受控模式。[#397](https://github.com/ant-design/ant-design/issues/397)
- Input Number
- 组件输入体验优化,现在可以键入任意字符,失焦时格式化为合法值。
- 修复不支持小数 step 的问题。[#530](https://github.com/ant-design/ant-design/issues/530)
- Tabs 新增[垂直页签功能](http://ant.design/components/tabs/#demo-vertical-left)。
- Upload 组件视觉优化,新增高级浏览器下的上传进度展示。[#311](https://github.com/ant-design/ant-design/issues/311)
- Menu
- 视觉效果大幅优化。
- 新增 [dark 主题](http://ant.design/components/menu/#demo-theme) 的样式。
- 修复一个链接点击区域的问题。[#535](https://github.com/ant-design/ant-design/issues/535)
- Dropdown 用 onClick 代替 onSelect 作为推荐的使用方式,因为原有的 onSelect 只在变化时触发。
- Slider
- 新增[双滑块功能](http://ant.design/components/slider/#demo-range)。
- 优化 marks 属性的使用逻辑,使其可以和具体数值进行绑定。[slider#26](https://github.com//react-component/slider/issues/26)
- 属性命名优化,用 `dots` 代替了 `withDots` 属性,用 `included` 代替了 `isIncluded`。
- Badge 当 `count` 为 0 时不展示。
- Progress 新增 `format` 属性,能够自定义展示的进度文案。
- Modal 新增 `confirmLoading` 属性。
- 新增 Radio.Button 的失效样式。
- 提供 IE8 下的圆角按钮[兼容方案](http://ant.design/components/button/#ie8-border-radius-support)。
- `antd.Notification()` 修正为 `antd.notification()`。
- 另有巨量样式的修复和优化。
> 备注:
>
> - [计划和推进 issue](https://github.com/ant-design/ant-design/issues/276)
> - [0.10 升级指南](http://010x.ant.design/docs/upgrade-to-0.10)
---
## 0.9.3 ~ 0.9.5
`2015-11-04`
* 增加对 React 版本的检测提示机制0.9.x 序列只能使用 `react@~0.13.3`。
## 0.9.2
`2015-10-26`
* Tooltip 的 title 为空时不展示浮层。[9b53117](https://github.com/ant-design/ant-design/commit/9b5311791e73270c7c16a602ac74dd59719a5f76)
* 修复 Upload 文件列表链接的 target 属性。[340a170](https://github.com/ant-design/ant-design/commit/340a1702b6a7b065ac02d417c891e1886dfe470d)
* 修复 Datepicker 设置 defaultValue 时星期顺序错误的问题。[9ef1450](https://github.com/ant-design/ant-design/commit/9ef14500f3abfcc7081f8dceab8187ec835e3918)
* 修复一些小的样式问题。
## 0.9.1
`2015-09-26`
* 添加 Pagination pageSize 发生变化的回调。[#317](https://github.com/ant-design/ant-design/issues/317)
* 升级依赖 rc-upload 到 1.6.x修复 IE8/9 下的兼容性问题。
* 升级依赖 rc-steps 到 1.3.x。
* 新增 current 属性,方便配置当前的步骤。[#290](https://github.com/ant-design/ant-design/issues/290)
* 修复因滚动条影响页面宽度导致的错位问题。
* 升级依赖 rc-menu 到 1.5.x。
* 新增 onSelect 回调中返回参数 keyPath从而支持只展开当前父级菜单的交互方式。[demo](http://ant.design/components/menu/#demo-sider-current)
* 修复 hover 类型的弹出菜单能响应点击事件的问题。[react-component/menu#14](https://github.com/react-component/menu/issues/14)
* 修复一个 Table 的分页无法正确展示的问题。[#253](https://github.com/ant-design/ant-design/issues/253)
* 修复一个 combobox 选择框无法选中的问题。[0435ca6](https://github.com/ant-design/ant-design/commit/0435ca60e3b574bac3808a10ba3db62f482335fd)
* 修复 Radio.Button 在 IE 8 下不可用的问题。[#321](https://github.com/ant-design/ant-design/issues/321)
* 适配 breadcrumb 面包屑组件和 `react-router@1.0.0-rc1`。
* 修复只能同时弹出一个 Modal 通知框的问题。[d6a4094](https://github.com/ant-design/ant-design/commit/d6a4094bc4c72acd05be001c7e46dbd17092001a)
* 升级依赖 rc-tooltip 到 2.8.0,增加 overlayClassName 属性。
* 部分组件交互和视觉效果修正。
## 0.9.0
`2015-09-14`
* 新增 [timeline](components/timeline/) 和 [badge](components/badge/) 组件。
* 优化弹出层类组件的动画效果,使其更加流畅。
* 部分文案更新。
* 优化主站在小分辨率屏幕下的样式。
* 使用 instantclick 改造主站,加载速度有明显提升。
* antd-bin 升级到 [0.6.x](https://github.com/ant-design/antd-bin/blob/master/HISTORY.md) 。
* Upload **重构了 API 接口,不向下兼容**,支持自定义的功能扩展。
* 新增 `onChange(file) {}` 接口,移出原来的 `onSuccess`、`onProgess`、`onError` 等接口。
* 新增 `fileList` 和 `defaultFileList` 属性,以满足更多的自定义功能,具体见演示。
* 设置 fileList 数组项的 url 属性可以作为链接展示在文件列表中方便下载。
* 移除内建的上传成功或失败的信息提示,业务可自行实现。
* 修正多文件选择上传时文件列表只展示一个文件的问题。
* Table
* 新增可展开的 table。[#258](https://github.com/ant-design/ant-design/pull/258)
* 新增无数据的展示样式。[4c54644](https://github.com/ant-design/ant-design/commit/4c54644116d46cb2510d2d475234529bad60e5d5)
* 修复本地模式 `dataSource` 无法更新的问题。[6d2dcc4](https://github.com/ant-design/ant-design/commit/6d2dcc45393b6ec0ad1ba73caf8b1ec42353743f)
* 修复远程模式 loading 失效的问题。[9b8abb2](https://github.com/ant-design/ant-design/commit/9b8abb219934c246970a84200818aa8f85974bdf)
* 用 [reqwest-without-xhr2](http://npmjs.com/reqwest-without-xhr2) 代替了 reqwest解决某些开发环境下 xhr2 依赖的问题。
* Select
* 增加 label 属性,允许多选模式下展示标签(原来只能显示 value 值)。[演示](http://react-component.github.io/select/examples/mul-suggest.html)
* 修复 combobox 模式下 value 失效的问题。
* Notification 修复不会自动消失的问题。[23fce55](https://github.com/ant-design/ant-design/commit/23fce559b0b2faf4e0b686a92dbcdd045727a464)
* Steps 新增竖版的步骤条。
* Carousel 修复 fade 模式下可以拖拽的问题。#212
* Collapse 修复动画不生效的问题。
* Datepicker 修复无法设置为空值的问题。
* Modal
* 添加 [通知类型](http://ant.design/components/modal/#demo-info) 的对话框函数。
* 用 `Modal.confirm()` 代替 `confirm()` 方法。
* 修改为需要在 onCancel 手动设置 visible 属性来关闭。
* Message 添加 [加载中类型](http://ant.design/components/message/#demo-loading)。
* Radio 修改 Radio.Group 容器的盒模型属性为 inline-block 。
* Enter Animation
* 大幅度的重构,全新 API 的设计。
* 支持和 react-router 结合使用。
## 0.8.0
`2015-08-25`
这个版本是第一个稳定版,组件经过三期迭代,基本到齐,并有大量改进和变化,不向下兼容。
* 新增九个组件 `menu`、`upload`、`carousel`、`tree`、`notification`、`validation`、`affix`、`alert`、`enterAnimation`。目前共有组件 34 个,基本能满足后台类项目的组件需求。
* 新增设计文档部分,包括文字、色彩、动画。
* 重新梳理了设计和 React 实现部分的关系,强调了 Ant Design 的设计属性,并更新了网站的信息结构。
* 构建工具 `antd-bin` 升级到 `0.4.0` 版本,支持合并 webpack 配置热替换HMR等特性[详见](https://github.com/ant-design/antd-bin)。
* 组件动画优化和补充,体验更加流畅动感。
* 排查并修复 IE 和 safari 等浏览器的兼容问题。
* 大量代码重构,演示代码补充,文档更新、以及样式上的优化。
## 0.7.3
`2015-07-30`
* 小幅重构了 Table 分页,修复了分页导致的数据不展示的问题。
* 更新了部分文档。
## 0.7.2
`2015-07-27`
* 修复本地模式下 pagination 为 false 时数据无法显示的 [问题](https://github.com/ant-design/ant-design/commit/1954586665e59031eae5d2c8b2cdb08f83d64fcb)。
* 重构了 message 组件。
* 添加英文版说明文档 [README-en_US.md](https://github.com/ant-design/ant-design/blob/master/README-en_US.md)。
* 部分代码切换至 ES6 模式。
* 修正了部分组件的样式和演示,优化部分动画。
## 0.7.1
`2015-07-22`
* 修复了 Table 组件的 pagination 为 false 时分页未消失的 [问题](https://github.com/ant-design/ant-design/commit/01a6c0f1e6707b72a54ef30d073d148a87b391a8)。
* select 组件[选中后默认显示标签内容](https://github.com/ant-design/ant-design/issues/50)(原来是显示 value
* 修正了部分组件的样式和演示。
* 打包文件为 [umd 模式](https://github.com/ant-design/ant-design/commit/9b7b940cb417429d8fc57d83e252991b043d0f2f)。
## 0.7.0
`2015-07-21`
* 第一个公开版本,发布 `layout`、`iconfont`、`button`、`form`、`checkbox`、`radio`、`switch`、`slider`、`input-number`、`datepicker`、`select`、`tabs`、`steps`、`breadcrumb`、`collapse`、`pagination`、`modal`、`message`、`dropdown`、`popover`、`popconfirm`、`tooltip`、`progress`、`table` 等组件。
* 发布 [Ant Design 首页](http://ant.design/) 和入门文档。
去 [GitHub](https://github.com/ant-design/ant-design/releases?after=1.0.0) 查看 `0.12.x` 及之前的更新日志。

View File

@@ -62,6 +62,10 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
- [组件设计原则](https://github.com/react-component/react-component.github.io/blob/master/docs/zh-cn/component-design.md)
- [网站和组件开发说明](https://github.com/ant-design/ant-design/wiki/%E7%BD%91%E7%AB%99%E5%92%8C%E7%BB%84%E4%BB%B6%E5%BC%80%E5%8F%91%E8%AF%B4%E6%98%8E)
- [版本发布手册](https://github.com/ant-design/ant-design/wiki/%E8%BD%AE%E5%80%BC%E8%A7%84%E5%88%99%E5%92%8C%E7%89%88%E6%9C%AC%E5%8F%91%E5%B8%83%E6%B5%81%E7%A8%8B)
- [社区贡献脚手架和范例](https://github.com/ant-design/ant-design/issues/129)
- [常见问题](https://github.com/ant-design/ant-design/wiki/FAQ)
- [CodePen 模板](http://codepen.io/benjycui/pen/KgPZrE?editors=001)
- [Awesome Ant Design](https://github.com/websemantics/awesome-ant-design)
## 如何贡献

View File

@@ -96,8 +96,10 @@ tsconfig.json
- [React component design guide](https://github.com/react-component/react-component.github.io/blob/master/docs/zh-cn/component-design.md)
- [Developer Instruction](https://github.com/ant-design/ant-design/wiki/Development)
- [Versioning Release Note](https://github.com/ant-design/ant-design/wiki/%E8%BD%AE%E5%80%BC%E8%A7%84%E5%88%99%E5%92%8C%E7%89%88%E6%9C%AC%E5%8F%91%E5%B8%83%E6%B5%81%E7%A8%8B)
- [Boilerplates](https://github.com/ant-design/ant-design/issues/129)
- [FAQ](https://github.com/ant-design/ant-design/wiki/FAQ)
- [CodePen boilerplate](http://codepen.io/anon/pen/wGOWGW?editors=001) for bug reports
- [CodePen boilerplate](http://codepen.io/benjycui/pen/KgPZrE?editors=001) for bug reports
- [Awesome Ant Design](https://github.com/websemantics/awesome-ant-design)
## Contributing

View File

@@ -0,0 +1,29 @@
---
order: 4
title: 参考对象
---
`target` 设置 `Affix` 需要监听其滚动事件的元素,默认为 `window`
````jsx
import { Affix, Button } from 'antd';
const Demo = () => {
return (
<div style={{ height: 100, overflow: 'hidden' }}>
<div style={{ height: '100%', overflowY: 'scroll' }} id="affix-target">
<div style={{ height: 300, backgroundImage: 'url(https://zos.alipayobjects.com/rmsportal/RmjwQiJorKyobvI.jpg)' }}>
<br />
<br />
<br />
<Affix target={() => document.getElementById('affix-target')} offsetTop={20}>
<Button type="primary">固定在容器顶部</Button>
</Affix>
</div>
</div>
</div>
);
};
ReactDOM.render(<Demo />, mountNode);
````

View File

@@ -5,32 +5,42 @@ import classNames from 'classnames';
import warning from 'warning';
import shallowequal from 'shallowequal';
function getScroll(w, top) {
let ret = w[`page${top ? 'Y' : 'X'}Offset`];
const method = `scroll${top ? 'Top' : 'Left'}`;
if (typeof ret !== 'number') {
const d = w.document;
// ie6,7,8 standard mode
ret = d.documentElement[method];
if (typeof ret !== 'number') {
// quirks mode
ret = d.body[method];
}
function getScroll(target, top) {
const prop = top ? 'pageYOffset' : 'pageXOffset';
const method = top ? 'scrollTop' : 'scrollLeft';
const isWindow = target === window;
let ret = isWindow ? target[prop] : target[method];
// ie6,7,8 standard mode
if (isWindow && typeof ret !== 'number') {
ret = window.document.documentElement[method];
}
return ret;
}
function getOffset(element) {
const rect = element.getBoundingClientRect();
const body = document.body;
const clientTop = element.clientTop || body.clientTop || 0;
const clientLeft = element.clientLeft || body.clientLeft || 0;
const scrollTop = getScroll(window, true);
const scrollLeft = getScroll(window);
function getTargetRect(target) {
return target !== window ?
target.getBoundingClientRect() :
{ top: 0, left: 0, bottom: 0 };
}
function getOffset(element, target) {
const elemRect = element.getBoundingClientRect();
const targetRect = getTargetRect(target);
const scrollTop = getScroll(target, true);
const scrollLeft = getScroll(target, false);
const docElem = window.document.body;
const clientTop = docElem.clientTop || 0;
const clientLeft = docElem.clientLeft || 0;
return {
top: rect.top + scrollTop - clientTop,
left: rect.left + scrollLeft - clientLeft,
top: elemRect.top - targetRect.top +
scrollTop - clientTop,
left: elemRect.left - targetRect.left +
scrollLeft - clientLeft,
};
}
@@ -38,9 +48,13 @@ export default class Affix extends React.Component {
static propTypes = {
offsetTop: React.PropTypes.number,
offsetBottom: React.PropTypes.number,
target: React.PropTypes.func,
}
static defaultProps = {
target() {
return window;
},
onChange() {},
}
@@ -53,8 +67,10 @@ export default class Affix extends React.Component {
}
setAffixStyle(e, affixStyle) {
const { onChange, target } = this.props;
const originalAffixStyle = this.state.affixStyle;
if (e.type === 'scroll' && originalAffixStyle && affixStyle) {
const isWindow = target() === window;
if (e.type === 'scroll' && originalAffixStyle && affixStyle && isWindow) {
return;
}
if (shallowequal(affixStyle, originalAffixStyle)) {
@@ -64,7 +80,7 @@ export default class Affix extends React.Component {
const affixed = !!this.state.affixStyle;
if ((affixStyle && !originalAffixStyle) ||
(!affixStyle && originalAffixStyle)) {
this.props.onChange(affixed);
onChange(affixed);
}
});
}
@@ -80,19 +96,21 @@ export default class Affix extends React.Component {
this.setState({ placeholderStyle });
}
handleScroll = (e) => {
let { offsetTop, offsetBottom, offset } = this.props;
updatePosition = (e) => {
let { offsetTop, offsetBottom, offset, target } = this.props;
const targetNode = target();
// Backwards support
offsetTop = offsetTop || offset;
const scrollTop = getScroll(window, true);
const elemOffset = getOffset(ReactDOM.findDOMNode(this));
const scrollTop = getScroll(targetNode, true);
const elemOffset = getOffset(ReactDOM.findDOMNode(this), targetNode);
const elemSize = {
width: ReactDOM.findDOMNode(this.refs.fixedNode).offsetWidth,
height: ReactDOM.findDOMNode(this.refs.fixedNode).offsetHeight,
width: this.refs.fixedNode.offsetWidth,
height: this.refs.fixedNode.offsetHeight,
};
const offsetMode = {};
// Default to `offsetTop=0`.
if (typeof offsetTop !== 'number' && typeof offsetBottom !== 'number') {
offsetMode.top = true;
offsetTop = 0;
@@ -101,25 +119,30 @@ export default class Affix extends React.Component {
offsetMode.bottom = typeof offsetBottom === 'number';
}
const targetRect = getTargetRect(targetNode);
const targetInnerHeight = targetNode.innerHeight || targetNode.clientHeight;
if (scrollTop > elemOffset.top - offsetTop && offsetMode.top) {
// Fixed Top
this.setAffixStyle(e, {
position: 'fixed',
top: offsetTop,
left: elemOffset.left,
top: targetRect.top + offsetTop,
left: targetRect.left + elemOffset.left,
width: ReactDOM.findDOMNode(this).offsetWidth,
});
this.setPlaceholderStyle(e, {
width: ReactDOM.findDOMNode(this).offsetWidth,
height: ReactDOM.findDOMNode(this).offsetHeight,
});
} else if (scrollTop < elemOffset.top + elemSize.height + offsetBottom - window.innerHeight &&
offsetMode.bottom) {
} else if (
scrollTop < elemOffset.top + elemSize.height + offsetBottom - targetInnerHeight &&
offsetMode.bottom
) {
// Fixed Bottom
const targetBottomOffet = targetNode === window ? 0 : (window.innerHeight - targetRect.bottom);
this.setAffixStyle(e, {
position: 'fixed',
bottom: offsetBottom,
left: elemOffset.left,
bottom: targetBottomOffet + offsetBottom,
left: targetRect.left + elemOffset.left,
width: ReactDOM.findDOMNode(this).offsetWidth,
});
this.setPlaceholderStyle(e, {
@@ -134,17 +157,37 @@ export default class Affix extends React.Component {
componentDidMount() {
warning(!('offset' in this.props), '`offset` prop of Affix is deprecated, use `offsetTop` instead.');
this.scrollEvent = addEventListener(window, 'scroll', this.handleScroll);
this.resizeEvent = addEventListener(window, 'resize', this.handleScroll);
const target = this.props.target;
this.setTargetEventListeners(target);
}
componentWillReceiveProps(nextProps) {
if (this.props.target !== nextProps.target) {
this.clearScrollEventListeners();
this.setTargetEventListeners(nextProps.target);
// Mock Event object.
this.updatePosition({});
}
}
componentWillUnmount() {
if (this.scrollEvent) {
this.scrollEvent.remove();
}
if (this.resizeEvent) {
this.resizeEvent.remove();
}
this.clearScrollEventListeners();
}
setTargetEventListeners(getTarget) {
const target = getTarget();
this.scrollEvent = addEventListener(target, 'scroll', this.updatePosition);
this.resizeEvent = addEventListener(target, 'resize', this.updatePosition);
}
clearScrollEventListeners() {
['scrollEvent', 'resizeEvent'].forEach((name) => {
if (this[name]) {
this[name].remove();
}
});
}
render() {
@@ -155,6 +198,7 @@ export default class Affix extends React.Component {
const props = { ...this.props };
delete props.offsetTop;
delete props.offsetBottom;
delete props.target;
return (
<div {...props} style={this.state.placeholderStyle}>

View File

@@ -20,4 +20,5 @@ english: Affix
|-------------|----------------|--------------------|--------------|
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | Number | |
| offsetBottom | 距离窗口底部达到指定偏移量后触发 | Number | |
| target | 设置 `Affix` 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 | Function | () => window |
| onChange | 固定状态改变时触发的回调函数 | Function | 无 |

View File

@@ -5,18 +5,21 @@ import addEventListener from 'rc-util/lib/Dom/addEventListener';
import classNames from 'classnames';
import omit from 'object.omit';
function getScroll(w, top) {
let ret = w[`page${top ? 'Y' : 'X'}Offset`];
const method = `scroll${top ? 'Top' : 'Left'}`;
if (typeof ret !== 'number') {
const d = w.document;
// ie6,7,8 standard mode
ret = d.documentElement[method];
if (typeof ret !== 'number') {
// quirks mode
ret = d.body[method];
}
function getScroll(target, top) {
if (typeof window === 'undefined') {
return 0;
}
const prop = top ? 'pageYOffset' : 'pageXOffset';
const method = top ? 'scrollTop' : 'scrollLeft';
const isWindow = target === window;
let ret = isWindow ? target[prop] : target[method];
// ie6,7,8 standard mode
if (isWindow && typeof ret !== 'number') {
ret = window.document.documentElement[method];
}
return ret;
}
@@ -24,19 +27,23 @@ export default class BackTop extends React.Component {
static propTypes = {
visibilityHeight: React.PropTypes.number,
target: React.PropTypes.func,
}
static defaultProps = {
onClick() {},
visibilityHeight: 400,
target() {
return window;
},
prefixCls: 'ant-back-top',
}
constructor(props) {
super(props);
const scrollTop = getScroll(window, true);
const scrollTop = getScroll(props.target(), true);
this.state = {
visible: scrollTop > this.props.visibilityHeight,
visible: scrollTop > props.visibilityHeight,
};
}
@@ -47,19 +54,25 @@ export default class BackTop extends React.Component {
}
setScrollTop(value) {
document.body.scrollTop = value;
document.documentElement.scrollTop = value;
const targetNode = this.props.target();
if (targetNode === window) {
document.body.scrollTop = value;
document.documentElement.scrollTop = value;
} else {
targetNode.scrollTop = value;
}
}
handleScroll = () => {
const scrollTop = getScroll(window, true);
const { visibilityHeight, target } = this.props;
const scrollTop = getScroll(target(), true);
this.setState({
visible: scrollTop > this.props.visibilityHeight,
visible: scrollTop > visibilityHeight,
});
}
componentDidMount() {
this.scrollEvent = addEventListener(window, 'scroll', this.handleScroll);
this.scrollEvent = addEventListener(this.props.target(), 'scroll', this.handleScroll);
}
componentWillUnmount() {
@@ -81,10 +94,6 @@ export default class BackTop extends React.Component {
</div>
);
const style = {
display: this.state.visible ? 'block' : 'none',
};
// fix https://fb.me/react-unknown-prop
const divProps = omit(otherProps, [
'visibilityHeight',
@@ -94,10 +103,8 @@ export default class BackTop extends React.Component {
<Animate component="" transitionName="fade">
{
this.state.visible ?
<div data-show={this.state.visible} style={style}>
<div {...divProps} className={classString} onClick={this.scrollToTop}>
{children || defaultElement}
</div>
<div {...divProps} className={classString} onClick={this.scrollToTop}>
{children || defaultElement}
</div>
: null
}

View File

@@ -21,7 +21,7 @@ export default class Badge extends React.Component {
}
render() {
let { count, prefixCls, overflowCount, className, style, children, dot } = this.props;
let { count, prefixCls, overflowCount, className, style, children, dot, ...restProps } = this.props;
count = count > overflowCount ? `${overflowCount}+` : count;
@@ -40,7 +40,7 @@ export default class Badge extends React.Component {
});
return (
<span className={badgeCls} title={count} style={null}>
<span className={badgeCls} title={count} style={null} {...restProps}>
{children}
<Animate
component=""

View File

@@ -23,5 +23,5 @@ export default function ButtonGroup(props) {
}
ButtonGroup.propTypes = {
size: React.PropTypes.oneOf(['large', 'small']),
size: React.PropTypes.oneOf(['large', 'default', 'small']),
};

View File

@@ -97,7 +97,7 @@
.button-size(@btn-padding-base; @font-size-base; @border-radius-base);
user-select: none;
transition: all .3s @ease-in-out;
transform: translate3d(0, 0, 0);
position: relative;
> .@{iconfont-css-prefix} {
line-height: 1;

View File

@@ -25,6 +25,7 @@ export default class Header extends React.Component {
prefixCls: PropTypes.string,
selectPrefixCls: PropTypes.string,
type: PropTypes.string,
fullscreen: PropTypes.bool,
}
getYearSelectElement(year) {
@@ -39,10 +40,8 @@ export default class Header extends React.Component {
}
return (
<Select
style={{ width: 75 }}
size={fullscreen ? null : 'small'}
dropdownMatchSelectWidth={false}
dropdownMenuStyle={{ minWidth: 103 }}
className={`${prefixCls}-year-select`}
onChange={this.onYearChange}
value={String(year)}
@@ -64,8 +63,6 @@ export default class Header extends React.Component {
return (
<Select
style={{ minWidth: 70 }}
dropdownMenuStyle={{ minWidth: 125 }}
size={fullscreen ? null : 'small'}
dropdownMatchSelectWidth={false}
className={`${prefixCls}-month-select`}
@@ -94,11 +91,12 @@ export default class Header extends React.Component {
}
render() {
const { type, value, prefixCls, locale } = this.props;
const { type, value, prefixCls, locale, fullscreen } = this.props;
const yearSelect = this.getYearSelectElement(value.getYear());
const monthSelect = type === 'date' ? this.getMonthSelectElement(value.getMonth()) : null;
const size = fullscreen ? 'default' : 'small';
const typeSwitch = (
<Group onChange={this.onTypeChange} value={type}>
<Group onChange={this.onTypeChange} value={type} size={size}>
<Button value="date">{locale.month}</Button>
<Button value="month">{locale.year}</Button>
</Group>

View File

@@ -9,7 +9,7 @@ title:
通过 `locale` 配置时区、语言等, 默认支持 en_US, zh_CN
## en_US
## en-US
To set the properties like time zone, language and etc. en_US, zh_CN are supported by default.

View File

@@ -9,7 +9,7 @@ title:
一个复杂的应用示例。
## en_US
## en-US
A complex application.

View File

@@ -20,6 +20,7 @@ export default class Carousel extends React.Component {
static defaultProps = {
dots: true,
arrows: false,
pauseOnHover: true,
}
render() {

View File

@@ -16,31 +16,7 @@ const options = [{
label: '杭州',
children: [{
value: 'xihu',
label: '西湖西湖西湖西湖西湖西湖',
}, {
value: 'xihu1',
label: '西湖西湖西湖西湖西湖西湖',
}, {
value: 'xihu2',
label: '西湖西湖西湖西湖西湖西湖',
}, {
value: 'xihu3',
label: '西湖西湖西湖西湖西湖西湖',
}, {
value: 'xihu4',
label: '西湖西湖西湖西湖西湖西湖',
}, {
value: 'xihu5',
label: '西湖西湖西湖西湖西湖西湖',
}, {
value: 'xihu6',
label: '西湖西湖西湖西湖西湖西湖',
}, {
value: 'xihu7',
label: '西湖西湖西湖西湖西湖西湖',
}, {
value: 'xihu8',
label: '西湖西湖西湖西湖西湖西湖',
label: '西湖',
}],
}],
}, {
@@ -51,7 +27,7 @@ const options = [{
label: '南京',
children: [{
value: 'zhonghuamen',
label: '中华门中华门中华门中华门中华门',
label: '中华门',
}],
}],
}];

View File

@@ -9,8 +9,9 @@
display: block;
cursor: pointer;
width: 100%;
background: rgba(255, 255, 255, 0);
z-index: 1;
background: transparent;
color: transparent;
}
&-picker {
position: relative;
@@ -43,7 +44,7 @@
opacity: 0;
position: absolute;
right: 8px;
z-index: 1;
z-index: 2;
background: #fff;
top: 50%;
font-size: 12px;
@@ -66,6 +67,7 @@
// arrow
&-arrow {
position: absolute;
z-index: 1;
top: 50%;
right: 8px;
width: 12px;
@@ -73,7 +75,6 @@
margin-top: -6px;
line-height: 12px;
color: #999;
background: #fff;
.iconfont-size-under-12px(8px);
&:before {
transition: transform 0.2s ease;

View File

@@ -173,10 +173,6 @@
margin-right: 8px;
}
.@{checkbox-prefix-cls}-wrapper + span {
display: inline-block;
}
.@{checkbox-prefix-cls}-group {
font-size: @font-size-base;
&-item {

View File

@@ -7,11 +7,11 @@ title:
## zh-CN
通过 `locale` 配置时区、语言等, 默认支持 `en_US``zh_CN`
通过 `locale` 配置时区、语言等, 默认支持 `en_US``zh_CN`不同版本带有不同的时区配置,如果所在时区与默认配置不同,需要自行设置。上面的 demo 就是在东八区使用 en_US 版本的例子。
## en-US
Use locale to set the properties like time zone, language and etc. en_US, zh_CN are supported by default.
Use locale to set the properties like time zone, language and etc. `en_US`, `zh_CN` are supported by default. There are different time zone configuration in different versions, you must set it by yourself if your time zone does not match the default setting. The example above is to show how to use the `en_US` version at GMT+8 time zone.
````jsx
@@ -19,7 +19,7 @@ import { DatePicker } from 'antd';
import enUS from 'antd/lib/date-picker/locale/en_US';
const customLocale = {
timezoneOffset: 0 * 60,
timezoneOffset: 8 * 60,
firstDayOfWeek: 0,
minimalDaysInFirstWeek: 1,
};

View File

@@ -1,6 +1,6 @@
---
order: 7
title:
title:
zh-CN: 日期范围一
en-US: Date range, case 1
---
@@ -62,8 +62,6 @@ const DateRange = React.createClass({
<div>
<DatePicker
disabledDate={this.disabledStartDate}
showTime
format="yyyy-MM-dd HH:mm:ss"
value={this.state.startValue}
placeholder="开始日期"
onChange={this.onStartChange}
@@ -71,8 +69,6 @@ const DateRange = React.createClass({
/>
<DatePicker
disabledDate={this.disabledEndDate}
showTime
format="yyyy-MM-dd HH:mm:ss"
value={this.state.endValue}
placeholder="结束日期"
onChange={this.onEndChange}

View File

@@ -34,7 +34,8 @@ By clicking the input box, you can select a date from a popup calendar.
| size | determine the size of the input box, the height of `large` and `small`, are 32px and 22px respectively, while default size is 28px | String | - |
| locale | localization configuration | Object | [default](https://github.com/ant-design/ant-design/issues/424) |
| onOk | a callback function, can be executed when OK-button is clicked | function(Date value) | - |
| toggleOpen | a callback function, can be executed whether the popup calendar is popped up or closed | function(status) | - |
| open | open state of picker | bool | - |
| toggleOpen | a callback function, can be executed whether the popup calendar is popped up or closed | function(open) | - |
| getCalendarContainer | to set the container of the floating layer, while the default is to create a `div` element in `body` | function(trigger) | - |
| showTime | to provide an additional time selection | Object/Boolean | [TimePicker Options](http://ant.design/components/time-picker/#api) |

View File

@@ -34,7 +34,8 @@ english: DatePicker
| popupStyle | 格外的弹出日历样式 | object | {} |
| size | 输入框大小,`large` 高度为 32px`small` 为 22px默认是 28px | string | 无 |
| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/issues/424) |
| toggleOpen | 弹出日历和关闭日历的回调 | function(status) | |
| open | 控制弹层是否展开 | bool | - |
| toggleOpen | 弹出日历和关闭日历的回调 | function(open) | 无 |
| getCalendarContainer | 定义浮层的容器,默认为 body 上新建 div | function(trigger) | 无 |
| showTime | 增加时间选择功能 | Object or Boolean | [TimePicker Options](http://ant.design/components/time-picker/#api) |

View File

@@ -39,9 +39,9 @@
}
&-clear {
opacity: 0;
z-index: -1;
position: absolute;
right: 7px;
z-index: 1;
background: #fff;
top: 50%;
font-size: 12px;
@@ -59,6 +59,7 @@
&:hover &-clear {
opacity: 1;
z-index: 1;
}
&-icon {
position: absolute;

View File

@@ -6,8 +6,7 @@ title: 带下拉框的按钮
左边是按钮,右边是额外的相关功能菜单。
````jsx
import { Menu, Dropdown } from 'antd';
const DropdownButton = Dropdown.Button;
import { Menu, Dropdown, Button, Icon } from 'antd';
function handleButtonClick(e) {
console.log('click left button', e);
@@ -26,8 +25,15 @@ const menu = (
);
ReactDOM.render(
<DropdownButton onClick={handleButtonClick} overlay={menu} type="primary">
某功能按钮
</DropdownButton>
<div>
<Dropdown.Button onClick={handleButtonClick} overlay={menu} type="ghost">
某功能按钮
</Dropdown.Button>
<Dropdown overlay={menu}>
<Button type="ghost" style={{ marginLeft: 8 }}>
按钮 <Icon type="down" />
</Button>
</Dropdown>
</div>
, mountNode);
````

View File

@@ -31,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) | - |
| overlay | 菜单 | [Menu](/components/menu/) | - |
| visible | 菜单是否显示 | Bool | 无 |
| onVisibleChange | 菜单显示状态改变时调用,参数为 { visible } | Function | - |

View File

@@ -17,7 +17,7 @@
position: relative;
.ant-btn > .@{iconfont-css-prefix}-down {
.iconfont-size-under-12px(10px);
.iconfont-size-under-12px(9px);
}
.anticon-down:before {
@@ -110,7 +110,7 @@
content: "\e600";
right: 15px;
color: #999;
.iconfont-size-under-12px(8px);
.iconfont-size-under-12px(9px);
}
&-submenu-vertical {
@@ -157,7 +157,7 @@
.@{dropdown-prefix-cls}-link {
font-size: 12px;
.anticon-down {
.iconfont-size-under-12px(8px);
.iconfont-size-under-12px(9px);
font-weight: bold;
}
}
@@ -167,6 +167,10 @@
padding-right: 7px;
}
.anticon-down {
.iconfont-size-under-12px(10px);
.iconfont-size-under-12px(9px);
}
}
.ant-btn .anticon-down {
.iconfont-size-under-12px(9px);
}

View File

@@ -23,7 +23,7 @@ export default class Form extends React.Component {
constructor(props) {
super(props);
warning(!props.form, 'It is unnessary to pass `form` to `Form` after antd@1.7.0.');
warning(!props.form, 'It is unnecessary to pass `form` to `Form` after antd@1.7.0.');
}
shouldComponentUpdate(...args) {
@@ -33,6 +33,7 @@ export default class Form extends React.Component {
render() {
const { prefixCls, className, inline, horizontal } = this.props;
const formClassName = classNames({
[`${prefixCls}`]: true,
[`${prefixCls}-horizontal`]: horizontal,
[`${prefixCls}-inline`]: inline,
[className]: !!className,

View File

@@ -67,7 +67,7 @@ CustomizedForm = Form.create({})(CustomizedForm);
|-----------|------------------------------------------|------------|
| getFieldsValue | 获取一组输入控件的值,如不传入参数,则获取全部组件的值 | Function([fieldNames: string[]]) |
| getFieldValue | 获取一个输入控件的值 | Function(fieldName: string) |
| setFieldsValue | 设置一组输入控件的值 | Function(obj: object) |
| setFieldsValue | 设置一组输入控件的值 | Function({ [fieldName]: value }) |
| setFields | 设置一组输入控件的值与 Error | Function(obj: object) |
| validateFields | 校验并获取一组输入域的值与 Error | Function([fieldNames: string[]], [options: object], callback: Function(errors, values)) |
| validateFieldsAndScroll | 与 `validateFields` 相似,但校验完后,如果校验不通过的菜单域不在可见范围内,则自动滚动进可见范围 | 参考 `validateFields` |
@@ -90,7 +90,7 @@ CustomizedForm = Form.create({})(CustomizedForm);
| 参数 | 说明 | 类型 | 默认值 |
|-----------|-----------------------------------------|-----|--------|
| options.id | 必填输入控件唯一标志 | string | |
| options.id | 必填输入控件唯一标志 | string | |
| options.valuePropName | 子节点的值的属性,如 Switch 的是 'checked' | string | 'value' |
| options.initialValue | 子节点的初始值,类型、可选值均由子节点决定 | | |
| options.trigger | 收集子节点的值的时机 | string | 'onChange' |

View File

@@ -67,7 +67,8 @@ input[type="checkbox"] {
color: #666;
// nested FormItem
& & {
& > &,
& :not(.@{form-prefix-cls}) > & {
margin-bottom: -@form-item-margin-bottom;
}
@@ -340,8 +341,9 @@ form {
color: @warning-color;
}
//input-number
.ant-input-number {
//input-number, timepicker
.ant-input-number,
.ant-time-picker-input {
border-color: @warning-color;
box-shadow: 0 0 0 2px fade(@warning-color, 20%);
&:not([disabled]):hover {
@@ -376,12 +378,13 @@ form {
}
//timepicker
.ant-time-picker-picker-icon:after {
.ant-time-picker-icon:after {
color: @error-color;
}
//input-number
.ant-input-number {
//input-number, timepicker
.ant-input-number,
.ant-time-picker-input {
border-color: @error-color;
box-shadow: 0 0 0 2px fade(@error-color, 20%);
&:not([disabled]):hover {

View File

@@ -5,8 +5,12 @@
}
// 输入框的不同校验状态
.ant-input {
border-color: @border-color;
box-shadow: 0 0 0 2px fade(@border-color, 20%);
&,
&:hover,
&:focus {
border-color: @border-color;
box-shadow: 0 0 0 2px fade(@border-color, 20%);
}
&:not([disabled]):hover {
border-color: @border-color;

View File

@@ -34,8 +34,9 @@
transition: all 0.1s linear;
display: block;
width: 100%;
&:hover {
background: #fefefe;
font-weight: bold;
&:active {
background: #f4f4f4;
}
&:hover &-up-inner,
&:hover &-down-inner {
@@ -155,8 +156,8 @@
&-handler-wrap {
border-left: 1px solid @border-color-base;
width: 22px;
height: 28px;
background: #fff;
height: 100%;
background: transparent;
position: absolute;
top: 0;
right: 0;

View File

@@ -33,6 +33,7 @@ export default class Input extends Component {
type: 'text',
onPressEnter() {},
onKeyDown() {},
onChange() {},
autosize: false,
}
@@ -84,10 +85,10 @@ export default class Input extends Component {
}
handleTextareaChange = (e) => {
this.resizeTextarea();
if (this.props.onChange) {
this.props.onChange(e);
if (!('value' in this.props)) {
this.resizeTextarea();
}
this.props.onChange(e);
}
resizeTextarea = () => {

View File

@@ -37,6 +37,21 @@ const SIZING_STYLE = [
let computedStyleCache = {};
let hiddenTextarea;
function computedStyle(node) {
return window.getComputedStyle ? getComputedStyle(node) : node.currentStyle;
}
function getStylePropertyValue(style, prop) {
let value;
if (style) {
value = window.getComputedStyle ?
style.getPropertyValue(prop)
:
style[prop.replace(/-(\w)/gi, (word, letter) => letter.toUpperCase())];
}
return value;
}
function calculateNodeStyling(node, useCache = false) {
const nodeRef = (
node.getAttribute('id') ||
@@ -48,26 +63,26 @@ function calculateNodeStyling(node, useCache = false) {
return computedStyleCache[nodeRef];
}
const style = window.getComputedStyle(node);
const style = computedStyle(node);
const boxSizing = (
style.getPropertyValue('box-sizing') ||
style.getPropertyValue('-moz-box-sizing') ||
style.getPropertyValue('-webkit-box-sizing')
getStylePropertyValue(style, 'box-sizing') ||
getStylePropertyValue(style, '-moz-box-sizing') ||
getStylePropertyValue(style, '-webkit-box-sizing')
);
const paddingSize = (
parseFloat(style.getPropertyValue('padding-bottom')) +
parseFloat(style.getPropertyValue('padding-top'))
parseFloat(getStylePropertyValue(style, 'padding-bottom')) +
parseFloat(getStylePropertyValue(style, 'padding-top'))
);
const borderSize = (
parseFloat(style.getPropertyValue('border-bottom-width')) +
parseFloat(style.getPropertyValue('border-top-width'))
parseFloat(getStylePropertyValue(style, 'border-bottom-width')) +
parseFloat(getStylePropertyValue(style, 'border-top-width'))
);
const sizingStyle = SIZING_STYLE
.map(name => `${name}:${style.getPropertyValue(name)}`)
.map(name => `${name}:${getStylePropertyValue(style, name)}`)
.join(';');
const nodeInfo = {

View File

@@ -1,6 +1,6 @@
---
category: Components
chinese: 布局
chinese: 栅格
type: Basic
cols: 1
english: Layout
@@ -87,19 +87,23 @@ Ant Design 的布局组件若不能满足你的需求,你也可以直接使用
### Row
| 成员 | 说明 | 类型 | 默认值 |
|------------|-----------------|--------------------|-------------|
| gutter | 栅格间隔 | number | 0 |
| type | 布局模式,可选 `flex`,现代浏览器下有效 | string | |
| 成员 | 说明 | 类型 | 默认值 |
|-----------|-----------------|--------------------|-------------|
| gutter | 栅格间隔 | number | 0 |
| type | 布局模式,可选 `flex`,现代浏览器下有效 | string | |
| align | flex 布局下的垂直对齐方式:`top` `middle` `bottom` | string | `top` |
| justify | flex 布局下的水平排列方式:`start` `end` `center` `space-around` `space-between` | string | `start` |
### Col
| 成员 | 说明 | 类型 | 默认值 |
|------------|-----------------|--------------------|-------------|
| span | 栅格占位格数,为 0 时相当于 `display: none` | number | |
| order | 栅格顺序,`flex` 布局模式下有效 | number | 0 |
| offset | 栅格左侧的间隔格数,间隔内不可以有栅格 | number | 0 |
| 成员 | 说明 | 类型 | 默认值 |
|----------|-----------------|--------------------|-------------|
| span | 栅格占位格数,为 0 时相当于 `display: none` | number | - |
| order | 栅格顺序,`flex` 布局模式下有效 | number | 0 |
| offset | 栅格左侧的间隔格数,间隔内不可以有栅格 | number | 0 |
| push | 栅格向右移动格数 | number | 0 |
| pull | 栅格向左移动格数 | number | 0 |
| xs | `<768px` 响应式栅格,可为栅格数或一个包含其他属性的对象 | number or object | - |
| sm | `≥768px` 响应式栅格,可为栅格数或一个包含其他属性的对象 | number or object | - |
| md | `≥992px` 响应式栅格,可为栅格数或一个包含其他属性的对象 | number or object | - |
| lg | `≥1200px` 响应式栅格,可为栅格数或一个包含其他属性的对象 | number or object | - |

View File

@@ -28,15 +28,19 @@ export default class Row extends React.Component {
...style,
} : style;
const cols = Children.map(children, col => {
if (!col) return null;
return cloneElement(col, {
style: gutter > 0 ? {
paddingLeft: gutter / 2,
paddingRight: gutter / 2,
...col.props.style,
} : col.props.style,
});
if (!col) {
return null;
}
if (col.props) {
return cloneElement(col, {
style: gutter > 0 ? {
paddingLeft: gutter / 2,
paddingRight: gutter / 2,
...col.props.style,
} : col.props.style,
});
}
return col;
});
return <div {...others} className={classes} style={rowStyle}>{cols}</div>;
}

View File

@@ -3,7 +3,7 @@ order: 2
title: 所有组件
---
此处列出 Ant Design 中需要国际化支持的组件,你可以在演示里切换语言。
此处列出 Ant Design 中需要国际化支持的组件,你可以在演示里切换语言。涉及时间的组件请注意时区设置 [DatePicker](/components/date-picker/#components-date-picker-demo-locale)。
````jsx
import { LocaleProvider, Pagination, DatePicker, TimePicker, Calendar,
@@ -24,6 +24,12 @@ const columns = [{
dataIndex: 'age',
}];
const customLocale = {
timezoneOffset: 8 * 60,
firstDayOfWeek: 1,
minimalDaysInFirstWeek: 1,
};
const Page = React.createClass({
getInitialState() {
return {
@@ -104,6 +110,10 @@ const App = React.createClass({
this.setState({ locale: e.target.value });
},
render() {
const locale = { ...this.state.locale };
if (locale.DatePicker) {
locale.DatePicker = { ...locale.DatePicker, ...customLocale };
}
return (
<div>
<div className="change-locale">
@@ -113,7 +123,7 @@ const App = React.createClass({
<Radio.Button key="cn">中文</Radio.Button>
</Radio.Group>
</div>
<LocaleProvider locale={this.state.locale}><Page /></LocaleProvider>
<LocaleProvider locale={locale}><Page /></LocaleProvider>
</div>
);
},

View File

@@ -89,6 +89,12 @@
}
}
&-horizontal,
&-inline,
&-vertical {
z-index: auto;
}
&-inline,
&-vertical {
border-right: 1px solid @border-color-split;
@@ -361,7 +367,6 @@
color: #fff;
> a {
color: #fff;
transform: translateZ(0);
}
}

View File

@@ -66,35 +66,40 @@ export default class Modal extends React.Component {
}
render() {
let props = this.props;
let { okText, cancelText, confirmLoading, footer, visible } = this.props;
let { okText, cancelText } = props;
if (this.context.antLocale && this.context.antLocale.Modal) {
okText = okText || this.context.antLocale.Modal.okText;
cancelText = cancelText || this.context.antLocale.Modal.cancelText;
}
let defaultFooter = [
<Button key="cancel"
const defaultFooter = [
<Button
key="cancel"
type="ghost"
size="large"
onClick={this.handleCancel}
>
{cancelText || '取消'}
</Button>,
<Button key="confirm"
<Button
key="confirm"
type="primary"
size="large"
loading={props.confirmLoading}
loading={confirmLoading}
onClick={this.handleOk}
>
{okText || '确定'}
</Button>,
];
let footer = props.footer || defaultFooter;
return (
<Dialog onClose={this.handleCancel} footer={footer} {...props}
visible={props.visible} mousePosition={mousePosition}
<Dialog
onClose={this.handleCancel}
footer={footer || defaultFooter}
{...this.props}
visible={visible}
mousePosition={mousePosition}
/>
);
}

View File

@@ -11,7 +11,6 @@ export default function confirm(config) {
let div = document.createElement('div');
document.body.appendChild(div);
let d;
props.iconType = props.iconType || 'question-circle';
let width = props.width || 416;
@@ -29,11 +28,10 @@ export default function confirm(config) {
props.cancelText = props.cancelText || runtimeLocale.cancelText;
function close() {
d.setState({
visible: false,
});
ReactDOM.unmountComponentAtNode(div);
div.parentNode.removeChild(div);
const unmountResult = ReactDOM.unmountComponentAtNode(div);
if (unmountResult) {
div.parentNode.removeChild(div);
}
}
function onCancel() {
@@ -126,9 +124,7 @@ export default function confirm(config) {
>
<div style={{ zoom: 1, overflow: 'hidden' }}>{body} {footer}</div>
</Dialog>
, div, function () {
d = this;
});
, div);
return {
destroy: close,

View File

@@ -128,3 +128,16 @@
overflow: hidden;
}
}
@media (max-width: 768px) {
.@{dialog-prefix-cls} {
width: auto !important;
margin: 10px;
}
.vertical-center-modal {
.@{dialog-prefix-cls} {
flex: 1;
}
}
}

View File

@@ -3,7 +3,7 @@ order: 1
title: 位置
---
位置有十二个方向。
位置有十二个方向。如需箭头指向目标元素中心,可以设置 `arrowPointAtCenter`
````jsx
import { Popconfirm, message, Button } from 'antd';

View File

@@ -4,16 +4,14 @@ import Icon from '../icon';
import Button from '../button';
import getPlacements from '../popover/placements';
const placements = getPlacements();
const prefixCls = 'ant-popover';
const noop = () => {};
export default class Popconfirm extends React.Component {
static defaultProps = {
prefixCls: 'ant-popover',
transitionName: 'zoom-big',
placement: 'top',
trigger: 'click',
overlayStyle: {},
onConfirm: noop,
onCancel: noop,
onVisibleChange: noop,
@@ -58,7 +56,7 @@ export default class Popconfirm extends React.Component {
}
render() {
const { title, placement, overlayStyle, trigger, ...restProps } = this.props;
const { prefixCls, title, placement, arrowPointAtCenter, ...restProps } = this.props;
let { okText, cancelText } = this.props;
if (this.context.antLocale && this.context.antLocale.Popconfirm) {
okText = okText || this.context.antLocale.Popconfirm.okText;
@@ -80,19 +78,15 @@ export default class Popconfirm extends React.Component {
);
return (
<Tooltip {...restProps}
placement={placement}
builtinPlacements={placements}
overlayStyle={overlayStyle}
<Tooltip
{...restProps}
builtinPlacements={getPlacements({ arrowPointAtCenter })}
prefixCls={prefixCls}
placement={placement}
onVisibleChange={this.onVisibleChange}
transitionName={this.props.transitionName}
visible={this.state.visible}
trigger={trigger}
overlay={overlay}
>
{this.props.children}
</Tooltip>
/>
);
}
}

View File

@@ -26,3 +26,4 @@ english: Popconfirm
| okText | 确认按钮文字 | String | 确定 |
| cancelText| 取消按钮文字 | String | 取消 |
| openClassName | 气泡框展现时触发器添加的类名,可用于打开浮层时高亮触发器 | string | ant-popover-open |
| arrowPointAtCenter | 箭头是否指向目标元素中心,`antd@1.11+` 支持 | Boolean | `false` |

View File

@@ -0,0 +1,29 @@
---
order: 4
title: 箭头指向
---
设置了 `arrowPointAtCenter` 后,箭头将指向目标元素的中心。
````jsx
import { Popover, Button } from 'antd';
const text = <span>标题</span>;
const content = (
<div>
<p>内容</p>
<p>内容</p>
</div>
);
ReactDOM.render(
<div>
<Popover placement="topLeft" title={text} content={content}>
<Button>默认对齐元素边缘</Button>
</Popover>
<Popover placement="topLeft" title={text} content={content} arrowPointAtCenter>
<Button>箭头指向目标元素的中心</Button>
</Popover>
</div>
, mountNode);
````

View File

@@ -3,8 +3,6 @@ import Tooltip from '../tooltip';
import getPlacements from './placements';
import warning from 'warning';
const placements = getPlacements();
export default class Popover extends React.Component {
static defaultProps = {
prefixCls: 'ant-popover',
@@ -13,19 +11,18 @@ export default class Popover extends React.Component {
trigger: 'hover',
mouseEnterDelay: 0.1,
mouseLeaveDelay: 0.1,
overlayStyle: {},
arrowPointAtCenter: false,
}
render() {
const { arrowPointAtCenter } = this.props;
return (
<Tooltip transitionName={this.props.transitionName}
builtinPlacements={placements}
<Tooltip
builtinPlacements={getPlacements({ arrowPointAtCenter })}
ref="tooltip"
{...this.props}
overlay={this.getOverlay()}
>
{this.props.children}
</Tooltip>
/>
);
}

View File

@@ -27,3 +27,4 @@ english: Popover
| onVisibleChange | 显示隐藏改变的回调 | function | 无 |
| getTooltipContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
| openClassName | 气泡框展现时触发器添加的类名,可用于打开浮层时高亮触发器 | string | ant-popover-open |
| arrowPointAtCenter | 箭头是否指向目标元素中心,`antd@1.11+` 支持 | Boolean | `false` |

View File

@@ -1,3 +1,5 @@
import { placements } from 'rc-tooltip/lib/placements';
const autoAdjustOverflow = {
adjustX: 1,
adjustY: 1,
@@ -6,6 +8,9 @@ const autoAdjustOverflow = {
const targetOffset = [0, 0];
export default function getPlacements(config = {}) {
if (!config.arrowPointAtCenter) {
return placements;
}
const { arrowWidth = 5, horizontalArrowShift = 16, verticalArrowShift = 12 } = config;
return {
left: {

View File

@@ -124,7 +124,7 @@ span.@{radio-prefix-cls} + * {
margin: 0;
height: 28px;
line-height: 26px;
color: #666;
color: @btn-default-color;
display: inline-block;
transition: all 0.3s ease;
cursor: pointer;
@@ -134,7 +134,7 @@ span.@{radio-prefix-cls} + * {
padding: 0 16px;
a {
color: #666;
color: @btn-default-color;
}
> .@{radio-prefix-cls}-button {

View File

@@ -5,7 +5,7 @@ title: 联动
省市联动是典型的例子。
推荐使用 [Cascader](/components/cascader) 组件。
推荐使用 [Cascader](/components/cascader/) 组件。
````jsx
import { Select } from 'antd';

View File

@@ -152,16 +152,16 @@
}
&-lg {
.ant-select-selection--single {
.@{select-prefix-cls}-selection--single {
height: 32px;
.ant-select-selection__rendered {
.@{select-prefix-cls}-selection__rendered {
line-height: 30px;
}
}
.ant-select-selection--multiple {
.@{select-prefix-cls}-selection--multiple {
min-height: 32px;
.ant-select-selection__rendered {
.@{select-prefix-cls}-selection__rendered {
li {
height: 24px;
line-height: 24px;
@@ -171,18 +171,18 @@
}
&-sm {
.ant-select-selection {
.@{select-prefix-cls}-selection {
border-radius: @border-radius-sm;
}
.ant-select-selection--single {
.@{select-prefix-cls}-selection--single {
height: 22px;
.ant-select-selection__rendered {
.@{select-prefix-cls}-selection__rendered {
line-height: 20px;
}
}
.ant-select-selection--multiple {
.@{select-prefix-cls}-selection--multiple {
min-height: 22px;
.ant-select-selection__rendered {
.@{select-prefix-cls}-selection__rendered {
li {
height: 14px;
line-height: 14px;
@@ -215,7 +215,6 @@
height: 20px;
max-width: 100%;
margin-top: -10px;
cursor: text;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
@@ -224,14 +223,17 @@
&-search--inline {
float: left;
width: 100%;
height: 100%;
.@{select-prefix-cls}-search__field__wrap {
width: 100%;
height: 100%;
}
.@{select-prefix-cls}-search__field {
border: 0;
font-size: 100%;
height: 100%;
background: transparent;
outline: 0;
border-radius: @border-radius-base;
@@ -362,6 +364,9 @@
position: absolute;
left: 0;
right: 0;
> ul {
height: 100%;
}
}
}
}
@@ -434,7 +439,6 @@
white-space: nowrap;
cursor: pointer;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
transition: background 0.3s ease;

View File

@@ -9,19 +9,18 @@
.@{spin-prefix-cls} {
color: @primary-color;
display: inline-block;
vertical-align: middle;
text-align: center;
opacity: 0;
position: absolute;
visibility: hidden;
transition: transform 0.3s @ease-in-out-circ;
font-size: @font-size-base;
display: none;
&-spinning {
opacity: 1;
position: static;
visibility: visible;
display: inline-block;
}
&-nested-loading {

View File

@@ -42,4 +42,4 @@ english: Steps
| status | 指定状态。当不配置该属性时,会使用 Steps 的 `current` 来自动指定状态。可选:`wait` `process` `finish` `error` | string | `wait` |
| title | 标题 | React.Element | - |
| description | 步骤的详情描述,可选 | React.Element | - |
| icon | 步骤图标,可选 | React.Element | - |
| icon | 步骤图标的类型,可选 | string | - |

View File

@@ -27,7 +27,6 @@ const defaultLocale = {
};
const defaultPagination = {
pageSize: 10,
onChange: noop,
onShowSizeChange: noop,
};
@@ -44,6 +43,7 @@ export default class Table extends React.Component {
bordered: React.PropTypes.bool,
onChange: React.PropTypes.func,
locale: React.PropTypes.object,
dropdownPrefixCls: React.PropTypes.string,
}
static defaultProps = {
@@ -59,6 +59,7 @@ export default class Table extends React.Component {
onChange: noop,
locale: {},
rowKey: 'key',
childrenColumnName: 'children',
}
static contextTypes = {
@@ -77,11 +78,12 @@ export default class Table extends React.Component {
selectionDirty: false,
...this.getSortStateFromColumns(),
pagination: this.hasPagination() ?
{
...defaultPagination,
...pagination,
current: pagination.defaultCurrent || pagination.current || 1,
} : {},
{
...defaultPagination,
...pagination,
current: pagination.defaultCurrent || pagination.current || 1,
pageSize: pagination.defaultPageSize || pagination.pageSize || 10,
} : {},
};
this.CheckboxPropsCache = {};
@@ -105,7 +107,7 @@ export default class Table extends React.Component {
if (!rowSelection.getCheckboxProps) {
return [];
}
return this.getFlatCurrentPageData()
return this.getFlatData()
.filter(item => this.getCheckboxPropsByItem(item).defaultChecked)
.map((record, rowIndex) => this.getRecordKey(record, rowIndex));
}
@@ -172,17 +174,28 @@ export default class Table extends React.Component {
}
}
setSelectedRowKeys(selectedRowKeys) {
if (this.props.rowSelection &&
!('selectedRowKeys' in this.props.rowSelection)) {
setSelectedRowKeys(selectedRowKeys, { selectWay, record, checked, changeRowKeys }) {
const { rowSelection = {} } = this.props;
if (rowSelection && !('selectedRowKeys' in rowSelection)) {
this.setState({ selectedRowKeys });
}
if (this.props.rowSelection && this.props.rowSelection.onChange) {
const data = this.getFlatCurrentPageData();
const selectedRows = data.filter(
(row, i) => selectedRowKeys.indexOf(this.getRecordKey(row, i)) >= 0
const data = this.getFlatData();
if (!rowSelection.onChange && !rowSelection[selectWay]) {
return;
}
const selectedRows = data.filter(
(row, i) => selectedRowKeys.indexOf(this.getRecordKey(row, i)) >= 0
);
if (rowSelection.onChange) {
rowSelection.onChange(selectedRowKeys, selectedRows);
}
if (selectWay === 'onSelect' && rowSelection.onSelect) {
rowSelection.onSelect(record, checked, selectedRows);
} else if (selectWay === 'onSelectAll' && rowSelection.onSelectAll) {
const changeRows = data.filter(
(row, i) => changeRowKeys.indexOf(this.getRecordKey(row, i)) >= 0
);
this.props.rowSelection.onChange(selectedRowKeys, selectedRows);
rowSelection.onSelectAll(checked, selectedRows, changeRows);
}
}
@@ -243,11 +256,11 @@ export default class Table extends React.Component {
return;
}
return (a, b) => {
let result = sortColumn.sorter(a, b);
const result = sortColumn.sorter(a, b);
if (result !== 0) {
return (sortOrder === 'descend') ? -result : result;
}
return a.indexForSort - b.indexForSort;
return 0;
};
}
@@ -347,14 +360,11 @@ export default class Table extends React.Component {
this.setState({
selectionDirty: true,
});
this.setSelectedRowKeys(selectedRowKeys);
if (this.props.rowSelection.onSelect) {
let data = this.getFlatCurrentPageData();
let selectedRows = data.filter((row, i) => {
return selectedRowKeys.indexOf(this.getRecordKey(row, i)) >= 0;
});
this.props.rowSelection.onSelect(record, checked, selectedRows);
}
this.setSelectedRowKeys(selectedRowKeys, {
selectWay: 'onSelect',
record,
checked,
});
}
handleRadioSelect = (record, rowIndex, e) => {
@@ -366,14 +376,11 @@ export default class Table extends React.Component {
this.setState({
selectionDirty: true,
});
this.setSelectedRowKeys(selectedRowKeys);
if (this.props.rowSelection.onSelect) {
let data = this.getFlatCurrentPageData();
let selectedRows = data.filter((row, i) => {
return selectedRowKeys.indexOf(this.getRecordKey(row, i)) >= 0;
});
this.props.rowSelection.onSelect(record, checked, selectedRows);
}
this.setSelectedRowKeys(selectedRowKeys, {
selectWay: 'onSelect',
record,
checked,
});
}
handleSelectAllRow = (e) => {
@@ -405,14 +412,11 @@ export default class Table extends React.Component {
this.setState({
selectionDirty: true,
});
this.setSelectedRowKeys(selectedRowKeys);
if (this.props.rowSelection.onSelectAll) {
const selectedRows = data.filter((row, i) =>
selectedRowKeys.indexOf(this.getRecordKey(row, i)) >= 0);
const changeRows = data.filter((row, i) =>
changeRowKeys.indexOf(this.getRecordKey(row, i)) >= 0);
this.props.rowSelection.onSelectAll(checked, selectedRows, changeRows);
}
this.setSelectedRowKeys(selectedRowKeys, {
selectWay: 'onSelectAll',
checked,
changeRowKeys,
});
}
handlePageChange = (current) => {
@@ -495,10 +499,11 @@ export default class Table extends React.Component {
}
renderRowSelection() {
const { prefixCls, rowSelection } = this.props;
const columns = this.props.columns.concat();
if (this.props.rowSelection) {
if (rowSelection) {
const data = this.getFlatCurrentPageData().filter((item) => {
if (this.props.rowSelection.getCheckboxProps) {
if (rowSelection.getCheckboxProps) {
return !this.getCheckboxPropsByItem(item).disabled;
}
return true;
@@ -516,27 +521,20 @@ export default class Table extends React.Component {
data.every(item => this.getCheckboxPropsByItem(item).defaultChecked)
);
}
let selectionColumn;
if (this.props.rowSelection.type === 'radio') {
selectionColumn = {
key: 'selection-column',
render: this.renderSelectionRadio,
className: 'ant-table-selection-column',
};
} else {
let selectionColumn = {
key: 'selection-column',
render: this.renderSelectionRadio,
className: `${prefixCls}-selection-column`,
};
if (rowSelection.type !== 'radio') {
const checkboxAllDisabled = data.every(item => this.getCheckboxPropsByItem(item).disabled);
const checkboxAll = (
selectionColumn.render = this.renderSelectionCheckBox;
selectionColumn.title = (
<Checkbox checked={checked}
disabled={checkboxAllDisabled}
onChange={this.handleSelectAllRow}
/>
);
selectionColumn = {
key: 'selection-column',
title: checkboxAll,
render: this.renderSelectionCheckBox,
className: 'ant-table-selection-column',
};
}
if (columns.some(column => column.fixed === 'left' || column.fixed === true)) {
selectionColumn.fixed = 'left';
@@ -571,6 +569,7 @@ export default class Table extends React.Component {
}
renderColumnsDropdown(columns) {
const { prefixCls, dropdownPrefixCls } = this.props;
const { sortOrder } = this.state;
const locale = this.getLocale();
return columns.map((originColumn, i) => {
@@ -586,6 +585,8 @@ export default class Table extends React.Component {
column={column}
selectedKeys={colFilters}
confirmFilter={this.handleFilter}
prefixCls={`${prefixCls}-filter`}
dropdownPrefixCls={dropdownPrefixCls || 'ant-dropdown'}
/>
);
}
@@ -594,20 +595,20 @@ export default class Table extends React.Component {
if (isSortColumn) {
column.className = column.className || '';
if (sortOrder) {
column.className += ' ant-table-column-sort';
column.className += ` ${prefixCls}-column-sort`;
}
}
const isAscend = isSortColumn && sortOrder === 'ascend';
const isDescend = isSortColumn && sortOrder === 'descend';
sortButton = (
<div className="ant-table-column-sorter">
<span className={`ant-table-column-sorter-up ${isAscend ? 'on' : 'off'}`}
<div className={`${prefixCls}-column-sorter`}>
<span className={`${prefixCls}-column-sorter-up ${isAscend ? 'on' : 'off'}`}
title="↑"
onClick={() => this.toggleSortOrder('ascend', column)}
>
<Icon type="caret-up" />
</span>
<span className={`ant-table-column-sorter-down ${isDescend ? 'on' : 'off'}`}
<span className={`${prefixCls}-column-sorter-down ${isDescend ? 'on' : 'off'}`}
title="↓"
onClick={() => this.toggleSortOrder('descend', column)}
>
@@ -707,21 +708,31 @@ export default class Table extends React.Component {
return data;
}
getFlatData() {
return flatArray(this.getLocalData());
}
getFlatCurrentPageData() {
return flatArray(this.getCurrentPageData());
}
recursiveSort(data, sorterFn) {
const { childrenColumnName } = this.props;
return data.sort(sorterFn).map(item => (item[childrenColumnName] ? {
...item,
[childrenColumnName]: this.recursiveSort(item[childrenColumnName], sorterFn),
} : item));
}
getLocalData() {
const state = this.state;
let data = this.props.dataSource || [];
const { dataSource } = this.props;
let data = dataSource || [];
// 优化本地排序
data = data.slice(0);
for (let i = 0; i < data.length; i++) {
data[i] = { ...data[i], indexForSort: i };
}
const sorterFn = this.getSorterFn();
if (sorterFn) {
data = data.sort(sorterFn);
data = this.recursiveSort(data, sorterFn);
}
// 筛选
if (state.filters) {
@@ -743,15 +754,17 @@ export default class Table extends React.Component {
}
render() {
const { style, className, ...restProps } = this.props;
const { style, className, prefixCls, showHeader, ...restProps } = this.props;
const data = this.getCurrentPageData();
let columns = this.renderRowSelection();
const expandIconAsCell = this.props.expandedRowRender && this.props.expandIconAsCell !== false;
const locale = this.getLocale();
const classString = classNames({
[`ant-table-${this.props.size}`]: true,
'ant-table-bordered': this.props.bordered,
[`${prefixCls}-${this.props.size}`]: true,
[`${prefixCls}-bordered`]: this.props.bordered,
[`${prefixCls}-empty`]: !data.length,
[`${prefixCls}-without-column-header`]: !showHeader,
});
columns = this.renderColumnsDropdown(columns);
@@ -760,40 +773,37 @@ export default class Table extends React.Component {
newColumn.key = this.getColumnKey(newColumn, i);
return newColumn;
});
let emptyText;
let emptyClass = '';
if (!data || data.length === 0) {
emptyText = (
<div className="ant-table-placeholder">
{locale.emptyText}
</div>
);
emptyClass = 'ant-table-empty';
let expandIconColumnIndex = (columns[0] && columns[0].key === 'selection-column') ? 1 : 0;
if ('expandIconColumnIndex' in restProps) {
expandIconColumnIndex = restProps.expandIconColumnIndex;
}
let table = (
<div>
<RcTable {...restProps}
data={data}
columns={columns}
className={classString}
expandIconColumnIndex={(columns[0] && columns[0].key === 'selection-column') ? 1 : 0}
expandIconAsCell={expandIconAsCell}
/>
{emptyText}
</div>
<RcTable
{...restProps}
prefixCls={prefixCls}
data={data}
columns={columns}
showHeader={showHeader}
className={classString}
expandIconColumnIndex={expandIconColumnIndex}
expandIconAsCell={expandIconAsCell}
emptyText={() => locale.emptyText}
/>
);
// if there is no pagination or no data,
// the height of spin should decrease by half of pagination
const paginationPatchClass = (this.hasPagination() && data && data.length !== 0)
? 'ant-table-with-pagination'
: 'ant-table-without-pagination';
const spinClassName = this.props.loading ? `${paginationPatchClass} ant-table-spin-holder` : '';
table = <Spin className={spinClassName} spinning={this.props.loading}>{table}</Spin>;
? `${prefixCls}-with-pagination`
: `${prefixCls}-without-pagination`;
const spinClassName = this.props.loading ? `${paginationPatchClass} ${prefixCls}-spin-holder` : '';
return (
<div className={`${emptyClass} ${className} clearfix`} style={style}>
{table}
{this.renderPagination()}
<div className={`${className} clearfix`} style={style}>
<Spin className={spinClassName} spinning={this.props.loading}>
{table}
{this.renderPagination()}
</Spin>
</div>
);
}

View File

@@ -11,9 +11,7 @@ import { Table } from 'antd';
const columns = [{
title: '姓名',
dataIndex: 'name',
render(text) {
return <a href="#">{text}</a>;
},
render: (text) => <a href="#">{text}</a>,
}, {
title: '资产',
className: 'column-money',
@@ -40,13 +38,15 @@ const data = [{
address: '西湖区湖底公园1号',
}];
ReactDOM.render(<Table
columns={columns}
dataSource={data}
bordered
title={() => '页头'}
footer={() => '页'}
/>, mountNode);
ReactDOM.render(
<Table
columns={columns}
dataSource={data}
bordered
title={() => '页'}
footer={() => '页脚'}
/>
, mountNode);
````
````css

View File

@@ -0,0 +1,123 @@
---
order: 19
title: 自定义筛选菜单
---
## zh-CN
通过 `filterDropdown``filterDropdownVisible``filterDropdownVisibleChange` 定义自定义的列筛选功能,并实现一个搜索列的示例。
## en-US
Implement a customized column search example via `filterDropdown`, `filterDropdownVisible` and `filterDropdownVisibleChange`.
````jsx
import { Table, Input, Button } from 'antd';
const data = [{
key: '1',
name: 'John Brown',
age: 32,
address: 'New York No. 1 Lake Park',
}, {
key: '2',
name: 'Jim Green',
age: 42,
address: 'London No. 1 Lake Park',
}, {
key: '3',
name: 'Joe Black',
age: 32,
address: 'Sidney No. 1 Lake Park',
}, {
key: '4',
name: 'Jim Red',
age: 32,
address: 'London No. 2 Lake Park',
}];
const App = React.createClass({
getInitialState() {
return {
filterDropdownVisible: false,
data,
searchText: '',
};
},
onInputChange(e) {
this.setState({ searchText: e.target.value });
},
onSearch() {
const { searchText } = this.state;
const reg = new RegExp(searchText, 'gi');
this.setState({
filterDropdownVisible: false,
data: data.map((record) => {
const match = record.name.match(reg);
if (!match) {
return null;
}
return {
...record,
name: (
<span>
{record.name.split(reg).map((text, i) => (
i > 0 ? [<span className="highlight">{match[0]}</span>, text] : text
))}
</span>
),
};
}).filter(record => !!record),
});
},
render() {
const columns = [{
title: 'Name',
dataIndex: 'name',
key: 'name',
filterDropdown: (
<div className="custom-filter-dropdown">
<Input
placeholder="Search name"
value={this.state.searchText}
onChange={this.onInputChange}
onPressEnter={this.onSearch}
/>
<Button type="primary" onClick={this.onSearch}>Search</Button>
</div>
),
filterDropdownVisible: this.state.filterDropdownVisible,
onFilterDropdownVisibleChange: visible => this.setState({ filterDropdownVisible: visible }),
}, {
title: 'Age',
dataIndex: 'age',
key: 'age',
}, {
title: 'Address',
dataIndex: 'address',
key: 'address',
}];
return <Table columns={columns} dataSource={this.state.data} />;
},
});
ReactDOM.render(<App />, mountNode);
````
````css
.custom-filter-dropdown {
padding: 8px;
border-radius: 6px;
background: #fff;
box-shadow: 0 1px 6px rgba(0, 0, 0, .2);
}
.custom-filter-dropdown input {
width: 130px;
margin-right: 8px;
}
.highlight {
color: #f50;
}
````

View File

@@ -5,36 +5,56 @@ import Icon from '../icon';
import Checkbox from '../checkbox';
import Radio from '../radio';
const FilterDropdownMenuWrapper = ({ onClick, children }) => (
<div className="ant-table-filter-dropdown" onClick={onClick}>{children}</div>
const FilterDropdownMenuWrapper = ({ onClick, children, className }) => (
<div className={className} onClick={onClick}>{children}</div>
);
export default class FilterMenu extends React.Component {
static defaultProps = {
handleFilter() {},
column: null,
column: {},
}
constructor(props) {
super(props);
const visible = ('filterDropdownVisible' in props.column) ?
props.column.filterDropdownVisible : false;
this.state = {
selectedKeys: props.selectedKeys,
keyPathOfSelectedItem: {}, // 记录所有有选中子菜单的祖先菜单
visible: false,
visible,
};
}
componentWillReceiveProps(nextProps) {
this.setState({
selectedKeys: nextProps.selectedKeys,
});
const { column } = nextProps;
let newState = {};
if ('selectedKeys' in nextProps) {
newState.selectedKeys = nextProps.selectedKeys;
}
if ('filterDropdownVisible' in column) {
newState.visible = column.filterDropdownVisible;
}
if (Object.keys(newState).length > 0) {
this.setState(newState);
}
}
setSelectedKeys = ({ selectedKeys }) => {
this.setState({ selectedKeys });
}
setVisible(visible) {
const { column } = this.props;
if (!('filterDropdownVisible' in column)) {
this.setState({ visible });
}
if (column.onFilterDropdownVisibleChange) {
column.onFilterDropdownVisibleChange(visible);
}
}
handleClearFilters = () => {
this.setState({
selectedKeys: [],
@@ -42,16 +62,12 @@ export default class FilterMenu extends React.Component {
}
handleConfirm = () => {
this.setState({
visible: false,
});
this.setVisible(false);
this.confirmFilter();
}
onVisibleChange = (visible) => {
this.setState({
visible,
});
this.setVisible(visible);
if (!visible) {
this.confirmFilter();
}
@@ -66,13 +82,14 @@ export default class FilterMenu extends React.Component {
renderMenuItem(item) {
const { column } = this.props;
const multiple = ('filterMultiple' in column) ? column.filterMultiple : true;
const input = multiple ? (
<Checkbox checked={this.state.selectedKeys.indexOf(item.value.toString()) >= 0} />
) : (
<Radio checked={this.state.selectedKeys.indexOf(item.value.toString()) >= 0} />
);
return (
<MenuItem key={item.value}>
{
multiple
? <Checkbox checked={this.state.selectedKeys.indexOf(item.value.toString()) >= 0} />
: <Radio checked={this.state.selectedKeys.indexOf(item.value.toString()) >= 0} />
}
{input}
<span>{item.text}</span>
</MenuItem>
);
@@ -85,7 +102,7 @@ export default class FilterMenu extends React.Component {
const containSelected = Object.keys(keyPathOfSelectedItem).some(
key => keyPathOfSelectedItem[key].indexOf(item.value) >= 0
);
const subMenuCls = containSelected ? 'ant-dropdown-submenu-contain-selected' : '';
const subMenuCls = containSelected ? `${this.props.dropdownPrefixCls}-submenu-contain-selected` : '';
return (
<SubMenu title={item.text} className={subMenuCls} key={item.value.toString()}>
{item.children.map(child => this.renderMenuItem(child))}
@@ -112,31 +129,34 @@ export default class FilterMenu extends React.Component {
}
render() {
const { column, locale } = this.props;
const { column, locale, prefixCls, dropdownPrefixCls } = this.props;
// default multiple selection in filter dropdown
const multiple = ('filterMultiple' in column) ? column.filterMultiple : true;
const menus = column.filterDropdown ? column.filterDropdown : (
const menus = column.filterDropdown ? (
<FilterDropdownMenuWrapper>
{column.filterDropdown}
</FilterDropdownMenuWrapper>
) : (
<FilterDropdownMenuWrapper className={`${prefixCls}-dropdown`}>
<Menu
multiple={multiple}
onClick={this.handleMenuItemClick}
prefixCls="ant-dropdown-menu"
prefixCls={`${dropdownPrefixCls}-menu`}
onSelect={this.setSelectedKeys}
onDeselect={this.setSelectedKeys}
selectedKeys={this.state.selectedKeys}
>
{this.renderMenus(column.filters)}
</Menu>
<div className="ant-table-filter-dropdown-btns">
<div className={`${prefixCls}-dropdown-btns`}>
<a
className="ant-table-filter-dropdown-link confirm"
className={`${prefixCls}-dropdown-link confirm`}
onClick={this.handleConfirm}
>
{locale.filterConfirm}
</a>
<a
className="ant-table-filter-dropdown-link clear"
className={`${prefixCls}-dropdown-link clear`}
onClick={this.handleClearFilters}
>
{locale.filterReset}
@@ -146,7 +166,7 @@ export default class FilterMenu extends React.Component {
);
const dropdownSelectedClass = (this.props.selectedKeys.length > 0)
? 'ant-table-filter-selected' : '';
? `${prefixCls}-selected` : '';
return (
<Dropdown

View File

@@ -89,6 +89,8 @@ const columns = [{
| onFilter | 本地模式下,确定筛选的运行函数 | Function | - |
| filterMultiple | 是否多选 | Boolean | true |
| filterDropdown | 可以自定义筛选菜单,此函数只负责渲染图层,需要自行编写各种交互 | React.Element | - |
| filterDropdownVisible | 用于控制自定义筛选菜单是否可见 | Boolean | - |
| onFilterDropdownVisibleChange | 自定义筛选菜单可见变化时调用 | function(visible) {} | - |
| sorter | 排序函数,本地排序使用一个函数,需要服务端排序可设为 true | Function or Boolean | - |
| colSpan | 表头列合并,设置为 0 时,不渲染 | Number | |
| width | 列宽度 | String or Number | - |

View File

@@ -25,7 +25,7 @@
overflow: hidden;
}
th {
&-thead > tr > th {
background: @table-head-background-color;
font-weight: bold;
transition: background .3s ease;
@@ -47,11 +47,12 @@
}
}
td {
&-tbody > tr > td {
border-bottom: 1px solid @border-color-split;
}
tr {
&-thead > tr,
&-tbody > tr {
transition: all .3s ease;
&.@{table-prefix-cls}-row-hover,
&:hover {
@@ -59,7 +60,7 @@
}
}
thead tr:hover {
&-thead > tr:hover {
background: none;
}
@@ -67,6 +68,7 @@
padding: 16px 8px;
background: @table-head-background-color;
position: relative;
z-index: 2;
top: -1px;
border-radius: 0 0 @border-radius-base @border-radius-base;
}
@@ -95,22 +97,28 @@
}
}
tr.@{table-prefix-cls}-row-selected {
// https://github.com/ant-design/ant-design/issues/4373
&-without-column-header &-title + &-content,
&-without-column-header table {
border-radius: 0;
}
&-tbody > tr.@{table-prefix-cls}-row-selected {
background: #fafafa;
}
th.@{table-prefix-cls}-column-sort {
&-thead > tr > th.@{table-prefix-cls}-column-sort {
background: #eaeaea;
}
th,
td {
&-thead > tr > th,
&-tbody > tr > td {
padding: 16px 8px;
word-break: break-all;
}
th.@{table-prefix-cls}-selection-column,
td.@{table-prefix-cls}-selection-column {
&-thead > tr > th.@{table-prefix-cls}-selection-column,
&-tbody > tr > td.@{table-prefix-cls}-selection-column {
text-align: center;
width: 60px;
}
@@ -148,8 +156,8 @@
}
&-middle {
th,
td {
.@{table-prefix-cls}-thead > tr > th,
.@{table-prefix-cls}-tbody > tr > td {
padding: 10px 8px;
}
}
@@ -158,18 +166,23 @@
border: 1px solid @border-color-split;
border-radius: @border-radius-base;
table {
.@{table-prefix-cls}-header > table,
.@{table-prefix-cls}-body > table {
border: 0;
padding: 0 8px;
}
th {
&.@{table-prefix-cls}-bordered .@{table-prefix-cls}-body > table {
border: 0;
}
.@{table-prefix-cls}-thead > tr > th {
padding: 10px 8px;
background: #fff;
border-bottom: 1px solid @border-color-split;
}
td {
.@{table-prefix-cls}-tbody > tr > td {
padding: 6px 8px;
}
@@ -178,7 +191,7 @@
table {
border-bottom: 1px solid @border-color-split;
}
th {
.@{table-prefix-cls}-thead > tr > th {
border-bottom: 0;
}
}
@@ -225,7 +238,7 @@
}
&-bordered {
table {
.@{table-prefix-cls}-body > table {
border: 1px solid @border-color-split;
}
@@ -240,21 +253,28 @@
.@{table-prefix-cls}-fixed-right {
border-left: 1px solid @border-color-split;
}
}
th {
border-bottom: 1px solid @border-color-split;
}
tbody tr:last-child {
th,
td {
.@{table-prefix-cls}-placeholder {
border-bottom: 0;
}
}
th,
td {
.@{table-prefix-cls}-thead > tr > th {
border-bottom: 1px solid @border-color-split;
}
&.@{table-prefix-cls}-empty .@{table-prefix-cls}-thead > tr > th {
border-bottom: 0;
}
.@{table-prefix-cls}-tbody tr:last-child {
> th,
> td {
border-bottom: 0;
}
}
.@{table-prefix-cls}-thead > tr > th,
.@{table-prefix-cls}-tbody > tr > td {
border-right: 1px solid @border-color-split;
&:last-child {
border-right: 0;
@@ -262,26 +282,15 @@
}
}
&-empty {
position: relative;
margin-bottom: 16px;
}
&-empty &-body {
height: 150px;
}
&-placeholder {
height: 100px;
line-height: 100px;
padding: 16px 8px;
background: #fff;
border-bottom: 1px solid @border-color-split;;
text-align: center;
position: relative;
z-index: 2;
font-size: 12px;
color: #999;
border-bottom: 1px solid @border-color-split;
position: absolute;
top: 50px;
left: 0;
width: 100%;
.anticon {
margin-right: 4px;
}
@@ -500,12 +509,12 @@
display: none;
}
th&-column-has-prev {
&-thead > tr > th&-column-has-prev {
position: relative;
}
th&-column-has-prev,
td&-column-has-prev {
&-thead > tr > th&-column-has-prev,
&-tbody > tr > td&-column-has-prev {
padding-left: 24px;
}

View File

@@ -45,15 +45,19 @@ export default class Tabs extends React.Component {
animation = null;
}
// only card type tabs can be added and closed
let childrenWithCross;
if (type === 'editable-card') {
children = children.map((child, index) => {
return cloneElement(child, {
tab: <div>
{child.props.tab}
<Icon type="cross" onClick={(e) => this.removeTab(child.key, e)} />
</div>,
childrenWithCross = [];
React.Children.forEach(children, (child, index) => {
childrenWithCross.push(cloneElement(child, {
tab: (
<div>
{child.props.tab}
<Icon type="cross" onClick={(e) => this.removeTab(child.key, e)} />
</div>
),
key: child.key || index,
});
}));
});
// Add new tab handler
if (!hideAdd) {
@@ -79,7 +83,7 @@ export default class Tabs extends React.Component {
onChange={this.handleChange}
animation={animation}
>
{children}
{childrenWithCross || children}
</RcTabs>
);
}

View File

@@ -66,7 +66,12 @@ export default class Tag extends React.Component {
onEnd={this.animationEnd}
>
{this.state.closed ? null : (
<div data-show={!this.state.closing} {...divProps} className={classString}>
<div
data-show={!this.state.closing}
{...divProps}
className={classString}
style={{ backgroundColor: /blue|red|green|yellow/.test(color) ? null : color }}
>
<span className={`${prefixCls}-text`}>{children}</span>
{closeIcon}
</div>

View File

@@ -0,0 +1,28 @@
---
order: 2
title: 箭头指向
---
设置了 `arrowPointAtCenter` 后,箭头将指向目标元素的中心。
````jsx
import { Tooltip, Button } from 'antd';
ReactDOM.render(
<div>
<Tooltip placement="topLeft" title="提示文字 提示文字">
<Button>默认对齐元素边缘</Button>
</Tooltip>
<Tooltip placement="topLeft" title="提示文字 提示文字" arrowPointAtCenter>
<Button>箭头指向目标元素的中心</Button>
</Tooltip>
</div>
, mountNode);
````
<style>
.code-box-demo .ant-btn {
margin-right: 1em;
margin-bottom: 1em;
}
</style>

View File

@@ -2,10 +2,6 @@ import React, { cloneElement } from 'react';
import RcTooltip from 'rc-tooltip';
import getPlacements from '../popover/placements';
const placements = getPlacements({
verticalArrowShift: 8,
});
export default class Tooltip extends React.Component {
static defaultProps = {
prefixCls: 'ant-tooltip',
@@ -14,6 +10,7 @@ export default class Tooltip extends React.Component {
mouseEnterDelay: 0.1,
mouseLeaveDelay: 0.1,
onVisibleChange() {},
arrowPointAtCenter: false,
}
constructor(props) {
@@ -32,8 +29,17 @@ export default class Tooltip extends React.Component {
return this.refs.tooltip.getPopupDomNode();
}
getPlacements() {
const { builtinPlacements, arrowPointAtCenter } = this.props;
return builtinPlacements || getPlacements({
arrowPointAtCenter,
verticalArrowShift: 8,
});
}
// 动态设置动画点
onPopupAlign = (domNode, align) => {
const placements = this.getPlacements();
// 当前返回的位置
const placement = Object.keys(placements).filter(
key => (
@@ -64,7 +70,7 @@ export default class Tooltip extends React.Component {
}
render() {
const { prefixCls, title, overlay, children, transitionName } = this.props;
const { prefixCls, title, overlay, children } = this.props;
// Hide tooltip when there is no title
let visible = this.state.visible;
if (!title && !overlay) {
@@ -76,15 +82,15 @@ export default class Tooltip extends React.Component {
const openClassName = this.props.openClassName || `${prefixCls}-open`;
const childrenCls = (children && children.props && children.props.className)
? `${children.props.className} ${openClassName}` : openClassName;
return (
<RcTooltip
transitionName={transitionName}
builtinPlacements={placements}
overlay={title}
visible={visible}
onPopupAlign={this.onPopupAlign}
ref="tooltip"
{...this.props}
builtinPlacements={this.getPlacements()}
onVisibleChange={this.onVisibleChange}
>
{visible ? cloneElement(children, { className: childrenCls }) : children}

View File

@@ -20,5 +20,6 @@ english: Tooltip
| placement | 气泡框位置,可选 `top` `left` `right` `bottom` `topLeft` `topRight` `bottomLeft` `bottomRight` `leftTop` `leftBottom` `rightTop` `rightBottom` | string | top |
| title | 提示文字 | string/React.Element | 无 |
| getTooltipContainer | 浮层渲染父节点。默认渲染到 body 上 | Function(triggerNode) | () => document.body |
| arrowPointAtCenter | 箭头是否指向目标元素中心,`antd@1.11+` 支持 | Boolean | `false` |
更多 API 可参考https://github.com/react-component/tooltip

View File

@@ -6,7 +6,7 @@ title: 自定义渲染行数据
自定义渲染每一个 Transfer Item可用于渲染复杂数据。
````jsx
import { Transfer, Icon } from 'antd';
import { Transfer } from 'antd';
const App = React.createClass({
getInitialState() {
@@ -41,9 +41,9 @@ const App = React.createClass({
},
renderItem(item) {
const customLabel = (
<div className="custom-item">
{item.title} - {item.description} <Icon type="android" />
</div>
<span className="custom-item">
{item.title} - {item.description}
</span>
);
return {

View File

@@ -3,7 +3,7 @@ order: 1
title: 带搜索框
---
带搜索框的穿梭框。
带搜索框的穿梭框,可以自定义搜索函数
````jsx
import { Transfer } from 'antd';
@@ -35,6 +35,9 @@ const App = React.createClass({
}
this.setState({ mockData, targetKeys });
},
filterOption(inputValue, option) {
return option.description.indexOf(inputValue) > -1;
},
handleChange(targetKeys) {
this.setState({ targetKeys });
},
@@ -43,6 +46,7 @@ const App = React.createClass({
<Transfer
dataSource={this.state.mockData}
showSearch
filterOption={this.filterOption}
targetKeys={this.state.targetKeys}
onChange={this.handleChange}
render={item => item.title}

View File

@@ -37,6 +37,7 @@ export default class Transfer extends React.Component {
titles: PropTypes.array,
operations: PropTypes.array,
showSearch: PropTypes.bool,
filterOption: PropTypes.func,
searchPlaceholder: PropTypes.string,
notFoundContent: PropTypes.node,
body: PropTypes.func,
@@ -187,7 +188,7 @@ export default class Transfer extends React.Component {
const {
prefixCls, titles, operations, showSearch, notFoundContent,
searchPlaceholder, body, footer, listStyle, className,
render,
filterOption, render,
} = this.props;
const { leftFilter, rightFilter, leftCheckedKeys, rightCheckedKeys } = this.state;
@@ -205,6 +206,7 @@ export default class Transfer extends React.Component {
<List titleText={titles[0]}
dataSource={leftDataSource}
filter={leftFilter}
filterOption={filterOption}
style={listStyle}
checkedKeys={leftCheckedKeys}
handleFilter={this.handleLeftFilter}
@@ -230,6 +232,7 @@ export default class Transfer extends React.Component {
<List titleText={titles[1]}
dataSource={rightDataSource}
filter={rightFilter}
filterOption={filterOption}
style={listStyle}
checkedKeys={rightCheckedKeys}
handleFilter={this.handleRightFilter}

View File

@@ -26,6 +26,7 @@ english: Transfer
| titles | 标题集合,顺序从左至右 | Array | ['源列表', '目的列表'] |
| operations | 操作文案集合,顺序从上至下 | Array | [] |
| showSearch | 是否显示搜索框 | Boolean | false |
| filterOption | 接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 `true`,反之则返回 `false`。| Function(inputValue, option) | |
| searchPlaceholder | 搜索框的默认值 | String | '请输入搜索内容' |
| notFoundContent | 当列表为空时显示的内容 | React.node | '列表为空' |
| footer | 底部渲染函数 | Function(props) | |
@@ -39,4 +40,4 @@ english: Transfer
```jsx
// 比如你的数据主键是 uid
return <Transfer rowKey={record => record.uid} />;
```
```

View File

@@ -32,6 +32,7 @@ export default class TransferList extends React.Component {
prefixCls: PropTypes.string,
dataSource: PropTypes.array,
showSearch: PropTypes.bool,
filterOption: PropTypes.func,
searchPlaceholder: PropTypes.string,
titleText: PropTypes.string,
style: PropTypes.object,
@@ -116,7 +117,11 @@ export default class TransferList extends React.Component {
);
}
matchFilter(text, filterText) {
matchFilter(filterText, item, text) {
const filterOption = this.props.filterOption;
if (filterOption) {
return filterOption(filterText, item);
}
return text.indexOf(filterText) >= 0;
}
@@ -150,7 +155,7 @@ export default class TransferList extends React.Component {
renderedEl = renderResult;
}
if (filter && filter.trim() && !this.matchFilter(renderedText, filter)) {
if (filter && filter.trim() && !this.matchFilter(filter, item, renderedText)) {
return null;
}

View File

@@ -7,6 +7,7 @@
.@{transfer-prefix-cls} {
position: relative;
line-height: @line-height-base;
&-list {
font-size: 12px;
@@ -64,7 +65,6 @@
&-body {
font-size: 12px;
line-height: 1.5;
position: relative;
height: 100%;

View File

@@ -69,6 +69,9 @@
}
}
&.@{select-tree-prefix-cls}-switcher {
&.@{select-tree-prefix-cls}-switcher-noop {
cursor: auto;
}
&.@{select-tree-prefix-cls}-roots_open,
&.@{select-tree-prefix-cls}-center_open,
&.@{select-tree-prefix-cls}-bottom_open,
@@ -118,3 +121,10 @@
cursor: not-allowed;
display: block;
}
.ant-select-not-found {
cursor: not-allowed;
color: #ccc;
padding: 7px 15px;
display: block;
}

View File

@@ -93,7 +93,7 @@ const Demo = React.createClass({
},
render() {
const loop = data => data.map((item) => {
if (item.children) {
if (item.children && item.children.length) {
return <TreeNode key={item.key} title={item.key}>{loop(item.children)}</TreeNode>;
}
return <TreeNode key={item.key} title={item.key} />;

View File

@@ -95,6 +95,9 @@
}
}
&.@{tree-prefix-cls}-switcher {
&.@{tree-prefix-cls}-switcher-noop {
cursor: auto;
}
&.@{tree-prefix-cls}-roots_open,
&.@{tree-prefix-cls}-center_open,
&.@{tree-prefix-cls}-bottom_open,

View File

@@ -12,6 +12,7 @@ import { Upload, Button, Icon, message } from 'antd';
const props = {
action: '/upload.do',
multiple: true,
beforeUpload(file) {
const isJPG = file.type === 'image/jpeg';
if (!isJPG) {

View File

@@ -72,6 +72,7 @@ export default class Upload extends React.Component {
showUploadList: true,
listType: 'text', // or pictrue
className: '',
disabled: false,
}
constructor(props) {
@@ -83,8 +84,6 @@ export default class Upload extends React.Component {
}
onStart = (file) => {
if (this.recentUploadStatus === false) return;
let targetItem;
let nextFileList = this.state.fileList.concat();
if (file.length > 0) {
@@ -181,11 +180,6 @@ export default class Upload extends React.Component {
this.handleRemove(targetItem);
}
beforeUpload = (file) => {
this.recentUploadStatus = this.props.beforeUpload(file);
return this.recentUploadStatus;
}
handleRemove(file) {
let fileList = this.removeFile(file);
if (fileList) {
@@ -197,6 +191,7 @@ export default class Upload extends React.Component {
}
handleManualRemove = (file) => {
this.refs.upload.abort(file);
/*eslint-disable */
file.status = 'removed';
/*eslint-enable */
@@ -240,7 +235,7 @@ export default class Upload extends React.Component {
onError: this.onError,
onProgress: this.onProgress,
onSuccess: this.onSuccess,
beforeUpload: this.beforeUpload,
beforeUpload: this.props.beforeUpload,
};
let uploadList;
if (this.props.showUploadList) {
@@ -253,18 +248,21 @@ export default class Upload extends React.Component {
);
}
if (type === 'drag') {
let dragUploadingClass = this.state.fileList.some(file => file.status === 'uploading')
? `${prefixCls}-drag-uploading` : '';
let draggingClass = this.state.dragState === 'dragover'
? `${prefixCls}-drag-hover` : '';
const dragCls = classNames({
[prefixCls]: true,
[`${prefixCls}-drag`]: true,
[`${prefixCls}-drag-uploading`]: this.state.fileList.some(file => file.status === 'uploading'),
[`${prefixCls}-drag-hover`]: this.state.dragState === 'dragover',
[`${prefixCls}-disabled`]: this.props.disabled,
});
return (
<span className={this.props.className}>
<div className={`${prefixCls} ${prefixCls}-drag ${dragUploadingClass} ${draggingClass}`}
<div className={dragCls}
onDrop={this.onFileDrop}
onDragOver={this.onFileDrop}
onDragLeave={this.onFileDrop}
>
<RcUpload {...props}>
<RcUpload {...props} ref="upload">
<div className={`${prefixCls}-drag-container`}>
{this.props.children}
</div>
@@ -279,11 +277,14 @@ export default class Upload extends React.Component {
[prefixCls]: true,
[`${prefixCls}-select`]: true,
[`${prefixCls}-select-${this.props.listType}`]: true,
[`${prefixCls}-disabled`]: this.props.disabled,
});
const uploadButton = this.props.children
? <div className={uploadButtonCls}><RcUpload {...props} /></div>
: null;
const uploadButton = (
<div className={uploadButtonCls} style={{ display: this.props.children ? '' : 'none' }}>
<RcUpload {...props} ref="upload" />
</div>
);
if (this.props.listType === 'picture-card') {
return (

View File

@@ -34,6 +34,7 @@ english: Upload
| onPreview | 点击文件链接时的回调 | Function(file) | 无 |
| onRemove | 点击移除文件时的回调 | Function(file) | 无 |
| supportServerRender | 服务端渲染时需要打开这个 | Boolean | false |
| disabled | 是否禁用 | Boolean | false |
### onChange
@@ -59,8 +60,7 @@ english: Upload
response: '{"status": "success"}', // 服务端响应内容
}
```
如果上传控件是 multiple 时,此参数将为一个对象数组 `[file, ...]`。
> `antd@1.9.0` 之前multiple 模式下,此参数为一个对象数组 `[file, ...]``antd@1.9.0` 开始无论是否多选,均为一个对象。
2. `fileList` 当前的文件列表。
3. `event` 上传中的服务端响应内容,包含了上传进度等信息,高级浏览器支持。

View File

@@ -52,10 +52,14 @@
height: 100%;
position: relative;
&.@{upload-prefix-cls}-drag-hover {
&.@{upload-prefix-cls}-drag-hover:not(.@{upload-prefix-cls}-disabled) {
border: 2px dashed tint(@primary-color, 20%);
}
&.@{upload-prefix-cls}-disabled {
cursor: not-allowed;
}
> span {
display: table;
height: 100%;
@@ -66,7 +70,7 @@
vertical-align: middle;
}
&:hover {
&:not(.@{upload-prefix-cls}-disabled):hover {
border-color: tint(@primary-color, 20%);
}
@@ -237,7 +241,7 @@
}
&-picture-card {
display: inline-block;
display: inline;
.@{upload-item} {
display: inline-block;
@@ -317,6 +321,7 @@
}
.@{upload-item}-info {
height: auto;
&:before,
.anticon-eye-o,
.anticon-delete {

View File

@@ -13,7 +13,7 @@ Ant Design React 致力于提供给程序员**愉悦**的开发体验。
最简单的试用方式参照以下 CodePen 演示,也推荐 Fork 本例来进行 `Bug Report`,注意不要在实际项目中这样使用。
- [antd CodePen](http://codepen.io/anon/pen/wGOWGW?editors=001)
- [antd CodePen](http://codepen.io/benjycui/pen/KgPZrE?editors=001)
## 标准开发

View File

@@ -32,23 +32,23 @@ $ npm install antd@beta --save
## 浏览器引入
我们在 npm 发布包内的 `antd/dist` 目录下提供了 `antd.js` `antd.css` 以及 `antd.min.js` `antd.min.css` 用于一次性引入所有的 antd 组件,也可以通过 [npmcdn](https://npmcdn.com/) 进行下载。
我们在 npm 发布包内的 `antd/dist` 目录下提供了 `antd.js` `antd.css` 以及 `antd.min.js` `antd.min.css` 用于一次性引入所有的 antd 组件,也可以通过 [UNPKG](https://unpkg.com/) 进行下载。
> 不推荐使用构建文件,因为难以获得底层依赖模块的 bug 快速修复支持。
#### stable
- https://npmcdn.com/antd/dist/antd.js
- https://npmcdn.com/antd/dist/antd.css
- https://npmcdn.com/antd/dist/antd.min.js
- https://npmcdn.com/antd/dist/antd.min.css
- https://unpkg.com/antd/dist/antd.js
- https://unpkg.com/antd/dist/antd.css
- https://unpkg.com/antd/dist/antd.min.js
- https://unpkg.com/antd/dist/antd.min.css
#### beta
- https://npmcdn.com/antd@beta/dist/antd.js
- https://npmcdn.com/antd@beta/dist/antd.css
- https://npmcdn.com/antd@beta/dist/antd.min.js
- https://npmcdn.com/antd@beta/dist/antd.min.css
- https://unpkg.com/antd@beta/dist/antd.js
- https://unpkg.com/antd@beta/dist/antd.css
- https://unpkg.com/antd@beta/dist/antd.min.js
- https://unpkg.com/antd@beta/dist/antd.min.css
> 对于 1.0 之前的版本,这里有一个 [自行构建的例子](https://github.com/ant-design/antd-init/tree/master/examples/build-antd-standalone) 以供参考。

View File

@@ -76,6 +76,9 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
- [组件设计原则](https://github.com/react-component/react-component.github.io/blob/master/docs/zh-cn/component-design.md)
- [设计规范速查手册](https://os.alipayobjects.com/rmsportal/HTXUgPGkyyxEivE.png)
- [社区贡献脚手架和范例](https://github.com/ant-design/ant-design/issues/129)
- [常见问题](https://github.com/ant-design/ant-design/wiki/FAQ)
- [CodePen 模板](http://codepen.io/benjycui/pen/KgPZrE?editors=001)
- [Awesome Ant Design](https://github.com/websemantics/awesome-ant-design)
## 谁在使用

View File

@@ -7,20 +7,13 @@ english: Download
这里提供 Ant Design 相关设计资源和设计工具的下载,更多设计资源正在整理和完善中。
<div class="resource-cards">
<a target="_blank" href="https://github.com/ant-design/ant-design/releases/download/resource/AntD_Component_v1.3.rplib" class="resource-card">
<a target="_blank" href="http://library.ant.design" class="resource-card">
<img src="https://os.alipayobjects.com/rmsportal/cnmjGfbBWUZPFiO.png">
<span class="resource-card-content">
<span class="resource-card-title">Axure Components v1.3</span>
<span class="resource-card-title">Ant Design Library v2.0.1</span>
<span class="resource-card-description">一套强大的 Ant Design 的 Axure 部件库</span>
</span>
</a>
<a target="_blank" href="https://github.com/ant-design/ant-design/releases/download/resource/AntD_Box_v1.3.rp" class="resource-card">
<img src="https://os.alipayobjects.com/rmsportal/UuYRXxndGMKdaiE.png">
<span class="resource-card-content">
<span class="resource-card-title">Axure Box v1.3</span>
<span class="resource-card-description">强大的 Ant Design 组件拼装方式</span>
</span>
</a>
<a target="_blank" href="http://ux.ant.design" class="resource-card">
<img src="https://os.alipayobjects.com/rmsportal/yfTqrQuSKcqBDLY.png">
<span class="resource-card-content">
@@ -28,7 +21,7 @@ english: Download
<span class="resource-card-description">一套页面逻辑原型库,帮你梳理页面逻辑</span>
</span>
</a>
<a target="_blank" href="https://github.com/ant-design/ant-design/releases/download/resource/iconfont-0.12.11.zip" class="resource-card">
<a target="_blank" href="https://github.com/ant-design/ant-design/releases/download/resource/iconfont-1.x.zip" class="resource-card">
<img src="https://os.alipayobjects.com/rmsportal/UEpOFKUQTZaUfnW.png">
<span class="resource-card-content">
<span class="resource-card-title">Web Font</span>

View File

@@ -157,6 +157,7 @@ ReactDOM.render(<ExtendPalettes key="palettes" />, mountNode);
`````__react
const Values = require('values.js');
const CopyToClipboard = require('react-copy-to-clipboard');
const classNames = require('classnames');
const antd = require('antd');
const Button = antd.Button;
const InputNumber = antd.InputNumber;
@@ -213,11 +214,20 @@ const TintShadeTool = React.createClass({
'0': '原色',
'100': '加白'
};
const className = classNames({
'color-block': true,
copied: this.state.justCopied,
dark: this.state.darkBackground,
});
return <div style={{margin: '40px 0'}}>
<div>
<Tooltip title="点击色块复制色值">
<CopyToClipboard onCopy={this.copySuccess} text={this.state.result}>
<div style={{backgroundColor: this.state.result}} className={'color-block ' + (this.state.justCopied ? 'copied' : '') + (this.state.darkBackground ? ' dark' : '')}></div>
<CopyToClipboard
className={className}
onCopy={this.copySuccess}
text={this.state.result}
>
<div style={{backgroundColor: this.state.result}} />
</CopyToClipboard>
</Tooltip>
<span style={{width: 188, display: 'inline-block', fontFamily: 'Consolas'}}>{this.state.result}</span>

View File

@@ -28,8 +28,9 @@ Ant Design 是一个致力于提升『用户』和『设计者』使用体验的
我们采用 [React](http://facebook.github.io/react/) 封装了一套 Ant Design 的组件库,也欢迎社区其他框架的实现版本。
- [Ant Design of React](/docs/react/introduce)(官方实现)
- [vue-antd](https://github.com/okoala/vue-antd)
- [antd-ember](https://github.com/idcos/antd-ember)
- <div class="outside-link internal"><a href="http://naza.alibaba.net" target="_blank">Ant Design of Angular 2.0</a></div>
- <div class="outside-link"><a href="https://github.com/okoala/vue-antd" target="_blank">vue-antd</a></div>
- <div class="outside-link"><a href="https://github.com/idcos/antd-ember" target="_blank">antd-ember</a></div>
## 如何贡献

64
index.d.ts vendored
View File

@@ -91,7 +91,7 @@ type ButtonSize = 'small' | 'large'
// Button
interface ButtonProps {
/** 设置按钮类型,可选值为 `primary` `ghost` 或者不设 */
type?:ButtonType,
type?:ButtonType,
/** 设置 `button` 原生的 `type` 值,可选值请参考 HTML标准*/
htmlType?:string,
@@ -101,7 +101,7 @@ interface ButtonProps {
/** 设置按钮大小,可选值为 `small` `large` 或者不设*/
size?:ButtonSize,
/** `click` 事件的 handler*/
onClick?:React.FormEventHandler<any>,
onClick?:React.FormEventHandler,
/** 设置按钮载入状态*/
loading?:boolean,
@@ -318,7 +318,7 @@ interface CheckboxProps {
/** 初始是否选中*/
defaultChecked?:boolean,
/** 变化时回调函数*/
onChange?:React.FormEventHandler<any>,
onChange?:React.FormEventHandler,
style?:React.CSSProperties
}
@@ -488,7 +488,7 @@ interface DropdownButtonProps {
/** 按钮类型*/
type?:'primary' | 'ghost' | 'dash',
/** 点击左侧按钮的回调*/
onClick?:React.FormEventHandler<any>,
onClick?:React.FormEventHandler,
/** 触发下拉的行为*/
trigger?:'click' | 'hover',
/** 菜单节点*/
@@ -552,7 +552,7 @@ export class FormItem extends React.Component<FormItemProps, {}> {
}
interface FormComponentProps {
form:CreateFormOptions
form?:CreateFormOptions
}
export class FormComponent extends React.Component<FormComponentProps, {}> {
}
@@ -560,37 +560,41 @@ export class FormComponent extends React.Component<FormComponentProps, {}> {
// function create
type CreateFormOptions = {
/** 获取一组输入控件的值,如不传入参数,则获取全部组件的值*/
getFieldsValue():(fieldNames?:Array<string>) => any
getFieldsValue:(fieldNames?:Array<string>) => any
/** 获取一个输入控件的值*/
getFieldValue():(fieldName:string) => any
getFieldValue:(fieldName:string) => any
/** 设置一组输入控件的值*/
setFieldsValue():(obj:Object) => void
setFieldsValue:(obj:Object) => void
/** 设置一组输入控件的值*/
setFields():(obj:Object) => void
setFields:(obj:Object) => void
/** 校验并获取一组输入域的值与 Error*/
validateFields():(fieldNames?:Array<string>, options?:Object, callback?:(erros:any, values:any) => void) => any
validateFields:(fieldNames?:Array<string>, options?:Object, callback?:(erros:any, values:any) => void) => any
/** 与 `validateFields` 相似,但校验完后,如果校验不通过的菜单域不在可见范围内,则自动滚动进可见范围 */
validateFieldsAndScroll():(fieldNames?:Array<string>, options?:Object, callback?:(erros:any, values:any) => void) => any
validateFieldsAndScroll:(fieldNames?:Array<string>, options?:Object, callback?:(erros:any, values:any) => void) => any
/** 获取某个输入控件的 Error */
getFieldError():(name:string) => Object
getFieldError:(name:string) => Object
/** 判断一个输入控件是否在校验状态*/
isFieldValidating():(name:string) => Object
isFieldValidating:(name:string) => Object
/**重置一组输入控件的值与状态,如不传入参数,则重置所有组件*/
resetFields():(names?:Array<string>) => void
resetFields:(names?:Array<string>) => void
getFieldsValue():(id:string, options:{
getFieldProps:(id:string, options:{
/** 子节点的值的属性,如 Checkbox 的是 'checked'*/
valuePropName?:string,
/** 子节点的初始值,类型、可选值均由子节点决定*/
initialValue?:any,
/** 收集子节点的值的时机*/
trigger?:string,
/** 可以把 onChange 的参数转化为控件的值,例如 DatePicker 可设为:(date, dateString) => dateString */
getValueFromEvent: (...args:any[]) => any,
/** 校验子节点值的时机*/
validateTrigger?:string,
/** 校验规则,参见 [async-validator](https://github.com/yiminghe/async-validator) */
rules?:Array<any>,
/** 必填输入控件唯一标志*/
id?:string
id?:string,
/** 是否和其他控件互斥,特别用于 Radio 单选控件 */
exclusive: boolean
}) => Array<any>
}
@@ -603,10 +607,10 @@ interface FormProps {
horizontal?:boolean,
/** 行内排列布局*/
inline?:boolean,
/** 经 `Form.create()` 包装过的组件会自带 `this.props.form` 属性,直接传给 Form 即可*/
/** 经 `Form.create()` 包装过的组件会自带 `this.props.form` 属性,直接传给 Form 即可。1.7.0 之后无需设置*/
form?:Object,
/** 数据验证成功后回调事件*/
onSubmit?:React.FormEventHandler<any>,
onSubmit?:React.FormEventHandler,
style?:React.CSSProperties
}
@@ -691,7 +695,7 @@ interface InputProps {
addonAfter?:React.ReactNode,
prefixCls?:string,
placeholder?:string,
onChange?:React.FormEventHandler<any>,
onChange?:React.FormEventHandler,
style:React.CSSProperties
}
export class Input extends React.Component<InputProps, {}> {
@@ -710,7 +714,7 @@ interface InputNumberProps {
/** 初始值*/
defaultValue?:number,
/** 变化回调*/
onChange?:React.FormEventHandler<any>,
onChange?:React.FormEventHandler,
/** 禁用*/
disabled?:boolean,
/** 输入框大小*/
@@ -1006,9 +1010,12 @@ export const notification:{
warn:NotificationFunc
close:(key:string) => void
destroy:() => void
open:NotificationFunc
config:(options:{
/** 消息距离顶部的位置*/
top:number
/** 默认自动关闭延时,单位秒 */
duration:number
}) => void
}
@@ -1164,7 +1171,7 @@ type RadioGroupSize = 'large' | 'default' | 'small'
interface RadioGroupProps {
/** 选项变化时的回调函数*/
onChange?:React.FormEventHandler<any>,
onChange?:React.FormEventHandler,
/** 用于设置当前选中的值*/
value?:string,
/** 默认选中的值*/
@@ -1481,10 +1488,14 @@ interface TableProps {
columns:Columns,
/** 表格行 key 的取值*/
rowKey?:(record:any, index:number) => string,
/** 表格行的类名 */
rowClassName?:(record:any, index) => string,
/** 额外的展开行*/
expandedRowRender?:Function,
/** 默认展开的行*/
defaultExpandedRowKeys?:Array<string>,
/** 展开的行,控制属性 */
expandedRowKeys?:Array<string>,
/** 分页、排序、筛选变化时触发*/
onChange?:(pagination:Object, filters:any, sorter:any) => void,
/** 页面是否加载中*/
@@ -1503,8 +1514,13 @@ interface TableProps {
showHeader?:boolean,
/** 表格底部自定义渲染函数*/
footer?:(currentPageData:Object) => void,
style?:React.CSSProperties
/** 表格头部自定义渲染函数 */
title?:(currentPageData:Object) => void,
/** 横向或纵向支持滚动,也可用于指定滚动区域的宽高度:{{ x: true, y: 300 }} */
scroll?:Object,
/** 表格body的样式 */
bodyStyle?:React.CSSProperties,
style?:React.CSSProperties,
}
/**
* #Table
@@ -1755,7 +1771,7 @@ interface TreeNodeEvent {
interface TreeNodeMouseEvent {
node:TreeNode,
event:React.MouseEventHandler<any>,
event:React.MouseEventHandler,
}
interface TreeProps {

View File

@@ -26,6 +26,6 @@ req.keys().forEach((mod) => {
if (process.env.NODE_ENV !== 'production') {
if (typeof console !== 'undefined' && console.warn) {
console.warn(`You are using prebuilt antd,
please use https://github.com/ant-design/babel-plugin-antd to reduce app bundle size.`);
please use https://www.npmjs.com/package/babel-plugin-antd to reduce app bundle size.`);
}
}

View File

@@ -1,8 +1,8 @@
{
"name": "antd",
"version": "1.7.0",
"version": "1.11.6",
"title": "Ant Design",
"description": "一个 UI 设计语言",
"description": "An enterprise-class UI design language and React-based implementation",
"homepage": "http://ant.design/",
"keywords": [
"ant",
@@ -42,34 +42,34 @@
"object.omit": "^2.0.0",
"rc-animate": "~2.3.0",
"rc-calendar": "~5.6.2",
"rc-cascader": "~0.9.10",
"rc-cascader": "~0.10.1",
"rc-checkbox": "~1.4.0",
"rc-collapse": "~1.6.3",
"rc-dialog": "~6.1.1",
"rc-dropdown": "~1.4.8",
"rc-form": "~0.17.1",
"rc-input-number": "~2.5.12",
"rc-input-number": "~2.6.3",
"rc-menu": "~4.13.0",
"rc-notification": "~1.3.4",
"rc-pagination": "~1.5.3",
"rc-progress": "~1.0.4",
"rc-queue-anim": "~0.11.12",
"rc-queue-anim": "~0.12.4",
"rc-radio": "~2.0.0",
"rc-rate": "~1.1.2",
"rc-select": "~6.4.6",
"rc-slider": "~3.7.3",
"rc-slider": "~4.0.0",
"rc-steps": "~2.1.5",
"rc-switch": "~1.4.2",
"rc-table": "~4.4.0",
"rc-table": "~4.6.0",
"rc-tabs": "~5.9.2",
"rc-time-picker": "~1.1.6",
"rc-tooltip": "~3.4.2",
"rc-tree": "~1.3.6",
"rc-tree-select": "~1.8.0",
"rc-upload": "~1.13.3",
"rc-upload": "~2.0.3",
"rc-util": "~3.3.0",
"react-addons-pure-render-mixin": "^15.0.0",
"react-slick": "~0.12.0",
"react-slick": "~0.13.3",
"shallowequal": "^0.2.2",
"warning": "~3.0.0"
},
@@ -78,7 +78,7 @@
"babel-eslint": "^6.0.2",
"babel-jest": "^13.2.2",
"babel-plugin-antd": "^0.4.0",
"bisheng": "^0.9.0",
"bisheng": "^0.12.0",
"bisheng-plugin-antd": "~0.2.0",
"bisheng-plugin-description": "^0.1.1",
"bisheng-plugin-react": "^0.2.0",
@@ -140,7 +140,7 @@
"jest": "jest",
"pre-publish": "node ./scripts/prepub",
"prepublish": "antd-tools run guard",
"pub": "antd-tools run update-self && antd-tools run pub",
"pub": "antd-tools run update-self && antd-tools run pub --npm-tag=1.x",
"authors": "git log --format='%aN <%aE>' | sort -u | grep -v 'users.noreply.github.com' | grep -v 'gitter.im' | grep -v '.local>' | grep -v 'alibaba-inc.com' | grep -v 'alipay.com' | grep -v 'taobao.com' > AUTHORS.txt"
},
"jest": {

View File

@@ -7,8 +7,8 @@ const utils = require('./utils');
module.exports = function buildCommon(dirs, outputFile) {
const mds = utils.findMDFile(dirs, true)
.filter((file) => !/\/demo$/i.test(path.dirname(file)))
.filter((file) => !/install_en\.md$/gi.test(file)); // TODO
.filter((file) => !/\/demo$/i.test(path.dirname(file)))
.filter((file) => !/install_en\.md$/gi.test(file)); // TODO
const addedMd = [];
let content = 'module.exports = {';

View File

@@ -1,5 +1,19 @@
const path = require('path');
function pickerGenerator(module) {
const tester = new RegExp(`^docs/${module}`);
return (markdownData) => {
const filename = markdownData.meta.filename;
if (tester.test(filename) &&
!/\/demo$/.test(path.dirname(filename)) &&
!/\.en-US\.md/.test(filename)) {
return {
meta: markdownData.meta,
};
}
};
}
module.exports = {
port: 8001,
source: [
@@ -7,7 +21,36 @@ module.exports = {
'./docs',
'CHANGELOG.md', // TODO: fix it in bisheng
],
lazyLoad: true,
lazyLoad(nodePath, nodeValue) {
if (typeof nodeValue === 'string') {
return true;
}
return nodePath.endsWith('/demo');
},
pick: {
components(markdownData) {
const filename = markdownData.meta.filename;
if (!/^components/.test(filename) ||
/\/demo$/.test(path.dirname(filename)) ||
/\.en-US\.md/.test(filename)) return;
return {
meta: markdownData.meta,
};
},
changelog(markdownData) {
if (markdownData.meta.filename === 'CHANGELOG.md') {
return {
meta: markdownData.meta,
};
}
},
'docs/pattern': pickerGenerator('pattern'),
'docs/practice': pickerGenerator('practice'),
'docs/react': pickerGenerator('react'),
'docs/resource': pickerGenerator('resource'),
'docs/spec': pickerGenerator('spec'),
},
theme: './site/theme',
htmlTemplate: './site/theme/static/template.html',
plugins: [

View File

@@ -37,7 +37,7 @@ module.exports = {
path: 'changelog',
component: contentTmpl,
}, {
path: 'components/:children',
path: 'components/:children/',
component: contentTmpl,
}, {
path: 'docs/spec/:children',

View File

@@ -67,11 +67,16 @@ div.main-container {
opacity: .67;
}
.outside-link {
display: inline-block;
}
.outside-link:after {
content: '\E669';
font-family: 'anticon';
margin-left: 5px;
font-size: 12px;
color: #aaa;
}
.outside-link.internal {

View File

@@ -44,21 +44,29 @@
box-shadow: 0 0 4px rgba(45, 183, 245, 0.5);
}
.code-box:hover .code-box-meta,
.code-box:target .code-box-meta {
background: #fbfbfb;
}
.code-box {
.code-box-title a,
.code-box-title a:hover {
color: #666;
font-size: 14px;
font-weight: 500;
}
.code-box:hover .code-box-title,
.code-box:target .code-box-title {
background: #fbfbfb;
box-shadow: 0 -1.2px 0 #e9e9e9;
}
a.edit-button {
position: absolute;
right: -16px;
top: 7px;
font-size: 12px;
transform: scale(0.9);
background: #fff;
padding-right: 6px;
opacity: 0;
transition: opacity .3s;
}
.code-box .code-box-title a,
.code-box .code-box-title a:hover {
color: #666;
font-size: 14px;
&:hover a.edit-button {
opacity: 1;
}
}
.code-box .code-box-demo {
@@ -73,7 +81,7 @@
.code-box-meta.markdown {
position: relative;
padding: 16px;
padding: 17px 16px 15px 20px;
border-radius: 0 0 6px 6px;
transition: background-color 0.4s ease;
width: 100%;
@@ -97,26 +105,13 @@ section.code-box-meta p {
.code-box-title {
position: absolute;
top: -14px;
padding: 1px 1.1em;
padding: 1px 8px;
margin-left: -8px;
color: #777;
border-radius: 6px;
border-top-left-radius: 0;
background: #fff;
transition: all 0.4s ease;
}
.code-box-title:before {
font-family: anticon;
content: "\e658";
font-size: 16px;
vertical-align: middle;
line-height: 22px;
position: relative;
margin-right: 8px;
top: -2px;
color: #ccc;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
display: inline-block;
transition: background-color 0.4s ease;
}
.code-box-meta > p {
@@ -135,7 +130,7 @@ section.code-box-meta p {
.code-box .collapse {
position: absolute;
right: 16px;
bottom: 16px;
bottom: 17px;
cursor: pointer;
width: 18px;
height: 18px;
@@ -143,9 +138,8 @@ section.code-box-meta p {
line-height: 18px;
opacity: 0.5;
text-align: center;
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
transition: all 0.3s ease;
transition: all 0.3s;
color: #999;
background: #fff;
user-select: none;
@@ -153,7 +147,6 @@ section.code-box-meta p {
}
.code-box.expand .collapse {
-webkit-transform: rotate(-90deg);
transform: rotate(-90deg);
}

View File

@@ -3,7 +3,7 @@
font-family: 'Lato';
font-style: normal;
font-weight: 400;
src: local('Lato Regular'), local('Lato-Regular'), url(http://fontstatic.useso.com/s/lato/v11/MDadn8DQ_3oT6kvnUq_2r_esZW2xOQ-xsNqO47m55DA.woff2) format('woff2');
src: local('Lato Regular'), local('Lato-Regular'), url(https://fonts.gstatic.com/s/lato/v11/MDadn8DQ_3oT6kvnUq_2r_esZW2xOQ-xsNqO47m55DA.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
/* latin */
@@ -11,7 +11,7 @@
font-family: 'Lato';
font-style: normal;
font-weight: 700;
src: local('Lato Bold'), local('Lato-Bold'), url(http://fontstatic.useso.com/s/lato/v11/MgNNr5y1C_tIEuLEmicLmwLUuEpTyoUstqEm5AMlJo4.woff2) format('woff2');
src: local('Lato Bold'), local('Lato-Bold'), url(https://fonts.gstatic.com/s/lato/v11/MgNNr5y1C_tIEuLEmicLmwLUuEpTyoUstqEm5AMlJo4.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
/* latin */
@@ -19,6 +19,6 @@
font-family: 'Raleway';
font-style: normal;
font-weight: 400;
src: local('Raleway'), url(http://fontstatic.useso.com/s/raleway/v9/QAUlVt1jXOgQavlW5wEfxQLUuEpTyoUstqEm5AMlJo4.woff2) format('woff2');
src: local('Raleway'), url(https://fonts.gstatic.com/s/raleway/v9/QAUlVt1jXOgQavlW5wEfxQLUuEpTyoUstqEm5AMlJo4.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}

View File

@@ -62,6 +62,9 @@
.markdown ul > li {
list-style: circle;
&:empty {
display: none;
}
}
.markdown > ul li,
@@ -166,6 +169,26 @@
cursor: not-allowed;
}
.markdown a.edit-button {
line-height: 12px;
display: inline-block;
margin-left: 10px;
height: 12px;
i {
color: #999;
&:hover {
color: #2db7f5;
}
}
.anticon {
display: block;
font-size: 14px;
}
}
.markdown h1:hover .anchor,
.markdown h2:hover .anchor,
.markdown h3:hover .anchor,

View File

@@ -118,15 +118,31 @@
position: relative;
text-align: center;
}
}
.image-modal-single.slick-slider {
padding-bottom: 0;
}
.ant-carousel {
.slick-slider {
padding-bottom: 24px;
img {
display: inline;
max-width: 100%;
}
}
.slick-dots {
text-align: left;
bottom: -10px;
li {
margin: 0;
}
}
}
.ant-carousel .slick-slider img {
display: inline;
max-width: 100%;
.image-modal-single.slick-slider {
padding-bottom: 0;
}
.image-modal-single .slick-dots {
display: none!important;
}
}
.transition-video-player {

View File

@@ -8,7 +8,7 @@
<link rel="icon" href="https://t.alipayobjects.com/images/T1QUBfXo4fXXXXXXXX.png" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="{{ root }}index.css"/>
<!--[if lte IE 10]>
<script src="https://as.alipayobjects.com/g/component/??console-polyfill/0.2.2/index.js,es5-shim/4.5.7/es5-shim.min.js,es5-shim/4.5.7/es5-sham.min.js,html5shiv/3.7.2/html5shiv.min.js,media-match/2.0.2/media.match.min.js"></script>
<script src="https://as.alipayobjects.com/g/component/??console-polyfill/0.2.2/index.js,media-match/2.0.2/media.match.min.js"></script>
<![endif]-->
</head>
<body>
@@ -45,6 +45,12 @@
/* eslint-enable */
}
</script>
<script>
if (!window.Intl) {
document.writeln('<script src="https://as.alipayobjects.com/g/component/intl/1.0.1/Intl.js">' + '<' + '/script>');
document.writeln('<script src="https://as.alipayobjects.com/g/component/intl/1.0.1/locale-data/jsonp/en.js">' + '<' + '/script>');
}
</script>
<script src="{{ root }}common.js"></script>
<script src="{{ root }}index.js"></script>
</body>

View File

@@ -2,6 +2,7 @@ import React, { Children, cloneElement } from 'react';
import DocumentTitle from 'react-document-title';
import { getChildren } from 'jsonml.js/lib/utils';
import { Timeline } from 'antd';
import EditButton from './EditButton';
import * as utils from '../utils';
export default class Article extends React.Component {
@@ -17,6 +18,8 @@ export default class Article extends React.Component {
this.pingTimer = utils.ping(checkImgUrl, status => {
if (status === 'responded') {
links.forEach(link => (link.style.display = 'block'));
} else {
links.forEach(link => link.parentNode.removeChild(link));
}
});
}
@@ -31,13 +34,18 @@ export default class Article extends React.Component {
}
const timelineItems = [];
let temp = [];
Children.forEach(article.props.children, (child, i) => {
let i = 1;
Children.forEach(article.props.children, child => {
if (child.type === 'h2' && temp.length > 0) {
timelineItems.push(<Timeline.Item key={i}>{temp}</Timeline.Item>);
temp = [];
i += 1;
}
temp.push(child);
});
if (temp.length > 0) {
timelineItems.push(<Timeline.Item key={i}>{temp}</Timeline.Item>);
}
return cloneElement(article, {
children: <Timeline>{timelineItems}</Timeline>,
});
@@ -47,7 +55,7 @@ export default class Article extends React.Component {
const content = props.content;
const { meta, description } = content;
const { title, subtitle, chinese, english } = meta;
const { title, subtitle, chinese, english, filename } = meta;
return (
<DocumentTitle title={`${title || chinese || english} - Ant Design`}>
@@ -58,6 +66,7 @@ export default class Article extends React.Component {
(!subtitle && !chinese) ? null :
<span className="subtitle">{subtitle || chinese}</span>
}
<EditButton title="在 Github 上编辑此页!" filename={filename} />
</h1>
{
!description ? null :

View File

@@ -4,6 +4,7 @@ import classNames from 'classnames';
import { Row, Col, Icon, Affix } from 'antd';
import { getChildren } from 'jsonml.js/lib/utils';
import Demo from './Demo';
import EditButton from './EditButton';
export default class ComponentDoc extends React.Component {
static contextTypes = {
@@ -30,7 +31,7 @@ export default class ComponentDoc extends React.Component {
const { content, meta } = doc;
const locale = this.context.intl.locale;
const demos = Object.keys(props.demos).map((key) => props.demos[key])
.filter((demoData) => !demoData.meta.hidden);
.filter((demoData) => !demoData.meta.hidden);
const expand = this.state.expandAll;
const isSingleCol = meta.cols === 1;
@@ -71,7 +72,7 @@ export default class ComponentDoc extends React.Component {
);
});
const { title, subtitle, chinese, english } = meta;
const { title, subtitle, chinese, english, filename } = meta;
return (
<DocumentTitle title={`${subtitle || chinese || ''} ${title || english} - Ant Design`}>
<article>
@@ -87,6 +88,7 @@ export default class ComponentDoc extends React.Component {
(!subtitle && !chinese) ? null :
<span className="subtitle">{subtitle || chinese}</span>
}
<EditButton title="在 Github 上编辑此页!" filename={filename} />
</h1>
{
props.utils.toReactComponent(

View File

@@ -1,6 +1,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import classNames from 'classnames';
import EditButton from './EditButton';
export default class Demo extends React.Component {
static contextTypes = {
@@ -49,7 +50,7 @@ export default class Demo extends React.Component {
const localizedTitle = meta.title[locale] || meta.title;
const localizeIntro = content[locale] || content;
const introChildren = props.utils
.toReactComponent(['div'].concat(localizeIntro));
.toReactComponent(['div'].concat(localizeIntro));
const highlightClass = classNames({
'highlight-wrapper': true,
@@ -74,6 +75,7 @@ export default class Demo extends React.Component {
<a href={`#${meta.id}`}>
{localizedTitle}
</a>
<EditButton title="在 Github 上编辑此示例!" filename={meta.filename} />
</div>
{introChildren}
<span className="collapse anticon anticon-circle-o-right"

View File

@@ -0,0 +1,14 @@
import React from 'react';
import { Tooltip, Icon } from 'antd';
const branchUrl = 'https://github.com/ant-design/ant-design/blob/1.x-stable/';
export default function EditButton({ title, filename }) {
return (
<Tooltip title={title}>
<a className="edit-button" href={`${branchUrl}${filename}`}>
<Icon type="edit" />
</a>
</Tooltip>
);
}

Some files were not shown because too many files have changed in this diff Show More