Compare commits

..

78 Commits
3.0.2 ... 3.1.0

Author SHA1 Message Date
愚指导
1eff817b9a release 3.1.0 (#8787)
add change log for 3.1.0 and update rc-pagination and rc-calendar.
2017-12-29 20:53:21 +08:00
Wei Zhu
999d6184ad docs: Sort api table 2017-12-29 20:22:58 +08:00
Cam Song
1af1534592 Add hideOnSinglePage to Pagination (#8615) 2017-12-29 20:14:53 +08:00
Wei Zhu
5cda605d00 Fix date mock 2017-12-29 19:51:05 +08:00
愚道
7b1f09a216 Merge branch 'feature-3.1' 2017-12-29 18:57:57 +08:00
Wei Zhu
8bd124b0e2 Remove empty test 2017-12-29 18:45:26 +08:00
Wei Zhu
b439ca7502 Improve LocaleProvider test 2017-12-29 18:44:19 +08:00
Wei Zhu
09ee79ec8c Fix indent 2017-12-29 18:18:55 +08:00
Wei Zhu
642f8b20ec Add open in CodeSandbox (#8747) 2017-12-29 17:02:45 +08:00
niko
675c1c1b8c List not display NoData when loading state & customize Spin indicator. #8647 #8659 (#8702)
* List not display NoData when loading state & customize Spin indicator. #8647 #8659

* fixed ci warning

* fix: empty block
2017-12-29 10:09:18 +08:00
Wei Zhu
18ba398f95 docs: Improve LocalProvider document
Close #8691
2017-12-28 17:17:24 +08:00
Wei Zhu
2026b80ae2 Merge branch 'master' into feature-3.1 2017-12-28 16:31:25 +08:00
Wei Zhu
e8a9ca0d2a Merge branch 'Rohanhacker-feature' into feature-3.1 2017-12-28 16:26:44 +08:00
Wei Zhu
f89254537e Document destroyOnClose in Chinese 2017-12-28 16:26:03 +08:00
Wei Zhu
5881621f01 Add @babel/types to devDependencies
Temporary fix for https://github.com/babel/babel-eslint/issues/530
2017-12-28 16:02:57 +08:00
afc163
abf9717eab Large component should has larger font size
14px => 16px
2017-12-28 15:41:48 +08:00
Rohan Malhotra
6f3f17bb06 removed unnecessary whitespace 2017-12-28 12:49:54 +05:30
Rohan Malhotra
58536ec23e changed ^ to ~ in package.json 2017-12-28 12:49:45 +05:30
Rohan Malhotra
c6a1861887 updated rc-dialog and docs for destroyOnClose 2017-12-28 12:49:33 +05:30
Claudio Restifo
f17ac47547 Minor typo in dropdown API - [contentMenu] (#8767)
I suspect there's a typo in the page:

in the `trigger` API description is listed as 3rd option:
```
contentMenu
```
I suspect you meant
```
contextMenu
```

If so this PR is just fixing this minor overlook.
2017-12-28 14:09:39 +08:00
afc163
67df1cd979 Fix test case 2017-12-28 13:20:12 +08:00
afc163
8fb285fce9 Move maxHeight code into anchor, close #8606 2017-12-28 13:20:12 +08:00
Wei Zhu
98ec9100c3 Update Input types 2017-12-28 10:51:12 +08:00
delesseps
8cdf9ea97a Add onKeyUp TypeScript definition to Input component (#8705)
* Add onKeyUp support to Input component

* Update snapshot

* Allow other pros to handle onKeyUp
2017-12-28 09:27:11 +08:00
afc163
d20b4c910c small tweaking 2017-12-27 20:53:26 +08:00
afc163
cae5eab13d Fix typo in changelog 2017-12-27 20:52:24 +08:00
afc163
823d10ac96 site: add instruction about yellow color 2017-12-27 20:52:24 +08:00
Dane David
5a15b243ae Fix typo in CHANGELOG (#8753) 2017-12-27 04:05:44 -06:00
afc163
95ede5d149 update design instruction of timeline 2017-12-27 17:54:12 +08:00
afc163
6afb853161 Fix menu collapse animation broken by #8475
change another way to fix #8475
2017-12-27 16:46:00 +08:00
afc163
1c557f43a8 Fix extra padding in Table small with fixed columns, close #8724 2017-12-27 12:20:04 +08:00
afc163
5241497642 Fix Checkbox.Group align issue in Form
close #8739

also fix style prop of Checkbox.Group
2017-12-27 10:18:48 +08:00
afc163
6236cb144b Add moment dep documentation 2017-12-26 11:53:03 +08:00
afc163
ca41bda610 upgrade babel-eslint to fix lint error 2017-12-26 10:58:49 +08:00
afc163
3a8df54fb7 Fix typo 2017-12-26 09:33:29 +08:00
afc163
f3df363ec7 update site style 2017-12-25 14:09:53 +08:00
afc163
0cf841db94 Fix santa in chrome 2017-12-25 14:05:59 +08:00
afc163
021b49f7d5 🎅 🎅 🎅 2017-12-25 13:53:16 +08:00
Canwen Xu
603cb9e33d Add responsive for BackTop (#8719) 2017-12-24 20:31:33 +08:00
afc163
dd7410e151 site: fix banner ssr 2017-12-23 17:33:33 +08:00
afc163
cbfa987b0b site: fix banner ssr 2017-12-23 16:56:36 +08:00
Joe Hsu
a1fafb5b72 fix ant-spin-container overflow resizing (#8602) 2017-12-23 15:00:47 +08:00
valleykid
2be5d3be17 Modify changelog for 3.0.3 2017-12-22 19:53:16 +08:00
afc163
6efebb5bfa patch for 8494d460 2017-12-22 19:28:22 +08:00
valleykid
f9ede28144 Merge branch 'master' of https://github.com/ant-design/ant-design 2017-12-22 18:34:16 +08:00
valleykid
926f07a609 Add changelog for 3.0.3 2017-12-22 18:33:56 +08:00
afc163
8494d46038 Fix select align issue in chrome 2017-12-22 18:11:29 +08:00
afc163
e1cea9e4e4 Tweak form feedback icon position 2017-12-22 17:35:55 +08:00
nikogu
7814502fcf update snapshots 2017-12-22 17:31:09 +08:00
afc163
692265f5f1 site: fix style 2017-12-22 17:21:10 +08:00
nikogu
a74ce6873e Merge branch 'master' into feature-3.1 2017-12-22 17:16:05 +08:00
afc163
8ba0b87dcd Fix button align in chrome 2017-12-22 16:47:12 +08:00
徐坤龙
b06ea2404f Add React.SFC type for Form.create return value #8672 (#8675)
* Add React.SFC type for Form.create return value

* Restore indented.Fixed #8672

* Commit for lint

* Commit for lint
2017-12-22 16:05:06 +08:00
afc163
24f0359e2d Fix some form components align 2017-12-22 15:22:22 +08:00
afc163
525efb8c76 Fix form item height problem
close #8701

revert fix of #6097 cause it does not exist in 3.x
2017-12-22 11:48:07 +08:00
nikogu
5252de9209 Merge branch 'master' into feature-3.1 2017-12-22 11:43:54 +08:00
afc163
13c6e8ec1e update getPopcontainer demo link 2017-12-21 21:50:41 +08:00
Wei Zhu
974809e6f2 export RangePickerValue 2017-12-21 17:50:12 +08:00
Wei Zhu
e22fbe70e5 Add RangePickerState interface 2017-12-21 17:06:59 +08:00
偏右
191f0c41fc Update CONTRIBUTING.zh-CN.md 2017-12-21 16:15:33 +08:00
偏右
18d78f18b2 Update CONTRIBUTING.zh-CN.md 2017-12-21 16:14:39 +08:00
偏右
b809003bef Update CONTRIBUTING.zh-CN.md 2017-12-21 16:14:09 +08:00
afc163
dd364e3358 site: fix details 2017-12-21 14:57:56 +08:00
jiang
4eb51bcb5c Update home.less 2017-12-21 10:26:40 +08:00
afc163
4f19fc0ee4 Improve input addon size, close #8680 2017-12-20 22:40:36 +08:00
afc163
294db783e1 Fix table size of fixed column, close #8660 2017-12-20 22:01:25 +08:00
Wei Zhu
45a9e300ed Update snapshot
https://github.com/react-component/collapse/pull/81
2017-12-20 15:11:14 +08:00
afc163
790a21a4ee Fix snapshot 2017-12-19 19:33:44 +08:00
afc163
a03ff5d574 Fix test case 2017-12-19 16:32:20 +08:00
afc163
bce66d6b3b fix code style 2017-12-19 16:32:20 +08:00
Wei Zhu
9a022b8aac docs: Update FormComponentProps import path 2017-12-19 14:30:56 +08:00
Benjy Cui
d7d39aa9fb site: fix windows compatibility 2017-12-19 12:11:26 +08:00
afc163
db1984d031 site: fix ssr render 2017-12-18 18:46:41 +08:00
afc163
3f3fbfbe67 Add promote link for seeconf 2017-12-18 17:58:45 +08:00
Trotyl Yu
0c4616b39e docs(grid): fix typo (#8648) 2017-12-18 15:50:09 +08:00
愚指导-TZ
c30ac8d138 update rate to 2.4.0 for support allowClear (#8627) 2017-12-15 15:30:38 +08:00
Bartek
28e9d1ee88 Add option for disabling arrow icon in collapse panel (#8536) 2017-12-13 23:23:38 +08:00
Dane David
5a94236c30 Version fix for rc-select. Update docs to add onInputKeyDown (#8552) 2017-12-13 04:34:54 -06:00
134 changed files with 139266 additions and 38521 deletions

View File

@@ -4,7 +4,7 @@
## 行为准则
我们有一份[行为准则](../CODE_OF_CONDUCT.md),希望所有的贡献者都能遵守,请花时间阅读一遍全文以确保你能明白哪些是可以做的,哪些是不可以做的。
我们有一份 [行为准则](../CODE_OF_CONDUCT.md),希望所有的贡献者都能遵守,请花时间阅读一遍全文以确保你能明白哪些是可以做的,哪些是不可以做的。
## 透明的开发
@@ -12,17 +12,17 @@
## 分支管理
基于我们的[发布周期](../CHANGELOG.zh-CN.md#release-schedule), 我们每个月都会从 `master` 分支切一个 `feature` 分支出来(比如 `features-3.1` 分支用来发布 3.1 版本)。 如果你要修一个 bug那么请发 pull request 到 `master`;如果你要提一个增加新功能的 pull request那么请基于 `feature` 分支来做。
基于我们的 [发布周期](../CHANGELOG.zh-CN.md#release-schedule)我们每个月都会从 `master` 分支切一个 `feature` 分支出来(比如 `features-3.1` 分支用来发布 3.1 版本)。 如果你要修一个 bug那么请发 pull request 到 `master`;如果你要提一个增加新功能的 pull request那么请基于 `feature` 分支来做。
## Bugs
我们使用 [GitHub Issues](https://github.com/ant-design/ant-design/issues) 来做 bug 追踪。 如果你想要你发现的 bug 被快速解决,最好的办法就是通过我们提供的 [issue 小助手](http://new-issue.ant.design) 来提 issue。 并且能使用这个[模板](https://u.ant.design/codesandbox-repro)来提供重现。
我们使用 [GitHub Issues](https://github.com/ant-design/ant-design/issues) 来做 bug 追踪。 如果你想要你发现的 bug 被快速解决,最好的办法就是通过我们提供的 [issue 小助手](http://new-issue.ant.design) 来提 issue。 并且能使用这个 [模板](https://u.ant.design/codesandbox-repro) 来提供重现。
在你报告一个 bug 之前,请先确保已经搜索过已有的 issue 和阅读了我们的[常见问题](https://github.com/ant-design/ant-design/wiki/FAQ)。
在你报告一个 bug 之前,请先确保已经搜索过已有的 issue 和阅读了我们的 [常见问题](https://github.com/ant-design/ant-design/wiki/FAQ)。
## 新增功能
如果你有改进我们的 API 或者新增功能的想法, 我们同样推荐你使用我们提供的[issue 小助手](http://new-issue.ant.design)来新建一个添加新功能的 issue。
如果你有改进我们的 API 或者新增功能的想法我们同样推荐你使用我们提供的 [issue 小助手](http://new-issue.ant.design) 来新建一个添加新功能的 issue。
## 第一次贡献
@@ -42,12 +42,12 @@ Ant Design 团队会关注所有的 pull request我们会 review 以及合并
**在你发送 Pull Request 之前**,请确认你是按照下面的步骤来做的:
1. 基于[正确的分支](./CONTRIBUTING.zh-CN.md#branch-organization)来做修改。
1. 在项目根目录下运行了 `npm install`
1. 如果你修复了一个 bug 或者新增了一个功能,请确保写了相应的测试, 这很重要。
1. 确认所有的测试都是通过的 `npm run test`。 小贴士:开发过程中可以用 `npm test -- --watch TestName` 来运行指定的测试。
1. 运行 `npm test -- -u` 来更新 [jest snapshot](http://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest) 并且把这些更新也提交上来(如果有的话)。
1. 确保你的代码通过了 lint 检查 `npm run lint`. 小贴士: Lint 会在你 `git commit` 的时候自动运行。
1. 基于 [正确的分支](./CONTRIBUTING.zh-CN.md#branch-organization) 来做修改。
2. 在项目根目录下运行了 `npm install`
3. 如果你修复了一个 bug 或者新增了一个功能,请确保写了相应的测试这很重要。
4. 确认所有的测试都是通过的 `npm run test`。 小贴士:开发过程中可以用 `npm test -- --watch TestName` 来运行指定的测试。
5. 运行 `npm test -- -u` 来更新 [jest snapshot](http://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest) 并且把这些更新也提交上来(如果有的话)。
6. 确保你的代码通过了 lint 检查 `npm run lint`. 小贴士: Lint 会在你 `git commit` 的时候自动运行。
给 [react-component](https://github.com/react-component/) 发送 pull request
@@ -58,7 +58,7 @@ Ant Design 团队会关注所有的 pull request我们会 review 以及合并
在你 clone 了 antd 的代码并且使用 `npm install` 安装完依赖后,你还可以运行下面几个常用的命令:
1. `npm start` 在本地运行 Ant Design 的网站。
1. `npm run lint` 检查代码风格。
1. `npm test` 运行测试。
1. `npm run compile` 编译 TypeScript 代码到 lib 和 es 目录。
1. `npm run dist` 构建 antd 的 UMD 版本到 dist 目录。
2. `npm run lint` 检查代码风格。
3. `npm test` 运行测试。
4. `npm run compile` 编译 TypeScript 代码到 lib 和 es 目录。
5. `npm run dist` 构建 antd 的 UMD 版本到 dist 目录。

View File

@@ -11,10 +11,33 @@ timeline: true
* Weekly release: patch version at the end of every week for routine bugfix (anytime for urgent bugfix).
* Monthly release: minor version at the end of every month for new features.
* Major version release is not included in this schedule for breadking change and new features.
* Major version release is not included in this schedule for breaking change and new features.
---
## 3.1.0
- 🐞 Fix ant-spin-container overflow resizing for Spin component. [#8602](https://github.com/ant-design/ant-design/issues/8602) [@jhsu](https://github.com/jhsu)
- 🐞 Fix extra padding in Table small with fixed columns. [#8724](https://github.com/ant-design/ant-design/issues/8724)
- 🐞 Fix Checkbox.Group align issue in Form. [#8739](https://github.com/ant-design/ant-design/issues/8739)
- 🐞 Fix unexpected scrollbar in Affix. [#8606](https://github.com/ant-design/ant-design/issues/8606)
- 🌟 Add onKeyUp TypeScript definition to Input component. [#8705](https://github.com/ant-design/ant-design/issues/8705) [@delesseps](https://github.com/delesseps)
- 🌟 Add `showArrow` for disabling arrow icon in collapse panel. [#8536](https://github.com/ant-design/ant-design/pull/8536) [@apieceofbart](https://github.com/apieceofbart)
- 🌟 Rate add `allowClear` for reset when click again. [#8627](https://github.com/ant-design/ant-design/issues/8627)
- 🌟 Add responsive for BackTop. [#8719](https://github.com/ant-design/ant-design/issues/8719) [@JetRunner](https://github.com/JetRunner)
- 🌟 Add `destroyOnClose` to Modal component to support unmount child compenents on onClose. [#8769](https://github.com/ant-design/ant-design/pull/8769) [@Rohanhacker](https://github.com/Rohanhacker)
- 🌟 Pagination add `hideOnSinglePage` for support hide it when only one page. [#8615](https://github.com/ant-design/ant-design/pull/8615) [@camsong](https://github.com/camsong)
- 🌟 Support customize spin for List component.
- 👻 Support open official demo in CodeSandbox.
## 3.0.3
`2017-12-22`
- 🐞 Add React.SFC type for Form.create return value. [#8672](https://github.com/ant-design/ant-design/issues/8672)
- 🐞 Fix form item height and align problem. [#8701](https://github.com/ant-design/ant-design/issues/8701)
- 🐞 Improve input addon size. [#8680](https://github.com/ant-design/ant-design/issues/8680)
- 🐞 Fix table size of fixed column. [#8660](https://github.com/ant-design/ant-design/issues/8660)
## 3.0.2
@@ -186,7 +209,7 @@ We provide a [migration tool](https://github.com/ant-design/antd-migration-helpe
},
};
<Table components={components} columns={columns data={data}} />
<Table components={components} columns={columns} data={data} />
```
- 🌟 Added new `onRow` prop to allow passing custom props to table body row.
- 🌟 Added new `onHeaderRow` props to allow passing custom props to table header row.

View File

@@ -15,6 +15,30 @@ timeline: true
---
## 3.1.0
- 🐞 修复组件 Spin 可能出现跳动的问题。[#8602](https://github.com/ant-design/ant-design/issues/8602) [@jhsu](https://github.com/jhsu)
- 🐞 修复 Table 在设置 `size=small` 的情况下出现多余 padding 的问题。[#8724](https://github.com/ant-design/ant-design/issues/8724)
- 🐞 修复 Checkbox.Group 在 Form 中和 label 的对齐问题。[#8739](https://github.com/ant-design/ant-design/issues/8739)
- 🐞 修复 Affix 组件出现滚动条的问题。[#8606](https://github.com/ant-design/ant-design/issues/8606)
- 🌟 为 Input 添加 onKeyUp。[#8705](https://github.com/ant-design/ant-design/issues/8705) [@delesseps](https://github.com/delesseps)
- 🌟 折叠面板 Collapse 添加 `showArrow` 来支持隐藏箭头。[#8536](https://github.com/ant-design/ant-design/pull/8536) [@apieceofbart](https://github.com/apieceofbart)
- 🌟 评分 Rate 组件添加 `allowClear`,支持再次点击后重置。[#8627](https://github.com/ant-design/ant-design/issues/8627)
- 🌟 优化 BackTop 组件的响应式效果。[#8719](https://github.com/ant-design/ant-design/issues/8719) [@JetRunner](https://github.com/JetRunner)
- 🌟 Modal 组件添加 `destroyOnClose` 支持关闭时销毁 Modal 里的子元素。[#8769](https://github.com/ant-design/ant-design/pull/8769) [@Rohanhacker](https://github.com/Rohanhacker)
- 🌟 组件 Pagination 添加 `hideOnSinglePage` 支持当只有一页时隐藏组件。[#8615](https://github.com/ant-design/ant-design/pull/8615) [@camsong](https://github.com/camsong)
- 🌟 支持 List 组件自定义加载动画。
- 👻 你现在可以通过 CodeSandbox 来打开官方文档中的示例了。
## 3.0.3
`2017-12-22`
- 🐞 Form.create 返回值增加 `React.SFC` 类型的支持。[#8672](https://github.com/ant-design/ant-design/issues/8672)
- 🐞 修复 Form 控件高度和对齐的问题。[#8701](https://github.com/ant-design/ant-design/issues/8701)
- 🐞 修复前后置标签与 Input 高度不一致的问题。[#8680](https://github.com/ant-design/ant-design/issues/8680)
- 🐞 修复 Table 固定列时左右未对齐的问题。[#8660](https://github.com/ant-design/ant-design/issues/8660)
## 3.0.2
`2017-12-17`
@@ -196,7 +220,7 @@ timeline: true
},
};
<Table components={components} columns={columns data={data}} />
<Table components={components} columns={columns} data={data} />
```
- 🌟 新增 `onRow` 属性,用于设置表格列的属性。
- 🌟 新增 `onHeaderRow`,用户设置表格头部列的属性。

View File

@@ -162,7 +162,6 @@ export default class Affix extends React.Component<AffixProps, AffixState> {
position: 'fixed',
top,
left: targetRect.left + elemOffset.left,
maxHeight: `calc(100vh - ${top}px)`,
width,
});
this.setPlaceholderStyle({

View File

@@ -3,5 +3,4 @@
.@{ant-prefix}-affix {
position: fixed;
z-index: @zindex-affix;
overflow: auto;
}

View File

@@ -226,8 +226,16 @@ export default class Anchor extends React.Component<AnchorProps, any> {
'fixed': !affix && !showInkInFixed,
});
const wrapperStyle = {
maxHeight: offsetTop ? `calc(100vh - ${offsetTop}px)` : '100vh',
...style,
};
const anchorContent = (
<div className={wrapperClass} style={style}>
<div
className={wrapperClass}
style={wrapperStyle}
>
<div className={anchorClass}>
<div className={`${prefixCls}-ink`} >
<span className={inkClass} ref={this.saveInkNode} />

View File

@@ -7,6 +7,7 @@ exports[`renders ./components/anchor/demo/basic.md correctly 1`] = `
>
<div
class="ant-anchor-wrapper"
style="max-height:100vh"
>
<div
class="ant-anchor"
@@ -82,6 +83,7 @@ exports[`renders ./components/anchor/demo/basic.md correctly 1`] = `
exports[`renders ./components/anchor/demo/static.md correctly 1`] = `
<div
class="ant-anchor-wrapper"
style="max-height:100vh"
>
<div
class="ant-anchor fixed"

View File

@@ -7,8 +7,12 @@
.reset-component;
position: relative;
padding-left: @anchor-border-width;
&-wrapper {
background-color: @component-background;
overflow: auto;
padding-left: 4px;
margin-left: -4px;
}
&-ink {

View File

@@ -41,5 +41,5 @@ const dataSource = ['12345', '23456', '34567'];
| Name | Description |
| ---- | ----------- |
| focus() | get focus |
| blur() | remove focus |
| focus() | get focus |

View File

@@ -41,6 +41,6 @@ const dataSource = ['12345', '23456', '34567'];
## 方法
| 名称 | 描述 |
| ---- | ----------- |
| focus() | 获取焦点 |
| --- | --- |
| blur() | 移除焦点 |
| focus() | 获取焦点 |

View File

@@ -36,3 +36,5 @@
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAoCAYAAACWwljjAAAABGdBTUEAALGPC/xhBQAAAbtJREFUWAntmMtKw0AUhhMvS5cuxILgQlRUpIggIoKIIoigG1eC+AA+jo+i6FIXBfeuXIgoeKVeitVWJX5HWhhDksnUpp3FDPyZk3Nm5nycmZKkXhAEOXSA3lG7muTeRzmfy6HneUvIhnYkQK+Q9NhAA0Opg0vBEhjBKHiyb8iGMyQMOYuK41BcBSypAL+MYXSKjtFAW7EAGEO3qN4uMQbbAkXiSfRQJ1H6a+yhlkKRcAoVFYiweYNjtCVQJJpBz2GCiPt7fBOZQpFgDpUikse5HgnkM4Fi4QX0Fpc5wf9EbLqpUCy4jMoJSXWhFwbMNgWKhVbRhy5jirhs9fy/oFhgHVVTJEs7RLZ8sSEoJm6iz7SZDMbJ+/OKERQTttCXQRLToRUmrKWCYuA2+jbN0MB4OQobYShfdTCgn/sL1K36M7TLrN3n+758aPy2rrpR6+/od5E8tf/A1uLS9aId5T7J3CNYihkQ4D9PiMdMC7mp4rjB9kjFjZp8BlnVHJBuO1yFXIV0FdDF3RlyFdJVQBdv5AxVdIsq8apiZ2PyYO1EVykesGfZEESsCkweyR8MUW+V8uJ1gkYipmpdP1pm2aJVPEGzAAAAAElFTkSuQmCC) ~"100%/100%" no-repeat;
}
}
@import './responsive';

View File

@@ -0,0 +1,11 @@
@media screen and (max-width: @screen-md) {
.@{backtop-prefix-cls} {
right: 60px;
}
}
@media screen and (max-width: @screen-xs) {
.@{backtop-prefix-cls} {
right: 20px;
}
}

View File

@@ -26,8 +26,8 @@ Badge normally appears in proximity to notifications or user avatars with eye-ca
| -------- | ----------- | ---- | ------- |
| count | Number to show in badge | number | |
| dot | Whether to display a red dot instead of `count` | boolean | `false` |
| offset | set offset of the badge dot, like [x, y] | [number, number] | - |
| overflowCount | Max count to show | number | 99 |
| showZero | Whether to show badge when `count` is zero | boolean | `false` |
| status | Set Badge as a status dot | `success` \| `processing` \| `default` \| `error` \| `warning` | `''` |
| text | If `status` is set, `text` sets the display text of the status `dot` | string | `''` |
| offset | set offset of the badge dot, like [x, y] | [number, number] | - |

View File

@@ -27,8 +27,8 @@ title: Badge
| --- | --- | --- | --- |
| count | 展示的数字,大于 overflowCount 时显示为 `${overflowCount}+`,为 0 时隐藏 | number | |
| dot | 不展示数字,只有一个小红点 | boolean | false |
| offset | 设置状态点的位置偏移,格式为 [x, y] | [number, number] | - |
| overflowCount | 展示封顶的数字值 | number | 99 |
| showZero | 当数值为 0 时,是否展示 Badge | boolean | false |
| status | 设置 Badge 为状态点 | Enum{ 'success', 'processing, 'default', 'error', 'warning' } | '' |
| text | 在设置了 `status` 的前提下有效,设置状态点的文本 | string | '' |
| offset | 设置状态点的位置偏移,格式为 [x, y] | [number, number] | - |

View File

@@ -17,15 +17,15 @@ To get a customized button, just set `type`/`shape`/`size`/`loading`/`disabled`.
| Property | Description | Type | Default |
| -------- | ----------- | ---- | ------- |
| ghost | make background transparent and invert text and border colors, added in 2.7 | boolean | false |
| href | redirect url of link button | string | - |
| htmlType | set the original html `type` of `button`, see: [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) | string | `button` |
| icon | set the icon of button, see: Icon component | string | - |
| loading | set the loading status of button | boolean \| { delay: number } | false |
| shape | can be set to `circle` or omitted | string | - |
| size | can be set to `small` `large` or omitted | string | `default` |
| target | same as target attribute of a, works when href is specified | string | - |
| type | can be set to `primary` `ghost` `dashed` `danger`(added in 2.7) or omitted (meaning `default`) | string | `default` |
| onClick | set the handler to handle `click` event | function | - |
| href | redirect url of link button | string | - |
| target | same as target attribute of a, works when href is specified | string | - |
`<Button>Hello world!</Button>` will be rendered into `<button><span>Hello world!</span></button>`, and all the properties which are not listed above will be transferred to the `<button>` tag.

View File

@@ -20,16 +20,15 @@ subtitle: 按钮
| 属性 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| ghost | 幽灵属性,使按钮背景透明,版本 2.7 中增加 | boolean | false |
| href | 点击跳转的地址,指定此属性 button 的行为和 a 链接一致 | string | - |
| htmlType | 设置 `button` 原生的 `type` 值,可选值请参考 [HTML 标准](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) | string | `button` |
| icon | 设置按钮的图标类型 | string | - |
| loading | 设置按钮载入状态 | boolean \| { delay: number } | `false` |
| shape | 设置按钮形状,可选值为 `circle` 或者不设 | string | - |
| size | 设置按钮大小,可选值为 `small` `large` 或者不设 | string | `default` |
| target | 相当于 a 链接的 target 属性href 存在时生效 | string | - |
| type | 设置按钮类型,可选值为 `primary` `dashed` `danger`(版本 2.7 中增加) 或者不设 | string | - |
| onClick | `click` 事件的 handler | function | - |
| href | 点击跳转的地址,指定此属性 button 的行为和 a 链接一致 | string | - |
| target | 相当于 a 链接的 target 属性href 存在时生效 | string | - |
`<Button>Hello world!</Button>` 最终会被渲染为 `<button><span>Hello world!</span></button>`,并且除了上表中的属性,其它属性都会直接传到 `<button></button>`

View File

@@ -147,7 +147,6 @@
background-image: none;
border: @border-width-base @border-style-base transparent;
white-space: nowrap;
line-height: 1.15; // https://github.com/ant-design/ant-design/issues/7070
.button-size(@btn-height-base; @btn-padding-base; @font-size-base; @btn-border-radius-base);
user-select: none;
transition: all .3s @ease-in-out;

View File

@@ -35,13 +35,13 @@ Cascade selection box.
| placeholder | input placeholder | string | 'Please select' |
| popupClassName | additional className of popup overlay | string | - |
| popupPlacement | use preset popup align config from builtinPlacements`bottomLeft` `bottomRight` `topLeft` `topRight` | string | `bottomLeft` |
| popupVisible | set visible of cascader popup | boolean | - |
| showSearch | Whether show search input in single mode. | boolean\|object | false |
| size | input size, one of `large` `default` `small` | string | `default` |
| style | additional style | string | - |
| value | selected value | string\[] | - |
| onChange | callback when finishing cascader select | `(value, selectedOptions) => void` | - |
| onPopupVisibleChange | callback when popup shown or hidden | `(value) => void` | - |
| popupVisible | set visible of cascader popup | boolean | - |
Fields in `showSearch`:
@@ -56,8 +56,8 @@ Fields in `showSearch`:
| Name | Description |
| ---- | ----------- |
| focus() | get focus |
| blur() | remove focus |
| focus() | get focus |
<style>
.ant-cascader-picker {

View File

@@ -36,13 +36,13 @@ subtitle: 级联选择
| placeholder | 输入框占位文本 | string | '请选择' |
| popupClassName | 自定义浮层类名 | string | - |
| popupPlacement | 浮层预设位置:`bottomLeft` `bottomRight` `topLeft` `topRight` | Enum | `bottomLeft` |
| popupVisible | 控制浮层显隐 | boolean | - |
| showSearch | 在选择框中显示搜索框 | boolean | false |
| size | 输入框大小,可选 `large` `default` `small` | string | `default` |
| style | 自定义样式 | string | - |
| value | 指定选中项 | string\[] | - |
| onChange | 选择完成后的回调 | `(value, selectedOptions) => void` | - |
| onPopupVisibleChange | 显示/隐藏浮层的回调 | `(value) => void` | - |
| popupVisible | 控制浮层显隐 | boolean | - |
`showSearch` 为对象时,其中的字段:
@@ -56,9 +56,9 @@ subtitle: 级联选择
## 方法
| 名称 | 描述 |
| ---- | ----------- |
| focus() | 获取焦点 |
| --- | --- |
| blur() | 移除焦点 |
| focus() | 获取焦点 |
<style>
.ant-cascader-picker {

View File

@@ -114,7 +114,7 @@ export default class CheckboxGroup extends React.Component<CheckboxGroupProps, C
}
render() {
const { props, state } = this;
const { prefixCls, className, options } = props;
const { prefixCls, className, style, options } = props;
let children = props.children;
if (options && options.length > 0) {
children = this.getOptions().map(option => (
@@ -133,7 +133,7 @@ export default class CheckboxGroup extends React.Component<CheckboxGroupProps, C
const classString = classNames(prefixCls, className);
return (
<div className={classString}>
<div className={classString} style={style}>
{children}
</div>
);

View File

@@ -257,6 +257,7 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
</label>
</div>
<br />
<br />
<div
class="ant-checkbox-group"
>
@@ -317,6 +318,7 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
</label>
</div>
<br />
<br />
<div
class="ant-checkbox-group"
>
@@ -385,6 +387,7 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
exports[`renders ./components/checkbox/demo/layout.md correctly 1`] = `
<div
class="ant-checkbox-group"
style="width:100%"
>
<div
class="ant-row"

View File

@@ -36,9 +36,9 @@ const optionsWithDisabled = [
ReactDOM.render(
<div>
<CheckboxGroup options={plainOptions} defaultValue={['Apple']} onChange={onChange} />
<br />
<br /><br />
<CheckboxGroup options={options} defaultValue={['Pear']} onChange={onChange} />
<br />
<br /><br />
<CheckboxGroup options={optionsWithDisabled} disabled defaultValue={['Apple']} onChange={onChange} />
</div>
, mountNode);

View File

@@ -21,7 +21,7 @@ function onChange(checkedValues) {
}
ReactDOM.render(
<Checkbox.Group onChange={onChange}>
<Checkbox.Group style={{ width: '100%' }} onChange={onChange}>
<Row>
<Col span={8}><Checkbox value="A">A</Checkbox></Col>
<Col span={8}><Checkbox value="B">B</Checkbox></Col>

View File

@@ -39,5 +39,5 @@ Checkbox.
| Name | Description |
| ---- | ----------- |
| focus() | get focus |
| blur() | remove focus |
| focus() | get focus |

View File

@@ -38,6 +38,6 @@ title: Checkbox
### Checkbox
| 名称 | 描述 |
| ---- | ----------- |
| focus() | 获取焦点 |
| --- | --- |
| blur() | 移除焦点 |
| focus() | 获取焦点 |

View File

@@ -167,6 +167,7 @@
.@{checkbox-prefix-cls}-group {
.reset-component;
display: inline-block;
&-item {
display: inline-block;
margin-right: 8px;

View File

@@ -2,37 +2,27 @@ import * as React from 'react';
import RcCollapse from 'rc-collapse';
import classNames from 'classnames';
import animation from '../_util/openAnimation';
import CollapsePanel from './CollapsePanel';
export interface CollapseProps {
activeKey?: Array<string> | string;
defaultActiveKey?: Array<string>;
/** 手风琴效果 */
accordion?: boolean;
onChange?: (key: string | string[]) => void;
onChange?: (key: string | string[]) => void;
style?: React.CSSProperties;
className?: string;
bordered?: boolean;
prefixCls?: string;
}
export interface CollapsePanelProps {
key: string;
header: React.ReactNode;
disabled?: boolean;
className?: string;
style?: React.CSSProperties;
}
export class CollapsePanel extends React.Component<CollapsePanelProps, {}> {
}
export default class Collapse extends React.Component<CollapseProps, any> {
static Panel: typeof CollapsePanel = RcCollapse.Panel;
static Panel = CollapsePanel;
static defaultProps = {
prefixCls: 'ant-collapse',
bordered: true,
openAnimation: { ...animation, appear() {} },
openAnimation: { ...animation, appear() { } },
};
render() {

View File

@@ -0,0 +1,23 @@
import * as React from 'react';
import RcCollapse from 'rc-collapse';
import classNames from 'classnames';
export interface CollapsePanelProps {
key: string;
header: React.ReactNode;
disabled?: boolean;
className?: string;
style?: React.CSSProperties;
showArrow?: boolean;
prefixCls?: string;
}
export default class CollapsePanel extends React.Component<CollapsePanelProps, {}> {
render() {
const { prefixCls, className = '', showArrow = true } = this.props;
const collapsePanelClassName = classNames({
[`${prefixCls}-no-arrow`]: !showArrow,
}, className);
return <RcCollapse.Panel {...this.props} className={collapsePanelClassName} />;
}
}

View File

@@ -6,6 +6,7 @@ exports[`renders ./components/collapse/demo/accordion.md correctly 1`] = `
>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
@@ -20,6 +21,7 @@ exports[`renders ./components/collapse/demo/accordion.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
@@ -34,6 +36,7 @@ exports[`renders ./components/collapse/demo/accordion.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
@@ -55,6 +58,7 @@ exports[`renders ./components/collapse/demo/basic.md correctly 1`] = `
>
<div
class="ant-collapse-item ant-collapse-item-active"
role="tablist"
>
<div
aria-expanded="true"
@@ -85,6 +89,7 @@ exports[`renders ./components/collapse/demo/basic.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
@@ -99,6 +104,7 @@ exports[`renders ./components/collapse/demo/basic.md correctly 1`] = `
</div>
<div
class="ant-collapse-item ant-collapse-item-disabled"
role="tablist"
>
<div
aria-expanded="false"
@@ -120,6 +126,7 @@ exports[`renders ./components/collapse/demo/borderless.md correctly 1`] = `
>
<div
class="ant-collapse-item ant-collapse-item-active"
role="tablist"
>
<div
aria-expanded="true"
@@ -148,6 +155,7 @@ exports[`renders ./components/collapse/demo/borderless.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
@@ -162,6 +170,7 @@ exports[`renders ./components/collapse/demo/borderless.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
@@ -183,6 +192,7 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
>
<div
class="ant-collapse-item ant-collapse-item-active"
role="tablist"
style="background:#f7f7f7;border-radius:4px;margin-bottom:24px;border:0;overflow:hidden"
>
<div
@@ -214,6 +224,7 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
style="background:#f7f7f7;border-radius:4px;margin-bottom:24px;border:0;overflow:hidden"
>
<div
@@ -229,6 +240,7 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
style="background:#f7f7f7;border-radius:4px;margin-bottom:24px;border:0;overflow:hidden"
>
<div
@@ -251,6 +263,7 @@ exports[`renders ./components/collapse/demo/mix.md correctly 1`] = `
>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
@@ -265,6 +278,7 @@ exports[`renders ./components/collapse/demo/mix.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
@@ -279,6 +293,7 @@ exports[`renders ./components/collapse/demo/mix.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
@@ -293,3 +308,53 @@ exports[`renders ./components/collapse/demo/mix.md correctly 1`] = `
</div>
</div>
`;
exports[`renders ./components/collapse/demo/noarrow.md correctly 1`] = `
<div
class="ant-collapse"
>
<div
class="ant-collapse-item ant-collapse-item-active"
role="tablist"
>
<div
aria-expanded="true"
class="ant-collapse-header"
role="tab"
>
<i
class="arrow"
/>
This is panel header with arrow icon
</div>
<div
class="ant-collapse-content ant-collapse-content-active"
role="tabpanel"
>
<div
class="ant-collapse-content-box"
>
<p>
A dog is a type of domesticated animal.
Known for its loyalty and faithfulness,
it can be found as a welcome guest in many households across the world.
</p>
</div>
</div>
</div>
<div
class="ant-collapse-item ant-collapse-no-arrow"
role="tablist"
>
<div
aria-expanded="false"
class="ant-collapse-header"
role="tab"
>
This is panel header with no arrow icon
</div>
</div>
</div>
`;

View File

@@ -0,0 +1,40 @@
---
order: 4
title:
zh-CN: 隐藏箭头
en-US: No arrow
---
## zh-CN
你可以通过 `showArrow={false}` 隐藏 `CollapsePanel` 组件的箭头图标。
## en-US
You can disable showing arrow icon by passing `showArrow={false}` to `CollapsePanel` component.
````jsx
import { Collapse } from 'antd';
const Panel = Collapse.Panel;
function callback(key) {
console.log(key);
}
const text = `
A dog is a type of domesticated animal.
Known for its loyalty and faithfulness,
it can be found as a welcome guest in many households across the world.
`;
ReactDOM.render(
<Collapse defaultActiveKey={['1']} onChange={callback}>
<Panel header="This is panel header with arrow icon" key="1">
<p>{text}</p>
</Panel>
<Panel showArrow={false} header="This is panel header with no arrow icon" key="2">
<p>{text}</p>
</Panel>
</Collapse>
, mountNode);
````

View File

@@ -29,3 +29,4 @@ A content area which can be collapsed and expanded.
| disabled | If `true`, panel cannot be opened or closed | boolean | `false` |
| header | Title of the panel | string\|ReactNode | - |
| key | Unique key identifying the panel from among its siblings | string | - |
| showArrow | If `false`, panel will not show arrow icon | boolean | `true` |

View File

@@ -1,5 +1,6 @@
import Collapse from './Collapse';
export { CollapsePanelProps, CollapseProps } from './Collapse';
export { CollapseProps } from './Collapse';
export { CollapsePanelProps } from './CollapsePanel';
export default Collapse;

View File

@@ -54,6 +54,12 @@
}
}
}
&.@{collapse-prefix-cls}-no-arrow {
> .@{collapse-prefix-cls}-header {
padding-left: 12px;
}
}
}
&-anim-active {

View File

@@ -8,6 +8,15 @@ import Icon from '../icon';
import warning from '../_util/warning';
import callMoment from '../_util/callMoment';
export type RangePickerValue = moment.Moment[];
export interface RangePickerState {
value?: RangePickerValue;
showDate?: RangePickerValue;
open?: boolean;
hoverValue?: RangePickerValue;
}
function getShowDateFromValue(value: moment.Moment[]): moment.Moment[] | undefined {
const [start, end] = value;
// value could be an empty array, then we should not reset showDate
@@ -39,7 +48,7 @@ function isEmptyArray(arr: any) {
return false;
}
export default class RangePicker extends React.Component<any, any> {
export default class RangePicker extends React.Component<any, RangePickerState> {
static defaultProps = {
prefixCls: 'ant-calendar',
allowClear: true,
@@ -97,7 +106,7 @@ export default class RangePicker extends React.Component<any, any> {
handleChange = (value: moment.Moment[]) => {
const props = this.props;
if (!('value' in props)) {
this.setState(({ showDate }: { showDate: boolean }) => ({
this.setState(({ showDate }) => ({
value,
showDate: getShowDateFromValue(value) || showDate,
}));
@@ -119,7 +128,7 @@ export default class RangePicker extends React.Component<any, any> {
}
}
handleShowDateChange = (showDate: boolean) => this.setState({ showDate });
handleShowDateChange = (showDate: RangePickerValue) => this.setState({ showDate });
handleHoverChange = (hoverValue: any) => this.setState({ hoverValue });

View File

@@ -1,5 +1,7 @@
import React from 'react';
import { mount } from 'enzyme';
import moment from 'moment';
import MockDate from 'mockdate';
import DatePicker from '..';
import focusTest from '../../../tests/shared/focusTest';
@@ -44,9 +46,12 @@ describe('DatePicker', () => {
placeholder: 'Избор на час',
},
};
MockDate.set(new Date('2016-11-22').getTime() + (new Date().getTimezoneOffset() * 60 * 1000));
const birthday = moment('2000-01-01', 'YYYY-MM-DD');
const wrapper = mount(
<DatePicker open locale={locale} />
<DatePicker open locale={locale} value={birthday} />
);
expect(wrapper.render()).toMatchSnapshot();
MockDate.reset();
});
});

View File

@@ -11,7 +11,10 @@ exports[`DatePicker prop locale should works 1`] = `
class="ant-calendar-picker-input ant-input"
placeholder="Избери дата"
readonly=""
value=""
value="2000-01-01"
/>
<i
class="anticon anticon-cross-circle ant-calendar-picker-clear"
/>
<span
class="ant-calendar-picker-icon"
@@ -38,7 +41,7 @@ exports[`DatePicker prop locale should works 1`] = `
<input
class="ant-calendar-input "
placeholder="Избери дата"
value=""
value="2000-01-01"
/>
</div>
<a
@@ -74,14 +77,14 @@ exports[`DatePicker prop locale should works 1`] = `
role="button"
title="Избор на месец"
>
Dec
Jan
</a>
<a
class="ant-calendar-year-select"
role="button"
title="Избор на година"
>
2017
2000
</a>
</span>
<a
@@ -189,13 +192,13 @@ exports[`DatePicker prop locale should works 1`] = `
class="ant-calendar-tbody"
>
<tr
class=""
class="ant-calendar-active-week"
role="row"
>
<td
class="ant-calendar-cell ant-calendar-last-month-cell"
role="gridcell"
title="November 26, 2017"
title="December 26, 1999"
>
<div
aria-disabled="false"
@@ -208,7 +211,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell ant-calendar-last-month-cell"
role="gridcell"
title="November 27, 2017"
title="December 27, 1999"
>
<div
aria-disabled="false"
@@ -221,7 +224,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell ant-calendar-last-month-cell"
role="gridcell"
title="November 28, 2017"
title="December 28, 1999"
>
<div
aria-disabled="false"
@@ -234,7 +237,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell ant-calendar-last-month-cell"
role="gridcell"
title="November 29, 2017"
title="December 29, 1999"
>
<div
aria-disabled="false"
@@ -247,7 +250,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell ant-calendar-last-month-cell"
role="gridcell"
title="November 30, 2017"
title="December 30, 1999"
>
<div
aria-disabled="false"
@@ -258,29 +261,29 @@ exports[`DatePicker prop locale should works 1`] = `
</div>
</td>
<td
class="ant-calendar-cell"
class="ant-calendar-cell ant-calendar-last-month-cell"
role="gridcell"
title="December 1, 2017"
title="December 31, 1999"
>
<div
aria-disabled="false"
aria-selected="false"
class="ant-calendar-date"
>
1
31
</div>
</td>
<td
class="ant-calendar-cell"
class="ant-calendar-cell ant-calendar-selected-date ant-calendar-selected-day"
role="gridcell"
title="December 2, 2017"
title="January 1, 2000"
>
<div
aria-disabled="false"
aria-selected="false"
aria-selected="true"
class="ant-calendar-date"
>
2
1
</div>
</td>
</tr>
@@ -291,7 +294,20 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 3, 2017"
title="January 2, 2000"
>
<div
aria-disabled="false"
aria-selected="false"
class="ant-calendar-date"
>
2
</div>
</td>
<td
class="ant-calendar-cell"
role="gridcell"
title="January 3, 2000"
>
<div
aria-disabled="false"
@@ -304,7 +320,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 4, 2017"
title="January 4, 2000"
>
<div
aria-disabled="false"
@@ -317,7 +333,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 5, 2017"
title="January 5, 2000"
>
<div
aria-disabled="false"
@@ -330,7 +346,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 6, 2017"
title="January 6, 2000"
>
<div
aria-disabled="false"
@@ -343,7 +359,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 7, 2017"
title="January 7, 2000"
>
<div
aria-disabled="false"
@@ -356,7 +372,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 8, 2017"
title="January 8, 2000"
>
<div
aria-disabled="false"
@@ -366,19 +382,6 @@ exports[`DatePicker prop locale should works 1`] = `
8
</div>
</td>
<td
class="ant-calendar-cell"
role="gridcell"
title="December 9, 2017"
>
<div
aria-disabled="false"
aria-selected="false"
class="ant-calendar-date"
>
9
</div>
</td>
</tr>
<tr
class=""
@@ -387,7 +390,20 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 10, 2017"
title="January 9, 2000"
>
<div
aria-disabled="false"
aria-selected="false"
class="ant-calendar-date"
>
9
</div>
</td>
<td
class="ant-calendar-cell"
role="gridcell"
title="January 10, 2000"
>
<div
aria-disabled="false"
@@ -400,7 +416,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 11, 2017"
title="January 11, 2000"
>
<div
aria-disabled="false"
@@ -413,7 +429,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 12, 2017"
title="January 12, 2000"
>
<div
aria-disabled="false"
@@ -426,7 +442,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 13, 2017"
title="January 13, 2000"
>
<div
aria-disabled="false"
@@ -439,7 +455,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 14, 2017"
title="January 14, 2000"
>
<div
aria-disabled="false"
@@ -452,7 +468,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 15, 2017"
title="January 15, 2000"
>
<div
aria-disabled="false"
@@ -462,10 +478,15 @@ exports[`DatePicker prop locale should works 1`] = `
15
</div>
</td>
</tr>
<tr
class=""
role="row"
>
<td
class="ant-calendar-cell"
role="gridcell"
title="December 16, 2017"
title="January 16, 2000"
>
<div
aria-disabled="false"
@@ -475,15 +496,10 @@ exports[`DatePicker prop locale should works 1`] = `
16
</div>
</td>
</tr>
<tr
class="ant-calendar-current-week ant-calendar-active-week"
role="row"
>
<td
class="ant-calendar-cell"
role="gridcell"
title="December 17, 2017"
title="January 17, 2000"
>
<div
aria-disabled="false"
@@ -494,13 +510,13 @@ exports[`DatePicker prop locale should works 1`] = `
</div>
</td>
<td
class="ant-calendar-cell ant-calendar-today ant-calendar-selected-day"
class="ant-calendar-cell"
role="gridcell"
title="December 18, 2017"
title="January 18, 2000"
>
<div
aria-disabled="false"
aria-selected="true"
aria-selected="false"
class="ant-calendar-date"
>
18
@@ -509,7 +525,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 19, 2017"
title="January 19, 2000"
>
<div
aria-disabled="false"
@@ -522,7 +538,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 20, 2017"
title="January 20, 2000"
>
<div
aria-disabled="false"
@@ -535,7 +551,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 21, 2017"
title="January 21, 2000"
>
<div
aria-disabled="false"
@@ -548,7 +564,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 22, 2017"
title="January 22, 2000"
>
<div
aria-disabled="false"
@@ -558,19 +574,6 @@ exports[`DatePicker prop locale should works 1`] = `
22
</div>
</td>
<td
class="ant-calendar-cell"
role="gridcell"
title="December 23, 2017"
>
<div
aria-disabled="false"
aria-selected="false"
class="ant-calendar-date"
>
23
</div>
</td>
</tr>
<tr
class=""
@@ -579,7 +582,20 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 24, 2017"
title="January 23, 2000"
>
<div
aria-disabled="false"
aria-selected="false"
class="ant-calendar-date"
>
23
</div>
</td>
<td
class="ant-calendar-cell"
role="gridcell"
title="January 24, 2000"
>
<div
aria-disabled="false"
@@ -592,7 +608,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 25, 2017"
title="January 25, 2000"
>
<div
aria-disabled="false"
@@ -605,7 +621,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 26, 2017"
title="January 26, 2000"
>
<div
aria-disabled="false"
@@ -618,7 +634,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 27, 2017"
title="January 27, 2000"
>
<div
aria-disabled="false"
@@ -631,7 +647,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 28, 2017"
title="January 28, 2000"
>
<div
aria-disabled="false"
@@ -644,7 +660,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 29, 2017"
title="January 29, 2000"
>
<div
aria-disabled="false"
@@ -654,19 +670,6 @@ exports[`DatePicker prop locale should works 1`] = `
29
</div>
</td>
<td
class="ant-calendar-cell"
role="gridcell"
title="December 30, 2017"
>
<div
aria-disabled="false"
aria-selected="false"
class="ant-calendar-date"
>
30
</div>
</td>
</tr>
<tr
class=""
@@ -675,7 +678,20 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell"
role="gridcell"
title="December 31, 2017"
title="January 30, 2000"
>
<div
aria-disabled="false"
aria-selected="false"
class="ant-calendar-date"
>
30
</div>
</td>
<td
class="ant-calendar-cell"
role="gridcell"
title="January 31, 2000"
>
<div
aria-disabled="false"
@@ -688,7 +704,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell ant-calendar-next-month-btn-day"
role="gridcell"
title="January 1, 2018"
title="February 1, 2000"
>
<div
aria-disabled="false"
@@ -701,7 +717,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell ant-calendar-next-month-btn-day"
role="gridcell"
title="January 2, 2018"
title="February 2, 2000"
>
<div
aria-disabled="false"
@@ -714,7 +730,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell ant-calendar-next-month-btn-day"
role="gridcell"
title="January 3, 2018"
title="February 3, 2000"
>
<div
aria-disabled="false"
@@ -727,7 +743,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell ant-calendar-next-month-btn-day"
role="gridcell"
title="January 4, 2018"
title="February 4, 2000"
>
<div
aria-disabled="false"
@@ -740,7 +756,7 @@ exports[`DatePicker prop locale should works 1`] = `
<td
class="ant-calendar-cell ant-calendar-next-month-btn-day"
role="gridcell"
title="January 5, 2018"
title="February 5, 2000"
>
<div
aria-disabled="false"
@@ -750,19 +766,6 @@ exports[`DatePicker prop locale should works 1`] = `
5
</div>
</td>
<td
class="ant-calendar-cell ant-calendar-next-month-btn-day"
role="gridcell"
title="January 6, 2018"
>
<div
aria-disabled="false"
aria-selected="false"
class="ant-calendar-date"
>
6
</div>
</td>
</tr>
</tbody>
</table>
@@ -776,7 +779,7 @@ exports[`DatePicker prop locale should works 1`] = `
<a
class="ant-calendar-today-btn "
role="button"
title="December 18, 2017"
title="November 22, 2016"
>
Днес
</a>

View File

@@ -51,13 +51,12 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker, WeekPicke
| style | to customize the style of the input box | object | {} |
| onOpenChange | a callback function, can be executed whether the popup calendar is popped up or closed | function(status) | - |
### Common Methods
| Name | Description |
| ---- | ----------- |
| focus() | get focus |
| blur() | remove focus |
| focus() | get focus |
### DatePicker
@@ -71,8 +70,8 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker, WeekPicke
| showTime.defaultValue | to set default time of selected date, [demo](https://ant.design/components/date-picker/#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/) | moment() |
| showToday | whether to show "Today" button | boolean | true |
| value | to set date | [moment](http://momentjs.com/) | - |
| onChange | a callback function, can be executed when the selected time is changing | function(date: moment, dateString: string) | - |
| onCalendarChange | a callback function, can be executed when the start time or the end time of the range is changing | function(dates: [moment, moment], dateStrings: [string, string]) | 无 |
| onChange | a callback function, can be executed when the selected time is changing | function(date: moment, dateString: string) | - |
| onOk | callback when click ok button | function() | - |
### MonthPicker
@@ -82,9 +81,9 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker, WeekPicke
| defaultValue | to set default date | [moment](http://momentjs.com/) | - |
| format | to set the date format, refer to [moment.js](http://momentjs.com/) | string | "YYYY-MM" |
| monthCellContentRender | Custom month cell content render method | function(date, locale): ReactNode | - |
| renderExtraFooter | render extra footer in panel | () => React.ReactNode | - |
| value | to set date | [moment](http://momentjs.com/) | - |
| onChange | a callback function, can be executed when the selected time is changing | function(date: moment, dateString: string) | - |
| renderExtraFooter | render extra footer in panel | () => React.ReactNode | - |
### WeekPicker

View File

@@ -55,9 +55,9 @@ subtitle: 日期选择框
### 共同的方法
| 名称 | 描述 |
| ---- | ----------- |
| focus() | 获取焦点 |
| --- | --- |
| blur() | 移除焦点 |
| focus() | 获取焦点 |
### DatePicker
@@ -81,9 +81,9 @@ subtitle: 日期选择框
| defaultValue | 默认日期 | [moment](http://momentjs.com/) | 无 |
| format | 展示的日期格式,配置参考 [moment.js](http://momentjs.com/) | string | "YYYY-MM" |
| monthCellContentRender | 自定义的月份内容渲染方法 | function(date, locale): ReactNode | - |
| renderExtraFooter | 在面板中添加额外的页脚 | () => React.ReactNode | - |
| value | 日期 | [moment](http://momentjs.com/) | 无 |
| onChange | 时间发生变化的回调,发生在用户选择时间时 | function(date: moment, dateString: string) | - |
| renderExtraFooter | 在面板中添加额外的页脚 | () => React.ReactNode | - |
### WeekPicker
@@ -106,8 +106,8 @@ subtitle: 日期选择框
| showTime | 增加时间选择功能 | Object\|boolean | [TimePicker Options](/components/time-picker/#API) |
| showTime.defaultValue | 设置用户选择日期时默认的时分秒,[例子](https://ant.design/components/date-picker/#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)\[] | [moment(), moment()] |
| value | 日期 | [moment](http://momentjs.com/)\[] | 无 |
| onChange | 日期范围发生变化的回调 | function(dates: [moment, moment], dateStrings: [string, string]) | 无 |
| onCalendarChange | 待选日期发生变化的回调 | function(dates: [moment, moment], dateStrings: [string, string]) | 无 |
| onChange | 日期范围发生变化的回调 | function(dates: [moment, moment], dateStrings: [string, string]) | 无 |
| onOk | 点击确定按钮的回调 | function() | - |
<style>

View File

@@ -18,5 +18,5 @@ A divider line separates different content.
| Property | Description | Type | Default |
| -------- | ----------- | ---- | ------- |
| dashed | whether line is dasded | Boolean | false |
| type | direction type of divider | enum: `horizontal` `vertical` | `horizontal` |
| dashed | whether line is dasded | Boolean | false

View File

@@ -16,5 +16,5 @@ subtitle: 分割线
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| dashed | 是否虚线 | Boolean | false |
| type | 水平还是垂直类型 | enum: `horizontal` `vertical` | `horizontal` |
| dashed | 是否虚线 | Boolean | false

View File

@@ -20,7 +20,7 @@ If there are too many operations to display, you can wrap them in a `Dropdown`.
| getPopupContainer | to set the container of the dropdown menu. The default is to create a `div` element in `body`, you can reset it to the scrolling area and make a relative reposition. [example](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | Function(triggerNode) | `() => document.body` |
| overlay | the dropdown menu | [Menu](/components/menu) | - |
| placement | placement of pop menu: `bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
| trigger | the trigger mode which executes the drop-down action | Array&lt;`click`\|`hover`\|`contentMenu`&gt; | `['hover']` |
| trigger | the trigger mode which executes the drop-down action | Array&lt;`click`\|`hover`\|`contentMenu`> | `['hover']` |
| visible | whether the dropdown menu is visible | boolean | - |
| onVisibleChange | a callback function takes an argument: `visible`, is executed when the visible state is changed | Function(visible) | - |
@@ -38,7 +38,7 @@ You should use [Menu](/components/menu/) as `overlay`. The menu items and divide
| overlay | the dropdown menu | [Menu](/components/menu) | - |
| placement | placement of pop menu: `bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
| size | size of the button, the same as [Button](/components/button) | string | `default` |
| trigger | the trigger mode which executes the drop-down action | Array&lt;`click`\|`hover`\|`contentMenu`&gt; | `['hover']` |
| trigger | the trigger mode which executes the drop-down action | Array&lt;`click`\|`hover`\|`contextMenu`> | `['hover']` |
| type | type of the button, the same as [Button](/components/button) | string | `default` |
| visible | whether the dropdown menu is visible | boolean | - |
| onClick | a callback function, the same as [Button](/components/button), which will be executed when you click the button on the left | Function | - |

View File

@@ -21,7 +21,7 @@ title: Dropdown
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | Function(triggerNode) | `() => document.body` |
| overlay | 菜单 | [Menu](/components/menu) | - |
| placement | 菜单弹出位置:`bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
| trigger | 触发下拉的行为 | Array&lt;`click`\|`hover`\|`contentMenu`&gt; | `['hover']` |
| trigger | 触发下拉的行为 | Array&lt;`click`\|`hover`\|`contentMenu`> | `['hover']` |
| visible | 菜单是否显示 | boolean | - |
| onVisibleChange | 菜单显示状态改变时调用,参数为 visible | Function(visible) | - |
@@ -39,7 +39,7 @@ title: Dropdown
| overlay | 菜单 | [Menu](/components/menu/) | - |
| placement | 菜单弹出位置:`bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
| size | 按钮大小,和 [Button](/components/button/) 一致 | string | 'default' |
| trigger | 触发下拉的行为 | Array&lt;`click`\|`hover`\|`contentMenu`&gt; | `['hover']` |
| trigger | 触发下拉的行为 | Array&lt;`click`\|`hover`\|`contentMenu`> | `['hover']` |
| type | 按钮类型,和 [Button](/components/button/) 一致 | string | 'default' |
| visible | 菜单是否显示 | boolean | - |
| onClick | 点击左侧按钮的回调,和 [Button](/components/button/) 一致 | Function | - |

View File

@@ -70,7 +70,7 @@ export type GetFieldDecoratorOptions = {
exclusive?: boolean;
/** Normalize value to form component */
normalize?: (value: any, prevValue: any, allValues: any) => any;
/** Whether stop validate on first rule of error for this field. */
/** Whether stop validate on first rule of error for this field. */
validateFirst?: boolean;
};
@@ -117,7 +117,7 @@ export type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;
export interface ComponentDecorator<TOwnProps> {
<P extends FormComponentProps>(
component: React.ComponentClass<P>,
component: React.ComponentClass<P> | React.SFC<P>,
): React.ComponentClass<Omit<P, keyof FormComponentProps> & TOwnProps>;
}

View File

@@ -53,8 +53,8 @@ The following `options` are available:
| Property | Description | Type |
| -------- | ----------- | ---- |
| validateMessages | Default validate message. And its format is similar with [newMessages](https://github.com/yiminghe/async-validator/blob/master/src/messages.js)'s returned value | Object { [nested.path]: String } |
| mapPropsToFields | Convert props to field value(e.g. reading the values from Redux store). And you must mark returned fields with [`Form.createFormField`](#Form.createFormField) | (props) => Object{ fieldName: FormField { value } } |
| validateMessages | Default validate message. And its format is similar with [newMessages](https://github.com/yiminghe/async-validator/blob/master/src/messages.js)'s returned value | Object { [nested.path]&#x3A; String } |
| onFieldsChange | Specify a function that will be called when the value a `Form.Item` gets changed. Usage example: saving the field's value to Redux store. | Function(props, fields) |
| onValuesChange | A handler while value of any field is changed | (props, values) => void |
@@ -168,7 +168,7 @@ See more advanced usage at [async-validator](https://github.com/yiminghe/async-v
```jsx
import { Form } from 'antd';
import { FormComponentProps } from 'antd/lib/form/Form';
import { FormComponentProps } from 'antd/lib/form';
interface UserFormProps extends FormComponentProps {
age: number;

View File

@@ -55,8 +55,8 @@ CustomizedForm = Form.create({})(CustomizedForm);
| 参数 | 说明 | 类型 |
| --- | --- | --- |
| validateMessages | 默认校验信息,可用于把默认错误信息改为中文等,格式与 [newMessages](https://github.com/yiminghe/async-validator/blob/master/src/messages.js) 返回值一致 | Object { [nested.path]: String } |
| mapPropsToFields | 把父组件的属性映射到表单项上(如:把 Redux store 中的值读出),需要对返回值中的表单域数据用 [`Form.createFormField`](#Form.createFormField) 标记 | (props) => Object{ fieldName: FormField { value } } |
| validateMessages | 默认校验信息,可用于把默认错误信息改为中文等,格式与 [newMessages](https://github.com/yiminghe/async-validator/blob/master/src/messages.js) 返回值一致 | Object { [nested.path]&#x3A; String } |
| onFieldsChange | 当 `Form.Item` 子节点的值发生改变时触发,可以把对应的值转存到 Redux store | Function(props, fields) |
| onValuesChange | 任一表单域的值发生改变时的回调 | (props, values) => void |
@@ -169,7 +169,7 @@ CustomizedForm = Form.create({})(CustomizedForm);
```jsx
import { Form } from 'antd';
import { FormComponentProps } from 'antd/lib/form/Form';
import { FormComponentProps } from 'antd/lib/form';
interface UserFormProps extends FormComponentProps {
age: number;

View File

@@ -121,7 +121,7 @@ input[type="checkbox"] {
}
.@{ant-prefix}-switch {
margin: 4px 0;
margin: 2px 0 4px;
}
&-no-colon &-label label:after {
@@ -243,22 +243,6 @@ form {
.@{ant-prefix}-select,
.@{ant-prefix}-cascader-picker {
width: 100%;
// Fix https://github.com/ant-design/ant-design/issues/6097
&:only-child {
display: block;
position: relative;
top: (@form-component-max-height - @input-height-base) / 2;
&.@{ant-prefix}-select-sm,
&.@{ant-prefix}-cascader-picker-small {
top: (@form-component-max-height - @input-height-sm) / 2;
}
&.@{ant-prefix}-select-lg,
&.@{ant-prefix}-cascader-picker-large {
top: (@form-component-max-height - @input-height-lg) / 2;
}
}
}
// Don't impact select inside input group
@@ -267,25 +251,6 @@ form {
width: auto;
}
// Don't impact select inside input group addon
.@{ant-prefix}-input-group-addon .@{ant-prefix}-select,
.@{ant-prefix}-input-group-addon .@{ant-prefix}-cascader-picker {
&:only-child {
display: inline-block;
top: 0;
&.@{ant-prefix}-select-sm,
&.@{ant-prefix}-cascader-picker-small {
top: 0;
}
&.@{ant-prefix}-select-lg,
&.@{ant-prefix}-cascader-picker-large {
top: 0;
}
}
}
// fix input with addon position. https://github.com/ant-design/ant-design/issues/8243
.@{ant-prefix}-input-group-wrapper {
position: relative;
@@ -433,7 +398,8 @@ form {
right: 0;
visibility: visible;
pointer-events: none;
.square(@form-component-max-height);
width: @form-component-height;
height: @form-component-max-height;
line-height: @form-component-max-height;
text-align: center;
font-size: @form-feedback-icon-size;

View File

@@ -709,7 +709,7 @@ exports[`renders ./components/grid/demo/playground.md correctly 1`] = `
</div>
`;
exports[`renders ./components/grid/demo/reponsive.md correctly 1`] = `
exports[`renders ./components/grid/demo/responsive.md correctly 1`] = `
<div
class="ant-row"
>
@@ -731,7 +731,7 @@ exports[`renders ./components/grid/demo/reponsive.md correctly 1`] = `
</div>
`;
exports[`renders ./components/grid/demo/reponsive-more.md correctly 1`] = `
exports[`renders ./components/grid/demo/responsive-more.md correctly 1`] = `
<div
class="ant-row"
>

View File

@@ -31,5 +31,5 @@ When a numeric value needs to be provided.
| Name | Description |
| ---- | ----------- |
| focus() | get focus |
| blur() | remove focus |
| focus() | get focus |

View File

@@ -33,6 +33,6 @@ title: InputNumber
## 方法
| 名称 | 描述 |
| ---- | ----------- |
| focus() | 获取焦点 |
| --- | --- |
| blur() | 移除焦点 |
| focus() | 获取焦点 |

View File

@@ -89,6 +89,7 @@
&-lg {
padding: 0;
font-size: @font-size-lg;
input {
height: @input-height-lg - 2px;

View File

@@ -27,17 +27,18 @@ export interface InputProps extends AbstractInputProps {
id?: number | string;
name?: string;
size?: 'large' | 'default' | 'small';
maxLength?: string;
maxLength?: number;
disabled?: boolean;
readOnly?: boolean;
addonBefore?: React.ReactNode;
addonAfter?: React.ReactNode;
onPressEnter?: React.FormEventHandler<any>;
onKeyDown?: React.FormEventHandler<any>;
onPressEnter?: React.FormEventHandler<HTMLInputElement>;
onKeyDown?: React.FormEventHandler<HTMLInputElement>;
onKeyUp?: React.FormEventHandler<HTMLInputElement>;
onChange?: React.ChangeEventHandler<HTMLInputElement>;
onClick?: React.FormEventHandler<any>;
onFocus?: React.FormEventHandler<any>;
onBlur?: React.FormEventHandler<any>;
onClick?: React.FormEventHandler<HTMLInputElement>;
onFocus?: React.FormEventHandler<HTMLInputElement>;
onBlur?: React.FormEventHandler<HTMLInputElement>;
autoComplete?: string;
prefix?: React.ReactNode;
suffix?: React.ReactNode;
@@ -74,6 +75,7 @@ export default class Input extends React.Component<InputProps, any> {
autosize: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
onPressEnter: PropTypes.func,
onKeyDown: PropTypes.func,
onKeyUp: PropTypes.func,
onFocus: PropTypes.func,
onBlur: PropTypes.func,
prefix: PropTypes.node,

View File

@@ -7,6 +7,7 @@
.input-lg() {
padding: @input-padding-vertical-lg @input-padding-horizontal-lg;
height: @input-height-lg;
font-size: @font-size-lg;
}
.input-sm() {
@@ -138,7 +139,7 @@
}
&-addon {
padding: @input-padding-vertical-base @input-padding-horizontal-base;
padding: 0 @input-padding-horizontal-base;
font-size: @font-size-base;
font-weight: normal;
line-height: 1;

View File

@@ -98,7 +98,7 @@ ReactDOM.render(<SiderDemo />, mountNode);
````css
#components-layout-demo-side .logo {
height: 32px;
background: rgba(255,255,255,.2);
background: rgba(255,255,255,.2);
margin: 16px;
}
````

View File

@@ -410,10 +410,8 @@ exports[`renders ./components/list/demo/loadmore.md correctly 1`] = `
class="ant-spin-container ant-spin-blur"
>
<div
class="ant-list-empty-text"
>
No data
</div>
style="min-height:53px"
/>
</div>
</div>
<div

View File

@@ -0,0 +1,23 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`List renders empty list 1`] = `
<div
class="ant-list ant-list-split"
>
<div>
<div
class="ant-spin-nested-loading"
>
<div
class="ant-spin-container"
>
<div
class="ant-list-empty-text"
>
No data
</div>
</div>
</div>
</div>
</div>
`;

View File

@@ -0,0 +1,12 @@
import React from 'react';
import { render } from 'enzyme';
import List from '..';
describe('List', () => {
it('renders empty list', () => {
const wrapper = render(
<List dataSource={[]} renderItem={() => <List.Item />} />
);
expect(wrapper).toMatchSnapshot();
});
});

View File

@@ -0,0 +1,47 @@
import React from 'react';
import { render } from 'enzyme';
import List from '..';
import Icon from '../../icon';
describe('List', () => {
it('renders empty loading', () => {
const loading = {
spinning: true,
};
const wrapper = render(
<List loading={loading} dataSource={[]} renderItem={() => <List.Item />} />
);
expect(wrapper.find('.ant-list-empty-text')).toHaveLength(0);
});
it('renders object loading', () => {
const loading = {
spinning: true,
};
const wrapper = render(
<List
loading={loading}
dataSource={[1]}
renderItem={() => <List.Item />}
/>
);
expect(wrapper.find('.ant-spin-spinning')).toHaveLength(1);
});
it('renders object loading with indicator', () => {
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
const loading = {
spinning: true,
indicator: antIcon,
};
const wrapper = render(
<List
loading={loading}
dataSource={[1]}
renderItem={() => <List.Item />}
/>
);
expect(wrapper.find('.anticon-loading')).toHaveLength(1);
});
});

View File

@@ -22,7 +22,7 @@ A list can be used to display content related to a single subject. The content c
| grid | The grid type of list. You can set grid to something like {gutter: 16, column: 4} | object | - |
| header | List header renderer | string\|ReactNode | - |
| itemLayout | The layout of list, default is `horizontal`, If a vertical list is desired, set the itemLayout property to `vertical` | string | - |
| loading | Shows a loading indicator while the contents of the list are being fetched | boolean | false |
| loading | Shows a loading indicator while the contents of the list are being fetched | boolean\|[object](https://ant.design/components/spin-cn/#API) ([more](https://github.com/ant-design/ant-design/issues/8659)) | false |
| loadMore | Shows a load more content | string\|ReactNode | - |
| pagination | Pagination [config](https://ant.design/components/pagination/), hide it by setting it to false | boolean \| object | false |
| split | Toggles rendering of the split under the list item | boolean | true |
@@ -31,9 +31,9 @@ A list can be used to display content related to a single subject. The content c
| Property | Description | Type | Default |
| -------- | ----------- | ---- | ------- |
| size | Size of list | `default` \| `middle` \| `small` | `default` |
| column | column of grid | number | - |
| gutter | spacing between grid | number | 0 |
| size | Size of list | `default` \| `middle` \| `small` | `default` |
| xs | `<576px` column of grid | number | - |
| sm | `≥576px` column of grid | number | - |
| md | `≥768px` column of grid | number | - |

View File

@@ -1,6 +1,7 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { SpinProps } from '../spin';
import LocaleReceiver from '../locale-provider/LocaleReceiver';
import defaultLocale from '../locale-provider/default';
@@ -37,7 +38,7 @@ export interface ListProps {
grid?: ListGridType;
id?: string;
itemLayout?: string;
loading?: boolean;
loading?: boolean | SpinProps;
loadMore?: React.ReactNode;
pagination?: any;
prefixCls?: string;
@@ -115,7 +116,6 @@ export default class List extends React.Component<ListProps> {
split,
className,
children,
loading,
itemLayout,
loadMore,
pagination,
@@ -127,9 +127,18 @@ export default class List extends React.Component<ListProps> {
renderItem,
header,
footer,
loading,
...rest,
} = this.props;
let loadingProp = loading;
if (typeof loadingProp === 'boolean') {
loadingProp = {
spinning: loadingProp,
};
}
const isLoading = (loadingProp && loadingProp.spinning);
// large => lg
// small => sm
let sizeCls = '';
@@ -148,7 +157,7 @@ export default class List extends React.Component<ListProps> {
[`${prefixCls}-${sizeCls}`]: sizeCls,
[`${prefixCls}-split`]: split,
[`${prefixCls}-bordered`]: bordered,
[`${prefixCls}-loading`]: loading,
[`${prefixCls}-loading`]: isLoading,
[`${prefixCls}-grid`]: grid,
[`${prefixCls}-something-after-last-item`]: this.isSomethingAfterLastTtem(),
});
@@ -160,6 +169,7 @@ export default class List extends React.Component<ListProps> {
);
let childrenContent;
childrenContent = isLoading && (<div style={{ minHeight: 53 }} />);
if (dataSource.length > 0) {
const items = dataSource.map((item: any, index: number) => this.renderItem(item, index));
const childrenList = React.Children.map(items, (child: any, index) => React.cloneElement(child, {
@@ -170,7 +180,7 @@ export default class List extends React.Component<ListProps> {
childrenContent = grid ? (
<Row gutter={grid.gutter}>{childrenList}</Row>
) : childrenList;
} else if (!children) {
} else if (!children && !isLoading) {
childrenContent = (
<LocaleReceiver
componentName="Table"
@@ -183,7 +193,7 @@ export default class List extends React.Component<ListProps> {
const content = (
<div>
<Spin spinning={loading}>{childrenContent}</Spin>
<Spin {...loadingProp}>{childrenContent}</Spin>
{loadMore}
{(!loadMore && pagination) ? paginationContent : null}
</div>

View File

@@ -18,15 +18,15 @@ cols: 1
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| size | list 的尺寸 | `default` \| `middle` \| `small` | `default` |
| bordered | 是否展示边框 | boolean | false |
| footer | 列表底部 | string\|ReactNode | - |
| grid | 列表栅格配置 | object | - |
| header | 列表头部 | string\|ReactNode | - |
| itemLayout | 设置 `List.Item` 布局, 设置成 `vertical` 则竖直样式显示, 默认横排 | string | - |
| loading | 当卡片内容还在加载中时,可以用 `loading` 展示一个占位 | boolean | false |
| loading | 当卡片内容还在加载中时,可以用 `loading` 展示一个占位 | boolean\|[object](https://ant.design/components/spin-cn/#API) ([更多](https://github.com/ant-design/ant-design/issues/8659)) | false |
| loadMore | 加载更多 | string\|ReactNode | - |
| pagination | 对应的 `pagination` 配置, 设置 `false` 不显示 | boolean\|object | false |
| size | list 的尺寸 | `default` \| `middle` \| `small` | `default` |
| split | 是否展示分割线 | boolean | true |
### List grid props

View File

@@ -62,9 +62,9 @@ const App = () => (
<Option value="jack">jack</Option>
<Option value="lucy">lucy</Option>
</Select>
<DatePicker />
<TimePicker defaultOpenValue={moment()} />
<RangePicker style={{ width: 200 }} />
<DatePicker open />
<TimePicker open defaultOpenValue={moment()} />
<RangePicker open style={{ width: 200 }} />
<Popconfirm title="Question?" visible>
<a>Click to confirm</a>
</Popconfirm>
@@ -83,17 +83,17 @@ const App = () => (
);
describe('Locale Provider', () => {
it('should display the text as locale changed', () => {
MockDate.set(moment('2017-09-18T03:30:07.795Z').valueOf());
locales.forEach((locale) => {
locales.forEach((locale) => {
it(`should display the text as ${locale.locale}`, () => {
MockDate.set(moment('2017-09-18T03:30:07.795Z').valueOf() + (new Date().getTimezoneOffset() * 60 * 1000));
const wrapper = mount(
<LocaleProvider locale={locale}>
<App />
</LocaleProvider>
);
expect(wrapper.render()).toMatchSnapshot();
MockDate.reset();
});
MockDate.reset();
});
it('should change locale of Modal.xxx', () => {

View File

@@ -1,47 +1,47 @@
import * as moment from 'moment';
moment.locale('ar');
import Pagination from 'rc-pagination/lib/locale/ar_EG';
import DatePicker from '../date-picker/locale/ar_EG';
import TimePicker from '../time-picker/locale/ar_EG';
import Calendar from '../calendar/locale/ar_EG';
export default {
locale: 'ar',
Pagination,
DatePicker,
TimePicker,
Calendar,
Table: {
filterTitle: 'الفلاتر',
filterConfirm: 'تأكيد',
filterReset: 'إعادة ضبط',
emptyText: 'لا توجد بيانات',
selectAll: 'اختيار الكل',
selectInvert: 'إلغاء الاختيار',
},
Modal: {
okText: 'تأكيد',
cancelText: 'إلغاء',
justOkText: 'تأكيد',
},
Popconfirm: {
okText: 'تأكيد',
cancelText: 'إلغاء',
},
Transfer: {
notFoundContent: 'لا يوجد محتوى',
searchPlaceholder: 'ابحث هنا',
itemUnit: 'عنصر',
itemsUnit: 'عناصر',
},
Select: {
notFoundContent: 'لايوجد محتوى',
},
Upload: {
uploading: 'جاري الرفع...',
removeFile: 'احذف الملف',
uploadError: 'مشكلة فى الرفع',
previewFile: 'استعرض الملف',
},
};
import * as moment from 'moment';
moment.locale('ar');
import Pagination from 'rc-pagination/lib/locale/ar_EG';
import DatePicker from '../date-picker/locale/ar_EG';
import TimePicker from '../time-picker/locale/ar_EG';
import Calendar from '../calendar/locale/ar_EG';
export default {
locale: 'ar',
Pagination,
DatePicker,
TimePicker,
Calendar,
Table: {
filterTitle: 'الفلاتر',
filterConfirm: 'تأكيد',
filterReset: 'إعادة ضبط',
emptyText: 'لا توجد بيانات',
selectAll: 'اختيار الكل',
selectInvert: 'إلغاء الاختيار',
},
Modal: {
okText: 'تأكيد',
cancelText: 'إلغاء',
justOkText: 'تأكيد',
},
Popconfirm: {
okText: 'تأكيد',
cancelText: 'إلغاء',
},
Transfer: {
notFoundContent: 'لا يوجد محتوى',
searchPlaceholder: 'ابحث هنا',
itemUnit: 'عنصر',
itemsUnit: 'عناصر',
},
Select: {
notFoundContent: 'لايوجد محتوى',
},
Upload: {
uploading: 'جاري الرفع...',
removeFile: 'احذف الملف',
uploadError: 'مشكلة فى الرفع',
previewFile: 'استعرض الملف',
},
};

View File

@@ -13,23 +13,24 @@ title: LocaleProvider
```jsx
import { LocaleProvider } from 'antd';
import enUS from 'antd/lib/locale-provider/en_US';
import fr_FR from 'antd/lib/locale-provider/fr_FR';
import 'moment/locale/fr';
...
return <LocaleProvider locale={enUS}><App /></LocaleProvider>;
return <LocaleProvider locale={fr_FR}><App /></LocaleProvider>;
```
We provide some locale like English, Chinese, Russian, German, French and etc, all locale packages can be found in [here](https://github.com/ant-design/ant-design/blob/master/components/locale-provider/).
Note: if you need to use antd's UMD dist file, please import `antd/dist/antd-with-locales.js`:
Note: if you need to use antd's UMD dist file, please use `antd/dist/antd-with-locales.js` and corresponding moment locale:
```jsx
const { LocaleProvider, locales } = window.antd;
...
return <LocaleProvider locale={locales.en_US}><App /></LocaleProvider>;
return <LocaleProvider locale={locales.fr_FR}><App /></LocaleProvider>;
```
### Add a new language

View File

@@ -13,16 +13,18 @@ title: LocaleProvider
LocaleProvider 使用 React 的 [context](https://facebook.github.io/react/docs/context.html) 特性,只需在应用外围包裹一次即可全局生效。
```jsx
import enUS from 'antd/lib/locale-provider/en_US';
import { LocaleProvider } from 'antd';
import zh_CN from 'antd/lib/locale-provider/zh_CN';
import 'moment/locale/zh-cn';
...
return <LocaleProvider locale={enUS}><App /></LocaleProvider>;
return <LocaleProvider locale={zh_CN}><App /></LocaleProvider>;
```
我们提供了英语,中文,俄语,法语,德语等多种语言支持,所有语言包可以在 [这里](https://github.com/ant-design/ant-design/blob/master/components/locale-provider/) 找到。
注意:如果你需要使用 UMD 版的 dist 文件,应该引入 `antd/dist/antd-with-locales.js`,然后按以下方式使用:
注意:如果你需要使用 UMD 版的 dist 文件,应该引入 `antd/dist/antd-with-locales.js`同时引入 moment 对应的 locale然后按以下方式使用:
```jsx
const { LocaleProvider, locales } = window.antd;

View File

@@ -55,8 +55,8 @@ When need to mention someone or something.
| Name | Description |
| ---- | ----------- |
| focus() | get focus |
| blur() | remove focus |
| focus() | get focus |
### Nav

View File

@@ -55,9 +55,9 @@ title: Mention
### Mention 方法
| 名称 | 描述 |
| ---- | ----------- |
| focus() | 获取焦点 |
| --- | --- |
| blur() | 移除焦点 |
| focus() | 获取焦点 |
### Nav

View File

@@ -30,6 +30,7 @@ More layouts with navigation: [layout](/components/layout).
| ----- | ----------- | ---- | ------------- |
| defaultOpenKeys | array with the keys of default opened sub menus | | |
| defaultSelectedKeys | array with the keys of default selected menu items | string\[] | |
| forceSubMenuRender | render submenu into DOM before it shows | boolean | false |
| inlineCollapsed | specifies the collapsed status when menu is inline mode | boolean | - |
| inlineIndent | indent px of inline menu item on each level | number | 24 |
| mode | type of the menu; `vertical`, `horizontal`, and `inline` modes are supported | string: `vertical` \| `vertical-right` \| `horizontal` \| `inline` | `vertical` |
@@ -38,14 +39,13 @@ More layouts with navigation: [layout](/components/layout).
| selectable | allow selecting menu items | boolean | true |
| selectedKeys | array with the keys of currently selected menu items | string\[] | |
| style | style of the root node | object | |
| subMenuCloseDelay | delay time to hide submenu when mouse leave, unit: second | number | 0.1 |
| subMenuOpenDelay | delay time to show submenu when mouse enter, unit: second | number | 0 |
| theme | color theme of the menu | string: `light` `dark` | `light` |
| onClick | callback executed when a menu item is clicked | function({ item, key, keyPath }) | - |
| onDeselect | callback executed when a menu item is deselected, only supported for multiple mode | function({ item, key, selectedKeys }) | - |
| onOpenChange | called when open/close sub menu | function(openKeys: string\[]) | noop |
| onSelect | callback executed when a menu item is selected | function({ item, key, selectedKeys }) | none |
| subMenuOpenDelay | delay time to show submenu when mouse enter, unit: second | number | 0 |
| subMenuCloseDelay | delay time to hide submenu when mouse leave, unit: second | number | 0.1 |
| forceSubMenuRender | render submenu into DOM before it shows | boolean | false |
> More options in [rc-menu](https://github.com/react-component/menu#api)

View File

@@ -1,4 +1,5 @@
import * as React from 'react';
import { findDOMNode } from 'react-dom';
import RcMenu, { Divider, ItemGroup } from 'rc-menu';
import PropTypes from 'prop-types';
import classNames from 'classnames';
@@ -105,6 +106,7 @@ export default class Menu extends React.Component<MenuProps, MenuState> {
};
}
componentWillReceiveProps(nextProps: MenuProps, nextContext: SliderContext) {
const { prefixCls } = this.props;
if (this.props.mode === 'inline' &&
nextProps.mode !== 'inline') {
this.switchModeFromInline = true;
@@ -115,7 +117,8 @@ export default class Menu extends React.Component<MenuProps, MenuState> {
}
if ((nextProps.inlineCollapsed && !this.props.inlineCollapsed) ||
(nextContext.siderCollapsed && !this.context.siderCollapsed)) {
this.switchModeFromInline = !!this.state.openKeys.length;
this.switchModeFromInline =
!!this.state.openKeys.length && !!findDOMNode(this).querySelectorAll(`.${prefixCls}-submenu-open`).length;
this.inlineOpenKeys = this.state.openKeys;
this.setState({ openKeys: [] });
}
@@ -148,8 +151,7 @@ export default class Menu extends React.Component<MenuProps, MenuState> {
}
getRealMenuMode() {
const inlineCollapsed = this.getInlineCollapsed();
if (this.switchModeFromInline && inlineCollapsed && this.leaveAnimationExecutedWhenInlineCollapsed) {
this.leaveAnimationExecutedWhenInlineCollapsed = false;
if (this.switchModeFromInline && inlineCollapsed) {
return 'inline';
}
const { mode } = this.props;
@@ -188,8 +190,6 @@ export default class Menu extends React.Component<MenuProps, MenuState> {
leave: (node: HTMLElement, done: () => void) => animation.leave(node, () => {
// Make sure inline menu leave animation finished before mode is switched
this.switchModeFromInline = false;
// Fix https://github.com/ant-design/ant-design/issues/8475
this.leaveAnimationExecutedWhenInlineCollapsed = true;
this.setState({});
// when inlineCollapsed change false to true, all submenu will be unmounted,
// so that we don't need handle animation leaving.

View File

@@ -31,6 +31,7 @@ subtitle: 导航菜单
| --- | --- | --- | --- |
| defaultOpenKeys | 初始展开的 SubMenu 菜单项 key 数组 | | |
| defaultSelectedKeys | 初始选中的菜单项 key 数组 | string\[] | |
| forceSubMenuRender | 在子菜单展示之前就渲染进 DOM | boolean | false |
| inlineCollapsed | inline 时菜单是否收起状态 | boolean | - |
| inlineIndent | inline 模式的菜单缩进宽度 | number | 24 |
| mode | 菜单类型,现在支持垂直、水平、和内嵌模式三种 | string: `vertical` `vertical-right` `horizontal` `inline` | `vertical` |
@@ -39,14 +40,13 @@ subtitle: 导航菜单
| selectable | 是否允许选中 | boolean | true |
| selectedKeys | 当前选中的菜单项 key 数组 | string\[] | |
| style | 根节点样式 | object | |
| subMenuCloseDelay | 用户鼠标离开子菜单后关闭延时,单位:秒 | number | 0.1 |
| subMenuOpenDelay | 用户鼠标进入子菜单后开启延时,单位:秒 | number | 0 |
| theme | 主题颜色 | string: `light` `dark` | `light` |
| onClick | 点击 MenuItem 调用此函数 | function({ item, key, keyPath }) | - |
| onDeselect | 取消选中时调用,仅在 multiple 生效 | function({ item, key, selectedKeys }) | - |
| onOpenChange | SubMenu 展开/关闭的回调 | function(openKeys: string\[]) | noop |
| onSelect | 被选中时调用 | function({ item, key, selectedKeys }) | 无   |
| subMenuOpenDelay | 用户鼠标进入子菜单后开启延时,单位:秒 | number | 0 |
| subMenuCloseDelay | 用户鼠标离开子菜单后关闭延时,单位:秒 | number | 0.1 |
| forceSubMenuRender | 在子菜单展示之前就渲染进 DOM | boolean | false |
> More options in [rc-menu](https://github.com/react-component/menu#api)

View File

@@ -36,6 +36,7 @@ export interface ModalProps {
cancelText?: string;
/** 点击蒙层是否允许关闭*/
maskClosable?: boolean;
destroyOnClose?: boolean;
style?: React.CSSProperties;
wrapClassName?: string;
maskTransitionName?: string;

View File

@@ -23,6 +23,7 @@ and so on.
| cancelText | Text of the Cancel button | string | `Cancel` |
| closable | Whether a close (x) button is visible on top right of the modal dialog or not | boolean | true |
| confirmLoading | Whether to apply loading visual effect for OK button or not | boolean | false |
| destroyOnClose | Whether to unmount child compenents on onClose | boolean | false |
| footer | Footer content, set as `footer={null}` when you don't need default buttons | string\|ReactNode | OK and Cancel buttons |
| getContainer | Return the mount node for Modal | (instance): HTMLElement | () => document.body |
| mask | Whether show mask or not. | Boolean | true |
@@ -39,10 +40,9 @@ and so on.
| onCancel | Specify a function that will be called when a user clicks mask, close button on top right or Cancel button | function(e) | - |
| onOk | Specify a function that will be called when a user clicks the OK button | function(e) | - |
#### Destroy on close
#### Note
> The state of Modal will be preserved at it's component lifecycle.
> If you wish to open it with a brand new state everytime, you need to reset state manually.
> The state of Modal will be preserved at it's component lifecycle by default, if you wish to open it with a brand new state everytime, set `destroyOnClose` on it.
### Modal.method()

View File

@@ -22,6 +22,7 @@ title: Modal
| cancelText | 取消按钮文字 | string | 取消 |
| closable | 是否显示右上角的关闭按钮 | boolean | true |
| confirmLoading | 确定按钮 loading | boolean | 无 |
| destroyOnClose | 关闭时销毁 Modal 里的子元素 | boolean | false |
| footer | 底部内容,当不需要默认底部按钮时,可以设为 `footer={null}` | string\|ReactNode | 确定取消按钮 |
| getContainer | 指定 Modal 挂载的 HTML 节点 | (instance): HTMLElement | () => document.body |
| mask | 是否展示遮罩 | Boolean | true |
@@ -38,10 +39,9 @@ title: Modal
| onCancel | 点击遮罩层或右上角叉或取消按钮的回调 | function(e) | 无 |
| onOk | 点击确定回调 | function(e) | 无 |
#### 清空旧数据
#### 注意
> `<Modal />` 组件有标准的 React 生命周期,关闭后状态不会自动清空
> 如果希望每次打开都是新内容,需要自行手动清空旧的状态。
> `<Modal />` 默认关闭后状态不会自动清空, 如果希望每次打开都是新内容,请设置 `destroyOnClose`
### Modal.method()

View File

@@ -13,6 +13,7 @@ export interface PaginationProps {
defaultPageSize?: number;
pageSize?: number;
onChange?: (page: number, pageSize?: number) => void;
hideOnSinglePage?: boolean;
showSizeChanger?: boolean;
pageSizeOptions?: string[];
onShowSizeChange?: (current: number, size: number) => void;

View File

@@ -23,6 +23,7 @@ A long list can be divided into several pages by `Pagination`, and only one page
| current | current page number | number | - |
| defaultCurrent | default initial page number | number | 1 |
| defaultPageSize | default number of data items per page | number | 10 |
| hideOnSinglePage | Whether to hide pager on single page | boolean | false |
| itemRender | to customize item innerHTML | (page, type: 'page' \| 'prev' \| 'next', originalElement) => React.ReactNode | - |
| pageSize | number of data items per page | number | - |
| pageSizeOptions | specify the sizeChanger options | string\[] | ['10', '20', '30', '40'] |

View File

@@ -24,6 +24,7 @@ cols: 1
| current | 当前页数 | number | - |
| defaultCurrent | 默认的当前页数 | number | 1 |
| defaultPageSize | 默认的每页条数 | number | 10 |
| hideOnSinglePage | 只有一页时是否隐藏分页器 | boolean | false |
| itemRender | 用于自定义页码的结构,可用于优化 SEO | (page, type: 'page' \| 'prev' \| 'next', originalElement) => React.ReactNode | - |
| pageSize | 每页条数 | number | - |
| pageSizeOptions | 指定每页可以显示多少条 | string\[] | ['10', '20', '30', '40'] |

View File

@@ -17,7 +17,7 @@ Radio.
| Property | Description | Type | optional | Default |
| -------- | ----------- | ---- | -------- | ------- |
| autoFocus | get focus when component mounted | boolean | false |
| autoFocus | get focus when component mounted | boolean | false | |
| checked | Specifies whether the radio is selected. | boolean | | false |
| defaultChecked | Specifies the initial state: whether or not the radio is selected. | boolean | | false |
| disabled | Disable radio | boolean | | false |
@@ -43,5 +43,5 @@ radio groupwrap a group of `Radio`。
| Name | Description |
| ---- | ----------- |
| focus() | get focus |
| blur() | remove focus |
| focus() | get focus |

View File

@@ -17,7 +17,7 @@ title: Radio
### Radio
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- | --- |
| --- | --- | --- | --- |
| autoFocus | 自动获取焦点 | boolean | false |
| checked | 指定当前是否选中 | boolean | false |
| defaultChecked | 初始是否选中 | boolean | false |
@@ -27,8 +27,8 @@ title: Radio
单选框组合,用于包裹一组 `Radio`
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- | --- |
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| defaultValue | 默认选中的值 | any | 无 |
| name | RadioGroup 下所有 `input[type="radio"]``name` 属性 | string | 无 |
| options | 以配置形式设置子元素 | string\[] \| Array&lt;{ label: string value: string disabled?: boolean }> | 无 |
@@ -41,6 +41,6 @@ title: Radio
### Radio
| 名称 | 描述 |
| ---- | ----------- |
| focus() | 获取焦点 |
| --- | --- |
| blur() | 移除焦点 |
| focus() | 获取焦点 |

View File

@@ -165,6 +165,7 @@ span.@{radio-prefix-cls} + * {
.@{radio-group-prefix-cls}-large & {
height: @input-height-lg;
line-height: @input-height-lg - 2px;
font-size: @font-size-lg;
}
.@{radio-group-prefix-cls}-small & {

View File

@@ -351,6 +351,204 @@ exports[`renders ./components/rate/demo/character.md correctly 1`] = `
</div>
`;
exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
<div>
<ul
class="ant-rate"
tabindex="0"
>
<li
class="ant-rate-star ant-rate-star-full"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-full"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-full"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-zero"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-zero"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
</ul>
allowClear: true
<br />
<ul
class="ant-rate"
tabindex="0"
>
<li
class="ant-rate-star ant-rate-star-full"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-full"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-full"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-zero"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-zero"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
</ul>
allowClear: false
</div>
`;
exports[`renders ./components/rate/demo/disabled.md correctly 1`] = `
<ul
class="ant-rate ant-rate-disabled"

View File

@@ -1,5 +1,5 @@
---
order: 4
order: 5
title:
zh-CN: 其他字符
en-US: Other Character

View File

@@ -0,0 +1,26 @@
---
order: 4
title:
zh-CN: 清除
en-US: Clear star
---
## zh-CN
支持允许或者禁用清除。
## en-US
Support set allow to clear star when click again.
````jsx
import { Rate } from 'antd';
ReactDOM.render(
<div>
<Rate defaultValue={3} /> allowClear: true
<br />
<Rate allowClear={false} defaultValue={3} /> allowClear: false
</div>
, mountNode);
````

View File

@@ -15,6 +15,7 @@ Rate component.
| Property | Description | type | Default |
| -------- | ----------- | ---- | ------- |
| allowClear | whether to allow clear when click again | boolean | true |
| allowHalf | whether to allow semi selection | boolean | false |
| autoFocus | get focus when component mounted | boolean | false |
| character | custom character of rate | ReactNode | `<Icon type="star" />` |
@@ -34,5 +35,5 @@ Rate component.
| Name | Description |
| ---- | ----------- |
| focus() | get focus |
| blur() | remove focus |
| focus() | get focus |

View File

@@ -9,6 +9,7 @@ export interface RateProps {
value?: number;
defaultValue?: number;
allowHalf?: boolean;
allowClear?: boolean;
disabled?: boolean;
onChange?: (value: number) => any;
onHoverChange?: (value: number) => any;

View File

@@ -16,6 +16,7 @@ title: Rate
| 属性 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| allowClear | 是否允许再次点击后清除 | boolean | true |
| allowHalf | 是否允许半选 | boolean | false |
| autoFocus | 自动获取焦点 | boolean | false |
| character | 自定义字符 | ReactNode | `<Icon type="star" />` |
@@ -34,6 +35,6 @@ title: Rate
## 方法
| 名称 | 描述 |
| ---- | ----------- |
| focus() | 获取焦点 |
| --- | --- |
| blur() | 移除焦点 |
| focus() | 获取焦点 |

View File

@@ -5,6 +5,7 @@
.@{rate-prefix-cls} {
.reset-component;
line-height: unset;
margin: 0;
padding: 0;
list-style: none;

View File

@@ -33,9 +33,9 @@ Select component to select value from options.
| dropdownStyle | style of dropdown menu | object | - |
| filterOption | If true, filter options by input, if function, filter options against it. The function will receive two arguments, `inputValue` and `option`, if the function returns `true`, the option will be included in the filtered set; Otherwise, it will be excluded. | boolean or function(inputValue, option) | true |
| firstActiveValue | Value of action option by default | string\|string\[] | - |
| getPopupContainer | Parent Node which the selector should be rendered to. Default to `body`. When position issues happen, try to modify it into scrollable content and position it relative.[example](http://codepen.io/anon/pen/xVBOVQ?editors=001) | function(triggerNode) | () => document.body |
| getPopupContainer | Parent Node which the selector should be rendered to. Default to `body`. When position issues happen, try to modify it into scrollable content and position it relative. [Example](https://codesandbox.io/s/4j168r7jw01) | function(triggerNode) | () => document.body |
| labelInValue | whether to embed label in value, turn the format of value from `string` to `{key: string, label: ReactNode}` | boolean | false |
| maxTagCount | Max tag count to show | number | - |
| maxTagCount | Max tag count to show | number | - |
| maxTagPlaceholder | Placeholder for not showing tags | ReactNode/function(omittedValues) | - |
| mode | Set mode of Select (Support after 2.9) | 'multiple' \| 'tags' \| 'combobox' | - |
| notFoundContent | Specify content to show when no result matches.. | string | 'Not Found' |
@@ -50,6 +50,7 @@ Select component to select value from options.
| onChange | Called when select an option or input value change, or value of input is changed in combobox mode | function(value, label) | - |
| onDeselect | Called when a option is deselected, the params are option's value (or key) . only called for multiple or tags, effective in multiple or tags mode only. | function(value) | - |
| onFocus | Called when focus | function | - |
| onInputKeyDown | Called when key pressed | function | - |
| onMouseEnter | Called when mouse enter | function | - |
| onMouseLeave | Called when mouse leave | function | - |
| onPopupScroll | Called when dropdown scrolls | function | - |
@@ -59,7 +60,7 @@ Select component to select value from options.
### Select Methods
| Name | Description |
| --- | --- |
| ---- | ----------- |
| blur() | Remove focus |
| focus() | Get focus |

View File

@@ -42,6 +42,7 @@ export interface SelectProps extends AbstractSelectProps {
onDeselect?: (value: SelectValue) => any;
onBlur?: () => any;
onFocus?: () => any;
onInputKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
dropdownMatchSelectWidth?: boolean;
optionFilterProp?: string;
labelInValue?: boolean;

View File

@@ -35,7 +35,7 @@ title: Select
| dropdownStyle | 下拉菜单的 style 属性 | object | - |
| filterOption | 是否根据输入项进行筛选。当其为一个函数时,会接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 `true`,反之则返回 `false`。 | boolean or function(inputValue, option) | true |
| firstActiveValue | 默认高亮的选项 | string\|string\[] | - |
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | Function(triggerNode) | () => document.body |
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](https://codesandbox.io/s/4j168r7jw0) | Function(triggerNode) | () => document.body |
| labelInValue | 是否把每个选项的 label 包装到 value 中,会把 Select 的 value 类型从 `string` 变为 `{key: string, label: ReactNode}` 的格式 | boolean | false |
| maxTagCount | 最多显示多少个 tag | number | - |
| maxTagPlaceholder | 隐藏 tag 时显示的内容 | ReactNode/function(omittedValues) | - |

View File

@@ -83,6 +83,9 @@
background-color: @component-background;
border-radius: @border-radius-base;
border: @border-width-base @border-style-base @border-color-base;
// strange align fix for chrome but works
// https://gw.alipayobjects.com/zos/rmsportal/VFTfKXJuogBAXcvfAUWJ.gif
border-top-width: @border-width-base + 0.02px;
transition: all .3s @ease-in-out;
&:hover {
@@ -166,6 +169,7 @@
}
&-lg {
font-size: @font-size-lg;
.@{select-prefix-cls}-selection--single {
height: @input-height-lg;
}

View File

@@ -34,5 +34,5 @@ To input a value in a range.
| Name | Description |
| ---- | ----------- |
| focus() | get focus |
| blur() | remove focus |
| focus() | get focus |

View File

@@ -34,6 +34,6 @@ title: Slider
## 方法
| 名称 | 描述 |
| ---- | ----------- |
| focus() | 获取焦点 |
| --- | --- |
| blur() | 移除焦点 |
| focus() | 获取焦点 |

View File

@@ -10,11 +10,12 @@
@slider-tooltip-arrow-width: 4px;
@slider-tooltip-distance: @slider-tooltip-arrow-width + 4px;
@slider-tooltip-arrow-color: @slider-tooltip-bg;
@slider-margin: 14px 6px 10px;
.@{slider-prefix-cls} {
.reset-component;
position: relative;
margin: 10px 6px;
margin: @slider-margin;
padding: 4px 0;
height: 12px;
cursor: pointer;

View File

@@ -72,6 +72,7 @@
}
&-container {
overflow: auto;
position: relative;
}

View File

@@ -139,7 +139,7 @@
@btn-disable-border : @border-color-base;
@btn-padding-base : 0 @padding-md - 1px;
@btn-font-size-lg : @font-size-base;
@btn-font-size-lg : @font-size-lg;
@btn-font-size-sm : @font-size-base;
@btn-padding-lg : @btn-padding-base;
@btn-padding-sm : 0 @padding-xs - 1px;

View File

@@ -20,14 +20,14 @@ Switching Selector.
| checkedChildren | content to be shown when the state is checked | string\|ReactNode | |
| defaultChecked | to set the initial state | boolean | false |
| disabled | Disable switch | boolean | false |
| loading | loading state of switch | boolean | false |
| size | the size of the `Switch`, options: `default` `small` | string | default |
| unCheckedChildren | content to be shown when the state is unchecked | string\|ReactNode | |
| onChange | a callback function, can be executed when the checked state is changing | Function(checked:Boolean) | |
| loading | loading state of switch | boolean | false |
## Methods
| Name | Description |
| ---- | ----------- |
| focus() | get focus |
| blur() | remove focus |
| focus() | get focus |

View File

@@ -20,14 +20,14 @@ title: Switch
| checked | 指定当前是否选中 | boolean | false |
| checkedChildren | 选中时的内容 | string\|ReactNode | |
| defaultChecked | 初始是否选中 | boolean | false |
| loading | 加载中的开关 | boolean | false |
| size | 开关大小,可选值:`default` `small` | string | default |
| unCheckedChildren | 非选中时的内容 | string\|ReactNode | |
| onChange | 变化时回调函数 | Function(checked:Boolean) | |
| loading | 加载中的开关 | boolean | false |
## 方法
| 名称 | 描述 |
| ---- | ----------- |
| focus() | 获取焦点 |
| --- | --- |
| blur() | 移除焦点 |
| focus() | 获取焦点 |

View File

@@ -195,13 +195,19 @@ describe('Table.filter', () => {
filters,
}],
}));
jest.useFakeTimers();
const dropdownWrapper = mount(wrapper.find('Trigger').instance().getComponent());
dropdownWrapper.find('.ant-dropdown-menu-submenu-title').at(0).simulate('mouseEnter');
jest.runAllTimers();
dropdownWrapper.update();
dropdownWrapper.find('.ant-dropdown-menu-submenu-title').at(1).simulate('mouseEnter');
jest.runAllTimers();
dropdownWrapper.update();
dropdownWrapper.find('MenuItem').last().simulate('click');
dropdownWrapper.find('.confirm').simulate('click');
wrapper.update();
expect(renderedNames(wrapper)).toEqual(['Jack']);
jest.useRealTimers();
});
it('works with JSX in controlled mode', () => {

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