mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 10:59:19 +08:00
Compare commits
127 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
978c086387 | ||
|
|
39cd160641 | ||
|
|
18188317c1 | ||
|
|
05de1a522f | ||
|
|
27a40679ec | ||
|
|
c2292793bc | ||
|
|
1735d89a66 | ||
|
|
49c2a6220b | ||
|
|
b87f76e64a | ||
|
|
df4097ca4d | ||
|
|
22c3097d79 | ||
|
|
70f30ef065 | ||
|
|
42354989e9 | ||
|
|
75c365aa2c | ||
|
|
24e373a812 | ||
|
|
d89ffcc5b2 | ||
|
|
03c180ff08 | ||
|
|
29969959f8 | ||
|
|
980b2cc32b | ||
|
|
aa88c656f1 | ||
|
|
a9537e5934 | ||
|
|
3b0a704df8 | ||
|
|
7a33a9e5d5 | ||
|
|
26b58a9808 | ||
|
|
0c69d721de | ||
|
|
ef55562deb | ||
|
|
bebed2c4ae | ||
|
|
8d6252cfe1 | ||
|
|
537c79785e | ||
|
|
5fd741bf21 | ||
|
|
6c46692160 | ||
|
|
842c7f21d9 | ||
|
|
9f2b4905f0 | ||
|
|
99469bd1b1 | ||
|
|
80a4ee7731 | ||
|
|
3b931e97c4 | ||
|
|
5c00985fed | ||
|
|
17e26ecb71 | ||
|
|
da9d34281b | ||
|
|
2dfd4b2cd5 | ||
|
|
85c7f02ca6 | ||
|
|
b93e33c535 | ||
|
|
d19fa740c7 | ||
|
|
b9120980fb | ||
|
|
4a9277277b | ||
|
|
eab8b42257 | ||
|
|
1c27c28ba9 | ||
|
|
f60e50a5b8 | ||
|
|
21aefd9c06 | ||
|
|
f3b7e3df67 | ||
|
|
fa14765695 | ||
|
|
1329de5ebd | ||
|
|
3ad71ea36a | ||
|
|
be11a6d8b1 | ||
|
|
70569c6d28 | ||
|
|
76c7ce669a | ||
|
|
a9562e75fe | ||
|
|
98387ad819 | ||
|
|
5950c09bf8 | ||
|
|
5afb1a28b6 | ||
|
|
e511c2ac33 | ||
|
|
b50ca50bad | ||
|
|
e4d7e5e510 | ||
|
|
506f97640e | ||
|
|
f2ba99978d | ||
|
|
d47325bf51 | ||
|
|
7c7125b7fa | ||
|
|
7d9a93e7ed | ||
|
|
bbe95e10e1 | ||
|
|
ef9cf00ad3 | ||
|
|
b3f31216df | ||
|
|
d54dfdfac2 | ||
|
|
c29cb15594 | ||
|
|
937f249b38 | ||
|
|
cad2b280e2 | ||
|
|
3c9c4077fa | ||
|
|
7cc05d487c | ||
|
|
cfdb1cab4b | ||
|
|
4332613633 | ||
|
|
38bf0be4ab | ||
|
|
72a5b1fef7 | ||
|
|
2759460908 | ||
|
|
8c442cfaf0 | ||
|
|
024e7c342f | ||
|
|
902fa9fea2 | ||
|
|
1502d3604d | ||
|
|
1f70cb9722 | ||
|
|
63de7fc154 | ||
|
|
dab43f4c7a | ||
|
|
cdb160ae4b | ||
|
|
b7901e541a | ||
|
|
2978644ccd | ||
|
|
ec16d97086 | ||
|
|
6ea33da9f8 | ||
|
|
a8a4152c65 | ||
|
|
a09f531453 | ||
|
|
7a7933038c | ||
|
|
d868c5a58e | ||
|
|
aa9e335145 | ||
|
|
4286131735 | ||
|
|
aa4a619f41 | ||
|
|
0bb531aca6 | ||
|
|
7b90be6326 | ||
|
|
49a53bf8df | ||
|
|
3a98fce47c | ||
|
|
32023c24e5 | ||
|
|
81cb1f4288 | ||
|
|
e0fb5b8866 | ||
|
|
28c589da18 | ||
|
|
65a3982f3f | ||
|
|
efa824e514 | ||
|
|
1d9afb6510 | ||
|
|
200d6cb11a | ||
|
|
9926c3d523 | ||
|
|
a9abe14122 | ||
|
|
a2b6d0a23e | ||
|
|
a760c40665 | ||
|
|
f95cb04585 | ||
|
|
a7b939db43 | ||
|
|
96c312f8fb | ||
|
|
d9062bdb5c | ||
|
|
0f0deff479 | ||
|
|
4f56b4d52d | ||
|
|
6f9c8da502 | ||
|
|
7aa665cc14 | ||
|
|
9cbe6ca6b3 | ||
|
|
9c52014585 |
10
.babelrc
10
.babelrc
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"env": {
|
||||
"test": {
|
||||
"presets": ["es2015", "react", "stage-0"],
|
||||
"plugins": [
|
||||
"add-module-exports"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
65
.github/CONTRIBUTING.md
vendored
65
.github/CONTRIBUTING.md
vendored
@@ -1,66 +1,13 @@
|
||||
# Contributing to Ant Design
|
||||
|
||||
[中文版](./CONTRIBUTING.zh-CN.md)
|
||||
Want to contribute to Ant Design? There are a few things you need to know.
|
||||
|
||||
The following is a set of guidelines for contributing to Ant Design. Please spend several minutes in reading these guidelines before you create an issue or pull request.
|
||||
We wrote a **[contribution guide](https://ant.design/docs/react/contributing)** to help you get started.
|
||||
|
||||
## Code of Conduct
|
||||
---
|
||||
|
||||
We have adopted a [Code of Conduct](../CODE_OF_CONDUCT.md) that we expect project participants to adhere to. Please read the full text so that you can understand what actions will and will not be tolerated.
|
||||
# 参与共建
|
||||
|
||||
## Open Development
|
||||
想要给 Ant Design 贡献自己的一份力量?
|
||||
|
||||
All work on Ant Design happens directly on [GitHub](https://github.com/ant-design). Both core team members and external contributors send pull requests which go through the same review process.
|
||||
|
||||
## Branch Organization
|
||||
|
||||
According to our [release schedule](../CHANGELOG.md#release-schedule), we'll cut a `feature` branch (e.g. `feature-3.1` for 3.1 release) from `master` every month. If you send a bugfix pull request, please do it against the `master` branch, if it's a feature pull request, please do it against the `feature` branch.
|
||||
|
||||
## Bugs
|
||||
|
||||
We are using [GitHub Issues](https://github.com/ant-design/ant-design/issues) for bug tracing. The best way to get your bug fixed is using our [issue helper](http://new-issue.ant.design) and provide a reprduction with this [template](https://u.ant.design/codesandbox-repro).
|
||||
|
||||
Before you reporting a bug, please make sure you've searched exists issues, and read our [FAQ](https://github.com/ant-design/ant-design/wiki/FAQ).
|
||||
|
||||
## Proposing a Change
|
||||
|
||||
If you intend to change the public API or introduce new feature, we also recommend use our [issue helper](http://new-issue.ant.design) to create a feature request issue.
|
||||
|
||||
## Your First Pull Request
|
||||
|
||||
Working on your first Pull Request? You can learn how from this free video series:
|
||||
|
||||
[How to Contribute to an Open Source Project on GitHub](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github)
|
||||
|
||||
To help you get your feet wet and get you familiar with our contribution process, we have a list of [good first issues](https://github.com/ant-design/ant-design/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) that contain bugs or small features that have a relatively limited scope. This is a great place to get started.
|
||||
|
||||
If you decide to fix an issue, please be sure to check the comment thread in case somebody is already working on a fix. If nobody is working on it at the moment, please leave a comment stating that you intend to work on it so other people don’t accidentally duplicate your effort.
|
||||
|
||||
If somebody claims an issue but doesn’t follow up for more than two weeks, it’s fine to take over it but you should still leave a comment.
|
||||
|
||||
## Sending a Pull Request
|
||||
|
||||
The core team is monitoring for pull requests. We will review your pull request and either merge it, request changes to it, or close it with an explanation.
|
||||
|
||||
**Before submitting a pull request**, please make sure the following is done:
|
||||
|
||||
1. Fork the repository and create your branch from [proper branch](./CONTRIBUTING.md#branch-organization).
|
||||
1. Run `npm install` in the repository root.
|
||||
1. If you’ve fixed a bug or added code that should be tested, add tests!
|
||||
1. Ensure the test suite passes (npm run test). Tip: `npm test -- --watch TestName` is helpful in development.
|
||||
1. Run `npm test -- -u` to update [jest snapshot](http://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest) and commit these changes as well (if has).
|
||||
1. Make sure your code lints (npm run lint). Tip: Lint runs automatically when you `git commit`.
|
||||
|
||||
Sending a Pull Request to [react-component](https://github.com/react-component/):
|
||||
|
||||
Since antd's components are based on react-component, sometimes you may need to send pull request to the corresponding react-component repository. If it's a bugfix pull request, after it's merged, the core team will release a patch release for that component as soon as possible, then you only need to do is reinstalling antd in your project to get the latest patch release. If it's a feature pull request, after it's merged, the core team will release a minor release, then you need raise another pull request to [Ant Design](https://github.com/ant-design/ant-design/) to update dependencies, document and TypeScript interfaces (if needed).
|
||||
|
||||
## Development Workflow
|
||||
|
||||
After cloning antd, run `npm install` to fetch its dependencies. Then, you can run several commands:
|
||||
|
||||
1. `npm start` runs Ant Design website locally.
|
||||
1. `npm run lint` checks the code style.
|
||||
1. `npm test` runs the complete test suite.
|
||||
1. `npm run compile` compiles TypeScript code to the `lib` and `es` directory.
|
||||
1. `npm run dist` creates UMD build of antd.
|
||||
我们写了一份 **[贡献指南](https://ant.design/docs/react/contributing-cn)** 来帮助你开始。
|
||||
|
||||
2
.jest.js
2
.jest.js
@@ -37,11 +37,13 @@ module.exports = {
|
||||
'!components/style/index.tsx',
|
||||
'!components/*/locale/index.tsx',
|
||||
'!components/*/__tests__/**/type.tsx',
|
||||
'!components/**/*/interface.{ts,tsx}',
|
||||
],
|
||||
transformIgnorePatterns,
|
||||
snapshotSerializers: [
|
||||
'enzyme-to-json/serializer',
|
||||
],
|
||||
mapCoverage: true,
|
||||
globals: {
|
||||
'ts-jest': {
|
||||
tsConfigFile: './tsconfig.test.json',
|
||||
|
||||
@@ -15,6 +15,83 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
# 3.2.0
|
||||
|
||||
`2018-02-04`
|
||||
|
||||
- 🌟 Add new `tabBarGutter` prop to Tab to allow setting gutter between tabs. [#8644](https://github.com/ant-design/ant-design/pull/8644) [@lixiaoyang1992](https://github.com/lixiaoyang1992)
|
||||
- 🌟 Add new `hasSider` prop to Layout to avoid render error when server rendering. [#8937](https://github.com/ant-design/ant-design/issues/8937)
|
||||
- 🌟 Add new `successPercent` to Progess to alow showing two phases. [Demo](https://ant.design/components/progress/#components-progress-demo-segment)
|
||||
- 🌟 Add new `iconType` prop to Alert to allow settting type of icon. [#8811](https://github.com/ant-design/ant-design/pull/8811) [@minwe](https://github.com/ant-design/ant-design/pull/8811)
|
||||
- 🌟 Add `id` prop to DatePicker. [#8598](https://github.com/ant-design/ant-design/pull/8598) [@mgrdevport](https://github.com/mgrdevport)
|
||||
- 🌟 Add new `forceRender` prop to Collapse to allow rendering hide panel. [#9192](https://github.com/ant-design/ant-design/pull/9192) [#Pyroboomka](https://github.com/ant-design/ant-design/pull/9192) [@paulcmason](https://github.com/react-component/collapse/pull/82)
|
||||
- RangePicker
|
||||
- 🌟 Improve `ranges` prop to allow passing function to it. [#8281](https://github.com/ant-design/ant-design/issues/8281)
|
||||
- 🐞 Fix issue resulting in can not input start date manually. [#6999](https://github.com/ant-design/ant-design/issues/6999)
|
||||
- 🐞 Fix issue resulting date panel being closed without animation when click on the preset range. [#6364](https://github.com/ant-design/ant-design/issues/6364)
|
||||
- 🐞 Fix issue resulting `onOk` is not being trigged, when click on the preset range. [#7747](https://github.com/ant-design/ant-design/issues/7747)
|
||||
- Select
|
||||
- 🌟 Improve `onChange`、`onDeselect`, they will receive selected `Option` as second paramteter.
|
||||
- 🐞 Fix issue resulting in `onSelect` is not trigged when using automatic tokenization. [#9094](https://github.com/ant-design/ant-design/issues/9094)
|
||||
- 🐞 Fix the missing scrollbar in Chrome.
|
||||
- 🌟 Improve Table's `rowSelection[getCheckboxProps]` prop, now the all the properties returned by `getCheckboxProps` will be passed to checkbox. [#9054](https://github.com/ant-design/ant-design/pull/9054) [@mgrdevport](https://github.com/ant-design/ant-design/pull/9054)
|
||||
- 🐞 Fix issue resulting in Calendar's `mode` not being allowed to be changed from outside. [#9243](https://github.com/ant-design/ant-design/pull/9243) [@mgrdevport](https://github.com/ant-design/ant-design/pull/9243)
|
||||
- 🐞 Fix issue resulting AutoComplete showing wrong border when showing validattion message.[9f2b490](https://github.com/ant-design/ant-design/commit/9f2b4905f09fca503da7a8bb5f2b8347bea663b7)
|
||||
- 🐞 Fix issue resulting in DatePicker showing wrong time in the control mode. [#8885](https://github.com/ant-design/ant-design/issues/8885)
|
||||
- 🐞 Fix issue resulting in TextArea showing wrong height in Edge. [#9108](https://github.com/ant-design/ant-design/pull/9108) [@cuyl](https://github.com/cuyl)
|
||||
- 🐞 Fix issue resulting in Tabs showing wrong tab style when using `type="card"` combine with `tabPosition="bottom"`. [#9165](https://github.com/ant-design/ant-design/pull/9165) [@ryanhoho](https://github.com/ryanhoho)
|
||||
- 🌟 Add new Kurdish locale.
|
||||
|
||||
## 3.1.6
|
||||
|
||||
`2018-01-28`
|
||||
|
||||
- 🐞 Revert [#9141](https://github.com/ant-design/ant-design/pull/9141) since it causes year and month can not be selected in DatePicker.
|
||||
|
||||
|
||||
## 3.1.5
|
||||
|
||||
`2018-01-27`
|
||||
|
||||
- 🐞 Fix Select Options were disappeared when click the scrollbar in IE11. [#7934](https://github.com/ant-design/ant-design/issues/7934) [@tianlang89757](https://github.com/tianlang89757)
|
||||
- 🐞 Fix Form `getFieldDecorator` referenced item will conflicted when using the same id. [#9103](https://github.com/ant-design/ant-design/issues/9103) [#7351](https://github.com/ant-design/ant-design/issues/7351)
|
||||
- 🐞 Fix RangePicker i18n issue which will shown the last language when change the language. [#8970](https://github.com/ant-design/ant-design/issues/8970)
|
||||
- 🐞 Fix DatePicker shown wrong in the control mode. [#8885](https://github.com/ant-design/ant-design/issues/8885)
|
||||
- 🐞 Fix Table shown emptyText when loading state. [#9095](https://github.com/ant-design/ant-design/pull/9095) [@sallen450](https://github.com/sallen450)
|
||||
- 🐞 Add Icon `file-word`. [#9092](https://github.com/ant-design/ant-design/issues/9092) [#9061](https://github.com/ant-design/ant-design/issues/9061)
|
||||
- 🐞 Fix wrong font family. [commit/506f97](https://github.com/ant-design/ant-design/commit/506f97640ec34a6d3d9fdb18e8036e5d34796a5f)
|
||||
- 📖 Add some TypeScript type definitions
|
||||
- Add `duration` for Notification. [pull/9120](https://github.com/ant-design/ant-design/pull/9120) [@duhongjun](https://github.com/duhongjun)
|
||||
- Add `style` for Steps. [pull/9126](https://github.com/ant-design/ant-design/pull/9126) [@wanliyunyan](https://github.com/wanliyunyan)
|
||||
- 🌟 Optimize Avatar default background color. [commit/275946](https://github.com/ant-design/ant-design/commit/275946090823ab8da90f1871976c671b2c7ac851)
|
||||
- 🌟 Add the less variable for Slider and Menu. [pull/9065](https://github.com/ant-design/ant-design/pull/9065) [pull/9115](https://github.com/ant-design/ant-design/pull/9115) [@mrgeorgegray](https://github.com/mrgeorgegray)
|
||||
|
||||
## 3.1.4
|
||||
|
||||
`2018-01-21`
|
||||
|
||||
- 🐞 Fix ButtonGroup z-index issue. [#9014](https://github.com/ant-design/ant-design/issues/9014)
|
||||
- 🐞 Fix Dropdown.Button can not be fully disabled. [#8991](https://github.com/ant-design/ant-design/issues/8991) [@sallen450](https://github.com/sallen450)
|
||||
- 🐞 Fix Layout error responsive docs. [#8995](https://github.com/ant-design/ant-design/pull/8995) [@ReedSun](https://github.com/ReedSun)
|
||||
- 🐞 Fix List `grid` do not support xxl. [#9019](https://github.com/ant-design/ant-design/issues/9019)
|
||||
- 🐞 Fix RangePicker can not cancel selected start date when the panel is closed. [#8839](https://github.com/ant-design/ant-design/issues/8839)
|
||||
- 🐞 Fix Tabs error margin. [commit/200d6c](https://github.com/ant-design/ant-design/commit/200d6cb11aba12a488510f957353bbd5bd1dcd1b)
|
||||
- 🐞 Fix WeekPicker shows error weeks. [#9021](https://github.com/ant-design/ant-design/issues/9021)
|
||||
- 🐞 Fix some TypeScript type definitions.
|
||||
- Add `subMenuCloseDelay` and `subMenuOpenDelay` for Menu. [#8976](https://github.com/ant-design/ant-design/issues/8976) [@Rohanhacker](https://github.com/Rohanhacker)
|
||||
- Refactor DatePicker types. [commit/0bb531](https://github.com/ant-design/ant-design/commit/0bb531aca6cb2045d5323196a599c925537a4eb0)
|
||||
- Fix Input `maxLength` type definitions. [#9046](https://github.com/ant-design/ant-design/pull/9046) [@Riokai](https://github.com/Riokai)
|
||||
- 🌟 Add some new less variables.
|
||||
- About Checkbox and Radio: [#9003](https://github.com/ant-design/ant-design/pull/9003) [@mrgeorgegray](https://github.com/mrgeorgegray)
|
||||
- About Breadcrumb: [#9022](https://github.com/ant-design/ant-design/pull/9022) [@mrgeorgegray](https://github.com/mrgeorgegray)
|
||||
- 🌟 Add aliyun icon.
|
||||
|
||||
## 3.1.3
|
||||
|
||||
`2018-01-14`
|
||||
|
||||
- 🐞 Fix error when passing `null` `locale` to LocaleProvider.
|
||||
|
||||
## 3.1.2
|
||||
|
||||
`2018-01-13`
|
||||
|
||||
@@ -15,6 +15,83 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
## 3.2.0
|
||||
|
||||
`2018-02-04`
|
||||
|
||||
- 🌟 Tab 新增 `tabBarGutter` 属性,用于设置 tabs 之间的间隙。[#8644](https://github.com/ant-design/ant-design/pull/8644) [@lixiaoyang1992](https://github.com/lixiaoyang1992)
|
||||
- 🌟 Layout 新增 `hasSider` 属性,用于避免服务端渲染时显示问题。[#8937](https://github.com/ant-design/ant-design/issues/8937)
|
||||
- 🌟 Progress 新增 `successPercent` 属性,用于显示分段进度条。[例子](https://ant.design/components/progress-cn/#components-progress-demo-segment)
|
||||
- 🌟 Alert 新增 `iconType` 属性,用于显示自定义图标。[#8811](https://github.com/ant-design/ant-design/pull/8811) [@minwe](https://github.com/ant-design/ant-design/pull/8811)
|
||||
- 🌟 DatePicker 新增 `id` 属性。[#8598](https://github.com/ant-design/ant-design/pull/8598) [@mgrdevport](https://github.com/mgrdevport)
|
||||
- 🌟 Collapse 新增 `forceRender` 属性,用于渲染隐藏的内容。[#9192](https://github.com/ant-design/ant-design/pull/9192) [#Pyroboomka](https://github.com/ant-design/ant-design/pull/9192) [@paulcmason](https://github.com/react-component/collapse/pull/82)
|
||||
- RangePicker
|
||||
- 🌟 改进 `ranges` 属性,使其支持方法。[#8281](https://github.com/ant-design/ant-design/issues/8281)
|
||||
- 🐞 修复无法手动输入开始时间的问题。[#6999](https://github.com/ant-design/ant-design/issues/6999)
|
||||
- 🐞 修复点击预设范围关闭日期面板的时候没有动画的问题。[#6364](https://github.com/ant-design/ant-design/issues/6364)
|
||||
- 🐞 修复点击预设范围时不触发 `onOk` 的问题。[#7747](https://github.com/ant-design/ant-design/issues/7747)
|
||||
- Select
|
||||
- 🌟 改进了 `onChange`、`onDeselect` 方法,现在他们会接受选中的 `Option` 作为第二个参数。
|
||||
- 🐞 修复自动分词不触发 `onSelect` 的问题。[#9094](https://github.com/ant-design/ant-design/issues/9094)
|
||||
- 🐞 修复 Chrome 上下拉框没有滚动条的问题。
|
||||
- 🌟 改进 Table 的 `rowSelection[getCheckboxProps]` 属性,现在可以传任意属性给 chekbox 了。[#9054](https://github.com/ant-design/ant-design/pull/9054) [@mgrdevport](https://github.com/ant-design/ant-design/pull/9054)
|
||||
- 🐞 修复 Calendar 的 `mode` 属性不能从外部控制的问题。[#9243](https://github.com/ant-design/ant-design/pull/9243) [@mgrdevport](https://github.com/ant-design/ant-design/pull/9243)
|
||||
- 🐞 修复 AutoComplete 在 Form 中显示错误信息时的边框颜色。[9f2b490](https://github.com/ant-design/ant-design/commit/9f2b4905f09fca503da7a8bb5f2b8347bea663b7)
|
||||
- 🐞 修复 DatePicker 在受控模式下时间显示不正确的问题。[#8885](https://github.com/ant-design/ant-design/issues/8885)
|
||||
- 🐞 修复 TextArea 在 Edge 下高度计算错误的问题。[#9108](https://github.com/ant-design/ant-design/pull/9108) [@cuyl](https://github.com/cuyl)
|
||||
- 🐞 修复 Tabs 在 card 模式且 tabPosition 是 `bottom` 时的样式问题。[#9165](https://github.com/ant-design/ant-design/pull/9165) [@ryanhoho](https://github.com/ryanhoho)
|
||||
- 🌟 新增库尔德语。
|
||||
|
||||
|
||||
## 3.1.6
|
||||
|
||||
`2018-01-28`
|
||||
|
||||
- 🐞 回退了 [#9141](https://github.com/ant-design/ant-design/pull/9141) 的修改,因其导致的 DatePicker 年月无法选择。
|
||||
|
||||
## 3.1.5
|
||||
|
||||
`2018-01-27`
|
||||
|
||||
- 🐞 修复了 Select 下拉选择框在 IE11 点击滚动条会无故消失的问题。[#7934](https://github.com/ant-design/ant-design/issues/7934) [@tianlang89757](https://github.com/tianlang89757)
|
||||
- 🐞 修复了 Form 中使用 `getFieldDecorator` 当 id 重复时引用冲突的问题。[#9103](https://github.com/ant-design/ant-design/issues/9103) [#7351](https://github.com/ant-design/ant-design/issues/7351)
|
||||
- 🐞 修复了 RangePicker 在语言切换时会显示上一次的语言的问题。[#8970](https://github.com/ant-design/ant-design/issues/8970)
|
||||
- 🐞 修复了 DatePicker 在受控模式下时间显示不正确的问题。[#8885](https://github.com/ant-design/ant-design/issues/8885)
|
||||
- 🐞 修复了 Table 在 `loading` 时显示空提示的问题。[#9095](https://github.com/ant-design/ant-design/pull/9095) [@sallen450](https://github.com/sallen450)
|
||||
- 🐞 补充 Icon 类型 `file-word`。[#9092](https://github.com/ant-design/ant-design/issues/9092) [#9061](https://github.com/ant-design/ant-design/issues/9061)
|
||||
- 🐞 修复写错的字体名称,造成浏览器无法正确识别的问题。[commit/506f97](https://github.com/ant-design/ant-design/commit/506f97640ec34a6d3d9fdb18e8036e5d34796a5f)
|
||||
- 📖 修复了 TypeScript 定义
|
||||
- 补充 Notification 缺失的 `duration` 定义。[pull/9120](https://github.com/ant-design/ant-design/pull/9120) [@duhongjun](https://github.com/duhongjun)
|
||||
- 补充 Steps 缺失的 `style` 定义。[pull/9126](https://github.com/ant-design/ant-design/pull/9126) [@wanliyunyan](https://github.com/wanliyunyan)
|
||||
- 🌟 优化了 Avatar 的默认背景色。[commit/275946](https://github.com/ant-design/ant-design/commit/275946090823ab8da90f1871976c671b2c7ac851)
|
||||
- 🌟 新增了 Slider 以及 Menu 的 less 变量,更加方便的修改主题。[pull/9065](https://github.com/ant-design/ant-design/pull/9065) [pull/9115](https://github.com/ant-design/ant-design/pull/9115) [@mrgeorgegray](https://github.com/mrgeorgegray)
|
||||
|
||||
## 3.1.4
|
||||
|
||||
`2018-01-21`
|
||||
|
||||
- 🐞 修复 ButtonGroup 错误 z-index 导致的样式问题。[#9014](https://github.com/ant-design/ant-design/issues/9014)
|
||||
- 🐞 修复 Dropdown.Button 不能被完全禁用的问题。[#8991](https://github.com/ant-design/ant-design/issues/8991) [@sallen450](https://github.com/sallen450)
|
||||
- 🐞 修复 Layout 错误的响应式相关文档。[#8995](https://github.com/ant-design/ant-design/pull/8995) [@ReedSun](https://github.com/ReedSun)
|
||||
- 🐞 修复 List `grid` 不支持 xxl 配置的问题。[#9019](https://github.com/ant-design/ant-design/issues/9019)
|
||||
- 🐞 修复 RangePicker 关闭选择面板之后无法清空已选开始时间的问题。[#8839](https://github.com/ant-design/ant-design/issues/8839)
|
||||
- 🐞 修复 Tabs 错误外边距导致的样式问题。[commit/200d6c](https://github.com/ant-design/ant-design/commit/200d6cb11aba12a488510f957353bbd5bd1dcd1b)
|
||||
- 🐞 修复 WeekPicker 显示错误周数的问题。[#9021](https://github.com/ant-design/ant-design/issues/9021)
|
||||
- 🐞 修复 TypeScript 定义
|
||||
- 补充 Menu 缺失的 `subMenuCloseDelay` 和 `subMenuOpenDelay`。[#8976](https://github.com/ant-design/ant-design/issues/8976) [@Rohanhacker](https://github.com/Rohanhacker)
|
||||
- 重构了 DatePicker 相关 type 定义。[commit/0bb531](https://github.com/ant-design/ant-design/commit/0bb531aca6cb2045d5323196a599c925537a4eb0)
|
||||
- 修复了 Input `maxLength` type 定义。[#9046](https://github.com/ant-design/ant-design/pull/9046) [@Riokai](https://github.com/Riokai)
|
||||
- 🌟 新增 less 变量
|
||||
- Checkbox 和 Radio 相关:[#9003](https://github.com/ant-design/ant-design/pull/9003) [@mrgeorgegray](https://github.com/mrgeorgegray)
|
||||
- Breadcrumb 相关:[#9022](https://github.com/ant-design/ant-design/pull/9022) [@mrgeorgegray](https://github.com/mrgeorgegray)
|
||||
- 🌟 新增 aliyun 图标。
|
||||
|
||||
## 3.1.3
|
||||
|
||||
`2018-01-14`
|
||||
|
||||
- 🐞 修复 `locale` 为 `null` 时 LocaleProvider 出错的问题。
|
||||
|
||||
## 3.1.2
|
||||
|
||||
`2018-01-13`
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
## 参与共建 [](http://makeapullrequest.com)
|
||||
|
||||
`antd` 是一个开源项目,我们欢迎社区参与共建。如果你对此项目感兴趣,有 [很多方式](https://opensource.guide/how-to-contribute/) 进行参与。你可以 watch 这个仓库,加入 [issue 中的讨论](https://github.com/ant-design/ant-design/issues?q=is%3Aopen+is%3Aissue+label%3ADiscussion),以及尝试实现一些 [已接受的特性](https://github.com/ant-design/ant-design/issues?q=is%3Aopen+is%3Aissue+label%3A%22PR+welcome%22)。我们会给予有活跃贡献的社区成员 [collaborator 权限](https://github.com/ant-design/ant-design/issues/3222)。
|
||||
请参考[贡献指南](https://ant.design/docs/react/contributing-cn).
|
||||
|
||||
## 安装
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ An enterprise-class UI design language and React-based implementation.
|
||||
|
||||
## Let's build a better antd together [](http://makeapullrequest.com)
|
||||
|
||||
Read our [contributing guide](./.github/CONTRIBUTING.md).
|
||||
Read our [contributing guide](https://ant.design/docs/react/contributing).
|
||||
|
||||
## Install
|
||||
|
||||
|
||||
@@ -21,5 +21,6 @@ Alert component for feedback.
|
||||
| description | Additional content of Alert | string\|ReactNode | - |
|
||||
| message | Content of Alert | string\|ReactNode | - |
|
||||
| showIcon | Whether to show icon | boolean | false, in `banner` mode default is true |
|
||||
| iconType | Icon type, effective when `showIcon` is `true` | string | - |
|
||||
| type | Type of Alert styles, options: `success`, `info`, `warning`, `error` | string | `info`, in `banner` mode default is `warning` |
|
||||
| onClose | Callback when Alert is closed | Function | - |
|
||||
|
||||
@@ -23,6 +23,7 @@ export interface AlertProps {
|
||||
onClose?: React.MouseEventHandler<HTMLAnchorElement>;
|
||||
/** Whether to show icon */
|
||||
showIcon?: boolean;
|
||||
iconType?: string;
|
||||
style?: React.CSSProperties;
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
@@ -59,7 +60,7 @@ export default class Alert extends React.Component<AlertProps, any> {
|
||||
render() {
|
||||
let {
|
||||
closable, description, type, prefixCls = 'ant-alert', message, closeText, showIcon, banner,
|
||||
className = '', style,
|
||||
className = '', style, iconType,
|
||||
} = this.props;
|
||||
|
||||
// banner模式默认有 Icon
|
||||
@@ -67,27 +68,28 @@ export default class Alert extends React.Component<AlertProps, any> {
|
||||
// banner模式默认为警告
|
||||
type = banner && type === undefined ? 'warning' : type || 'info';
|
||||
|
||||
let iconType = '';
|
||||
switch (type) {
|
||||
case 'success':
|
||||
iconType = 'check-circle';
|
||||
break;
|
||||
case 'info':
|
||||
iconType = 'info-circle';
|
||||
break;
|
||||
case 'error':
|
||||
iconType = 'cross-circle';
|
||||
break;
|
||||
case 'warning':
|
||||
iconType = 'exclamation-circle';
|
||||
break;
|
||||
default:
|
||||
iconType = 'default';
|
||||
}
|
||||
if (!iconType) {
|
||||
switch (type) {
|
||||
case 'success':
|
||||
iconType = 'check-circle';
|
||||
break;
|
||||
case 'info':
|
||||
iconType = 'info-circle';
|
||||
break;
|
||||
case 'error':
|
||||
iconType = 'cross-circle';
|
||||
break;
|
||||
case 'warning':
|
||||
iconType = 'exclamation-circle';
|
||||
break;
|
||||
default:
|
||||
iconType = 'default';
|
||||
}
|
||||
|
||||
// use outline icon in alert with description
|
||||
if (!!description) {
|
||||
iconType += '-o';
|
||||
// use outline icon in alert with description
|
||||
if (!!description) {
|
||||
iconType += '-o';
|
||||
}
|
||||
}
|
||||
|
||||
let alertCls = classNames(prefixCls, {
|
||||
|
||||
@@ -22,5 +22,6 @@ title: Alert
|
||||
| description | 警告提示的辅助性文字介绍 | string\|ReactNode | 无 |
|
||||
| message | 警告提示内容 | string\|ReactNode | 无 |
|
||||
| showIcon | 是否显示辅助图标 | boolean | false,`banner` 模式下默认值为 true |
|
||||
| iconType | 自定义图标类型,`showIcon` 为 `true` 时有效 | string | - |
|
||||
| type | 指定警告提示的样式,有四种选择 `success`、`info`、`warning`、`error` | string | `info`,`banner` 模式下默认值为 `warning` |
|
||||
| onClose | 关闭时触发的回调函数 | Function | 无 |
|
||||
|
||||
@@ -12,6 +12,11 @@
|
||||
white-space: nowrap;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
vertical-align: middle;
|
||||
|
||||
&-image {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.avatar-size(@avatar-size-base, @avatar-font-size-base);
|
||||
|
||||
|
||||
@@ -5,22 +5,23 @@
|
||||
|
||||
.@{breadcrumb-prefix-cls} {
|
||||
.reset-component;
|
||||
color: @text-color-secondary;
|
||||
color: @breadcrumb-base-color;
|
||||
font-size: @breadcrumb-font-size;
|
||||
|
||||
.@{iconfont-css-prefix} {
|
||||
font-size: @font-size-sm;
|
||||
font-size: @breadcrumb-icon-font-size;
|
||||
}
|
||||
|
||||
a {
|
||||
color: @text-color-secondary;
|
||||
color: @breadcrumb-link-color;
|
||||
transition: color .3s;
|
||||
&:hover {
|
||||
color: @primary-5;
|
||||
color: @breadcrumb-link-color-hover;
|
||||
}
|
||||
}
|
||||
|
||||
& > span:last-child {
|
||||
color: @text-color;
|
||||
color: @breadcrumb-last-item-color;
|
||||
}
|
||||
|
||||
& > span:last-child &-separator {
|
||||
@@ -28,8 +29,8 @@
|
||||
}
|
||||
|
||||
&-separator {
|
||||
margin: 0 @padding-xs;
|
||||
color: @text-color-secondary;
|
||||
margin: @breadcrumb-separator-margin;
|
||||
color: @breadcrumb-separator-color;
|
||||
}
|
||||
|
||||
&-link {
|
||||
|
||||
@@ -481,6 +481,7 @@ exports[`renders ./components/button/demo/size.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="large"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -499,6 +500,7 @@ exports[`renders ./components/button/demo/size.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="default"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -517,6 +519,7 @@ exports[`renders ./components/button/demo/size.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="small"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
}
|
||||
|
||||
&-background-ghost&-primary {
|
||||
.button-variant-ghost(@primary-color);
|
||||
.button-variant-ghost(@btn-primary-bg);
|
||||
}
|
||||
|
||||
&-background-ghost&-danger {
|
||||
|
||||
@@ -108,7 +108,6 @@
|
||||
display: inline-block;
|
||||
> .@{btnClassName} {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
|
||||
&:hover,
|
||||
&:focus,
|
||||
|
||||
@@ -84,6 +84,7 @@ exports[`renders ./components/calendar/demo/basic.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="date"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -102,6 +103,7 @@ exports[`renders ./components/calendar/demo/basic.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="month"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -1091,6 +1093,7 @@ exports[`renders ./components/calendar/demo/card.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="date"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -1109,6 +1112,7 @@ exports[`renders ./components/calendar/demo/card.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="month"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -2096,6 +2100,7 @@ exports[`renders ./components/calendar/demo/notice-calendar.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="date"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -2114,6 +2119,7 @@ exports[`renders ./components/calendar/demo/notice-calendar.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="month"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -3511,6 +3517,7 @@ exports[`renders ./components/calendar/demo/select.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="date"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -3529,6 +3536,7 @@ exports[`renders ./components/calendar/demo/select.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="month"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
|
||||
@@ -14,4 +14,28 @@ describe('Calendar', () => {
|
||||
const value = onSelect.mock.calls[0][0];
|
||||
expect(Moment.isMoment(value)).toBe(true);
|
||||
});
|
||||
|
||||
it('Calendar should change mode by prop', () => {
|
||||
const monthMode = 'month';
|
||||
const yearMode = 'year';
|
||||
const wrapper = mount(
|
||||
<Calendar />
|
||||
);
|
||||
expect(wrapper.state().mode).toEqual(monthMode);
|
||||
wrapper.setProps({ mode: 'year' });
|
||||
expect(wrapper.state().mode).toEqual(yearMode);
|
||||
});
|
||||
|
||||
it('Calendar should switch mode', () => {
|
||||
const monthMode = 'month';
|
||||
const yearMode = 'year';
|
||||
const onPanelChangeStub = jest.fn();
|
||||
const wrapper = mount(
|
||||
<Calendar mode={yearMode} onPanelChange={onPanelChangeStub} />
|
||||
);
|
||||
expect(wrapper.state().mode).toEqual(yearMode);
|
||||
wrapper.instance().setType('date');
|
||||
expect(wrapper.state().mode).toEqual(monthMode);
|
||||
expect(onPanelChangeStub).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -91,6 +91,11 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
|
||||
value: nextProps.value!,
|
||||
});
|
||||
}
|
||||
if ('mode' in nextProps && nextProps.mode !== this.props.mode) {
|
||||
this.setState({
|
||||
mode: nextProps.mode!,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
monthCellRender = (value: moment.Moment) => {
|
||||
|
||||
2
components/calendar/locale/ku_IQ.tsx
Executable file
2
components/calendar/locale/ku_IQ.tsx
Executable file
@@ -0,0 +1,2 @@
|
||||
import ku_IQ from '../../date-picker/locale/ku_IQ';
|
||||
export default ku_IQ;
|
||||
@@ -30,17 +30,15 @@ exports[`renders ./components/card/demo/basic.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
<p>
|
||||
Card content
|
||||
</p>
|
||||
<p>
|
||||
Card content
|
||||
</p>
|
||||
<p>
|
||||
Card content
|
||||
</p>
|
||||
</div>
|
||||
<p>
|
||||
Card content
|
||||
</p>
|
||||
<p>
|
||||
Card content
|
||||
</p>
|
||||
<p>
|
||||
Card content
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -69,17 +67,15 @@ exports[`renders ./components/card/demo/border-less.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
<p>
|
||||
Card content
|
||||
</p>
|
||||
<p>
|
||||
Card content
|
||||
</p>
|
||||
<p>
|
||||
Card content
|
||||
</p>
|
||||
</div>
|
||||
<p>
|
||||
Card content
|
||||
</p>
|
||||
<p>
|
||||
Card content
|
||||
</p>
|
||||
<p>
|
||||
Card content
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -101,23 +97,21 @@ exports[`renders ./components/card/demo/flexible-content.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
<div
|
||||
class="ant-card-meta"
|
||||
>
|
||||
<div
|
||||
class="ant-card-meta"
|
||||
class="ant-card-meta-detail"
|
||||
>
|
||||
<div
|
||||
class="ant-card-meta-detail"
|
||||
class="ant-card-meta-title"
|
||||
>
|
||||
<div
|
||||
class="ant-card-meta-title"
|
||||
>
|
||||
Europe Street beat
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-meta-description"
|
||||
>
|
||||
www.instagram.com
|
||||
</div>
|
||||
Europe Street beat
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-meta-description"
|
||||
>
|
||||
www.instagram.com
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -145,49 +139,47 @@ exports[`renders ./components/card/demo/grid-card.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center"
|
||||
>
|
||||
Content
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center"
|
||||
>
|
||||
Content
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center"
|
||||
>
|
||||
Content
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center"
|
||||
>
|
||||
Content
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center"
|
||||
>
|
||||
Content
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center"
|
||||
>
|
||||
Content
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center"
|
||||
>
|
||||
Content
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center"
|
||||
>
|
||||
Content
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center"
|
||||
>
|
||||
Content
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center"
|
||||
>
|
||||
Content
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center"
|
||||
>
|
||||
Content
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center"
|
||||
>
|
||||
Content
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center"
|
||||
>
|
||||
Content
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-grid"
|
||||
style="width:25%;text-align:center"
|
||||
>
|
||||
Content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -224,9 +216,7 @@ exports[`renders ./components/card/demo/in-column.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Card content
|
||||
</div>
|
||||
Card content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -253,9 +243,7 @@ exports[`renders ./components/card/demo/in-column.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Card content
|
||||
</div>
|
||||
Card content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -282,9 +270,7 @@ exports[`renders ./components/card/demo/in-column.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Card content
|
||||
</div>
|
||||
Card content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -312,79 +298,73 @@ exports[`renders ./components/card/demo/inner.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
<p
|
||||
style="font-size:14px;color:rgba(0, 0, 0, 0.85);margin-bottom:16px;font-weight:500"
|
||||
>
|
||||
Group title
|
||||
</p>
|
||||
<p
|
||||
style="font-size:14px;color:rgba(0, 0, 0, 0.85);margin-bottom:16px;font-weight:500"
|
||||
>
|
||||
Group title
|
||||
</p>
|
||||
<div
|
||||
class="ant-card ant-card-bordered ant-card-type-inner"
|
||||
>
|
||||
<div
|
||||
class="ant-card ant-card-bordered ant-card-type-inner"
|
||||
class="ant-card-head"
|
||||
>
|
||||
<div
|
||||
class="ant-card-head"
|
||||
class="ant-card-head-wrapper"
|
||||
>
|
||||
<div
|
||||
class="ant-card-head-wrapper"
|
||||
class="ant-card-head-title"
|
||||
>
|
||||
<div
|
||||
class="ant-card-head-title"
|
||||
>
|
||||
Inner Card title
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-extra"
|
||||
>
|
||||
<a
|
||||
href="#"
|
||||
>
|
||||
More
|
||||
</a>
|
||||
</div>
|
||||
Inner Card title
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Inner Card content
|
||||
<div
|
||||
class="ant-card-extra"
|
||||
>
|
||||
<a
|
||||
href="#"
|
||||
>
|
||||
More
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-card ant-card-bordered ant-card-type-inner"
|
||||
style="margin-top:16px"
|
||||
class="ant-card-body"
|
||||
>
|
||||
Inner Card content
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-card ant-card-bordered ant-card-type-inner"
|
||||
style="margin-top:16px"
|
||||
>
|
||||
<div
|
||||
class="ant-card-head"
|
||||
>
|
||||
<div
|
||||
class="ant-card-head"
|
||||
class="ant-card-head-wrapper"
|
||||
>
|
||||
<div
|
||||
class="ant-card-head-wrapper"
|
||||
class="ant-card-head-title"
|
||||
>
|
||||
<div
|
||||
class="ant-card-head-title"
|
||||
Inner Card title
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-extra"
|
||||
>
|
||||
<a
|
||||
href="#"
|
||||
>
|
||||
Inner Card title
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-extra"
|
||||
>
|
||||
<a
|
||||
href="#"
|
||||
>
|
||||
More
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Inner Card content
|
||||
More
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
Inner Card content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -483,34 +463,32 @@ exports[`renders ./components/card/demo/meta.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
<div
|
||||
class="ant-card-meta"
|
||||
>
|
||||
<div
|
||||
class="ant-card-meta"
|
||||
class="ant-card-meta-avatar"
|
||||
>
|
||||
<span
|
||||
class="ant-avatar ant-avatar-circle ant-avatar-image"
|
||||
>
|
||||
<img
|
||||
src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-meta-detail"
|
||||
>
|
||||
<div
|
||||
class="ant-card-meta-avatar"
|
||||
class="ant-card-meta-title"
|
||||
>
|
||||
<span
|
||||
class="ant-avatar ant-avatar-circle ant-avatar-image"
|
||||
>
|
||||
<img
|
||||
src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
|
||||
/>
|
||||
</span>
|
||||
Card title
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-meta-detail"
|
||||
class="ant-card-meta-description"
|
||||
>
|
||||
<div
|
||||
class="ant-card-meta-title"
|
||||
>
|
||||
Card title
|
||||
</div>
|
||||
<div
|
||||
class="ant-card-meta-description"
|
||||
>
|
||||
This is the description
|
||||
</div>
|
||||
This is the description
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -557,17 +535,15 @@ exports[`renders ./components/card/demo/simple.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
<p>
|
||||
Card content
|
||||
</p>
|
||||
<p>
|
||||
Card content
|
||||
</p>
|
||||
<p>
|
||||
Card content
|
||||
</p>
|
||||
</div>
|
||||
<p>
|
||||
Card content
|
||||
</p>
|
||||
<p>
|
||||
Card content
|
||||
</p>
|
||||
<p>
|
||||
Card content
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -679,11 +655,9 @@ exports[`renders ./components/card/demo/tabs.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
<p>
|
||||
content1
|
||||
</p>
|
||||
</div>
|
||||
<p>
|
||||
content1
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
@@ -791,11 +765,9 @@ exports[`renders ./components/card/demo/tabs.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
<p>
|
||||
article content
|
||||
</p>
|
||||
</div>
|
||||
<p>
|
||||
article content
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -180,7 +180,7 @@ export default class Card extends React.Component<CardProps, {}> {
|
||||
const coverDom = cover ? <div className={`${prefixCls}-cover`}>{cover}</div> : null;
|
||||
const body = (
|
||||
<div className={`${prefixCls}-body`} style={bodyStyle}>
|
||||
{loading ? loadingBlock : <div>{children}</div>}
|
||||
{loading ? loadingBlock : children}
|
||||
</div>
|
||||
);
|
||||
const actionDom = actions && actions.length ?
|
||||
|
||||
@@ -69,6 +69,30 @@ exports[`renders ./components/carousel/demo/autoplay.md correctly 1`] = `
|
||||
1
|
||||
</h3>
|
||||
</div>
|
||||
<div
|
||||
class="slick-slide slick-cloned"
|
||||
data-index="5"
|
||||
>
|
||||
<h3>
|
||||
2
|
||||
</h3>
|
||||
</div>
|
||||
<div
|
||||
class="slick-slide slick-cloned"
|
||||
data-index="6"
|
||||
>
|
||||
<h3>
|
||||
3
|
||||
</h3>
|
||||
</div>
|
||||
<div
|
||||
class="slick-slide slick-cloned"
|
||||
data-index="7"
|
||||
>
|
||||
<h3>
|
||||
4
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -144,6 +168,30 @@ exports[`renders ./components/carousel/demo/basic.md correctly 1`] = `
|
||||
1
|
||||
</h3>
|
||||
</div>
|
||||
<div
|
||||
class="slick-slide slick-cloned"
|
||||
data-index="5"
|
||||
>
|
||||
<h3>
|
||||
2
|
||||
</h3>
|
||||
</div>
|
||||
<div
|
||||
class="slick-slide slick-cloned"
|
||||
data-index="6"
|
||||
>
|
||||
<h3>
|
||||
3
|
||||
</h3>
|
||||
</div>
|
||||
<div
|
||||
class="slick-slide slick-cloned"
|
||||
data-index="7"
|
||||
>
|
||||
<h3>
|
||||
4
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -278,6 +326,30 @@ exports[`renders ./components/carousel/demo/vertical.md correctly 1`] = `
|
||||
1
|
||||
</h3>
|
||||
</div>
|
||||
<div
|
||||
class="slick-slide slick-cloned"
|
||||
data-index="5"
|
||||
>
|
||||
<h3>
|
||||
2
|
||||
</h3>
|
||||
</div>
|
||||
<div
|
||||
class="slick-slide slick-cloned"
|
||||
data-index="6"
|
||||
>
|
||||
<h3>
|
||||
3
|
||||
</h3>
|
||||
</div>
|
||||
<div
|
||||
class="slick-slide slick-cloned"
|
||||
data-index="7"
|
||||
>
|
||||
<h3>
|
||||
4
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -59,6 +59,7 @@ exports[`renders ./components/checkbox/demo/check-all.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-checkbox-input"
|
||||
type="checkbox"
|
||||
value="Apple"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
@@ -77,6 +78,7 @@ exports[`renders ./components/checkbox/demo/check-all.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
type="checkbox"
|
||||
value="Pear"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
@@ -96,6 +98,7 @@ exports[`renders ./components/checkbox/demo/check-all.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-checkbox-input"
|
||||
type="checkbox"
|
||||
value="Orange"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
@@ -210,6 +213,7 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-checkbox-input"
|
||||
type="checkbox"
|
||||
value="Apple"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
@@ -228,6 +232,7 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
type="checkbox"
|
||||
value="Pear"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
@@ -246,6 +251,7 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
type="checkbox"
|
||||
value="Orange"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
@@ -270,6 +276,7 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
type="checkbox"
|
||||
value="Apple"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
@@ -289,6 +296,7 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-checkbox-input"
|
||||
type="checkbox"
|
||||
value="Pear"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
@@ -307,6 +315,7 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
type="checkbox"
|
||||
value="Orange"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
@@ -333,6 +342,7 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
|
||||
class="ant-checkbox-input"
|
||||
disabled=""
|
||||
type="checkbox"
|
||||
value="Apple"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
@@ -352,6 +362,7 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
|
||||
class="ant-checkbox-input"
|
||||
disabled=""
|
||||
type="checkbox"
|
||||
value="Pear"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
@@ -371,6 +382,7 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
|
||||
class="ant-checkbox-input"
|
||||
disabled=""
|
||||
type="checkbox"
|
||||
value="Orange"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
@@ -404,6 +416,7 @@ exports[`renders ./components/checkbox/demo/layout.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
type="checkbox"
|
||||
value="A"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
@@ -426,6 +439,7 @@ exports[`renders ./components/checkbox/demo/layout.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
type="checkbox"
|
||||
value="B"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
@@ -448,6 +462,7 @@ exports[`renders ./components/checkbox/demo/layout.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
type="checkbox"
|
||||
value="C"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
@@ -470,6 +485,7 @@ exports[`renders ./components/checkbox/demo/layout.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
type="checkbox"
|
||||
value="D"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
@@ -492,6 +508,7 @@ exports[`renders ./components/checkbox/demo/layout.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
type="checkbox"
|
||||
value="E"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
.@{checkbox-prefix-cls}-wrapper:hover &-inner,
|
||||
&:hover &-inner,
|
||||
&-input:focus + &-inner {
|
||||
border-color: @primary-color;
|
||||
border-color: @checkbox-color;
|
||||
}
|
||||
|
||||
&-checked:after {
|
||||
@@ -27,7 +27,7 @@
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: @border-radius-sm;
|
||||
border: 1px solid @primary-color;
|
||||
border: 1px solid @checkbox-color;
|
||||
content: '';
|
||||
animation: antCheckboxEffect 0.36s ease-in-out;
|
||||
animation-fill-mode: both;
|
||||
@@ -115,8 +115,8 @@
|
||||
.@{checkbox-prefix-cls}-checked,
|
||||
.@{checkbox-prefix-cls}-indeterminate {
|
||||
.@{checkbox-inner-prefix-cls} {
|
||||
background-color: @primary-color;
|
||||
border-color: @primary-color;
|
||||
background-color: @checkbox-color;
|
||||
border-color: @checkbox-color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ export interface CollapsePanelProps {
|
||||
style?: React.CSSProperties;
|
||||
showArrow?: boolean;
|
||||
prefixCls?: string;
|
||||
forceRender?: boolean;
|
||||
}
|
||||
|
||||
export default class CollapsePanel extends React.Component<CollapsePanelProps, {}> {
|
||||
|
||||
@@ -30,3 +30,4 @@ A content area which can be collapsed and expanded.
|
||||
| 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` |
|
||||
| forceRender | Forced render of content on panel, instead of lazy rending after clicking on header | boolean | `false` |
|
||||
|
||||
@@ -30,3 +30,4 @@ cols: 1
|
||||
| disabled | 禁用后的面板展开与否将无法通过用户交互改变 | boolean | false |
|
||||
| header | 面板头内容 | string\|ReactNode | 无 |
|
||||
| key | 对应 activeKey | string | 无 |
|
||||
| forceRender | 被隐藏时是否渲染 DOM 结构 | boolean | false |
|
||||
|
||||
@@ -7,8 +7,7 @@ import classNames from 'classnames';
|
||||
import Icon from '../icon';
|
||||
import warning from '../_util/warning';
|
||||
import callMoment from '../_util/callMoment';
|
||||
|
||||
export type RangePickerValue = moment.Moment[];
|
||||
import { RangePickerValue, RangePickerPresetRange } from './interface';
|
||||
|
||||
export interface RangePickerState {
|
||||
value?: RangePickerValue;
|
||||
@@ -17,21 +16,21 @@ export interface RangePickerState {
|
||||
hoverValue?: RangePickerValue;
|
||||
}
|
||||
|
||||
function getShowDateFromValue(value: moment.Moment[]): moment.Moment[] | undefined {
|
||||
function getShowDateFromValue(value: RangePickerValue) {
|
||||
const [start, end] = value;
|
||||
// value could be an empty array, then we should not reset showDate
|
||||
if (!start && !end) {
|
||||
return;
|
||||
}
|
||||
const newEnd = end && end.isSame(start, 'month') ? end.clone().add(1, 'month') : end;
|
||||
return [start, newEnd];
|
||||
return [start, newEnd] as RangePickerValue;
|
||||
}
|
||||
|
||||
function formatValue(value: moment.Moment | undefined, format: string): string {
|
||||
return (value && value.format(format)) || '';
|
||||
}
|
||||
|
||||
function pickerValueAdapter(value?: moment.Moment | moment.Moment[]): moment.Moment[] | undefined {
|
||||
function pickerValueAdapter(value?: moment.Moment | RangePickerValue): RangePickerValue | undefined {
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
@@ -48,6 +47,21 @@ function isEmptyArray(arr: any) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function fixLocale(value: RangePickerValue | undefined, localeCode: string) {
|
||||
if (!localeCode) {
|
||||
return;
|
||||
}
|
||||
if (!value || value.length === 0) {
|
||||
return;
|
||||
}
|
||||
if (value[0]) {
|
||||
value[0]!.locale(localeCode);
|
||||
}
|
||||
if (value[1]) {
|
||||
value[1]!.locale(localeCode);
|
||||
}
|
||||
}
|
||||
|
||||
export default class RangePicker extends React.Component<any, RangePickerState> {
|
||||
static defaultProps = {
|
||||
prefixCls: 'ant-calendar',
|
||||
@@ -103,7 +117,7 @@ export default class RangePicker extends React.Component<any, RangePickerState>
|
||||
|
||||
clearHoverValue = () => this.setState({ hoverValue: [] });
|
||||
|
||||
handleChange = (value: moment.Moment[]) => {
|
||||
handleChange = (value: RangePickerValue) => {
|
||||
const props = this.props;
|
||||
if (!('value' in props)) {
|
||||
this.setState(({ showDate }) => ({
|
||||
@@ -122,6 +136,10 @@ export default class RangePicker extends React.Component<any, RangePickerState>
|
||||
this.setState({ open });
|
||||
}
|
||||
|
||||
if (open === false) {
|
||||
this.clearHoverValue();
|
||||
}
|
||||
|
||||
const { onOpenChange } = this.props;
|
||||
if (onOpenChange) {
|
||||
onOpenChange(open);
|
||||
@@ -132,7 +150,33 @@ export default class RangePicker extends React.Component<any, RangePickerState>
|
||||
|
||||
handleHoverChange = (hoverValue: any) => this.setState({ hoverValue });
|
||||
|
||||
setValue(value: moment.Moment[], hidePanel?: boolean) {
|
||||
handleRangeMouseLeave = () => {
|
||||
if (this.state.open) {
|
||||
this.clearHoverValue();
|
||||
}
|
||||
}
|
||||
|
||||
handleCalendarInputSelect = (value: RangePickerValue) => {
|
||||
this.setState(({ showDate }) => ({
|
||||
value,
|
||||
showDate: getShowDateFromValue(value) || showDate,
|
||||
}));
|
||||
}
|
||||
|
||||
handleRangeClick = (value: RangePickerPresetRange) => {
|
||||
if (typeof value === 'function') {
|
||||
value = value();
|
||||
}
|
||||
|
||||
this.setValue(value, true);
|
||||
|
||||
const { onOk } = this.props;
|
||||
if (onOk) {
|
||||
onOk(value);
|
||||
}
|
||||
}
|
||||
|
||||
setValue(value: RangePickerValue, hidePanel?: boolean) {
|
||||
this.handleChange(value);
|
||||
if ((hidePanel || !this.props.showTime) && !('open' in this.props)) {
|
||||
this.setState({ open: false });
|
||||
@@ -166,9 +210,9 @@ export default class RangePicker extends React.Component<any, RangePickerState>
|
||||
return (
|
||||
<a
|
||||
key={range}
|
||||
onClick={() => this.setValue(value, true)}
|
||||
onClick={() => this.handleRangeClick(value)}
|
||||
onMouseEnter={() => this.setState({ hoverValue: value })}
|
||||
onMouseLeave={this.clearHoverValue}
|
||||
onMouseLeave={this.handleRangeMouseLeave}
|
||||
>
|
||||
{range}
|
||||
</a>
|
||||
@@ -192,14 +236,9 @@ export default class RangePicker extends React.Component<any, RangePickerState>
|
||||
ranges, onOk, locale, localeCode, format,
|
||||
dateRender, onCalendarChange,
|
||||
} = props;
|
||||
if (value && localeCode) {
|
||||
if (value[0]) {
|
||||
value[0].locale(localeCode);
|
||||
}
|
||||
if (value[1]) {
|
||||
value[1].locale(localeCode);
|
||||
}
|
||||
}
|
||||
|
||||
fixLocale(value, localeCode);
|
||||
fixLocale(showDate, localeCode);
|
||||
|
||||
warning(!('onOK' in props), 'It should be `RangePicker[onOk]`, instead of `onOK`!');
|
||||
|
||||
@@ -250,6 +289,7 @@ export default class RangePicker extends React.Component<any, RangePickerState>
|
||||
onHoverChange={this.handleHoverChange}
|
||||
onPanelChange={props.onPanelChange}
|
||||
showToday={showToday}
|
||||
onInputSelect={this.handleCalendarInputSelect}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -298,6 +338,7 @@ export default class RangePicker extends React.Component<any, RangePickerState>
|
||||
return (
|
||||
<span
|
||||
ref={this.savePicker}
|
||||
id={props.id}
|
||||
className={classNames(props.className, props.pickerClass)}
|
||||
style={{ ...style, ...pickerStyle }}
|
||||
tabIndex={props.disabled ? -1 : 0}
|
||||
|
||||
@@ -11,7 +11,7 @@ function formatValue(value: moment.Moment | null, format: string): string {
|
||||
|
||||
export default class WeekPicker extends React.Component<any, any> {
|
||||
static defaultProps = {
|
||||
format: 'YYYY-Wo',
|
||||
format: 'YYYY-wo',
|
||||
allowClear: true,
|
||||
};
|
||||
|
||||
@@ -131,7 +131,7 @@ export default class WeekPicker extends React.Component<any, any> {
|
||||
);
|
||||
};
|
||||
return (
|
||||
<span className={classNames(className, pickerClass)}>
|
||||
<span className={classNames(className, pickerClass)} id={this.props.id}>
|
||||
<RcDatePicker
|
||||
{...this.props}
|
||||
calendar={calendar}
|
||||
|
||||
@@ -3,11 +3,27 @@ import { mount } from 'enzyme';
|
||||
import moment from 'moment';
|
||||
import MockDate from 'mockdate';
|
||||
import DatePicker from '..';
|
||||
import {
|
||||
selectDate,
|
||||
openPanel,
|
||||
clearInput,
|
||||
nextYear,
|
||||
nextMonth,
|
||||
hasSelected,
|
||||
} from './utils';
|
||||
import focusTest from '../../../tests/shared/focusTest';
|
||||
|
||||
describe('DatePicker', () => {
|
||||
focusTest(DatePicker);
|
||||
|
||||
beforeEach(() => {
|
||||
MockDate.set(new Date('2016-11-22').getTime() + (new Date().getTimezoneOffset() * 60 * 1000));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
MockDate.reset();
|
||||
});
|
||||
|
||||
it('prop locale should works', () => {
|
||||
const locale = {
|
||||
lang: {
|
||||
@@ -46,12 +62,80 @@ 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} value={birthday} />
|
||||
);
|
||||
expect(wrapper.render()).toMatchSnapshot();
|
||||
MockDate.reset();
|
||||
});
|
||||
|
||||
// Fix https://github.com/ant-design/ant-design/issues/8885
|
||||
it('control value after panel closed', () => {
|
||||
class Test extends React.Component {
|
||||
state = {
|
||||
cleared: false,
|
||||
value: moment(),
|
||||
}
|
||||
|
||||
onChange = (value) => {
|
||||
let cleared = this.state.cleared;
|
||||
|
||||
if (cleared) {
|
||||
value = moment(moment(value).format('YYYY-MM-DD 12:12:12'));
|
||||
cleared = false;
|
||||
}
|
||||
|
||||
if (!value) {
|
||||
cleared = true;
|
||||
}
|
||||
|
||||
this.setState({ value, cleared });
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<DatePicker
|
||||
showTime
|
||||
value={this.state.value}
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
onChange={this.onChange}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const wrapper = mount(<Test />);
|
||||
// clear input
|
||||
clearInput(wrapper);
|
||||
openPanel(wrapper);
|
||||
selectDate(wrapper, moment('2016-11-13'));
|
||||
expect(wrapper.find('.ant-calendar-input').getDOMNode().value).toBe('2016-11-13 12:12:12');
|
||||
selectDate(wrapper, moment('2016-11-14'));
|
||||
expect(wrapper.find('.ant-calendar-input').getDOMNode().value).toBe('2016-11-14 12:12:12');
|
||||
});
|
||||
|
||||
it('triggers onChange only when date was selected', () => {
|
||||
const handleChange = jest.fn();
|
||||
const wrapper = mount(
|
||||
<DatePicker onChange={handleChange} />
|
||||
);
|
||||
openPanel(wrapper);
|
||||
nextYear(wrapper);
|
||||
expect(handleChange).not.toBeCalled();
|
||||
nextMonth(wrapper);
|
||||
expect(handleChange).not.toBeCalled();
|
||||
selectDate(wrapper, moment('2017-12-22'));
|
||||
expect(handleChange).toBeCalled();
|
||||
});
|
||||
|
||||
it('clear input', () => {
|
||||
const wrapper = mount(
|
||||
<DatePicker />
|
||||
);
|
||||
openPanel(wrapper);
|
||||
selectDate(wrapper, moment('2016-11-23'));
|
||||
clearInput(wrapper);
|
||||
openPanel(wrapper);
|
||||
expect(hasSelected(wrapper, moment('2016-11-22'))).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,6 +2,7 @@ import React from 'react';
|
||||
import { mount, render } from 'enzyme';
|
||||
import moment from 'moment';
|
||||
import DatePicker from '../';
|
||||
import { setMockDate, resetMockDate } from '../../../tests/utils';
|
||||
import focusTest from '../../../tests/shared/focusTest';
|
||||
|
||||
const { RangePicker } = DatePicker;
|
||||
@@ -9,6 +10,14 @@ const { RangePicker } = DatePicker;
|
||||
describe('RangePicker', () => {
|
||||
focusTest(RangePicker);
|
||||
|
||||
beforeEach(() => {
|
||||
setMockDate();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
resetMockDate();
|
||||
});
|
||||
|
||||
it('show month panel according to value', () => {
|
||||
const birthday = moment('2000-01-01', 'YYYY-MM-DD').locale('zh-cn');
|
||||
const wrapper = mount(
|
||||
@@ -112,4 +121,85 @@ describe('RangePicker', () => {
|
||||
expect(() => rangeCalendarWrapper.find('.ant-calendar-cell').at(15).simulate('click').simulate('click'))
|
||||
.not.toThrow();
|
||||
});
|
||||
|
||||
it('clear hover value after panel close', () => {
|
||||
jest.useFakeTimers();
|
||||
const wrapper = mount(
|
||||
<div>
|
||||
<RangePicker value={[moment(), moment().add(2, 'day')]} />
|
||||
</div>
|
||||
);
|
||||
wrapper.find('.ant-calendar-picker-input').simulate('click');
|
||||
wrapper.find('.ant-calendar-cell').at(25).simulate('click');
|
||||
wrapper.find('.ant-calendar-cell').at(27).simulate('mouseEnter');
|
||||
document.dispatchEvent(new MouseEvent('mousedown'));
|
||||
jest.runAllTimers();
|
||||
wrapper.find('.ant-calendar-picker-input').simulate('click');
|
||||
expect(
|
||||
wrapper.find('.ant-calendar-cell').at(23).hasClass('ant-calendar-in-range-cell')
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
describe('preset range', () => {
|
||||
it('static range', () => {
|
||||
const range = [moment().subtract(2, 'd'), moment()];
|
||||
const format = 'YYYY-MM-DD HH:mm:ss';
|
||||
const wrapper = mount(
|
||||
<RangePicker
|
||||
ranges={{ 'recent two days': range }}
|
||||
format={format}
|
||||
/>
|
||||
);
|
||||
wrapper.find('.ant-calendar-picker-input').simulate('click');
|
||||
wrapper.find('.ant-calendar-range-quick-selector a').simulate('click');
|
||||
expect(
|
||||
wrapper.find('.ant-calendar-range-picker-input').first().getDOMNode().value
|
||||
).toBe(range[0].format(format));
|
||||
expect(
|
||||
wrapper.find('.ant-calendar-range-picker-input').last().getDOMNode().value
|
||||
).toBe(range[1].format(format));
|
||||
});
|
||||
|
||||
it('function range', () => {
|
||||
const range = [moment().subtract(2, 'd'), moment()];
|
||||
const format = 'YYYY-MM-DD HH:mm:ss';
|
||||
const wrapper = mount(
|
||||
<RangePicker
|
||||
ranges={{ 'recent two days': () => range }}
|
||||
format={format}
|
||||
/>
|
||||
);
|
||||
wrapper.find('.ant-calendar-picker-input').simulate('click');
|
||||
wrapper.find('.ant-calendar-range-quick-selector a').simulate('click');
|
||||
expect(
|
||||
wrapper.find('.ant-calendar-range-picker-input').first().getDOMNode().value
|
||||
).toBe(range[0].format(format));
|
||||
expect(
|
||||
wrapper.find('.ant-calendar-range-picker-input').last().getDOMNode().value
|
||||
).toBe(range[1].format(format));
|
||||
});
|
||||
});
|
||||
|
||||
// https://github.com/ant-design/ant-design/issues/6999
|
||||
it('input date manually', () => {
|
||||
const wrapper = mount(<RangePicker open />);
|
||||
const dateString = '2008-12-31';
|
||||
const input = wrapper.find('.ant-calendar-input').first();
|
||||
input.simulate('change', { target: { value: dateString } });
|
||||
expect(input.getDOMNode().value).toBe(dateString);
|
||||
});
|
||||
|
||||
it('triggers onOk when click on preset range', () => {
|
||||
const handleOk = jest.fn();
|
||||
const range = [moment().subtract(2, 'd'), moment()];
|
||||
const wrapper = mount(
|
||||
<RangePicker
|
||||
ranges={{ 'recent two days': range }}
|
||||
onOk={handleOk}
|
||||
/>
|
||||
);
|
||||
wrapper.find('.ant-calendar-picker-input').simulate('click');
|
||||
wrapper.find('.ant-calendar-range-quick-selector a').simulate('click');
|
||||
expect(handleOk).toBeCalledWith(range);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -601,6 +601,7 @@ exports[`renders ./components/date-picker/demo/size.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="large"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -620,6 +621,7 @@ exports[`renders ./components/date-picker/demo/size.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="default"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -638,6 +640,7 @@ exports[`renders ./components/date-picker/demo/size.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="small"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
|
||||
28
components/date-picker/__tests__/utils.js
Normal file
28
components/date-picker/__tests__/utils.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
export function selectDate(wrapper, date, index) {
|
||||
let calendar = wrapper;
|
||||
if (index) {
|
||||
calendar = wrapper.find('.ant-calendar-range-part')[index];
|
||||
}
|
||||
calendar.find({ title: date.format('LL'), role: 'gridcell' }).simulate('click');
|
||||
}
|
||||
|
||||
export function hasSelected(wrapper, date) {
|
||||
return wrapper.find({ title: date.format('LL'), role: 'gridcell' }).hasClass('ant-calendar-selected-day');
|
||||
}
|
||||
|
||||
export function openPanel(wrapper) {
|
||||
wrapper.find('.ant-calendar-picker-input').simulate('click');
|
||||
}
|
||||
|
||||
export function clearInput(wrapper) {
|
||||
wrapper.find('.ant-calendar-picker-clear').hostNodes().simulate('click');
|
||||
}
|
||||
|
||||
export function nextYear(wrapper) {
|
||||
wrapper.find('.ant-calendar-next-year-btn').simulate('click');
|
||||
}
|
||||
|
||||
export function nextMonth(wrapper) {
|
||||
wrapper.find('.ant-calendar-next-month-btn').simulate('click');
|
||||
}
|
||||
@@ -34,6 +34,7 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
|
||||
}
|
||||
this.state = {
|
||||
value,
|
||||
showDate: value,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -41,6 +42,7 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
|
||||
if ('value' in nextProps) {
|
||||
this.setState({
|
||||
value: nextProps.value,
|
||||
showDate: nextProps.value,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -63,11 +65,18 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
|
||||
handleChange = (value: moment.Moment | null) => {
|
||||
const props = this.props;
|
||||
if (!('value' in props)) {
|
||||
this.setState({ value });
|
||||
this.setState({
|
||||
value,
|
||||
showDate: value,
|
||||
});
|
||||
}
|
||||
props.onChange(value, (value && value.format(props.format)) || '');
|
||||
}
|
||||
|
||||
handleCalendarChange = (value: moment.Moment) => {
|
||||
this.setState({ showDate: value });
|
||||
}
|
||||
|
||||
focus() {
|
||||
this.input.focus();
|
||||
}
|
||||
@@ -81,7 +90,7 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { value } = this.state;
|
||||
const { value, showDate } = this.state;
|
||||
const props = omit(this.props, ['onChange']);
|
||||
const { prefixCls, locale, localeCode } = props;
|
||||
|
||||
@@ -95,6 +104,10 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
|
||||
[`${prefixCls}-month`]: MonthCalendar === TheCalendar,
|
||||
});
|
||||
|
||||
if (value && localeCode) {
|
||||
value.locale(localeCode);
|
||||
}
|
||||
|
||||
let pickerProps: Object = {};
|
||||
let calendarProps: any = {};
|
||||
if (props.showTime) {
|
||||
@@ -130,6 +143,8 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
|
||||
monthCellContentRender={props.monthCellContentRender}
|
||||
renderFooter={this.renderFooter}
|
||||
onPanelChange={props.onPanelChange}
|
||||
onChange={this.handleCalendarChange}
|
||||
value={showDate}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -156,12 +171,9 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
|
||||
</div>
|
||||
);
|
||||
|
||||
const pickerValue = value;
|
||||
if (pickerValue && localeCode) {
|
||||
pickerValue.locale(localeCode);
|
||||
}
|
||||
return (
|
||||
<span
|
||||
id={props.id}
|
||||
className={classNames(props.className, props.pickerClass)}
|
||||
style={props.style}
|
||||
onFocus={props.onFocus}
|
||||
@@ -171,7 +183,7 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
|
||||
{...props}
|
||||
{...pickerProps}
|
||||
calendar={calendar}
|
||||
value={pickerValue}
|
||||
value={value}
|
||||
prefixCls={`${prefixCls}-picker-container`}
|
||||
style={props.popupStyle}
|
||||
>
|
||||
|
||||
@@ -90,7 +90,7 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker, WeekPicke
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| defaultValue | to set default date | [moment](http://momentjs.com/) | - |
|
||||
| format | to set the date format, refer to [moment.js](http://momentjs.com/) | string | "YYYY-Wo" |
|
||||
| format | to set the date format, refer to [moment.js](http://momentjs.com/) | string | "YYYY-wo" |
|
||||
| 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) | - |
|
||||
|
||||
@@ -101,7 +101,7 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker, WeekPicke
|
||||
| defaultValue | to set default date | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - |
|
||||
| disabledTime | to specify the time that cannot be selected | function(dates: [moment, moment], partial: `'start'|'end'`) | - |
|
||||
| format | to set the date format | string | "YYYY-MM-DD HH:mm:ss" |
|
||||
| ranges | preseted ranges for quick selection | { [range: string]: [moment](http://momentjs.com/)\[] } | - |
|
||||
| ranges | preseted ranges for quick selection | { \[range: string\]: [moment](http://momentjs.com/)\[] } \| () => { \[range: string\]: [moment](http://momentjs.com/)\[] } | - |
|
||||
| renderExtraFooter | render extra footer in panel | () => React.ReactNode | - |
|
||||
| showTime | to provide an additional time selection | object\|boolean | [TimePicker Options](/components/time-picker/#API) |
|
||||
| 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(), moment()] |
|
||||
|
||||
@@ -1,98 +1,20 @@
|
||||
import * as React from 'react';
|
||||
import * as moment from 'moment';
|
||||
import RcCalendar from 'rc-calendar';
|
||||
import MonthCalendar from 'rc-calendar/lib/MonthCalendar';
|
||||
import createPicker from './createPicker';
|
||||
import wrapPicker from './wrapPicker';
|
||||
import RangePicker from './RangePicker';
|
||||
import WeekPicker from './WeekPicker';
|
||||
import { TimePickerProps } from '../time-picker';
|
||||
import { DatePickerProps, DatePickerDecorator } from './interface';
|
||||
|
||||
export interface PickerProps {
|
||||
prefixCls?: string;
|
||||
inputPrefixCls?: string;
|
||||
format?: string;
|
||||
disabled?: boolean;
|
||||
allowClear?: boolean;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
popupStyle?: React.CSSProperties;
|
||||
locale?: any;
|
||||
size?: 'large' | 'small' | 'default';
|
||||
getCalendarContainer?: (triggerNode: Element) => HTMLElement;
|
||||
open?: boolean;
|
||||
onOpenChange?: (status: boolean) => void;
|
||||
disabledDate?: (current: moment.Moment) => boolean;
|
||||
renderExtraFooter?: () => React.ReactNode;
|
||||
dateRender?: (current: moment.Moment, today: moment.Moment) => React.ReactNode;
|
||||
}
|
||||
|
||||
export interface SinglePickerProps {
|
||||
value?: moment.Moment;
|
||||
defaultValue?: moment.Moment;
|
||||
defaultPickerValue?: moment.Moment;
|
||||
onChange?: (date: moment.Moment, dateString: string) => void;
|
||||
}
|
||||
|
||||
export interface DatePickerProps extends PickerProps, SinglePickerProps {
|
||||
className?: string;
|
||||
showTime?: TimePickerProps | boolean;
|
||||
showToday?: boolean;
|
||||
open?: boolean;
|
||||
disabledTime?: (current: moment.Moment) => {
|
||||
disabledHours?: () => number[],
|
||||
disabledMinutes?: () => number[],
|
||||
disabledSeconds?: () => number[],
|
||||
};
|
||||
onOpenChange?: (status: boolean) => void;
|
||||
onOk?: (selectedTime: moment.Moment) => void;
|
||||
placeholder?: string;
|
||||
}
|
||||
const DatePicker = wrapPicker(createPicker(RcCalendar)) as React.ClassicComponentClass<DatePickerProps>;
|
||||
|
||||
export interface MonthPickerProps extends PickerProps, SinglePickerProps {
|
||||
className?: string;
|
||||
placeholder?: string;
|
||||
}
|
||||
const MonthPicker = wrapPicker(createPicker(MonthCalendar), 'YYYY-MM');
|
||||
|
||||
export interface RangePickerProps extends PickerProps {
|
||||
className?: string;
|
||||
value?: [moment.Moment, moment.Moment];
|
||||
defaultValue?: [moment.Moment, moment.Moment];
|
||||
defaultPickerValue?: [moment.Moment, moment.Moment];
|
||||
onChange?: (dates: [moment.Moment, moment.Moment], dateStrings: [string, string]) => void;
|
||||
onCalendarChange?: (dates: [moment.Moment, moment.Moment], dateStrings: [string, string]) => void;
|
||||
onOk?: (selectedTime: moment.Moment) => void;
|
||||
showTime?: TimePickerProps | boolean;
|
||||
ranges?: {
|
||||
[range: string]: moment.Moment[],
|
||||
};
|
||||
placeholder?: [string, string];
|
||||
mode?: string | string[];
|
||||
disabledTime?: (current: moment.Moment, type: string) => {
|
||||
disabledHours?: () => number[],
|
||||
disabledMinutes?: () => number[],
|
||||
disabledSeconds?: () => number[],
|
||||
};
|
||||
onPanelChange?: (value?: moment.Moment[], mode?: string | string[]) => void;
|
||||
}
|
||||
|
||||
export interface WeexPickerProps extends PickerProps, SinglePickerProps {
|
||||
className?: string;
|
||||
placeholder?: string;
|
||||
}
|
||||
|
||||
Object.assign(DatePicker, {
|
||||
RangePicker: wrapPicker(RangePicker),
|
||||
MonthPicker,
|
||||
WeekPicker: wrapPicker(WeekPicker, 'YYYY-Wo'),
|
||||
WeekPicker: wrapPicker(WeekPicker, 'YYYY-wo'),
|
||||
});
|
||||
|
||||
export interface DatePickerDecorator extends React.ClassicComponentClass<DatePickerProps> {
|
||||
RangePicker: React.ClassicComponentClass<RangePickerProps>;
|
||||
MonthPicker: React.ClassicComponentClass<MonthPickerProps>;
|
||||
WeekPicker: React.ClassicComponentClass<WeexPickerProps>;
|
||||
}
|
||||
|
||||
export default DatePicker as DatePickerDecorator;
|
||||
|
||||
@@ -90,7 +90,7 @@ subtitle: 日期选择框
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| defaultValue | 默认日期 | [moment](http://momentjs.com/) | - |
|
||||
| format | 展示的日期格式,配置参考 [moment.js](http://momentjs.com/) | string | "YYYY-Wo" |
|
||||
| format | 展示的日期格式,配置参考 [moment.js](http://momentjs.com/) | string | "YYYY-wo" |
|
||||
| value | 日期 | [moment](http://momentjs.com/) | - |
|
||||
| onChange | 时间发生变化的回调,发生在用户选择时间时 | function(date: moment, dateString: string) | - |
|
||||
|
||||
@@ -101,7 +101,7 @@ subtitle: 日期选择框
|
||||
| defaultValue | 默认日期 | [moment](http://momentjs.com/)\[] | 无 |
|
||||
| disabledTime | 不可选择的时间 | function(dates: [moment, moment], partial: `'start'|'end'`) | 无 |
|
||||
| format | 展示的日期格式 | string | "YYYY-MM-DD HH:mm:ss" |
|
||||
| ranges | 预设时间范围快捷选择 | { [range: string]: [moment](http://momentjs.com/)\[] } | 无 |
|
||||
| ranges | 预设时间范围快捷选择 | { \[range: string\]: [moment](http://momentjs.com/)\[] } \| () => { \[range: string\]: [moment](http://momentjs.com/)\[] } | 无 |
|
||||
| renderExtraFooter | 在面板中添加额外的页脚 | () => React.ReactNode | - |
|
||||
| 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()] |
|
||||
|
||||
90
components/date-picker/interface.tsx
Normal file
90
components/date-picker/interface.tsx
Normal file
@@ -0,0 +1,90 @@
|
||||
import * as React from 'react';
|
||||
import * as moment from 'moment';
|
||||
import { TimePickerProps } from '../time-picker';
|
||||
|
||||
export interface PickerProps {
|
||||
id?: number | string;
|
||||
prefixCls?: string;
|
||||
inputPrefixCls?: string;
|
||||
format?: string;
|
||||
disabled?: boolean;
|
||||
allowClear?: boolean;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
popupStyle?: React.CSSProperties;
|
||||
locale?: any;
|
||||
size?: 'large' | 'small' | 'default';
|
||||
getCalendarContainer?: (triggerNode: Element) => HTMLElement;
|
||||
open?: boolean;
|
||||
onOpenChange?: (status: boolean) => void;
|
||||
disabledDate?: (current: moment.Moment) => boolean;
|
||||
renderExtraFooter?: () => React.ReactNode;
|
||||
dateRender?: (current: moment.Moment, today: moment.Moment) => React.ReactNode;
|
||||
}
|
||||
|
||||
export interface SinglePickerProps {
|
||||
value?: moment.Moment;
|
||||
defaultValue?: moment.Moment;
|
||||
defaultPickerValue?: moment.Moment;
|
||||
onChange?: (date: moment.Moment, dateString: string) => void;
|
||||
}
|
||||
|
||||
export interface DatePickerProps extends PickerProps, SinglePickerProps {
|
||||
className?: string;
|
||||
showTime?: TimePickerProps | boolean;
|
||||
showToday?: boolean;
|
||||
open?: boolean;
|
||||
disabledTime?: (current: moment.Moment) => {
|
||||
disabledHours?: () => number[],
|
||||
disabledMinutes?: () => number[],
|
||||
disabledSeconds?: () => number[],
|
||||
};
|
||||
onOpenChange?: (status: boolean) => void;
|
||||
onOk?: (selectedTime: moment.Moment) => void;
|
||||
placeholder?: string;
|
||||
}
|
||||
|
||||
export interface MonthPickerProps extends PickerProps, SinglePickerProps {
|
||||
className?: string;
|
||||
placeholder?: string;
|
||||
}
|
||||
|
||||
export type RangePickerValue =
|
||||
undefined[] |
|
||||
[moment.Moment] |
|
||||
[undefined, moment.Moment] |
|
||||
[moment.Moment, moment.Moment];
|
||||
export type RangePickerPresetRange = RangePickerValue | (() => RangePickerValue);
|
||||
|
||||
export interface RangePickerProps extends PickerProps {
|
||||
className?: string;
|
||||
value?: RangePickerValue;
|
||||
defaultValue?: RangePickerValue;
|
||||
defaultPickerValue?: RangePickerValue;
|
||||
onChange?: (dates: RangePickerValue, dateStrings: [string, string]) => void;
|
||||
onCalendarChange?: (dates: RangePickerValue, dateStrings: [string, string]) => void;
|
||||
onOk?: (selectedTime: moment.Moment) => void;
|
||||
showTime?: TimePickerProps | boolean;
|
||||
ranges?: {
|
||||
[range: string]: RangePickerPresetRange,
|
||||
};
|
||||
placeholder?: [string, string];
|
||||
mode?: string | string[];
|
||||
disabledTime?: (current: moment.Moment, type: string) => {
|
||||
disabledHours?: () => number[],
|
||||
disabledMinutes?: () => number[],
|
||||
disabledSeconds?: () => number[],
|
||||
};
|
||||
onPanelChange?: (value?: RangePickerValue, mode?: string | string[]) => void;
|
||||
}
|
||||
|
||||
export interface WeexPickerProps extends PickerProps, SinglePickerProps {
|
||||
className?: string;
|
||||
placeholder?: string;
|
||||
}
|
||||
|
||||
export interface DatePickerDecorator extends React.ClassicComponentClass<DatePickerProps> {
|
||||
RangePicker: React.ClassicComponentClass<RangePickerProps>;
|
||||
MonthPicker: React.ClassicComponentClass<MonthPickerProps>;
|
||||
WeekPicker: React.ClassicComponentClass<WeexPickerProps>;
|
||||
}
|
||||
18
components/date-picker/locale/ku_IQ.tsx
Executable file
18
components/date-picker/locale/ku_IQ.tsx
Executable file
@@ -0,0 +1,18 @@
|
||||
import CalendarLocale from 'rc-calendar/lib/locale/ku_IQ';
|
||||
import TimePickerLocale from '../../time-picker/locale/ku_IQ';
|
||||
|
||||
// Merge into a locale object
|
||||
const locale = {
|
||||
lang: {
|
||||
placeholder: 'Dîrok hilbijêre',
|
||||
rangePlaceholder: ['Dîroka destpêkê', 'Dîroka dawîn'],
|
||||
...CalendarLocale,
|
||||
},
|
||||
timePickerLocale: {
|
||||
...TimePickerLocale,
|
||||
},
|
||||
};
|
||||
|
||||
// All settings at:
|
||||
// https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json
|
||||
export default locale;
|
||||
@@ -58,6 +58,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-dropdown-trigger ant-btn-default"
|
||||
disabled=""
|
||||
type="button"
|
||||
>
|
||||
<i
|
||||
|
||||
@@ -14,6 +14,7 @@ describe('DropdownButton', () => {
|
||||
<Menu.Item>foo</Menu.Item>
|
||||
</Menu>
|
||||
),
|
||||
disabled: false,
|
||||
trigger: ['hover'],
|
||||
visible: true,
|
||||
onVisibleChange: () => {},
|
||||
|
||||
@@ -31,6 +31,7 @@ export default class DropdownButton extends React.Component<DropdownButtonProps,
|
||||
const dropdownProps = {
|
||||
align,
|
||||
overlay,
|
||||
disabled,
|
||||
trigger: disabled ? [] : trigger,
|
||||
onVisibleChange,
|
||||
placement,
|
||||
@@ -53,7 +54,7 @@ export default class DropdownButton extends React.Component<DropdownButtonProps,
|
||||
{children}
|
||||
</Button>
|
||||
<Dropdown {...dropdownProps}>
|
||||
<Button type={type} disabled={disabled}>
|
||||
<Button type={type}>
|
||||
<Icon type="down" />
|
||||
</Button>
|
||||
</Dropdown>
|
||||
|
||||
@@ -49,16 +49,18 @@ export default class Dropdown extends React.Component<DropDownProps, any> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { children, prefixCls, overlay, trigger, disabled } = this.props;
|
||||
const dropdownTrigger = React.cloneElement(children as any, {
|
||||
className: classNames((children as any).props.className, `${prefixCls}-trigger`),
|
||||
const { children, prefixCls, overlay: overlayElements, trigger, disabled } = this.props;
|
||||
|
||||
const child = React.Children.only(children);
|
||||
const overlay = React.Children.only(overlayElements);
|
||||
|
||||
const dropdownTrigger = React.cloneElement(child, {
|
||||
className: classNames(child.props.className, `${prefixCls}-trigger`),
|
||||
disabled,
|
||||
});
|
||||
// menu cannot be selectable in dropdown defaultly
|
||||
const overlayProps = overlay && (overlay as any).props;
|
||||
const selectable = (overlayProps && 'selectable' in overlayProps)
|
||||
? overlayProps.selectable : false;
|
||||
const fixedModeOverlay = React.cloneElement(overlay as any, {
|
||||
const selectable = overlay.props.selectable || false;
|
||||
const fixedModeOverlay = React.cloneElement(overlay, {
|
||||
mode: 'vertical',
|
||||
selectable,
|
||||
});
|
||||
|
||||
@@ -222,13 +222,19 @@ export default class FormItem extends React.Component<FormItemProps, any> {
|
||||
|
||||
// Resolve duplicated ids bug between different forms
|
||||
// https://github.com/ant-design/ant-design/issues/7351
|
||||
onLabelClick = () => {
|
||||
onLabelClick = (e: any) => {
|
||||
const { label } = this.props;
|
||||
const id = this.props.id || this.getId();
|
||||
if (!id) {
|
||||
return;
|
||||
}
|
||||
const controls = document.querySelectorAll(`[id="${id}"]`);
|
||||
if (controls.length !== 1) {
|
||||
// Only prevent in default situation
|
||||
// Avoid preventing event in `label={<a href="xx">link</a>}``
|
||||
if (typeof label === 'string') {
|
||||
e.preventDefault();
|
||||
}
|
||||
const control = ReactDOM.findDOMNode(this).querySelector(`[id="${id}"]`) as HTMLElement;
|
||||
if (control && control.focus) {
|
||||
control.focus();
|
||||
|
||||
@@ -762,6 +762,7 @@ exports[`renders ./components/form/demo/dynamic-rule.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
type="checkbox"
|
||||
value="false"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
@@ -989,6 +990,7 @@ exports[`renders ./components/form/demo/layout.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="horizontal"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -1007,6 +1009,7 @@ exports[`renders ./components/form/demo/layout.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="vertical"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -1025,6 +1028,7 @@ exports[`renders ./components/form/demo/layout.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="inline"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -1720,6 +1724,7 @@ exports[`renders ./components/form/demo/time-related-controls.md correctly 1`] =
|
||||
>
|
||||
<span
|
||||
class="ant-calendar-picker"
|
||||
id="date-picker"
|
||||
>
|
||||
<div>
|
||||
<input
|
||||
@@ -1758,6 +1763,7 @@ exports[`renders ./components/form/demo/time-related-controls.md correctly 1`] =
|
||||
>
|
||||
<span
|
||||
class="ant-calendar-picker"
|
||||
id="date-time-picker"
|
||||
>
|
||||
<div>
|
||||
<input
|
||||
@@ -1796,6 +1802,7 @@ exports[`renders ./components/form/demo/time-related-controls.md correctly 1`] =
|
||||
>
|
||||
<span
|
||||
class="ant-calendar-picker"
|
||||
id="month-picker"
|
||||
>
|
||||
<div>
|
||||
<input
|
||||
@@ -1834,6 +1841,7 @@ exports[`renders ./components/form/demo/time-related-controls.md correctly 1`] =
|
||||
>
|
||||
<span
|
||||
class="ant-calendar-picker"
|
||||
id="range-picker"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
@@ -1888,6 +1896,7 @@ exports[`renders ./components/form/demo/time-related-controls.md correctly 1`] =
|
||||
>
|
||||
<span
|
||||
class="ant-calendar-picker"
|
||||
id="range-time-picker"
|
||||
style="width:350px"
|
||||
tabindex="0"
|
||||
>
|
||||
@@ -2390,6 +2399,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="a"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -2408,6 +2418,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="b"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -2426,6 +2437,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="c"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -2472,6 +2484,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="a"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -2490,6 +2503,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="b"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -2508,6 +2522,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="c"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
|
||||
@@ -488,6 +488,12 @@ form {
|
||||
}
|
||||
}
|
||||
|
||||
.@{ant-prefix}-select.@{ant-prefix}-select-auto-complete {
|
||||
.@{ant-prefix}-input:focus {
|
||||
border-color: @error-color;
|
||||
}
|
||||
}
|
||||
|
||||
.@{ant-prefix}-input-group-addon .@{ant-prefix}-select {
|
||||
&-selection {
|
||||
border-color: transparent;
|
||||
|
||||
@@ -25,6 +25,7 @@ export interface ColProps {
|
||||
md?: number | ColSize;
|
||||
lg?: number | ColSize;
|
||||
xl?: number | ColSize;
|
||||
xxl?: number | ColSize;
|
||||
prefixCls?: string;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
@@ -43,6 +44,7 @@ export default class Col extends React.Component<ColProps, {}> {
|
||||
md: objectOrNumber,
|
||||
lg: objectOrNumber,
|
||||
xl: objectOrNumber,
|
||||
xxl: objectOrNumber,
|
||||
};
|
||||
|
||||
render() {
|
||||
|
||||
@@ -15,7 +15,7 @@ title:
|
||||
|
||||
From the stack to the horizontal arrangement.
|
||||
|
||||
You can create a basic grid system by using a single set of `Row` and` Col` grid assembly, all of the columns (Col) must be placed in `Row`.
|
||||
You can create a basic grid system by using a single set of `Row` and `Col` grid assembly, all of the columns (Col) must be placed in `Row`.
|
||||
|
||||
````jsx
|
||||
import { Row, Col } from 'antd';
|
||||
|
||||
@@ -13,7 +13,7 @@ Flex 布局基础。
|
||||
|
||||
## en-US
|
||||
|
||||
Use `row-flex` define` flex` layout, its child elements depending on the value of the `start`,` center`, `end`,` space-between`, `space-around`, which are defined in its parent node layout mode.
|
||||
Use `row-flex` define `flex` layout, its child elements depending on the value of the `start`,` center`, `end`,` space-between`, `space-around`, which are defined in its parent node layout mode.
|
||||
|
||||
````jsx
|
||||
import { Row, Col } from 'antd';
|
||||
|
||||
@@ -13,7 +13,7 @@ title:
|
||||
|
||||
## en-US
|
||||
|
||||
`Span` `pull` `push` `offset` `order` property can be embedded into `xs` `sm` `md` `lg` `xl` properties to use,
|
||||
`span` `pull` `push` `offset` `order` property can be embedded into `xs` `sm` `md` `lg` `xl` properties to use,
|
||||
where `xs = {6}` is equivalent to `xs = {{span: 6}}`.
|
||||
|
||||
````jsx
|
||||
|
||||
@@ -111,4 +111,4 @@ If the Ant Design grid layout component does not meet your needs, you can use th
|
||||
| xl | `≥1200px`, could be a `span` value or an object containing above props | number\|object | - |
|
||||
| xxl | `≥1600px`, could be a `span` value or an object containing above props | number\|object | - |
|
||||
|
||||
The breakpoints of responsive grid follow [BootStrap 3 media queries rules](https://getbootstrap.com/docs/3.3/css/#responsive-utilities-classes)(not including `occasionally part`).
|
||||
The breakpoints of responsive grid follow [BootStrap 4 media queries rules](https://getbootstrap.com/docs/4.0/layout/overview/#responsive-breakpoints)(not including `occasionally part`).
|
||||
|
||||
@@ -28,7 +28,7 @@ export interface InputProps extends AbstractInputProps {
|
||||
id?: number | string;
|
||||
name?: string;
|
||||
size?: 'large' | 'default' | 'small';
|
||||
maxLength?: number;
|
||||
maxLength?: number | string;
|
||||
disabled?: boolean;
|
||||
readOnly?: boolean;
|
||||
addonBefore?: React.ReactNode;
|
||||
@@ -65,7 +65,10 @@ export default class Input extends React.Component<InputProps, any> {
|
||||
PropTypes.number,
|
||||
]),
|
||||
size: PropTypes.oneOf(['small', 'default', 'large']),
|
||||
maxLength: PropTypes.string,
|
||||
maxLength: PropTypes.oneOfType([
|
||||
PropTypes.string,
|
||||
PropTypes.number,
|
||||
]),
|
||||
disabled: PropTypes.bool,
|
||||
value: PropTypes.any,
|
||||
defaultValue: PropTypes.any,
|
||||
|
||||
@@ -138,7 +138,7 @@ export default function calculateNodeHeight(
|
||||
|
||||
if (minRows !== null || maxRows !== null) {
|
||||
// measure height of a textarea with a single row
|
||||
hiddenTextarea.value = '';
|
||||
hiddenTextarea.value = ' ';
|
||||
let singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
|
||||
if (minRows !== null) {
|
||||
minHeight = singleRowHeight * minRows;
|
||||
|
||||
@@ -77,6 +77,7 @@ The wrapper.
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| className | container className | string | - |
|
||||
| style | to customize the styles | object | - |
|
||||
| hasSider | whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering | boolean | - |
|
||||
|
||||
> APIs of `Layout.Header` `Layout.Footer` `Layout.Content` are the same as that of `Layout`.
|
||||
|
||||
@@ -103,9 +104,10 @@ The sidebar.
|
||||
```js
|
||||
{
|
||||
xs: '480px',
|
||||
sm: '768px',
|
||||
md: '992px',
|
||||
lg: '1200px',
|
||||
xl: '1600px',
|
||||
sm: '576px',
|
||||
md: '768px',
|
||||
lg: '992px',
|
||||
xl: '1200px',
|
||||
xxl: '1600px',
|
||||
}
|
||||
```
|
||||
|
||||
@@ -78,6 +78,7 @@ title: Layout
|
||||
| --- | --- | --- | --- |
|
||||
| className | 容器 className | string | - |
|
||||
| style | 指定样式 | object | - |
|
||||
| hasSider | 表示子元素里有 Sider,一般不用指定。可用于服务端渲染时避免样式闪动 | boolean | - |
|
||||
|
||||
> `Layout.Header` `Layout.Footer` `Layout.Content` API 与 `Layout` 相同
|
||||
|
||||
@@ -104,9 +105,10 @@ title: Layout
|
||||
```js
|
||||
{
|
||||
xs: '480px',
|
||||
sm: '768px',
|
||||
md: '992px',
|
||||
lg: '1200px',
|
||||
xl: '1600px',
|
||||
sm: '576px',
|
||||
md: '768px',
|
||||
lg: '992px',
|
||||
xl: '1200px',
|
||||
xxl: '1600px',
|
||||
}
|
||||
```
|
||||
|
||||
@@ -7,6 +7,7 @@ export interface BasicProps {
|
||||
style?: React.CSSProperties;
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
hasSider?: boolean;
|
||||
}
|
||||
|
||||
function generator(props: BasicProps) {
|
||||
@@ -58,9 +59,9 @@ class BasicLayout extends React.Component<BasicProps, any> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { prefixCls, className, children, ...others } = this.props;
|
||||
const { prefixCls, className, children, hasSider, ...others } = this.props;
|
||||
const divCls = classNames(className, prefixCls, {
|
||||
[`${prefixCls}-has-sider`]: this.state.siders.length > 0,
|
||||
[`${prefixCls}-has-sider`]: hasSider || this.state.siders.length > 0,
|
||||
});
|
||||
return (
|
||||
<div className={divCls} {...others}>{children}</div>
|
||||
|
||||
@@ -67,6 +67,7 @@ export default class Item extends React.Component<ListItemProps, any> {
|
||||
md: PropTypes.oneOf(GridColumns),
|
||||
lg: PropTypes.oneOf(GridColumns),
|
||||
xl: PropTypes.oneOf(GridColumns),
|
||||
xxl: PropTypes.oneOf(GridColumns),
|
||||
};
|
||||
|
||||
static contextTypes = {
|
||||
@@ -131,6 +132,7 @@ export default class Item extends React.Component<ListItemProps, any> {
|
||||
md={getGrid(grid, 'md')}
|
||||
lg={getGrid(grid, 'lg')}
|
||||
xl={getGrid(grid, 'xl')}
|
||||
xxl={getGrid(grid, 'xxl')}
|
||||
>
|
||||
<div {...others} className={classString}>
|
||||
{extra && extraContent}
|
||||
|
||||
@@ -209,9 +209,7 @@ exports[`renders ./components/list/demo/grid.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Card content
|
||||
</div>
|
||||
Card content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -246,9 +244,7 @@ exports[`renders ./components/list/demo/grid.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Card content
|
||||
</div>
|
||||
Card content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -283,9 +279,7 @@ exports[`renders ./components/list/demo/grid.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Card content
|
||||
</div>
|
||||
Card content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -320,9 +314,7 @@ exports[`renders ./components/list/demo/grid.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Card content
|
||||
</div>
|
||||
Card content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -446,7 +438,7 @@ exports[`renders ./components/list/demo/resposive.md correctly 1`] = `
|
||||
style="margin-left:-8px;margin-right:-8px"
|
||||
>
|
||||
<div
|
||||
class="ant-col-xs-24 ant-col-sm-12 ant-col-md-6 ant-col-lg-6 ant-col-xl-4"
|
||||
class="ant-col-xs-24 ant-col-sm-12 ant-col-md-6 ant-col-lg-6 ant-col-xl-4 ant-col-xxl-8"
|
||||
>
|
||||
<div
|
||||
class="ant-list-item"
|
||||
@@ -474,16 +466,14 @@ exports[`renders ./components/list/demo/resposive.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Card content
|
||||
</div>
|
||||
Card content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-col-xs-24 ant-col-sm-12 ant-col-md-6 ant-col-lg-6 ant-col-xl-4"
|
||||
class="ant-col-xs-24 ant-col-sm-12 ant-col-md-6 ant-col-lg-6 ant-col-xl-4 ant-col-xxl-8"
|
||||
>
|
||||
<div
|
||||
class="ant-list-item"
|
||||
@@ -511,16 +501,14 @@ exports[`renders ./components/list/demo/resposive.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Card content
|
||||
</div>
|
||||
Card content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-col-xs-24 ant-col-sm-12 ant-col-md-6 ant-col-lg-6 ant-col-xl-4"
|
||||
class="ant-col-xs-24 ant-col-sm-12 ant-col-md-6 ant-col-lg-6 ant-col-xl-4 ant-col-xxl-8"
|
||||
>
|
||||
<div
|
||||
class="ant-list-item"
|
||||
@@ -548,16 +536,14 @@ exports[`renders ./components/list/demo/resposive.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Card content
|
||||
</div>
|
||||
Card content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-col-xs-24 ant-col-sm-12 ant-col-md-6 ant-col-lg-6 ant-col-xl-4"
|
||||
class="ant-col-xs-24 ant-col-sm-12 ant-col-md-6 ant-col-lg-6 ant-col-xl-4 ant-col-xxl-8"
|
||||
>
|
||||
<div
|
||||
class="ant-list-item"
|
||||
@@ -585,16 +571,14 @@ exports[`renders ./components/list/demo/resposive.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Card content
|
||||
</div>
|
||||
Card content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-col-xs-24 ant-col-sm-12 ant-col-md-6 ant-col-lg-6 ant-col-xl-4"
|
||||
class="ant-col-xs-24 ant-col-sm-12 ant-col-md-6 ant-col-lg-6 ant-col-xl-4 ant-col-xxl-8"
|
||||
>
|
||||
<div
|
||||
class="ant-list-item"
|
||||
@@ -622,16 +606,14 @@ exports[`renders ./components/list/demo/resposive.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Card content
|
||||
</div>
|
||||
Card content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-col-xs-24 ant-col-sm-12 ant-col-md-6 ant-col-lg-6 ant-col-xl-4"
|
||||
class="ant-col-xs-24 ant-col-sm-12 ant-col-md-6 ant-col-lg-6 ant-col-xl-4 ant-col-xxl-8"
|
||||
>
|
||||
<div
|
||||
class="ant-list-item"
|
||||
@@ -659,9 +641,7 @@ exports[`renders ./components/list/demo/resposive.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Card content
|
||||
</div>
|
||||
Card content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -39,7 +39,7 @@ const data = [
|
||||
|
||||
ReactDOM.render(
|
||||
<List
|
||||
grid={{ gutter: 16, xs: 1, sm: 2, md: 4, lg: 4, xl: 6 }}
|
||||
grid={{ gutter: 16, xs: 1, sm: 2, md: 4, lg: 4, xl: 6, xxl: 3 }}
|
||||
dataSource={data}
|
||||
renderItem={item => (
|
||||
<List.Item>
|
||||
|
||||
@@ -15,7 +15,7 @@ export { ListItemProps, ListItemMetaProps } from './Item';
|
||||
|
||||
export type ColumnCount = 1 | 2 | 3 | 4 | 6 | 8 | 12 | 24;
|
||||
|
||||
export type ColumnType = 'gutter' | 'column' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
||||
export type ColumnType = 'gutter' | 'column' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
||||
|
||||
export interface ListGridType {
|
||||
gutter?: number;
|
||||
@@ -25,6 +25,7 @@ export interface ListGridType {
|
||||
md?: ColumnCount;
|
||||
lg?: ColumnCount;
|
||||
xl?: ColumnCount;
|
||||
xxl?: ColumnCount;
|
||||
}
|
||||
|
||||
export type ListSize = 'small' | 'default' | 'large';
|
||||
|
||||
@@ -41,6 +41,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="[object Object]"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -551,6 +552,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="date"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -569,6 +571,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="month"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -39,8 +39,9 @@ import isIS from '../is_IS';
|
||||
import arEG from '../ar_EG';
|
||||
import ukUA from '../uk_UA';
|
||||
import zhCN from '../zh_CN';
|
||||
import kuIQ from '../ku_IQ';
|
||||
|
||||
const locales = [enUS, ptBR, ptPT, ruRU, esES, svSE, frBE, deDE, nlNL, caES, csCZ, koKR, etEE, skSK, jaJP, trTR, zhTW, fiFI, plPL, bgBG, enGB, frFR, nlBE, itIT, viVN, thTH, faIR, elGR, nbNO, srRS, isIS, arEG, ukUA, zhCN];
|
||||
const locales = [enUS, ptBR, ptPT, ruRU, esES, svSE, frBE, deDE, nlNL, caES, csCZ, koKR, etEE, skSK, jaJP, trTR, zhTW, fiFI, plPL, bgBG, enGB, frFR, nlBE, itIT, viVN, thTH, faIR, elGR, nbNO, srRS, isIS, arEG, ukUA, zhCN, kuIQ];
|
||||
|
||||
const { Option } = Select;
|
||||
const { RangePicker } = DatePicker;
|
||||
@@ -153,5 +154,7 @@ describe('Locale Provider', () => {
|
||||
expect(wrapper.render()).toMatchSnapshot();
|
||||
wrapper.setState({ locale: frFR });
|
||||
expect(wrapper.render()).toMatchSnapshot();
|
||||
wrapper.setState({ locale: null });
|
||||
expect(wrapper.render()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -25,6 +25,8 @@ export interface LocaleProviderProps {
|
||||
function setMomentLocale(locale: Locale) {
|
||||
if (locale && locale.locale) {
|
||||
moment.locale(locale.locale);
|
||||
} else {
|
||||
moment.locale('en');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +60,7 @@ export default class LocaleProvider extends React.Component<LocaleProviderProps,
|
||||
componentWillReceiveProps(nextProps: LocaleProviderProps) {
|
||||
const { locale } = this.props;
|
||||
const nextLocale = nextProps.locale;
|
||||
if (locale.locale !== nextLocale.locale) {
|
||||
if (locale !== nextLocale) {
|
||||
setMomentLocale(nextProps.locale);
|
||||
}
|
||||
}
|
||||
|
||||
44
components/locale-provider/ku_IQ.tsx
Executable file
44
components/locale-provider/ku_IQ.tsx
Executable file
@@ -0,0 +1,44 @@
|
||||
import Pagination from 'rc-pagination/lib/locale/ku_IQ';
|
||||
import DatePicker from '../date-picker/locale/ku_IQ';
|
||||
import TimePicker from '../time-picker/locale/ku_IQ';
|
||||
import Calendar from '../calendar/locale/ku_IQ';
|
||||
|
||||
export default {
|
||||
locale: 'ku-iq',
|
||||
Pagination,
|
||||
DatePicker,
|
||||
TimePicker,
|
||||
Calendar,
|
||||
Table: {
|
||||
filterTitle: 'Menuê peldanka',
|
||||
filterConfirm: 'Temam',
|
||||
filterReset: 'Jê bibe',
|
||||
emptyText: 'Agahî tune',
|
||||
selectAll: 'Hemî hilbijêre',
|
||||
selectInvert: 'Hilbijartinan veguhere',
|
||||
},
|
||||
Modal: {
|
||||
okText: 'Temam',
|
||||
cancelText: 'Betal ke',
|
||||
justOkText: 'Temam',
|
||||
},
|
||||
Popconfirm: {
|
||||
okText: 'Temam',
|
||||
cancelText: 'Betal ke',
|
||||
},
|
||||
Transfer: {
|
||||
notFoundContent: 'Peyda Nebû',
|
||||
searchPlaceholder: 'Lêgerîn',
|
||||
itemUnit: 'tişt',
|
||||
itemsUnit: 'tişt',
|
||||
},
|
||||
Select: {
|
||||
notFoundContent: 'Peyda Nebû',
|
||||
},
|
||||
Upload: {
|
||||
uploading: 'Bardike...',
|
||||
removeFile: 'Pelê rabike',
|
||||
uploadError: 'Xeta barkirine',
|
||||
previewFile: 'Pelê pêşbibîne',
|
||||
},
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
import Pagination from 'rc-pagination/lib/locale/en_US';
|
||||
import DatePicker from '../date-picker/locale/tr_TR';
|
||||
import TimePicker from '../time-picker/locale/tr_TR';
|
||||
import Calendar from '../calendar/locale/en_US';
|
||||
import Calendar from '../calendar/locale/tr_TR';
|
||||
|
||||
export default {
|
||||
locale: 'tr',
|
||||
|
||||
@@ -47,6 +47,8 @@ export interface MenuProps {
|
||||
multiple?: boolean;
|
||||
inlineIndent?: number;
|
||||
inlineCollapsed?: boolean;
|
||||
subMenuCloseDelay?: number;
|
||||
subMenuOpenDelay?: number;
|
||||
}
|
||||
|
||||
export interface MenuState {
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
// dark theme
|
||||
&-dark,
|
||||
&-dark &-sub {
|
||||
color: @text-color-secondary-dark;
|
||||
color: @menu-dark-color;
|
||||
background: @menu-dark-bg;
|
||||
.@{menu-prefix-cls}-submenu-title .@{menu-prefix-cls}-submenu-arrow {
|
||||
opacity: .45;
|
||||
transition: all .3s;
|
||||
&:after,
|
||||
&:before {
|
||||
background: #fff;
|
||||
background: @menu-dark-arrow-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@
|
||||
&-dark &-item,
|
||||
&-dark &-item-group-title,
|
||||
&-dark &-item > a {
|
||||
color: @text-color-secondary-dark;
|
||||
color: @menu-dark-color;
|
||||
}
|
||||
|
||||
&-dark&-inline,
|
||||
@@ -70,9 +70,9 @@
|
||||
&-dark &-submenu-selected,
|
||||
&-dark &-submenu-title:hover {
|
||||
background-color: transparent;
|
||||
color: #fff;
|
||||
color: @menu-dark-highlight-color;
|
||||
> a {
|
||||
color: #fff;
|
||||
color: @menu-dark-highlight-color;
|
||||
}
|
||||
> .@{menu-prefix-cls}-submenu-title,
|
||||
> .@{menu-prefix-cls}-submenu-title:hover {
|
||||
@@ -80,7 +80,7 @@
|
||||
opacity: 1;
|
||||
&:after,
|
||||
&:before {
|
||||
background: #fff;
|
||||
background: @menu-dark-highlight-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,19 +88,19 @@
|
||||
|
||||
&-dark &-item-selected {
|
||||
border-right: 0;
|
||||
color: #fff;
|
||||
color: @menu-dark-highlight-color;
|
||||
&:after {
|
||||
border-right: 0;
|
||||
}
|
||||
> a,
|
||||
> a:hover {
|
||||
color: #fff;
|
||||
color: @menu-dark-highlight-color;
|
||||
}
|
||||
}
|
||||
|
||||
&&-dark &-item-selected,
|
||||
&-submenu-popup&-dark &-item-selected {
|
||||
background-color: @primary-color;
|
||||
background-color: @menu-dark-item-selected-bg;
|
||||
}
|
||||
|
||||
// Disabled state sets text to dark gray and nukes hover/tab effects
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
@import "../../style/mixins/index";
|
||||
|
||||
@menu-prefix-cls: ~"@{ant-prefix}-menu";
|
||||
@menu-inline-toplevel-item-height: 40px;
|
||||
@menu-item-height: 40px;
|
||||
|
||||
// default theme
|
||||
.@{menu-prefix-cls} {
|
||||
@@ -13,7 +11,8 @@
|
||||
padding-left: 0; // Override default ul/ol
|
||||
list-style: none;
|
||||
box-shadow: @box-shadow-base;
|
||||
background: @component-background;
|
||||
color: @menu-item-color;
|
||||
background: @menu-bg;
|
||||
line-height: 0; // Fix display inline-block gap
|
||||
transition: background .3s, width .2s;
|
||||
.clearfix;
|
||||
@@ -30,7 +29,7 @@
|
||||
}
|
||||
|
||||
&-item-group-title {
|
||||
color: @text-color-secondary;
|
||||
color: @menu-item-group-title-color;
|
||||
font-size: @font-size-base;
|
||||
line-height: @line-height-base;
|
||||
padding: 8px 16px;
|
||||
@@ -44,7 +43,7 @@
|
||||
|
||||
&-item:active,
|
||||
&-submenu-title:active {
|
||||
background: @item-active-bg;
|
||||
background: @menu-item-active-bg;
|
||||
}
|
||||
|
||||
&-submenu &-sub {
|
||||
@@ -54,9 +53,9 @@
|
||||
|
||||
&-item > a {
|
||||
display: block;
|
||||
color: @text-color;
|
||||
color: @menu-item-color;
|
||||
&:hover {
|
||||
color: @primary-color;
|
||||
color: @menu-highlight-color;
|
||||
}
|
||||
&:focus {
|
||||
text-decoration: none;
|
||||
@@ -86,7 +85,7 @@
|
||||
&:not(&-inline) &-submenu-open,
|
||||
&-submenu-active,
|
||||
&-submenu-title:hover {
|
||||
color: @primary-color;
|
||||
color: @menu-highlight-color;
|
||||
}
|
||||
|
||||
&-horizontal &-item,
|
||||
@@ -101,15 +100,15 @@
|
||||
}
|
||||
|
||||
&-item-selected {
|
||||
color: @primary-color;
|
||||
color: @menu-highlight-color;
|
||||
> a,
|
||||
> a:hover {
|
||||
color: @primary-color;
|
||||
color: @menu-highlight-color;
|
||||
}
|
||||
}
|
||||
|
||||
&:not(&-horizontal) &-item-selected {
|
||||
background-color: @item-active-bg;
|
||||
background-color: @menu-item-active-bg;
|
||||
}
|
||||
|
||||
&-inline,
|
||||
@@ -185,7 +184,7 @@
|
||||
}
|
||||
|
||||
> .@{menu-prefix-cls} {
|
||||
background-color: @component-background;
|
||||
background-color: @menu-bg;
|
||||
border-radius: @border-radius-base;
|
||||
&-submenu-title:after {
|
||||
transition: transform .3s @ease-in-out;
|
||||
@@ -208,7 +207,7 @@
|
||||
position: absolute;
|
||||
vertical-align: baseline;
|
||||
background: #fff;
|
||||
background-image: linear-gradient(to right, @text-color, @text-color);
|
||||
background-image: linear-gradient(to right, @menu-item-color, @menu-item-color);
|
||||
width: 6px;
|
||||
height: 1.5px;
|
||||
border-radius: 2px;
|
||||
@@ -224,7 +223,7 @@
|
||||
> .@{menu-prefix-cls}-submenu-title:hover .@{menu-prefix-cls}-submenu-arrow {
|
||||
&:after,
|
||||
&:before {
|
||||
background: linear-gradient(to right, @primary-color, @primary-color);
|
||||
background: linear-gradient(to right, @menu-highlight-color, @menu-highlight-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -254,9 +253,9 @@
|
||||
&-vertical &-submenu-selected,
|
||||
&-vertical-left &-submenu-selected,
|
||||
&-vertical-right &-submenu-selected {
|
||||
color: @primary-color;
|
||||
color: @menu-highlight-color;
|
||||
> a {
|
||||
color: @primary-color;
|
||||
color: @menu-highlight-color;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,15 +276,15 @@
|
||||
&-active,
|
||||
&-open,
|
||||
&-selected {
|
||||
border-bottom: 2px solid @primary-color;
|
||||
color: @primary-color;
|
||||
border-bottom: 2px solid @menu-highlight-color;
|
||||
color: @menu-highlight-color;
|
||||
}
|
||||
|
||||
> a {
|
||||
display: block;
|
||||
color: @text-color;
|
||||
color: @menu-item-color;
|
||||
&:hover {
|
||||
color: @primary-color;
|
||||
color: @menu-highlight-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -310,7 +309,7 @@
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
border-right: 3px solid @primary-color;
|
||||
border-right: 3px solid @menu-highlight-color;
|
||||
transform: scaleY(.0001);
|
||||
opacity: 0;
|
||||
transition: transform .15s @ease-out, opacity .15s @ease-out;
|
||||
@@ -360,6 +359,10 @@
|
||||
.@{menu-prefix-cls}-submenu-title {
|
||||
width: ~"calc(100% + 1px)";
|
||||
}
|
||||
|
||||
.@{menu-prefix-cls}-submenu-title {
|
||||
padding-right: 34px;
|
||||
}
|
||||
}
|
||||
|
||||
&-inline-collapsed {
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
color: @heading-color;
|
||||
font-weight: 500;
|
||||
font-size: @font-size-lg;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
.@{confirm-prefix-cls}-content {
|
||||
@@ -36,8 +37,8 @@
|
||||
> .@{iconfont-css-prefix} {
|
||||
font-size: 22px;
|
||||
margin-right: 16px;
|
||||
margin-top: 1px;
|
||||
float: left;
|
||||
min-height: 48px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ export interface ArgsProps {
|
||||
btn?: React.ReactNode;
|
||||
key?: string;
|
||||
onClose?: () => void;
|
||||
duration?: number;
|
||||
duration?: number | null;
|
||||
icon?: React.ReactNode;
|
||||
placement?: NotificationPlacement;
|
||||
style?: React.CSSProperties;
|
||||
|
||||
@@ -720,3 +720,33 @@ exports[`renders ./components/progress/demo/line-mini.md correctly 1`] = `
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders ./components/progress/demo/segment.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
|
||||
>
|
||||
<div>
|
||||
<div
|
||||
class="ant-progress-outer"
|
||||
>
|
||||
<div
|
||||
class="ant-progress-inner"
|
||||
>
|
||||
<div
|
||||
class="ant-progress-bg"
|
||||
style="width:60%;height:8px"
|
||||
/>
|
||||
<div
|
||||
class="ant-progress-success-bg"
|
||||
style="width:30%;height:8px"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<span
|
||||
class="ant-progress-text"
|
||||
>
|
||||
60%
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
24
components/progress/demo/segment.md
Normal file
24
components/progress/demo/segment.md
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
order: 9
|
||||
title:
|
||||
zh-CN: 分段进度条
|
||||
en-US: Progress bar with success segment
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
||||
标准的进度条。
|
||||
|
||||
## en-US
|
||||
|
||||
A standard progress bar.
|
||||
|
||||
````jsx
|
||||
import { Tooltip, Progress } from 'antd';
|
||||
|
||||
ReactDOM.render(
|
||||
<Tooltip title="3 done / 3 in progress / 4 to do">
|
||||
<Progress percent={60} successPercent={30} />
|
||||
</Tooltip>
|
||||
, mountNode);
|
||||
````
|
||||
@@ -27,3 +27,4 @@ If it will take a long time to complete an operation, you can use `Progress` to
|
||||
| strokeWidth `(type=circle)` | to set the width of the circular progress bar, unit: percentage of the canvas width | number | 6 |
|
||||
| type | to set the type, options: `line` `circle` `dashboard` | string | `line` |
|
||||
| width `(type=circle)` | to set the canvas width of the circular progress bar, unit: `px` | number | 132 |
|
||||
| successPercent | segmented success percent, works when `type="line"` | number | 0 |
|
||||
|
||||
@@ -28,3 +28,4 @@ title: Progress
|
||||
| strokeWidth `(type=circle)` | 圆形进度条线的宽度,单位是进度条画布宽度的百分比 | number | 6 |
|
||||
| type | 类型,可选 `line` `circle` `dashboard` | string | line |
|
||||
| width `(type=circle)` | 圆形进度条画布宽度,单位 px | number | 132 |
|
||||
| successPercent | 已完成的分段百分比,`type="line"` 时有效 | number | 0 |
|
||||
|
||||
@@ -15,6 +15,7 @@ export interface ProgressProps {
|
||||
className?: string;
|
||||
type?: 'line' | 'circle' | 'dashboard';
|
||||
percent?: number;
|
||||
successPercent?: number;
|
||||
format?: (percent: number) => string;
|
||||
status?: 'success' | 'active' | 'exception';
|
||||
showInfo?: boolean;
|
||||
@@ -56,7 +57,7 @@ export default class Progress extends React.Component<ProgressProps, {}> {
|
||||
render() {
|
||||
const props = this.props;
|
||||
const {
|
||||
prefixCls, className, percent = 0, status, format, trailColor, size,
|
||||
prefixCls, className, percent = 0, status, format, trailColor, size, successPercent,
|
||||
type, strokeWidth, width, showInfo, gapDegree = 0, gapPosition, ...restProps,
|
||||
} = props;
|
||||
const progressStatus = parseInt(percent.toString(), 10) >= 100 && !('status' in props) ?
|
||||
@@ -83,11 +84,19 @@ export default class Progress extends React.Component<ProgressProps, {}> {
|
||||
width: `${percent}%`,
|
||||
height: strokeWidth || (size === 'small' ? 6 : 8),
|
||||
};
|
||||
const successPercentStyle = {
|
||||
width: `${successPercent}%`,
|
||||
height: strokeWidth || (size === 'small' ? 6 : 8),
|
||||
};
|
||||
const successSegment = successPercent !== undefined
|
||||
? <div className={`${prefixCls}-success-bg`} style={successPercentStyle} />
|
||||
: null;
|
||||
progress = (
|
||||
<div>
|
||||
<div className={`${prefixCls}-outer`}>
|
||||
<div className={`${prefixCls}-inner`}>
|
||||
<div className={`${prefixCls}-bg`} style={percentStyle} />
|
||||
{successSegment}
|
||||
</div>
|
||||
</div>
|
||||
{progressInfo}
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
background-color: @progress-remaining-color;
|
||||
border-radius: 100px;
|
||||
vertical-align: middle;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&-circle-trail {
|
||||
@@ -46,6 +47,7 @@
|
||||
animation: ~"@{ant-prefix}-progress-appear" .3s;
|
||||
}
|
||||
|
||||
&-success-bg,
|
||||
&-bg {
|
||||
border-radius: 100px;
|
||||
background-color: @progress-default-color;
|
||||
@@ -53,6 +55,13 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&-success-bg {
|
||||
background-color: @success-color;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
&-text {
|
||||
word-break: normal;
|
||||
width: 2em;
|
||||
|
||||
@@ -94,6 +94,7 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="a"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -112,6 +113,7 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="b"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -130,6 +132,7 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="c"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -148,6 +151,7 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="d"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -175,6 +179,7 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="a"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -194,6 +199,7 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
|
||||
class="ant-radio-button-input"
|
||||
disabled=""
|
||||
type="radio"
|
||||
value="b"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -212,6 +218,7 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="c"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -230,6 +237,7 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="d"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -258,6 +266,7 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
|
||||
class="ant-radio-button-input"
|
||||
disabled=""
|
||||
type="radio"
|
||||
value="a"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -277,6 +286,7 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
|
||||
class="ant-radio-button-input"
|
||||
disabled=""
|
||||
type="radio"
|
||||
value="b"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -296,6 +306,7 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
|
||||
class="ant-radio-button-input"
|
||||
disabled=""
|
||||
type="radio"
|
||||
value="c"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -315,6 +326,7 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
|
||||
class="ant-radio-button-input"
|
||||
disabled=""
|
||||
type="radio"
|
||||
value="d"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -343,6 +355,7 @@ exports[`renders ./components/radio/demo/radiogroup.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="1"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -361,6 +374,7 @@ exports[`renders ./components/radio/demo/radiogroup.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="2"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -379,6 +393,7 @@ exports[`renders ./components/radio/demo/radiogroup.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="3"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -397,6 +412,7 @@ exports[`renders ./components/radio/demo/radiogroup.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="4"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -424,6 +440,7 @@ exports[`renders ./components/radio/demo/radiogroup-more.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="1"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -443,6 +460,7 @@ exports[`renders ./components/radio/demo/radiogroup-more.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="2"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -462,6 +480,7 @@ exports[`renders ./components/radio/demo/radiogroup-more.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="3"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -481,6 +500,7 @@ exports[`renders ./components/radio/demo/radiogroup-more.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="4"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -508,6 +528,7 @@ exports[`renders ./components/radio/demo/radiogroup-options.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="Apple"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -526,6 +547,7 @@ exports[`renders ./components/radio/demo/radiogroup-options.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="Pear"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -544,6 +566,7 @@ exports[`renders ./components/radio/demo/radiogroup-options.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="Orange"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -567,6 +590,7 @@ exports[`renders ./components/radio/demo/radiogroup-options.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="Apple"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -585,6 +609,7 @@ exports[`renders ./components/radio/demo/radiogroup-options.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="Pear"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -603,6 +628,7 @@ exports[`renders ./components/radio/demo/radiogroup-options.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="Orange"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -626,6 +652,7 @@ exports[`renders ./components/radio/demo/radiogroup-options.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="Apple"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -644,6 +671,7 @@ exports[`renders ./components/radio/demo/radiogroup-options.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="Pear"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -662,6 +690,7 @@ exports[`renders ./components/radio/demo/radiogroup-options.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="Orange"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -690,6 +719,7 @@ exports[`renders ./components/radio/demo/radiogroup-with-name.md correctly 1`] =
|
||||
class="ant-radio-input"
|
||||
name="radiogroup"
|
||||
type="radio"
|
||||
value="1"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -709,6 +739,7 @@ exports[`renders ./components/radio/demo/radiogroup-with-name.md correctly 1`] =
|
||||
class="ant-radio-input"
|
||||
name="radiogroup"
|
||||
type="radio"
|
||||
value="2"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -728,6 +759,7 @@ exports[`renders ./components/radio/demo/radiogroup-with-name.md correctly 1`] =
|
||||
class="ant-radio-input"
|
||||
name="radiogroup"
|
||||
type="radio"
|
||||
value="3"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -747,6 +779,7 @@ exports[`renders ./components/radio/demo/radiogroup-with-name.md correctly 1`] =
|
||||
class="ant-radio-input"
|
||||
name="radiogroup"
|
||||
type="radio"
|
||||
value="4"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
@@ -775,6 +808,7 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="a"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -793,6 +827,7 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="b"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -811,6 +846,7 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="c"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -829,6 +865,7 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="d"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -856,6 +893,7 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="a"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -874,6 +912,7 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="b"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -892,6 +931,7 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="c"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -910,6 +950,7 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="d"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -937,6 +978,7 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="a"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -955,6 +997,7 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="b"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -973,6 +1016,7 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="c"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -991,6 +1035,7 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="d"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
&:hover,
|
||||
&-focused {
|
||||
.@{radio-inner-prefix-cls} {
|
||||
border-color: @primary-color;
|
||||
border-color: @radio-dot-color;
|
||||
}
|
||||
}
|
||||
&-checked:after {
|
||||
@@ -46,7 +46,7 @@
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
border: 1px solid @primary-color;
|
||||
border: 1px solid @radio-dot-color;
|
||||
content: '';
|
||||
animation: antRadioEffect 0.36s ease-in-out;
|
||||
animation-fill-mode: both;
|
||||
@@ -69,7 +69,7 @@
|
||||
border-top: 0;
|
||||
border-left: 0;
|
||||
content: ' ';
|
||||
background-color: @primary-color;
|
||||
background-color: @radio-dot-color;
|
||||
opacity: 0;
|
||||
transform: scale(0);
|
||||
transition: all @radio-duration @ease-in-out-circ;
|
||||
@@ -104,7 +104,7 @@
|
||||
// 选中状态
|
||||
.@{radio-prefix-cls}-checked {
|
||||
.@{radio-inner-prefix-cls} {
|
||||
border-color: @primary-color;
|
||||
border-color: @radio-dot-color;
|
||||
&:after {
|
||||
transform: scale(.875);
|
||||
opacity: 1;
|
||||
@@ -204,7 +204,7 @@ span.@{radio-prefix-cls} + * {
|
||||
|
||||
&:hover,
|
||||
&-focused {
|
||||
color: @primary-color;
|
||||
color: @radio-dot-color;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@@ -218,29 +218,29 @@ span.@{radio-prefix-cls} + * {
|
||||
|
||||
&-checked {
|
||||
background: @radio-button-bg;
|
||||
border-color: @primary-color;
|
||||
color: @primary-color;
|
||||
box-shadow: -1px 0 0 0 @primary-color;
|
||||
border-color: @radio-dot-color;
|
||||
color: @radio-dot-color;
|
||||
box-shadow: -1px 0 0 0 @radio-dot-color;
|
||||
z-index: 1;
|
||||
&::before {
|
||||
background-color: @primary-color !important;
|
||||
background-color: @radio-dot-color !important;
|
||||
opacity: 0.1;
|
||||
}
|
||||
&:first-child {
|
||||
border-color: @primary-color;
|
||||
border-color: @radio-dot-color;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
border-color: @primary-5;
|
||||
box-shadow: -1px 0 0 0 @primary-5;
|
||||
color: @primary-5;
|
||||
border-color: @radio-button-hover-color;
|
||||
box-shadow: -1px 0 0 0 @radio-button-hover-color;
|
||||
color: @radio-button-hover-color;
|
||||
}
|
||||
|
||||
&:active {
|
||||
border-color: @primary-7;
|
||||
box-shadow: -1px 0 0 0 @primary-7;
|
||||
color: @primary-7;
|
||||
border-color: @radio-button-active-color;
|
||||
box-shadow: -1px 0 0 0 @radio-button-active-color;
|
||||
color: @radio-button-active-color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -558,6 +558,7 @@ exports[`renders ./components/select/demo/size.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="large"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -577,6 +578,7 @@ exports[`renders ./components/select/demo/size.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="default"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -595,6 +597,7 @@ exports[`renders ./components/select/demo/size.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="small"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
|
||||
@@ -47,15 +47,15 @@ Select component to select value from options.
|
||||
| tokenSeparators | Separator used to tokenize on tag/multiple mode | string\[] | |
|
||||
| value | Current selected option. | string\|number\|string\[]\|number\[] | - |
|
||||
| onBlur | Called when blur | function | - |
|
||||
| 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) | - |
|
||||
| onChange | Called when select an option or input value change, or value of input is changed in combobox mode | function(value, option:Option/Array<Option\>) | - |
|
||||
| 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, option:Option) | - |
|
||||
| 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 | - |
|
||||
| onSearch | Callback function that is fired when input changed. | function(value: string) | |
|
||||
| onSelect | Called when a option is selected, the params are option's value (or key) and option instance. | function(value, option) | - |
|
||||
| onSelect | Called when a option is selected, the params are option's value (or key) and option instance. | function(value, option:Option) | - |
|
||||
|
||||
### Select Methods
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ export interface AbstractSelectProps {
|
||||
allowClear?: boolean;
|
||||
disabled?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
tabIndex?: number;
|
||||
placeholder?: string;
|
||||
defaultActiveFirstOption?: boolean;
|
||||
dropdownClassName?: string;
|
||||
|
||||
@@ -51,14 +51,14 @@ title: Select
|
||||
| tokenSeparators | 在 tags 和 multiple 模式下自动分词的分隔符 | string\[] | |
|
||||
| value | 指定当前选中的条目 | string\|string\[]\|number\|number\[] | - |
|
||||
| onBlur | 失去焦点的时回调 | function | - |
|
||||
| onChange | 选中 option,或 input 的 value 变化(combobox 模式下)时,调用此函数 | function(value) | - |
|
||||
| onDeselect | 取消选中时调用,参数为选中项的 value (或 key) 值,仅在 multiple 或 tags 模式下生效 | function(value) | - |
|
||||
| onChange | 选中 option,或 input 的 value 变化(combobox 模式下)时,调用此函数 | function(value, option:Option/Array<Option\>) | - |
|
||||
| onDeselect | 取消选中时调用,参数为选中项的 value (或 key) 值,仅在 multiple 或 tags 模式下生效 | function(value,option:Option) | - |
|
||||
| onFocus | 获得焦点时回调 | function | - |
|
||||
| onMouseEnter | 鼠标移入时回调 | function | - |
|
||||
| onMouseLeave | 鼠标移出时回调 | function | - |
|
||||
| onPopupScroll | 下拉列表滚动时的回调 | function | - |
|
||||
| onSearch | 文本框值变化时回调 | function(value: string) | |
|
||||
| onSelect | 被选中时调用,参数为选中项的 value (或 key) 值 | function(value, option) | - |
|
||||
| onSelect | 被选中时调用,参数为选中项的 value (或 key) 值 | function(value, option:Option) | - |
|
||||
|
||||
> 注意,如果发现下拉菜单跟随页面滚动,或者需要在其他弹层中触发 Select,请尝试使用 `getPopupContainer={triggerNode => triggerNode.parentNode}` 将下拉弹层渲染节点固定在触发器的父元素中。
|
||||
|
||||
|
||||
@@ -448,7 +448,6 @@
|
||||
top: -9999px;
|
||||
position: absolute;
|
||||
outline: none;
|
||||
overflow: hidden;
|
||||
font-size: @font-size-base;
|
||||
|
||||
&-menu {
|
||||
@@ -457,7 +456,6 @@
|
||||
padding-left: 0; // Override default ul/ol
|
||||
list-style: none;
|
||||
max-height: 250px;
|
||||
overflow: auto;
|
||||
|
||||
&-item-group-list {
|
||||
margin: 0;
|
||||
|
||||
@@ -2,15 +2,6 @@
|
||||
@import "../../style/mixins/index";
|
||||
|
||||
@slider-prefix-cls: ~"@{ant-prefix}-slider";
|
||||
// slider color
|
||||
@slider-disabled-color: @disabled-color;
|
||||
// tooltip
|
||||
@slider-tooltip-color: #fff;
|
||||
@slider-tooltip-bg: tint(@text-color, 4%);
|
||||
@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;
|
||||
@@ -31,7 +22,7 @@
|
||||
width: 100%;
|
||||
height: 4px;
|
||||
border-radius: 2px;
|
||||
background-color: @background-color-base;
|
||||
background-color: @slider-rail-background-color;
|
||||
transition: background-color .3s;
|
||||
}
|
||||
|
||||
@@ -39,7 +30,7 @@
|
||||
position: absolute;
|
||||
height: 4px;
|
||||
border-radius: @border-radius-base;
|
||||
background-color: @primary-3;
|
||||
background-color: @slider-track-background-color;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
@@ -51,30 +42,30 @@
|
||||
height: 14px;
|
||||
cursor: pointer;
|
||||
border-radius: 50%;
|
||||
border: solid 2px @primary-3;
|
||||
border: solid 2px @slider-handle-color;
|
||||
background-color: @component-background;
|
||||
transition: border-color .3s, transform .3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
|
||||
|
||||
&:focus {
|
||||
border-color: tint(@primary-color, 20%);
|
||||
box-shadow: 0 0 0 5px tint(@primary-color, 50%);
|
||||
border-color: @slider-handle-color-focus;
|
||||
box-shadow: 0 0 0 5px @slider-handle-color-focus-shadow;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
&.@{ant-prefix}-tooltip-open {
|
||||
border-color: @primary-color;
|
||||
border-color: @slider-handle-color-tooltip-open;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.@{slider-prefix-cls}-rail {
|
||||
background-color: #e1e1e1;
|
||||
background-color: @slider-rail-background-color-hover;
|
||||
}
|
||||
.@{slider-prefix-cls}-track {
|
||||
background-color: @primary-4;
|
||||
background-color: @slider-track-background-color-hover;
|
||||
}
|
||||
.@{slider-prefix-cls}-handle:not(.@{ant-prefix}-tooltip-open) {
|
||||
border-color: @primary-4;
|
||||
border-color: @slider-handle-color-hover;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +103,7 @@
|
||||
margin-left: -4px;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border: 2px solid @border-color-split;
|
||||
border: 2px solid @slider-dot-border-color;
|
||||
background-color: @component-background;
|
||||
cursor: pointer;
|
||||
border-radius: 50%;
|
||||
@@ -124,7 +115,7 @@
|
||||
margin-left: -4px;
|
||||
}
|
||||
&-active {
|
||||
border-color: tint(@primary-color, 50%);
|
||||
border-color: @slider-dot-border-color-active;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,14 +42,3 @@ class Card extends React.Component {
|
||||
|
||||
ReactDOM.render(<Card />, mountNode);
|
||||
````
|
||||
|
||||
````css
|
||||
.example {
|
||||
text-align: center;
|
||||
background: rgba(0,0,0,0.05);
|
||||
border-radius: 4px;
|
||||
margin-bottom: 20px;
|
||||
padding: 30px 50px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
````
|
||||
|
||||
@@ -10,6 +10,7 @@ export interface StepsProps {
|
||||
size?: 'default' | 'small';
|
||||
direction?: 'horizontal' | 'vertical';
|
||||
progressDot?: boolean | Function;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
|
||||
export default class Steps extends React.Component<StepsProps, any> {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
// http://stackoverflow.com/a/13611748/3040605
|
||||
@font-face {
|
||||
font-family: "Monospace Number";
|
||||
font-family: "Monospaced Number";
|
||||
src: local("Tahoma");
|
||||
unicode-range: U+30-39;
|
||||
}
|
||||
|
||||
@@ -327,3 +327,4 @@
|
||||
.@{iconfont-css-prefix}-codepen-circle:before { content: "\e9b4"; }
|
||||
.@{iconfont-css-prefix}-alipay:before { content: "\e9b3"; }
|
||||
.@{iconfont-css-prefix}-ant-design:before { content: "\e9b2"; }
|
||||
.@{iconfont-css-prefix}-aliyun:before { content: "\e9f4"; }
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
// Base background color for most components
|
||||
@component-background : #fff;
|
||||
@font-family-no-number : "Chinese Quote", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
@font-family : "Monospace Number", @font-family-no-number;
|
||||
@font-family : "Monospaced Number", @font-family-no-number;
|
||||
@code-family : Consolas, Menlo, Courier, monospace;
|
||||
@heading-color : fade(#000, 85%);
|
||||
@text-color : fade(#000, 65%);
|
||||
@@ -67,7 +67,7 @@
|
||||
|
||||
// ICONFONT
|
||||
@iconfont-css-prefix : anticon;
|
||||
@icon-url : "https://at.alicdn.com/t/font_148784_r2qo40wrmaolayvi";
|
||||
@icon-url : "https://at.alicdn.com/t/font_148784_dky7e838xq4obt9";
|
||||
|
||||
// LINK
|
||||
@link-color : @primary-color;
|
||||
@@ -156,13 +156,17 @@
|
||||
|
||||
// Checkbox
|
||||
@checkbox-size : 16px;
|
||||
@checkbox-color : @primary-color;
|
||||
|
||||
// Radio
|
||||
@radio-size : 16px;
|
||||
@radio-dot-color : @primary-color;
|
||||
|
||||
// Radio buttons
|
||||
@radio-button-bg : @btn-default-bg;
|
||||
@radio-button-color : @btn-default-color;
|
||||
@radio-button-bg : @btn-default-bg;
|
||||
@radio-button-color : @btn-default-color;
|
||||
@radio-button-hover-color : @primary-5;
|
||||
@radio-button-active-color : @primary-7;
|
||||
|
||||
// Media queries breakpoints
|
||||
// Extra small screen / phone
|
||||
@@ -304,9 +308,21 @@
|
||||
|
||||
// Menu
|
||||
// ---
|
||||
@menu-dark-bg: @layout-header-background;
|
||||
@menu-dark-submenu-bg: #000c17;
|
||||
@menu-inline-toplevel-item-height: 40px;
|
||||
@menu-item-height: 40px;
|
||||
@menu-collapsed-width: 80px;
|
||||
@menu-bg: @component-background;
|
||||
@menu-item-color: @text-color;
|
||||
@menu-highlight-color: @primary-color;
|
||||
@menu-item-active-bg: @item-active-bg;
|
||||
@menu-item-group-title-color: @text-color-secondary;
|
||||
// dark theme
|
||||
@menu-dark-color: @text-color-secondary-dark;
|
||||
@menu-dark-bg: @layout-header-background;
|
||||
@menu-dark-arrow-color: #fff;
|
||||
@menu-dark-submenu-bg: #000c17;
|
||||
@menu-dark-highlight-color: #fff;
|
||||
@menu-dark-item-selected-bg: @primary-color;
|
||||
|
||||
// Spin
|
||||
// ---
|
||||
@@ -368,7 +384,18 @@
|
||||
// ---
|
||||
@tabs-card-head-background: @background-color-light;
|
||||
@tabs-card-height: 40px;
|
||||
@tabs-card-active-color: @primary-color;
|
||||
@tabs-title-font-size: @font-size-base;
|
||||
@tabs-ink-bar-bg-color: @primary-color;
|
||||
@tab-bar-margin: 0 0 16px 0;
|
||||
@tab-horizontal-margin: 0 32px 0 0;
|
||||
@tab-vertical-margin: 0 0 16px 0;
|
||||
@tab-horizontal-padding: 12px 16px;
|
||||
@tab-vertical-padding: 8px 24px;
|
||||
@tab-scrolling-size: 32px;
|
||||
@tab-highlight-color: @primary-color;
|
||||
@tab-hover-color: @primary-5;
|
||||
@tab-active-color: @primary-7;
|
||||
|
||||
// BackTop
|
||||
// ---
|
||||
@@ -399,3 +426,31 @@
|
||||
// ---
|
||||
@pagination-item-size: 32px;
|
||||
@pagination-item-size-sm: 24px;
|
||||
|
||||
// Breadcrumb
|
||||
// ---
|
||||
@breadcrumb-base-color: @text-color-secondary;
|
||||
@breadcrumb-last-item-color: @text-color;
|
||||
@breadcrumb-font-size: @font-size-base;
|
||||
@breadcrumb-icon-font-size: @font-size-sm;
|
||||
@breadcrumb-link-color: @text-color-secondary;
|
||||
@breadcrumb-link-color-hover: @primary-5;
|
||||
@breadcrumb-separator-color: @text-color-secondary;
|
||||
@breadcrumb-separator-margin: 0 @padding-xs;
|
||||
|
||||
// Slider
|
||||
// ---
|
||||
@slider-margin: 14px 6px 10px;
|
||||
@slider-rail-background-color: @background-color-base;
|
||||
@slider-rail-background-color-hover: #e1e1e1;
|
||||
@slider-track-background-color: @primary-3;
|
||||
@slider-track-background-color-hover: @primary-4;
|
||||
@slider-handle-color: @primary-3;
|
||||
@slider-handle-color-hover: @primary-4;
|
||||
@slider-handle-color-focus: tint(@primary-color, 20%);
|
||||
@slider-handle-color-focus-shadow: tint(@primary-color, 50%);
|
||||
@slider-handle-color-tooltip-open: @primary-color;
|
||||
@slider-dot-border-color: @border-color-split;
|
||||
@slider-dot-border-color-active: tint(@primary-color, 50%);
|
||||
@slider-disabled-color: @disabled-color;
|
||||
@slider-disabled-background-color: @component-background;
|
||||
|
||||
@@ -45,26 +45,24 @@ export default class SelectionBox extends React.Component<SelectionBoxProps, Sel
|
||||
}
|
||||
|
||||
render() {
|
||||
const { type, rowIndex, disabled, onChange } = this.props;
|
||||
const { type, rowIndex, ...rest } = this.props;
|
||||
const { checked } = this.state;
|
||||
|
||||
if (type === 'radio') {
|
||||
return (
|
||||
<Radio
|
||||
disabled={disabled}
|
||||
onChange={onChange}
|
||||
value={rowIndex}
|
||||
checked={checked}
|
||||
value={rowIndex}
|
||||
{...rest}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<Checkbox
|
||||
checked={checked}
|
||||
{...rest}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Checkbox
|
||||
checked={checked}
|
||||
disabled={disabled}
|
||||
onChange={onChange}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -597,9 +597,9 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
|
||||
type={type}
|
||||
store={this.store}
|
||||
rowIndex={rowIndex}
|
||||
disabled={props.disabled}
|
||||
onChange={handleChange}
|
||||
defaultSelection={this.getDefaultSelection()}
|
||||
{...props}
|
||||
/>
|
||||
</span>
|
||||
);
|
||||
@@ -912,7 +912,7 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
|
||||
|
||||
renderTable = (contextLocale: TableLocale) => {
|
||||
const locale = { ...contextLocale, ...this.props.locale };
|
||||
const { style, className, prefixCls, showHeader, ...restProps } = this.props;
|
||||
const { style, loading, className, prefixCls, showHeader, ...restProps } = this.props;
|
||||
const data = this.getCurrentPageData();
|
||||
const expandIconAsCell = this.props.expandedRowRender && this.props.expandIconAsCell !== false;
|
||||
|
||||
@@ -948,7 +948,7 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
|
||||
className={classString}
|
||||
expandIconColumnIndex={expandIconColumnIndex}
|
||||
expandIconAsCell={expandIconAsCell}
|
||||
emptyText={locale.emptyText}
|
||||
emptyText={!loading && locale.emptyText}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,16 +3,18 @@ import { mount } from 'enzyme';
|
||||
import createStore from '../createStore';
|
||||
import SelectionBox from '../SelectionBox';
|
||||
|
||||
const getDefaultStore = (selectedRowKeys) => {
|
||||
return createStore({
|
||||
selectedRowKeys: selectedRowKeys || [],
|
||||
selectionDirty: false,
|
||||
});
|
||||
};
|
||||
|
||||
describe('SelectionBox', () => {
|
||||
it('unchecked by selectedRowKeys ', () => {
|
||||
const store = createStore({
|
||||
selectedRowKeys: [],
|
||||
selectionDirty: false,
|
||||
});
|
||||
|
||||
const wrapper = mount(
|
||||
<SelectionBox
|
||||
store={store}
|
||||
store={getDefaultStore()}
|
||||
rowIndex="1"
|
||||
disabled={false}
|
||||
onChange={() => {}}
|
||||
@@ -24,14 +26,9 @@ describe('SelectionBox', () => {
|
||||
});
|
||||
|
||||
it('checked by selectedRowKeys ', () => {
|
||||
const store = createStore({
|
||||
selectedRowKeys: ['1'],
|
||||
selectionDirty: false,
|
||||
});
|
||||
|
||||
const wrapper = mount(
|
||||
<SelectionBox
|
||||
store={store}
|
||||
store={getDefaultStore(['1'])}
|
||||
rowIndex="1"
|
||||
disabled={false}
|
||||
onChange={() => {}}
|
||||
@@ -43,14 +40,9 @@ describe('SelectionBox', () => {
|
||||
});
|
||||
|
||||
it('checked by defaultSelection', () => {
|
||||
const store = createStore({
|
||||
selectedRowKeys: [],
|
||||
selectionDirty: false,
|
||||
});
|
||||
|
||||
const wrapper = mount(
|
||||
<SelectionBox
|
||||
store={store}
|
||||
store={getDefaultStore()}
|
||||
rowIndex="1"
|
||||
disabled={false}
|
||||
onChange={() => {}}
|
||||
@@ -62,11 +54,7 @@ describe('SelectionBox', () => {
|
||||
});
|
||||
|
||||
it('checked when store change', () => {
|
||||
const store = createStore({
|
||||
selectedRowKeys: [],
|
||||
selectionDirty: false,
|
||||
});
|
||||
|
||||
const store = getDefaultStore();
|
||||
const wrapper = mount(
|
||||
<SelectionBox
|
||||
store={store}
|
||||
@@ -84,4 +72,49 @@ describe('SelectionBox', () => {
|
||||
|
||||
expect(wrapper.state()).toEqual({ checked: true });
|
||||
});
|
||||
|
||||
it('passes props to Checkbox', () => {
|
||||
const checkboxProps = {
|
||||
name: 'testName',
|
||||
id: 'testId',
|
||||
};
|
||||
const wrapper = mount(
|
||||
<SelectionBox
|
||||
store={getDefaultStore()}
|
||||
rowIndex="1"
|
||||
disabled={false}
|
||||
onChange={() => {
|
||||
}}
|
||||
defaultSelection={['1']}
|
||||
{...checkboxProps}
|
||||
/>
|
||||
);
|
||||
wrapper.find('Checkbox').forEach((box) => {
|
||||
expect(box.props().name).toEqual(checkboxProps.name);
|
||||
expect(box.props().id).toEqual(checkboxProps.id);
|
||||
});
|
||||
});
|
||||
|
||||
it('passes props to Radios', () => {
|
||||
const radioProps = {
|
||||
name: 'testName',
|
||||
id: 'testId',
|
||||
};
|
||||
const wrapper = mount(
|
||||
<SelectionBox
|
||||
store={getDefaultStore()}
|
||||
rowIndex="1"
|
||||
disabled={false}
|
||||
onChange={() => {
|
||||
}}
|
||||
defaultSelection={['1']}
|
||||
type="radio"
|
||||
{...radioProps}
|
||||
/>
|
||||
);
|
||||
wrapper.find('Radio').forEach((radio) => {
|
||||
expect(radio.props().name).toEqual(radioProps.name);
|
||||
expect(radio.props().id).toEqual(radioProps.id);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -77,6 +77,7 @@ describe('Table.rowSelection', () => {
|
||||
const rowSelection = {
|
||||
getCheckboxProps: record => ({
|
||||
disabled: record.name === 'Lucy',
|
||||
name: record.name,
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -84,7 +85,9 @@ describe('Table.rowSelection', () => {
|
||||
const checkboxes = wrapper.find('input');
|
||||
|
||||
expect(checkboxes.at(1).props().disabled).toBe(false);
|
||||
expect(checkboxes.at(1).props().name).toEqual(data[0].name);
|
||||
expect(checkboxes.at(2).props().disabled).toBe(true);
|
||||
expect(checkboxes.at(2).props().name).toEqual(data[1].name);
|
||||
});
|
||||
|
||||
it('works with pagination', () => {
|
||||
|
||||
@@ -1541,6 +1541,7 @@ exports[`renders ./components/table/demo/dynamic-settings.md correctly 1`] = `
|
||||
checked=""
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="default"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -1559,6 +1560,7 @@ exports[`renders ./components/table/demo/dynamic-settings.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="middle"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -1577,6 +1579,7 @@ exports[`renders ./components/table/demo/dynamic-settings.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="small"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
@@ -9299,6 +9302,7 @@ exports[`renders ./components/table/demo/row-selection.md correctly 1`] = `
|
||||
>
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
name="John Brown"
|
||||
type="checkbox"
|
||||
/>
|
||||
<span
|
||||
@@ -9347,6 +9351,7 @@ exports[`renders ./components/table/demo/row-selection.md correctly 1`] = `
|
||||
>
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
name="Jim Green"
|
||||
type="checkbox"
|
||||
/>
|
||||
<span
|
||||
@@ -9395,6 +9400,7 @@ exports[`renders ./components/table/demo/row-selection.md correctly 1`] = `
|
||||
>
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
name="Joe Black"
|
||||
type="checkbox"
|
||||
/>
|
||||
<span
|
||||
@@ -9444,6 +9450,7 @@ exports[`renders ./components/table/demo/row-selection.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
disabled=""
|
||||
name="Disabled User"
|
||||
type="checkbox"
|
||||
/>
|
||||
<span
|
||||
|
||||
@@ -452,3 +452,126 @@ exports[`Table renders empty table with fixed columns 1`] = `
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`Table renders empty table without emptyText when loading 1`] = `
|
||||
<div
|
||||
class="ant-table-wrapper"
|
||||
>
|
||||
<div
|
||||
class="ant-spin-nested-loading"
|
||||
>
|
||||
<div>
|
||||
<div
|
||||
class="ant-spin ant-spin-spinning ant-table-without-pagination ant-table-spin-holder"
|
||||
>
|
||||
<span
|
||||
class="ant-spin-dot"
|
||||
>
|
||||
<i />
|
||||
<i />
|
||||
<i />
|
||||
<i />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-spin-container ant-spin-blur"
|
||||
>
|
||||
<div
|
||||
class="ant-table ant-table-large ant-table-empty ant-table-scroll-position-left"
|
||||
>
|
||||
<div
|
||||
class="ant-table-content"
|
||||
>
|
||||
<div
|
||||
class="ant-table-body"
|
||||
>
|
||||
<table
|
||||
class=""
|
||||
>
|
||||
<colgroup>
|
||||
<col />
|
||||
<col />
|
||||
<col />
|
||||
<col />
|
||||
<col />
|
||||
<col />
|
||||
<col />
|
||||
<col />
|
||||
</colgroup>
|
||||
<thead
|
||||
class="ant-table-thead"
|
||||
>
|
||||
<tr>
|
||||
<th
|
||||
class=""
|
||||
>
|
||||
<span>
|
||||
Column 1
|
||||
</span>
|
||||
</th>
|
||||
<th
|
||||
class=""
|
||||
>
|
||||
<span>
|
||||
Column 2
|
||||
</span>
|
||||
</th>
|
||||
<th
|
||||
class=""
|
||||
>
|
||||
<span>
|
||||
Column 3
|
||||
</span>
|
||||
</th>
|
||||
<th
|
||||
class=""
|
||||
>
|
||||
<span>
|
||||
Column 4
|
||||
</span>
|
||||
</th>
|
||||
<th
|
||||
class=""
|
||||
>
|
||||
<span>
|
||||
Column 5
|
||||
</span>
|
||||
</th>
|
||||
<th
|
||||
class=""
|
||||
>
|
||||
<span>
|
||||
Column 6
|
||||
</span>
|
||||
</th>
|
||||
<th
|
||||
class=""
|
||||
>
|
||||
<span>
|
||||
Column 7
|
||||
</span>
|
||||
</th>
|
||||
<th
|
||||
class=""
|
||||
>
|
||||
<span>
|
||||
Column 8
|
||||
</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody
|
||||
class="ant-table-tbody"
|
||||
/>
|
||||
</table>
|
||||
</div>
|
||||
<div
|
||||
class="ant-table-placeholder"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -62,4 +62,11 @@ describe('Table', () => {
|
||||
);
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('renders empty table without emptyText when loading', () => {
|
||||
const wrapper = render(
|
||||
<Table dataSource={[]} columns={columns} loading />
|
||||
);
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,6 +11,8 @@ title:
|
||||
|
||||
对某一列数据进行排序,通过指定列的 `sorter` 函数即可启动排序按钮。`sorter: function(a, b) { ... }`, a、b 为比较的两个列数据。
|
||||
|
||||
使用 `defaultSortOrder` 属性,设置列的默认排序顺序。
|
||||
|
||||
## en-US
|
||||
|
||||
Use `filters` to generate filter menu in columns, `onFilter` to determine filtered result, and `filterMultiple` to indicate whether it's multiple or single selection.
|
||||
|
||||
@@ -135,4 +135,8 @@ ReactDOM.render(<NestedTable />, mountNode);
|
||||
.components-table-demo-nested .table-operation a:not(:last-child) {
|
||||
margin-right: 24px;
|
||||
}
|
||||
|
||||
.components-table-demo-nested .ant-table-expanded-row:hover > td {
|
||||
background: #fbfbfb;
|
||||
}
|
||||
````
|
||||
|
||||
@@ -9,10 +9,14 @@ title:
|
||||
|
||||
第一列是联动的选择框。
|
||||
|
||||
> 默认点击 checkbox 触发选择行为,需要点击行触发可以参考例子:https://codesandbox.io/s/000vqw38rl
|
||||
|
||||
## en-US
|
||||
|
||||
Rows can be selectable by making first column as a selectable column.
|
||||
|
||||
> selection happens when clicking checkbox defaultly. You can see https://codesandbox.io/s/000vqw38rl if you need row-click selection behavior.
|
||||
|
||||
````jsx
|
||||
import { Table } from 'antd';
|
||||
|
||||
@@ -56,6 +60,7 @@ const rowSelection = {
|
||||
},
|
||||
getCheckboxProps: record => ({
|
||||
disabled: record.name === 'Disabled User', // Column configuration not to be checked
|
||||
name: record.name,
|
||||
}),
|
||||
};
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user