mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 10:59:19 +08:00
Compare commits
125 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07a0a1f336 | ||
|
|
eab4fdfe95 | ||
|
|
86ab00fbbd | ||
|
|
c28d6f1624 | ||
|
|
947cee4475 | ||
|
|
feaf238dfa | ||
|
|
f1fd85780e | ||
|
|
dc439bd7c3 | ||
|
|
2c95ea0e5e | ||
|
|
aeeebab9d9 | ||
|
|
a6ffd332fa | ||
|
|
97b09b393b | ||
|
|
a438b9b33f | ||
|
|
7d5db31e67 | ||
|
|
053396810b | ||
|
|
676635abde | ||
|
|
c92cf5b778 | ||
|
|
2a1612b0c2 | ||
|
|
1d1ea1ac59 | ||
|
|
b574e8ee14 | ||
|
|
0e9743e78a | ||
|
|
4107a4bd8e | ||
|
|
ba236419be | ||
|
|
5294a69296 | ||
|
|
ec399ba27f | ||
|
|
d31612f2de | ||
|
|
c04377e541 | ||
|
|
626ebf2063 | ||
|
|
e3f115dd3d | ||
|
|
1ae7da3878 | ||
|
|
d72a6dd7b9 | ||
|
|
f27bc6bd9d | ||
|
|
fff5680743 | ||
|
|
5accd6367a | ||
|
|
2909e5f651 | ||
|
|
b5f88c0005 | ||
|
|
240289ed73 | ||
|
|
1e92ff8efd | ||
|
|
3ffe718476 | ||
|
|
44063967a1 | ||
|
|
2411bdb7b7 | ||
|
|
3b6cd56820 | ||
|
|
7d3ff69e12 | ||
|
|
7b4abe7568 | ||
|
|
dc7d9de4cd | ||
|
|
70f3afeda0 | ||
|
|
6577616be2 | ||
|
|
875024cd1e | ||
|
|
3ed3a078e1 | ||
|
|
f8e996ee8e | ||
|
|
a8f1c35dcb | ||
|
|
a5f29f06a5 | ||
|
|
e992682aa8 | ||
|
|
33e2ef0f8d | ||
|
|
f1bd8d0d11 | ||
|
|
7c062bb118 | ||
|
|
59b18b4c26 | ||
|
|
ca6a8d13bd | ||
|
|
c725cbe791 | ||
|
|
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 | ||
|
|
5950c09bf8 | ||
|
|
5afb1a28b6 | ||
|
|
937f249b38 | ||
|
|
7cc05d487c | ||
|
|
cfdb1cab4b | ||
|
|
b7901e541a | ||
|
|
7a7933038c | ||
|
|
aa4a619f41 | ||
|
|
49a53bf8df | ||
|
|
3a98fce47c | ||
|
|
7aa665cc14 | ||
|
|
9cbe6ca6b3 | ||
|
|
9c52014585 |
10
.babelrc
10
.babelrc
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"env": {
|
||||
"test": {
|
||||
"presets": ["es2015", "react", "stage-0"],
|
||||
"plugins": [
|
||||
"add-module-exports"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
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,76 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
## 3.2.2
|
||||
|
||||
`2018-02-24`
|
||||
|
||||
- 🌟 Add font-family variable for `Pagination`. [#9351](https://github.com/ant-design/ant-design/issues/9351)
|
||||
- 🌟 Add font-weight variable for `Badge`. [#9352](https://github.com/ant-design/ant-design/issues/9352)
|
||||
- 🐞 Fix table custom spin indicator. [#9355](https://github.com/ant-design/ant-design/issues/9355)
|
||||
- 🐞 Fix `Form.create`. [#9331](https://github.com/ant-design/ant-design/issues/9331)
|
||||
- 🐞 Revert typescript definition of `column.dataIndex`. [#9393](https://github.com/ant-design/ant-design/issues/9393)
|
||||
- 🐞 Fix last menu item in Sider could be blocked by collapse trigger. [#9398](https://github.com/ant-design/ant-design/issues/9398) [@MJ111](https://github.com/MJ111)
|
||||
- 🐞 Fix badge works wrong in dot mode. [#9359](https://github.com/ant-design/ant-design/issues/9359) [@khayalan-mathew](https://github.com/khayalan-mathew)
|
||||
|
||||
## 3.2.1
|
||||
|
||||
`2018-02-11`
|
||||
|
||||
- 🌟 Add icons of some famous products. [c04377e5](https://github.com/ant-design/ant-design/commit/c04377e5413d344b37c34ceac6fee456933fa516)
|
||||
- Mention
|
||||
- 🌟 `multiLines` mode will support autosize.
|
||||
- 🐞 Fix paste not working when `placeholder` is specified. [#9215](https://github.com/ant-design/ant-design/issues/9215)
|
||||
- Table
|
||||
- 🐞 Fix padding of middle size table. [#9319](https://github.com/ant-design/ant-design/issues/9319)
|
||||
- 🐞 Fix border bug of small size table. [#8980](https://github.com/ant-design/ant-design/issues/8980)
|
||||
- 🐞 Fix overflow issue of sort icon interactive area. [#8979](https://github.com/ant-design/ant-design/issues/8979)
|
||||
- 🌟 Improve typescript definition of `column.dataIndex`. [#9298](https://github.com/ant-design/ant-design/pull/9298) [@clinyong](https://github.com/clinyong)
|
||||
- Select
|
||||
- 🐞 Fix wrong scroll position when navigating active item with keyboard. [#9276](https://github.com/ant-design/ant-design/issues/9276)
|
||||
- 🐞 Fix arrow position in IE11.
|
||||
- 🐞 Fix issue that file item showing `uploading` when Upload `beforeUpload` return false. [#8020](https://github.com/ant-design/ant-design/issues/8020)
|
||||
- 🐞 Fix misplace of feedback icon of `vertical` layout Form. [#9153](https://github.com/ant-design/ant-design/issues/9153)
|
||||
- 🐞 Fix loading style missing of empty childen Card. [#9258](https://github.com/ant-design/ant-design/issues/9258)
|
||||
- 🐞 Fix background color of Avatar when image source is not existe. [#9278](https://github.com/ant-design/ant-design/pull/9278) [@andriijas](https://github.com/andriijas)
|
||||
- 🐞 Fix RangePicker `Cannot read property 'locale' of undefined` error when select end date. [#9267](https://github.com/ant-design/ant-design/issues/9267)
|
||||
- 🐞 Fix style problem when using disabled button with Tooltip inside ButtonGroup. [#9296](https://github.com/ant-design/ant-design/issues/9296) [#9296](https://github.com/ant-design/ant-design/issues/9296)
|
||||
- 🐞 Fix z-index of Dropdown's submenu. [#9218](https://github.com/ant-design/ant-design/issues/9218)
|
||||
|
||||
## 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 Progress to allow showing two phases. [Demo](https://ant.design/components/progress/#components-progress-demo-segment)
|
||||
- 🌟 Add new `iconType` prop to Alert to allow settting icon type. [#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`
|
||||
|
||||
@@ -15,6 +15,76 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
## 3.2.2
|
||||
|
||||
`2018-02-24`
|
||||
|
||||
- 🌟 添加 `Pagination` 字体变量。 [#9351](https://github.com/ant-design/ant-design/issues/9351)
|
||||
- 🌟 添加 `Badge` 字重变量。 [#9352](https://github.com/ant-design/ant-design/issues/9352)
|
||||
- 🐞 修复 `Table` 当自定义 `loading.indicator` 时,不显示emptyText。 [#9355](https://github.com/ant-design/ant-design/issues/9355)
|
||||
- 🐞 修复 `Form.create` 。 [#9331](https://github.com/ant-design/ant-design/issues/9331)
|
||||
- 🐞 回滚 `Table` 中 `column.dataIndex` 的 TypeScript 定义。 [#9393](https://github.com/ant-design/ant-design/issues/9393)
|
||||
- 🐞 修复 `Layout` 中 sider 高度不足时,最后一个菜单无法显示。 [#9398](https://github.com/ant-design/ant-design/issues/9398) [@MJ111](https://github.com/MJ111)
|
||||
- 🐞 修复 `Badge` dot 模式问题。 [#9359](https://github.com/ant-design/ant-design/issues/9359) [@khayalan-mathew](https://github.com/khayalan-mathew)
|
||||
|
||||
## 3.2.1
|
||||
|
||||
`2018-02-11`
|
||||
|
||||
- 🌟 新增了部分著名产品的图标。[c04377e5](https://github.com/ant-design/ant-design/commit/c04377e5413d344b37c34ceac6fee456933fa516)
|
||||
- Mention
|
||||
- 🌟 现在 `multiLines` 模式的高度将默认自适应内容。
|
||||
- 🐞 修复指定了 `placeholder` 时无法粘贴内容的问题。[#9215](https://github.com/ant-design/ant-design/issues/9215)
|
||||
- Table
|
||||
- 🐞 修复中号表格的 padding。[#9319](https://github.com/ant-design/ant-design/issues/9319)
|
||||
- 🐞 修复小号表格的边框错位问题。[#8980](https://github.com/ant-design/ant-design/issues/8980)
|
||||
- 🐞 修复排序图标点击区域溢出表头的问题。[#8979](https://github.com/ant-design/ant-design/issues/8979)
|
||||
- 🌟 优化了 `column.dataIndex` 的 TypeScript 定义。[#9298](https://github.com/ant-design/ant-design/pull/9298) [@clinyong](https://github.com/clinyong)
|
||||
- Select
|
||||
- 🐞 修复使用键盘导航时,滚动条不会自动定位的问题。[#9276](https://github.com/ant-design/ant-design/issues/9276)
|
||||
- 🐞 修复在 IE11 下的箭头位置。
|
||||
- 🐞 修复 Upload `beforeUpload` 返回 `false` 时,上传文件仍然显示 `uploading` 以及文件列表被替换的问题。[#8020](https://github.com/ant-design/ant-design/issues/8020)
|
||||
- 🐞 修复 `vertical` 布局的 Form 下反馈图标错位的问题。[#9153](https://github.com/ant-design/ant-design/issues/9153)
|
||||
- 🐞 修复 Card 没有子节点时 `loading` 样式不生效的问题。[#9258](https://github.com/ant-design/ant-design/issues/9258)
|
||||
- 🐞 修复 Avatar 的图片不存在时的背景色。[#9278](https://github.com/ant-design/ant-design/pull/9278) [@andriijas](https://github.com/andriijas)
|
||||
- 🐞 修复 RangePicker 选择结束时间时报 `Cannot read property 'locale' of undefined` 的问题。[#9267](https://github.com/ant-design/ant-design/issues/9267)
|
||||
- 🐞 修复 ButtonGroup 内使用了失效按钮和 Tooltip 时样式错位的问题。[#9296](https://github.com/ant-design/ant-design/issues/9296) [#9296](https://github.com/ant-design/ant-design/issues/9296)
|
||||
- 🐞 修复 Dropdown 的子菜单被遮挡的问题。[#9218](https://github.com/ant-design/ant-design/issues/9218)
|
||||
|
||||
## 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`
|
||||
@@ -321,7 +391,7 @@ timeline: true
|
||||
```
|
||||
- Select
|
||||
- 🌟 默认和多选模式下 Option 的值允许使用 number。
|
||||
- 🌟 新增 `maxTagCount 和 `maxTagPlaceholder`,用与设置最多可显示的选中项。
|
||||
- 🌟 新增 `maxTagCount 和 `maxTagPlaceholder`,用于设置最多可显示的选中项。
|
||||
- 🌟 新增 `showAction`,用于设置出发下拉框打开的事件。
|
||||
- 🌟 新增 `onMouseEnter` 和 `onMouseLeave` 事件回调。
|
||||
- LocaleProvider
|
||||
|
||||
@@ -92,6 +92,7 @@ See [i18n](http://ant.design/docs/react/i18n).
|
||||
|
||||
```bash
|
||||
$ git clone git@github.com:ant-design/ant-design.git
|
||||
$ cd ant-design
|
||||
$ npm install
|
||||
$ npm start
|
||||
```
|
||||
|
||||
@@ -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 | 无 |
|
||||
|
||||
@@ -83,7 +83,7 @@ export default class Avatar extends React.Component<AvatarProps, AvatarState> {
|
||||
|
||||
const classString = classNames(prefixCls, className, sizeCls, {
|
||||
[`${prefixCls}-${shape}`]: shape,
|
||||
[`${prefixCls}-image`]: src,
|
||||
[`${prefixCls}-image`]: src && this.state.isImgExist,
|
||||
[`${prefixCls}-icon`]: icon,
|
||||
});
|
||||
|
||||
|
||||
@@ -423,6 +423,13 @@ exports[`renders ./components/badge/demo/dot.md correctly 1`] = `
|
||||
data-show="true"
|
||||
/>
|
||||
</span>
|
||||
<span
|
||||
class="ant-badge"
|
||||
>
|
||||
<i
|
||||
class="anticon anticon-notification"
|
||||
/>
|
||||
</span>
|
||||
<span
|
||||
class="ant-badge"
|
||||
>
|
||||
|
||||
14
components/badge/__tests__/index.test.js
Normal file
14
components/badge/__tests__/index.test.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import Badge from '../index';
|
||||
|
||||
describe('Badge', () => {
|
||||
test('badge dot not scaling count > 9', () => {
|
||||
const badge = mount(<Badge count={10} dot />);
|
||||
expect(badge.find('.ant-card-multiple-words').length).toBe(0);
|
||||
});
|
||||
test('badge dot not showing count == 0', () => {
|
||||
const badge = mount(<Badge count={0} dot />);
|
||||
expect(badge.find('.ant-badge-dot').length).toBe(0);
|
||||
});
|
||||
});
|
||||
@@ -12,6 +12,7 @@ title:
|
||||
## en-US
|
||||
|
||||
This will simply display a red badge, without a specific count.
|
||||
If count equals 0, it won't display the dot.
|
||||
|
||||
````jsx
|
||||
import { Badge, Icon } from 'antd';
|
||||
@@ -21,6 +22,9 @@ ReactDOM.render(
|
||||
<Badge dot>
|
||||
<Icon type="notification" />
|
||||
</Badge>
|
||||
<Badge count={0} dot>
|
||||
<Icon type="notification" />
|
||||
</Badge>
|
||||
<Badge dot>
|
||||
<a href="#">Link something</a>
|
||||
</Badge>
|
||||
|
||||
@@ -26,7 +26,7 @@ Badge normally appears in proximity to notifications or user avatars with eye-ca
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| count | Number to show in badge | number\|ReactNode | |
|
||||
| dot | Whether to display a red dot instead of `count` | boolean | `false` |
|
||||
| offset | set offset of the badge dot, like [x, y] | [number, number] | - |
|
||||
| offset | set offset of the badge dot, like`[x, y]` | `[number, number]` | - |
|
||||
| overflowCount | Max count to show | number | 99 |
|
||||
| showZero | Whether to show badge when `count` is zero | boolean | `false` |
|
||||
| status | Set Badge as a status dot | `success` \| `processing` \| `default` \| `error` \| `warning` | `''` |
|
||||
|
||||
@@ -59,14 +59,13 @@ export default class Badge extends React.Component<BadgeProps, any> {
|
||||
offset,
|
||||
...restProps,
|
||||
} = this.props;
|
||||
const isDot = dot || status;
|
||||
let displayCount = (count as number) > (overflowCount as number) ? `${overflowCount}+` : count;
|
||||
const isZero = displayCount === '0' || displayCount === 0;
|
||||
const isDot = (dot && !isZero) || status;
|
||||
// dot mode don't need count
|
||||
if (isDot) {
|
||||
displayCount = '';
|
||||
}
|
||||
|
||||
const isZero = displayCount === '0' || displayCount === 0;
|
||||
const isEmpty = displayCount === null || displayCount === undefined || displayCount === '';
|
||||
const hidden = (isEmpty || (isZero && !showZero)) && !isDot;
|
||||
const statusCls = classNames({
|
||||
@@ -76,7 +75,7 @@ export default class Badge extends React.Component<BadgeProps, any> {
|
||||
const scrollNumberCls = classNames({
|
||||
[`${prefixCls}-dot`]: isDot,
|
||||
[`${prefixCls}-count`]: !isDot,
|
||||
[`${prefixCls}-multiple-words`]: count && count.toString && count.toString().length > 1,
|
||||
[`${prefixCls}-multiple-words`]: !isDot && count && count.toString && count.toString().length > 1,
|
||||
[`${prefixCls}-status-${status}`]: !!status,
|
||||
});
|
||||
const badgeCls = classNames(className, prefixCls, {
|
||||
|
||||
@@ -27,7 +27,7 @@ title: Badge
|
||||
| --- | --- | --- | --- |
|
||||
| count | 展示的数字,大于 overflowCount 时显示为 `${overflowCount}+`,为 0 时隐藏 | number\|ReactNode | |
|
||||
| dot | 不展示数字,只有一个小红点 | boolean | false |
|
||||
| offset | 设置状态点的位置偏移,格式为 [x, y] | [number, number] | - |
|
||||
| offset | 设置状态点的位置偏移,格式为 `[x, y]` | `[number, number]` | - |
|
||||
| overflowCount | 展示封顶的数字值 | number | 99 |
|
||||
| showZero | 当数值为 0 时,是否展示 Badge | boolean | false |
|
||||
| status | 设置 Badge 为状态点 | Enum{ 'success', 'processing, 'default', 'error', 'warning' } | '' |
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
text-align: center;
|
||||
padding: 0 6px;
|
||||
font-size: @badge-font-size;
|
||||
font-weight: @badge-font-weight;
|
||||
white-space: nowrap;
|
||||
transform-origin: -10% center;
|
||||
box-shadow: 0 0 0 1px #fff;
|
||||
|
||||
@@ -47,6 +47,8 @@ export interface ButtonProps {
|
||||
onClick?: React.FormEventHandler<any>;
|
||||
onMouseUp?: React.FormEventHandler<any>;
|
||||
onMouseDown?: React.FormEventHandler<any>;
|
||||
onKeyPress?: React.KeyboardEventHandler<any>;
|
||||
onKeyDown?: React.KeyboardEventHandler<any>;
|
||||
tabIndex?: number;
|
||||
loading?: boolean | { delay?: number };
|
||||
disabled?: boolean;
|
||||
|
||||
@@ -36,7 +36,8 @@ To get a customized button, just set `type`/`shape`/`size`/`loading`/`disabled`.
|
||||
margin-right: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
[id^=components-button-demo-] .ant-btn-group > .ant-btn {
|
||||
[id^=components-button-demo-] .ant-btn-group > .ant-btn,
|
||||
[id^=components-button-demo-] .ant-btn-group > span > .ant-btn {
|
||||
margin-right: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
}
|
||||
|
||||
&-background-ghost&-primary {
|
||||
.button-variant-ghost(@primary-color);
|
||||
.button-variant-ghost(@btn-primary-bg);
|
||||
}
|
||||
|
||||
&-background-ghost&-danger {
|
||||
|
||||
@@ -198,7 +198,7 @@
|
||||
&:focus,
|
||||
&:active,
|
||||
&.active {
|
||||
background: #fff;
|
||||
background: @btn-default-bg;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,6 +241,8 @@
|
||||
|
||||
.@{btnClassName} + .@{btnClassName},
|
||||
.@{btnClassName} + &,
|
||||
span + .@{btnClassName},
|
||||
.@{btnClassName} + span,
|
||||
& + .@{btnClassName},
|
||||
& + & {
|
||||
margin-left: -1px;
|
||||
@@ -250,15 +252,19 @@
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
> .@{btnClassName}:first-child {
|
||||
> .@{btnClassName}:first-child,
|
||||
> span:first-child > .@{btnClassName} {
|
||||
margin-left: 0;
|
||||
&:not(:last-child) {
|
||||
border-bottom-right-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
}
|
||||
|
||||
> .@{btnClassName}:last-child:not(:first-child) {
|
||||
> .@{btnClassName}:first-child:not(:last-child),
|
||||
> span:first-child:not(:last-child) > .@{btnClassName} {
|
||||
border-bottom-right-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
|
||||
> .@{btnClassName}:last-child:not(:first-child),
|
||||
> span:last-child:not(:first-child) > .@{btnClassName} {
|
||||
border-bottom-left-radius: 0;
|
||||
border-top-left-radius: 0;
|
||||
}
|
||||
|
||||
@@ -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 ?
|
||||
@@ -192,7 +192,7 @@ export default class Card extends React.Component<CardProps, {}> {
|
||||
<div {...divProps} className={classString} ref={this.saveRef}>
|
||||
{head}
|
||||
{coverDom}
|
||||
{children ? body : null}
|
||||
{body}
|
||||
{actionDom}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -15,6 +15,8 @@ export interface AbstractCheckboxProps {
|
||||
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
||||
onMouseEnter?: React.MouseEventHandler<any>;
|
||||
onMouseLeave?: React.MouseEventHandler<any>;
|
||||
onKeyPress?: React.KeyboardEventHandler<any>;
|
||||
onKeyDown?: React.KeyboardEventHandler<any>;
|
||||
value?: any;
|
||||
tabIndex?: number;
|
||||
name?: string;
|
||||
|
||||
@@ -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,7 +7,7 @@ import classNames from 'classnames';
|
||||
import Icon from '../icon';
|
||||
import warning from '../_util/warning';
|
||||
import callMoment from '../_util/callMoment';
|
||||
import { RangePickerValue } from './interface';
|
||||
import { RangePickerValue, RangePickerPresetRange } from './interface';
|
||||
|
||||
export interface RangePickerState {
|
||||
value?: RangePickerValue;
|
||||
@@ -150,6 +150,35 @@ export default class RangePicker extends React.Component<any, RangePickerState>
|
||||
|
||||
handleHoverChange = (hoverValue: any) => this.setState({ hoverValue });
|
||||
|
||||
handleRangeMouseLeave = () => {
|
||||
if (this.state.open) {
|
||||
this.clearHoverValue();
|
||||
}
|
||||
}
|
||||
|
||||
handleCalendarInputSelect = (value: RangePickerValue) => {
|
||||
if (!value[0]) {
|
||||
return;
|
||||
}
|
||||
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)) {
|
||||
@@ -184,9 +213,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>
|
||||
@@ -263,6 +292,7 @@ export default class RangePicker extends React.Component<any, RangePickerState>
|
||||
onHoverChange={this.handleHoverChange}
|
||||
onPanelChange={props.onPanelChange}
|
||||
showToday={showToday}
|
||||
onInputSelect={this.handleCalendarInputSelect}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -311,6 +341,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}
|
||||
|
||||
@@ -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,7 +3,14 @@ import { mount } from 'enzyme';
|
||||
import moment from 'moment';
|
||||
import MockDate from 'mockdate';
|
||||
import DatePicker from '..';
|
||||
import { selectDate } from './utils';
|
||||
import {
|
||||
selectDate,
|
||||
openPanel,
|
||||
clearInput,
|
||||
nextYear,
|
||||
nextMonth,
|
||||
hasSelected,
|
||||
} from './utils';
|
||||
import focusTest from '../../../tests/shared/focusTest';
|
||||
|
||||
describe('DatePicker', () => {
|
||||
@@ -87,27 +94,48 @@ describe('DatePicker', () => {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<DatePicker
|
||||
showTime
|
||||
value={this.state.value}
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
onChange={this.onChange}
|
||||
/>
|
||||
</div>
|
||||
<DatePicker
|
||||
showTime
|
||||
value={this.state.value}
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
onChange={this.onChange}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const wrapper = mount(<Test />);
|
||||
// clear input
|
||||
wrapper.find('.ant-calendar-picker-clear').hostNodes().simulate('click');
|
||||
// open panel
|
||||
wrapper.find('.ant-calendar-picker-input').simulate('click');
|
||||
// select a date
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@ import { mount, render } from 'enzyme';
|
||||
import moment from 'moment';
|
||||
import DatePicker from '../';
|
||||
import { setMockDate, resetMockDate } from '../../../tests/utils';
|
||||
import { selectDate } from './utils';
|
||||
import focusTest from '../../../tests/shared/focusTest';
|
||||
|
||||
const { RangePicker } = DatePicker;
|
||||
@@ -10,6 +11,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(
|
||||
@@ -115,7 +124,6 @@ describe('RangePicker', () => {
|
||||
});
|
||||
|
||||
it('clear hover value after panel close', () => {
|
||||
setMockDate();
|
||||
jest.useFakeTimers();
|
||||
const wrapper = mount(
|
||||
<div>
|
||||
@@ -131,6 +139,80 @@ describe('RangePicker', () => {
|
||||
expect(
|
||||
wrapper.find('.ant-calendar-cell').at(23).hasClass('ant-calendar-in-range-cell')
|
||||
).toBe(true);
|
||||
resetMockDate();
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
// https://github.com/ant-design/ant-design/issues/9267
|
||||
it('invali end date not throw error', () => {
|
||||
const wrapper = mount(<RangePicker />);
|
||||
wrapper.find('.ant-calendar-picker-input').simulate('click');
|
||||
selectDate(wrapper, moment('2017-09-18'), 0);
|
||||
selectDate(wrapper, moment('2017-10-18'), 1);
|
||||
wrapper.find('.ant-calendar-picker-input').simulate('click');
|
||||
expect(() =>
|
||||
wrapper.find('.ant-calendar-input').at(1).simulate('change', { target: { value: '2016-01-01' } })
|
||||
).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,8 +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];
|
||||
if (index !== undefined) {
|
||||
calendar = wrapper.find('.ant-calendar-range-part').at(index);
|
||||
}
|
||||
calendar.find({ title: date.format('LL') }).simulate('click');
|
||||
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;
|
||||
|
||||
@@ -134,7 +143,8 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
|
||||
monthCellContentRender={props.monthCellContentRender}
|
||||
renderFooter={this.renderFooter}
|
||||
onPanelChange={props.onPanelChange}
|
||||
value={value}
|
||||
onChange={this.handleCalendarChange}
|
||||
value={showDate}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -163,6 +173,7 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
|
||||
|
||||
return (
|
||||
<span
|
||||
id={props.id}
|
||||
className={classNames(props.className, props.pickerClass)}
|
||||
style={props.style}
|
||||
onFocus={props.onFocus}
|
||||
|
||||
@@ -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()] |
|
||||
|
||||
@@ -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()] |
|
||||
|
||||
@@ -3,6 +3,7 @@ import * as moment from 'moment';
|
||||
import { TimePickerProps } from '../time-picker';
|
||||
|
||||
export interface PickerProps {
|
||||
id?: number | string;
|
||||
prefixCls?: string;
|
||||
inputPrefixCls?: string;
|
||||
format?: string;
|
||||
@@ -53,7 +54,7 @@ export type RangePickerValue =
|
||||
[moment.Moment] |
|
||||
[undefined, moment.Moment] |
|
||||
[moment.Moment, moment.Moment];
|
||||
export type RangePickerRange = RangePickerValue | (() => RangePickerValue);
|
||||
export type RangePickerPresetRange = RangePickerValue | (() => RangePickerValue);
|
||||
|
||||
export interface RangePickerProps extends PickerProps {
|
||||
className?: string;
|
||||
@@ -65,7 +66,7 @@ export interface RangePickerProps extends PickerProps {
|
||||
onOk?: (selectedTime: moment.Moment) => void;
|
||||
showTime?: TimePickerProps | boolean;
|
||||
ranges?: {
|
||||
[range: string]: RangePickerRange,
|
||||
[range: string]: RangePickerPresetRange,
|
||||
};
|
||||
placeholder?: [string, string];
|
||||
mode?: string | string[];
|
||||
|
||||
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;
|
||||
@@ -126,7 +126,6 @@
|
||||
.@{calendar-prefix-cls}-footer {
|
||||
position: relative;
|
||||
height: auto;
|
||||
line-height: auto;
|
||||
|
||||
&-btn {
|
||||
text-align: right;
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
|
||||
&-submenu-popup {
|
||||
position: absolute;
|
||||
z-index: @zindex-dropdown;
|
||||
}
|
||||
|
||||
&-item,
|
||||
|
||||
@@ -117,10 +117,10 @@ export type Diff<T extends string, U extends string> =
|
||||
({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T];
|
||||
export type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;
|
||||
|
||||
export interface ComponentDecorator<TOwnProps> {
|
||||
export interface ComponentDecorator {
|
||||
<P extends FormComponentProps>(
|
||||
component: React.ComponentClass<P> | React.SFC<P>,
|
||||
): React.ComponentClass<Omit<P, keyof FormComponentProps> & TOwnProps>;
|
||||
): React.ComponentClass<Omit<P, keyof FormComponentProps>>;
|
||||
}
|
||||
|
||||
export default class Form extends React.Component<FormProps, any> {
|
||||
@@ -149,7 +149,7 @@ export default class Form extends React.Component<FormProps, any> {
|
||||
|
||||
static createFormField = createFormField;
|
||||
|
||||
static create = function<TOwnProps>(options: FormCreateOption<TOwnProps> = {}): ComponentDecorator<TOwnProps> {
|
||||
static create = function<TOwnProps>(options: FormCreateOption<TOwnProps> = {}): ComponentDecorator {
|
||||
return createDOMForm({
|
||||
fieldNameProp: 'id',
|
||||
...options,
|
||||
|
||||
@@ -186,7 +186,8 @@ export default class FormItem extends React.Component<FormItemProps, any> {
|
||||
}
|
||||
return (
|
||||
<div className={classes}>
|
||||
{c1}{c2}{c3}
|
||||
<span className={`${this.props.prefixCls}-item-children`}>{c1}</span>
|
||||
{c2}{c3}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/* tslint:disable */
|
||||
import * as React from 'react';
|
||||
import Form, { FormComponentProps } from '../Form';
|
||||
import Form, { FormComponentProps, FormCreateOption } from '../Form';
|
||||
|
||||
// test Form.create on component without own props
|
||||
class WithoutOwnProps extends React.Component<any, any> {
|
||||
@@ -34,3 +34,28 @@ class WithOwnProps extends React.Component<WithOwnPropsProps, any> {
|
||||
const WithOwnPropsForm = Form.create()(WithOwnProps);
|
||||
|
||||
<WithOwnPropsForm name="foo" />;
|
||||
|
||||
// test Form.create with options
|
||||
interface WithCreateOptionsProps extends FormComponentProps {
|
||||
username: string;
|
||||
}
|
||||
|
||||
class WithCreateOptions extends React.Component<WithCreateOptionsProps, {}> {
|
||||
render() {
|
||||
return <div>foo</div>;
|
||||
}
|
||||
}
|
||||
|
||||
const mapPropsToFields = (props: WithCreateOptionsProps) => {
|
||||
const { username } = props;
|
||||
|
||||
return {
|
||||
username: Form.createFormField({ value: username })
|
||||
};
|
||||
};
|
||||
|
||||
const formOptions: FormCreateOption<WithCreateOptionsProps> = { mapPropsToFields };
|
||||
|
||||
const WithCreateOptionsForm = Form.create(formOptions)(WithCreateOptions);
|
||||
|
||||
<WithCreateOptionsForm username="foo" />
|
||||
|
||||
@@ -87,6 +87,10 @@ input[type="checkbox"] {
|
||||
.clearfix;
|
||||
}
|
||||
|
||||
&-children {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&-with-help {
|
||||
margin-bottom: @form-item-margin-bottom - @font-size-base * @line-height-base - @form-help-margin-top;
|
||||
transition: none;
|
||||
@@ -233,8 +237,8 @@ form {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.@{ant-prefix}-input-number {
|
||||
margin-right: 8px;
|
||||
.@{ant-prefix}-input-number + .@{form-prefix-cls}-text {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.@{ant-prefix}-select,
|
||||
@@ -396,15 +400,16 @@ form {
|
||||
.has-warning,
|
||||
.has-error,
|
||||
.is-validating {
|
||||
&.has-feedback:after {
|
||||
&.has-feedback .@{form-prefix-cls}-item-children:after {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
top: 50%;
|
||||
right: 0;
|
||||
visibility: visible;
|
||||
pointer-events: none;
|
||||
width: @form-component-height;
|
||||
height: @form-component-max-height;
|
||||
line-height: @form-component-max-height;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
margin-top: -10px;
|
||||
text-align: center;
|
||||
font-size: @form-feedback-icon-size;
|
||||
animation: zoomIn .3s @ease-out-back;
|
||||
@@ -414,7 +419,7 @@ form {
|
||||
}
|
||||
|
||||
.has-success {
|
||||
&.has-feedback:after {
|
||||
&.has-feedback .@{form-prefix-cls}-item-children:after {
|
||||
animation-name: diffZoomIn1 !important;
|
||||
content: '\e630';
|
||||
color: @success-color;
|
||||
@@ -424,7 +429,7 @@ form {
|
||||
.has-warning {
|
||||
.form-control-validation(@warning-color; @warning-color;);
|
||||
|
||||
&.has-feedback:after {
|
||||
&.has-feedback .@{form-prefix-cls}-item-children:after {
|
||||
content: '\e62c';
|
||||
color: @warning-color;
|
||||
animation-name: diffZoomIn3 !important;
|
||||
@@ -471,7 +476,7 @@ form {
|
||||
.has-error {
|
||||
.form-control-validation(@error-color; @error-color;);
|
||||
|
||||
&.has-feedback:after {
|
||||
&.has-feedback .@{form-prefix-cls}-item-children:after {
|
||||
content: '\e62e';
|
||||
color: @error-color;
|
||||
animation-name: diffZoomIn2 !important;
|
||||
@@ -488,6 +493,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;
|
||||
@@ -535,7 +546,7 @@ form {
|
||||
}
|
||||
|
||||
.is-validating {
|
||||
&.has-feedback:after {
|
||||
&.has-feedback .@{form-prefix-cls}-item-children:after {
|
||||
display: inline-block;
|
||||
animation: loadingCircle 1s infinite linear;
|
||||
content: "\e64d";
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -212,7 +212,7 @@ export default class Sider extends React.Component<SiderProps, SliderState> {
|
||||
};
|
||||
const siderCls = classNames(className, prefixCls, {
|
||||
[`${prefixCls}-collapsed`]: !!this.state.collapsed,
|
||||
[`${prefixCls}-has-trigger`]: !!trigger,
|
||||
[`${prefixCls}-has-trigger`]: collapsible && trigger !== null && !zeroWidthTrigger,
|
||||
[`${prefixCls}-below`]: !!this.state.below,
|
||||
[`${prefixCls}-zero-width`]: siderWidth === 0 || siderWidth === '0' || siderWidth === '0px',
|
||||
});
|
||||
|
||||
@@ -688,7 +688,7 @@ exports[`renders ./components/layout/demo/side.md correctly 1`] = `
|
||||
style="min-height:100vh"
|
||||
>
|
||||
<div
|
||||
class="ant-layout-sider"
|
||||
class="ant-layout-sider ant-layout-sider-has-trigger"
|
||||
style="flex:0 0 200px;max-width:200px;min-width:200px;width:200px"
|
||||
>
|
||||
<div
|
||||
|
||||
@@ -24,4 +24,14 @@ describe('Layout', () => {
|
||||
);
|
||||
expect(wrapper.find('.ant-layout').hasClass('ant-layout-has-sider')).toBe(true);
|
||||
});
|
||||
|
||||
it('detect ant-layout-sider-has-trigger class in sider when ant-layout-sider-trigger div tag exists', async () => {
|
||||
const wrapper = mount(
|
||||
<Layout>
|
||||
<div><Sider collapsible>Sider</Sider></div>
|
||||
<Content>Content</Content>
|
||||
</Layout>
|
||||
);
|
||||
expect(wrapper.find('.ant-layout-sider').hasClass('ant-layout-sider-has-trigger')).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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`.
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ title: Layout
|
||||
| --- | --- | --- | --- |
|
||||
| className | 容器 className | string | - |
|
||||
| style | 指定样式 | object | - |
|
||||
| hasSider | 表示子元素里有 Sider,一般不用指定。可用于服务端渲染时避免样式闪动 | boolean | - |
|
||||
|
||||
> `Layout.Header` `Layout.Footer` `Layout.Content` API 与 `Layout` 相同
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
@@ -372,7 +364,7 @@ exports[`renders ./components/list/demo/infinite-virtualized-load.md correctly 1
|
||||
class="ant-spin"
|
||||
>
|
||||
<span
|
||||
class="ant-spin-dot"
|
||||
class="ant-spin-dot ant-spin-dot-spin"
|
||||
>
|
||||
<i />
|
||||
<i />
|
||||
@@ -397,7 +389,7 @@ exports[`renders ./components/list/demo/loadmore.md correctly 1`] = `
|
||||
class="ant-spin ant-spin-spinning"
|
||||
>
|
||||
<span
|
||||
class="ant-spin-dot"
|
||||
class="ant-spin-dot ant-spin-dot-spin"
|
||||
>
|
||||
<i />
|
||||
<i />
|
||||
@@ -474,9 +466,7 @@ exports[`renders ./components/list/demo/resposive.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Card content
|
||||
</div>
|
||||
Card content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -511,9 +501,7 @@ exports[`renders ./components/list/demo/resposive.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Card content
|
||||
</div>
|
||||
Card content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -548,9 +536,7 @@ exports[`renders ./components/list/demo/resposive.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Card content
|
||||
</div>
|
||||
Card content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -585,9 +571,7 @@ exports[`renders ./components/list/demo/resposive.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Card content
|
||||
</div>
|
||||
Card content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -622,9 +606,7 @@ exports[`renders ./components/list/demo/resposive.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-card-body"
|
||||
>
|
||||
<div>
|
||||
Card content
|
||||
</div>
|
||||
Card content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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>
|
||||
|
||||
@@ -1506,7 +1506,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
|
||||
>
|
||||
<tr>
|
||||
<th
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span>
|
||||
Name
|
||||
|
||||
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;
|
||||
|
||||
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',
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
.@{mention-prefix-cls}-editor {
|
||||
.input;
|
||||
min-height: @input-height-base;
|
||||
height: auto; // To override height in .input mixin
|
||||
line-height: @line-height-base;
|
||||
padding: 0;
|
||||
display: block;
|
||||
@@ -29,6 +31,7 @@
|
||||
}
|
||||
.public-DraftEditorPlaceholder-root {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
.public-DraftEditorPlaceholder-inner {
|
||||
color: @input-placeholder-color;
|
||||
opacity: 1;
|
||||
|
||||
@@ -223,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
border: @border-width-base @border-style-base @border-color-base;
|
||||
background-color: @component-background;
|
||||
margin-right: 8px;
|
||||
font-family: Arial;
|
||||
font-family: @pagination-font-family;
|
||||
outline: 0;
|
||||
|
||||
a {
|
||||
@@ -134,7 +134,7 @@
|
||||
&-next,
|
||||
&-jump-prev,
|
||||
&-jump-next {
|
||||
font-family: Arial;
|
||||
font-family: @pagination-font-family;
|
||||
cursor: pointer;
|
||||
color: @text-color;
|
||||
border-radius: @border-radius-base;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -43,19 +43,20 @@ Select component to select value from options.
|
||||
| optionLabelProp | Which prop value of option will render as content of select. | string | `children` |
|
||||
| placeholder | Placeholder of select | string\|ReactNode | - |
|
||||
| showSearch | Whether show search input in single mode. | boolean | false |
|
||||
| showArrow | Whether to show the drop-down arrow | boolean | true |
|
||||
| size | Size of Select input. `default` `large` `small` | string | default |
|
||||
| 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
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ export interface SelectProps extends AbstractSelectProps {
|
||||
defaultValue?: SelectValue;
|
||||
mode?: 'default' | 'multiple' | 'tags' | 'combobox';
|
||||
optionLabelProp?: string;
|
||||
onChange?: (value: SelectValue) => void;
|
||||
onSelect?: (value: SelectValue, option: Object) => any;
|
||||
onChange?: (value: SelectValue, option: React.ReactElement<any> | React.ReactElement<any>[]) => void;
|
||||
onSelect?: (value: SelectValue, option: React.ReactElement<any>) => any;
|
||||
onDeselect?: (value: SelectValue) => any;
|
||||
onBlur?: () => any;
|
||||
onFocus?: () => any;
|
||||
|
||||
@@ -46,19 +46,20 @@ title: Select
|
||||
| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` (combobox 模式下为 `value`) |
|
||||
| placeholder | 选择框默认文字 | string | - |
|
||||
| showSearch | 使单选模式可搜索 | boolean | false |
|
||||
| showArrow | 是否显示下拉小箭头 | boolean | true |
|
||||
| size | 选择框大小,可选 `large` `small` | string | default |
|
||||
| tags | 可以把随意输入的条目作为 tag,输入项不需要与下拉选项匹配(2.9 之后废弃,请使用 `mode`) | boolean | false |
|
||||
| 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}` 将下拉弹层渲染节点固定在触发器的父元素中。
|
||||
|
||||
|
||||
@@ -58,10 +58,10 @@
|
||||
top: 50%;
|
||||
right: @control-padding-horizontal - 1px;
|
||||
line-height: 1;
|
||||
transform: translateY(-50%);
|
||||
margin-top: -@font-size-sm / 2;
|
||||
transform-origin: 50% 50%;
|
||||
color: @disabled-color;
|
||||
font-size: 12px;
|
||||
font-size: @font-size-sm;
|
||||
|
||||
* {
|
||||
display: none;
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
&:before {
|
||||
content: '\e61d';
|
||||
transition: transform 0.2s ease;
|
||||
transition: transform .3s;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -376,11 +376,8 @@
|
||||
}
|
||||
|
||||
&-open {
|
||||
.@{select-prefix-cls}-arrow {
|
||||
-ms-transform: rotate(180deg);
|
||||
&:before {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
.@{select-prefix-cls}-arrow:before {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
.@{select-prefix-cls}-selection {
|
||||
.active();
|
||||
@@ -448,7 +445,6 @@
|
||||
top: -9999px;
|
||||
position: absolute;
|
||||
outline: none;
|
||||
overflow: hidden;
|
||||
font-size: @font-size-base;
|
||||
|
||||
&-menu {
|
||||
@@ -457,6 +453,7 @@
|
||||
padding-left: 0; // Override default ul/ol
|
||||
list-style: none;
|
||||
max-height: 250px;
|
||||
overflow: auto;
|
||||
|
||||
&-item-group-list {
|
||||
margin: 0;
|
||||
|
||||
@@ -5,7 +5,7 @@ exports[`renders ./components/spin/demo/basic.md correctly 1`] = `
|
||||
class="ant-spin ant-spin-spinning"
|
||||
>
|
||||
<span
|
||||
class="ant-spin-dot"
|
||||
class="ant-spin-dot ant-spin-dot-spin"
|
||||
>
|
||||
<i />
|
||||
<i />
|
||||
@@ -20,7 +20,7 @@ exports[`renders ./components/spin/demo/custom-indicator.md correctly 1`] = `
|
||||
class="ant-spin ant-spin-spinning"
|
||||
>
|
||||
<i
|
||||
class="anticon anticon-spin anticon-loading"
|
||||
class="anticon anticon-spin anticon-loading ant-spin-dot"
|
||||
style="font-size:24px"
|
||||
/>
|
||||
</div>
|
||||
@@ -75,7 +75,7 @@ exports[`renders ./components/spin/demo/inside.md correctly 1`] = `
|
||||
class="ant-spin ant-spin-spinning"
|
||||
>
|
||||
<span
|
||||
class="ant-spin-dot"
|
||||
class="ant-spin-dot ant-spin-dot-spin"
|
||||
>
|
||||
<i />
|
||||
<i />
|
||||
@@ -133,7 +133,7 @@ exports[`renders ./components/spin/demo/size.md correctly 1`] = `
|
||||
class="ant-spin ant-spin-sm ant-spin-spinning"
|
||||
>
|
||||
<span
|
||||
class="ant-spin-dot"
|
||||
class="ant-spin-dot ant-spin-dot-spin"
|
||||
>
|
||||
<i />
|
||||
<i />
|
||||
@@ -145,7 +145,7 @@ exports[`renders ./components/spin/demo/size.md correctly 1`] = `
|
||||
class="ant-spin ant-spin-spinning"
|
||||
>
|
||||
<span
|
||||
class="ant-spin-dot"
|
||||
class="ant-spin-dot ant-spin-dot-spin"
|
||||
>
|
||||
<i />
|
||||
<i />
|
||||
@@ -157,7 +157,7 @@ exports[`renders ./components/spin/demo/size.md correctly 1`] = `
|
||||
class="ant-spin ant-spin-lg ant-spin-spinning"
|
||||
>
|
||||
<span
|
||||
class="ant-spin-dot"
|
||||
class="ant-spin-dot ant-spin-dot-spin"
|
||||
>
|
||||
<i />
|
||||
<i />
|
||||
@@ -177,7 +177,7 @@ exports[`renders ./components/spin/demo/tip.md correctly 1`] = `
|
||||
class="ant-spin ant-spin-spinning ant-spin-show-text"
|
||||
>
|
||||
<span
|
||||
class="ant-spin-dot"
|
||||
class="ant-spin-dot ant-spin-dot-spin"
|
||||
>
|
||||
<i />
|
||||
<i />
|
||||
|
||||
11
components/spin/__tests__/__snapshots__/index.test.js.snap
Normal file
11
components/spin/__tests__/__snapshots__/index.test.js.snap
Normal file
@@ -0,0 +1,11 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Spin should render custom indicator when it's set 1`] = `
|
||||
<div
|
||||
class="ant-spin ant-spin-spinning"
|
||||
>
|
||||
<div
|
||||
class="custom-indicator ant-spin-dot"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow, render } from 'enzyme';
|
||||
import Spin from '..';
|
||||
|
||||
describe('Spin', () => {
|
||||
@@ -15,9 +15,9 @@ describe('Spin', () => {
|
||||
|
||||
it('should render custom indicator when it\'s set', () => {
|
||||
const customIndicator = <div className="custom-indicator" />;
|
||||
const wrapper = shallow(
|
||||
const wrapper = render(
|
||||
<Spin indicator={customIndicator} />
|
||||
);
|
||||
expect(wrapper.contains(customIndicator)).toEqual(true);
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -15,7 +15,7 @@ When part of the page is waiting for asynchronous data or during a rendering pro
|
||||
| Property | Description | Type | Default Value |
|
||||
| -------- | ----------- | ---- | ------------- |
|
||||
| delay | specifies a delay in milliseconds for loading state (prevent flush) | number (milliseconds) | - |
|
||||
| indicator | React node of the spinning indicator | ReactNode | - |
|
||||
| indicator | React node of the spinning indicator | ReactElement | - |
|
||||
| size | size of Spin, options: `small`, `default` and `large` | string | `default` |
|
||||
| spinning | whether Spin is spinning | boolean | true |
|
||||
| tip | customize description content when Spin has children | string | - |
|
||||
|
||||
@@ -5,6 +5,8 @@ import Animate from 'rc-animate';
|
||||
import isCssAnimationSupported from '../_util/isCssAnimationSupported';
|
||||
import omit from 'omit.js';
|
||||
|
||||
export type SpinIndicator = React.ReactElement<any>;
|
||||
|
||||
export interface SpinProps {
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
@@ -14,7 +16,7 @@ export interface SpinProps {
|
||||
tip?: string;
|
||||
delay?: number;
|
||||
wrapperClassName?: string;
|
||||
indicator?: React.ReactNode;
|
||||
indicator?: SpinIndicator;
|
||||
}
|
||||
|
||||
export interface SpinState {
|
||||
@@ -96,8 +98,27 @@ export default class Spin extends React.Component<SpinProps, SpinState> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
renderIndicator() {
|
||||
const { prefixCls, indicator } = this.props;
|
||||
const dotClassName = `${prefixCls}-dot`;
|
||||
if (React.isValidElement(indicator)) {
|
||||
return React.cloneElement((indicator as SpinIndicator), {
|
||||
className: classNames((indicator as SpinIndicator).props.className, dotClassName),
|
||||
});
|
||||
}
|
||||
return (
|
||||
<span className={classNames(dotClassName, `${prefixCls}-dot-spin`)}>
|
||||
<i />
|
||||
<i />
|
||||
<i />
|
||||
<i />
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { className, size, prefixCls, tip, wrapperClassName, indicator, ...restProps } = this.props;
|
||||
const { className, size, prefixCls, tip, wrapperClassName, ...restProps } = this.props;
|
||||
const { spinning, notCssAnimationSupported } = this.state;
|
||||
|
||||
const spinClassName = classNames(prefixCls, {
|
||||
@@ -111,20 +132,12 @@ export default class Spin extends React.Component<SpinProps, SpinState> {
|
||||
const divProps = omit(restProps, [
|
||||
'spinning',
|
||||
'delay',
|
||||
'indicator',
|
||||
]);
|
||||
|
||||
const spinIndicator = indicator ? indicator : (
|
||||
<span className={`${prefixCls}-dot`}>
|
||||
<i />
|
||||
<i />
|
||||
<i />
|
||||
<i />
|
||||
</span>
|
||||
);
|
||||
|
||||
const spinElement = (
|
||||
<div {...divProps} className={spinClassName} >
|
||||
{spinIndicator}
|
||||
{this.renderIndicator()}
|
||||
{tip ? <div className={`${prefixCls}-text`}>{tip}</div> : null}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -16,7 +16,7 @@ subtitle: 加载中
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| delay | 延迟显示加载效果的时间(防止闪烁) | number (毫秒) | - |
|
||||
| indicator | 加载指示符 | ReactNode | - |
|
||||
| indicator | 加载指示符 | ReactElement | - |
|
||||
| size | 组件大小,可选值为 `small` `default` `large` | string | 'default' |
|
||||
| spinning | 是否旋转 | boolean | true |
|
||||
| tip | 当作为包裹元素时,可以自定义描述文案 | string | - |
|
||||
|
||||
@@ -115,8 +115,7 @@
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
.square(@spin-dot-size);
|
||||
transform: rotate(45deg);
|
||||
animation: antRotate 1.2s infinite linear;
|
||||
|
||||
i {
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
@@ -148,6 +147,11 @@
|
||||
animation-delay: 1.2s;
|
||||
}
|
||||
}
|
||||
|
||||
&-spin {
|
||||
transform: rotate(45deg);
|
||||
animation: antRotate 1.2s infinite linear;
|
||||
}
|
||||
}
|
||||
|
||||
// Sizes
|
||||
|
||||
@@ -328,3 +328,13 @@
|
||||
.@{iconfont-css-prefix}-alipay:before { content: "\e9b3"; }
|
||||
.@{iconfont-css-prefix}-ant-design:before { content: "\e9b2"; }
|
||||
.@{iconfont-css-prefix}-aliyun:before { content: "\e9f4"; }
|
||||
.@{iconfont-css-prefix}-zhihu:before { content: "\e703"; }
|
||||
.@{iconfont-css-prefix}-file-markdown:before { content: "\e704"; }
|
||||
.@{iconfont-css-prefix}-slack:before { content: "\e705"; }
|
||||
.@{iconfont-css-prefix}-slack-square:before { content: "\e706"; }
|
||||
.@{iconfont-css-prefix}-behance:before { content: "\e707"; }
|
||||
.@{iconfont-css-prefix}-behance-square:before { content: "\e708"; }
|
||||
.@{iconfont-css-prefix}-dribbble:before { content: "\e709"; }
|
||||
.@{iconfont-css-prefix}-dribbble-square:before { content: "\e70a"; }
|
||||
.@{iconfont-css-prefix}-instagram:before { content: "\e70b"; }
|
||||
.@{iconfont-css-prefix}-yuque:before { content: "\e70c"; }
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
|
||||
// ICONFONT
|
||||
@iconfont-css-prefix : anticon;
|
||||
@icon-url : "https://at.alicdn.com/t/font_148784_dky7e838xq4obt9";
|
||||
@icon-url : "https://at.alicdn.com/t/font_148784_v4ggb6wrjmkotj4i";
|
||||
|
||||
// LINK
|
||||
@link-color : @primary-color;
|
||||
@@ -362,6 +362,7 @@
|
||||
@badge-height: 20px;
|
||||
@badge-dot-size: 6px;
|
||||
@badge-font-size: @font-size-sm;
|
||||
@badge-font-weight: normal;
|
||||
@badge-status-size: 6px;
|
||||
|
||||
// Rate
|
||||
@@ -384,7 +385,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
|
||||
// ---
|
||||
@@ -415,6 +427,7 @@
|
||||
// ---
|
||||
@pagination-item-size: 32px;
|
||||
@pagination-item-size-sm: 24px;
|
||||
@pagination-font-family: Arial;
|
||||
|
||||
// Breadcrumb
|
||||
// ---
|
||||
|
||||
@@ -16,10 +16,11 @@ title: Switch
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| allowClear | 支持清除, 单选模式有效 | boolean | false |
|
||||
| autoFocus | 组件自动获取焦点 | boolean | false |
|
||||
| checked | 指定当前是否选中 | boolean | false |
|
||||
| checkedChildren | 选中时的内容 | string\|ReactNode | |
|
||||
| defaultChecked | 初始是否选中 | boolean | false |
|
||||
| disabled | 是否禁用 | boolean | false |
|
||||
| loading | 加载中的开关 | boolean | false |
|
||||
| size | 开关大小,可选值:`default` `small` | string | default |
|
||||
| unCheckedChildren | 非选中时的内容 | string\|ReactNode | |
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
font-family: anticon;
|
||||
animation: loadingCircle 1s infinite linear;
|
||||
text-align: center;
|
||||
background: transprent;
|
||||
background: transparent;
|
||||
z-index: 1;
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
|
||||
@@ -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}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import Column from './Column';
|
||||
import ColumnGroup from './ColumnGroup';
|
||||
import createBodyRow from './createBodyRow';
|
||||
import { flatArray, treeMap, flatFilter, normalizeColumns } from './util';
|
||||
import { SpinProps } from '../spin';
|
||||
import {
|
||||
TableProps,
|
||||
TableState,
|
||||
@@ -597,9 +598,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>
|
||||
);
|
||||
@@ -749,6 +750,11 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
|
||||
{filterDropdown}
|
||||
</span>
|
||||
);
|
||||
|
||||
if (sortButton || filterDropdown) {
|
||||
column.className = classNames(`${prefixCls}-column-has-filters`, column.className);
|
||||
}
|
||||
|
||||
return column;
|
||||
});
|
||||
}
|
||||
@@ -910,9 +916,9 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
|
||||
}
|
||||
}
|
||||
|
||||
renderTable = (contextLocale: TableLocale) => {
|
||||
renderTable = (contextLocale: TableLocale, loading: SpinProps) => {
|
||||
const locale = { ...contextLocale, ...this.props.locale };
|
||||
const { style, loading, className, prefixCls, showHeader, ...restProps } = this.props;
|
||||
const { style, className, prefixCls, showHeader, ...restProps } = this.props;
|
||||
const data = this.getCurrentPageData();
|
||||
const expandIconAsCell = this.props.expandedRowRender && this.props.expandIconAsCell !== false;
|
||||
|
||||
@@ -948,7 +954,7 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
|
||||
className={classString}
|
||||
expandIconColumnIndex={expandIconColumnIndex}
|
||||
expandIconAsCell={expandIconAsCell}
|
||||
emptyText={!loading && locale.emptyText}
|
||||
emptyText={!loading.spinning && locale.emptyText}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -957,12 +963,19 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
|
||||
const { style, className, prefixCls } = this.props;
|
||||
const data = this.getCurrentPageData();
|
||||
|
||||
let loading = this.props.loading as SpinProps;
|
||||
if (typeof loading === 'boolean') {
|
||||
loading = {
|
||||
spinning: loading,
|
||||
};
|
||||
}
|
||||
|
||||
const table = (
|
||||
<LocaleReceiver
|
||||
componentName="Table"
|
||||
defaultLocale={defaultLocale.Table}
|
||||
>
|
||||
{this.renderTable}
|
||||
{(locale) => this.renderTable(locale, loading)}
|
||||
</LocaleReceiver>
|
||||
);
|
||||
|
||||
@@ -971,13 +984,6 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
|
||||
const paginationPatchClass = (this.hasPagination() && data && data.length !== 0)
|
||||
? `${prefixCls}-with-pagination` : `${prefixCls}-without-pagination`;
|
||||
|
||||
let loading = this.props.loading;
|
||||
if (typeof loading === 'boolean') {
|
||||
loading = {
|
||||
spinning: loading,
|
||||
};
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classNames(`${prefixCls}-wrapper`, className)}
|
||||
@@ -985,7 +991,7 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
|
||||
>
|
||||
<Spin
|
||||
{...loading}
|
||||
className={loading ? `${paginationPatchClass} ${prefixCls}-spin-holder` : ''}
|
||||
className={loading.spinning ? `${paginationPatchClass} ${prefixCls}-spin-holder` : ''}
|
||||
>
|
||||
{table}
|
||||
{this.renderPagination()}
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -67,6 +67,7 @@ describe('Table', () => {
|
||||
};
|
||||
const wrapper = mount(<Table loading={loading} />);
|
||||
expect(wrapper.find('.ant-spin')).toHaveLength(0);
|
||||
expect(wrapper.find('.ant-table-placeholder').text()).not.toEqual('');
|
||||
|
||||
loading.spinning = true;
|
||||
wrapper.setProps({ loading });
|
||||
|
||||
@@ -46,7 +46,7 @@ exports[`Table.filter renders filter correctly 1`] = `
|
||||
>
|
||||
<tr>
|
||||
<th
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span>
|
||||
Name
|
||||
@@ -65,7 +65,7 @@ exports[`Table.filter renders filter correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -78,7 +78,7 @@ exports[`Table.filter renders filter correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -91,7 +91,7 @@ exports[`Table.filter renders filter correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -104,7 +104,7 @@ exports[`Table.filter renders filter correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
|
||||
@@ -6,7 +6,7 @@ exports[`Table.sorter renders sorter icon correctly 1`] = `
|
||||
>
|
||||
<tr>
|
||||
<th
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span>
|
||||
Name
|
||||
|
||||
@@ -36,7 +36,7 @@ exports[`renders ./components/table/demo/ajax.md correctly 1`] = `
|
||||
>
|
||||
<tr>
|
||||
<th
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span>
|
||||
Name
|
||||
@@ -63,7 +63,7 @@ exports[`renders ./components/table/demo/ajax.md correctly 1`] = `
|
||||
</span>
|
||||
</th>
|
||||
<th
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span>
|
||||
Gender
|
||||
@@ -879,7 +879,7 @@ exports[`renders ./components/table/demo/custom-filter-panel.md correctly 1`] =
|
||||
>
|
||||
<tr>
|
||||
<th
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span>
|
||||
Name
|
||||
@@ -898,7 +898,7 @@ exports[`renders ./components/table/demo/custom-filter-panel.md correctly 1`] =
|
||||
</span>
|
||||
</th>
|
||||
<th
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span>
|
||||
Address
|
||||
@@ -917,7 +917,7 @@ exports[`renders ./components/table/demo/custom-filter-panel.md correctly 1`] =
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -931,7 +931,7 @@ exports[`renders ./components/table/demo/custom-filter-panel.md correctly 1`] =
|
||||
32
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
New York No. 1 Lake Park
|
||||
</td>
|
||||
@@ -940,7 +940,7 @@ exports[`renders ./components/table/demo/custom-filter-panel.md correctly 1`] =
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -954,7 +954,7 @@ exports[`renders ./components/table/demo/custom-filter-panel.md correctly 1`] =
|
||||
42
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
London No. 1 Lake Park
|
||||
</td>
|
||||
@@ -963,7 +963,7 @@ exports[`renders ./components/table/demo/custom-filter-panel.md correctly 1`] =
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -977,7 +977,7 @@ exports[`renders ./components/table/demo/custom-filter-panel.md correctly 1`] =
|
||||
32
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
Sidney No. 1 Lake Park
|
||||
</td>
|
||||
@@ -986,7 +986,7 @@ exports[`renders ./components/table/demo/custom-filter-panel.md correctly 1`] =
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -1000,7 +1000,7 @@ exports[`renders ./components/table/demo/custom-filter-panel.md correctly 1`] =
|
||||
32
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
London No. 2 Lake Park
|
||||
</td>
|
||||
@@ -1253,12 +1253,16 @@ exports[`renders ./components/table/demo/dynamic-settings.md correctly 1`] = `
|
||||
class="ant-form-item-control"
|
||||
>
|
||||
<span
|
||||
class="ant-switch"
|
||||
tabindex="0"
|
||||
class="ant-form-item-children"
|
||||
>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
class="ant-switch"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1283,12 +1287,16 @@ exports[`renders ./components/table/demo/dynamic-settings.md correctly 1`] = `
|
||||
class="ant-form-item-control"
|
||||
>
|
||||
<span
|
||||
class="ant-switch"
|
||||
tabindex="0"
|
||||
class="ant-form-item-children"
|
||||
>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
class="ant-switch"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1313,13 +1321,17 @@ exports[`renders ./components/table/demo/dynamic-settings.md correctly 1`] = `
|
||||
class="ant-form-item-control"
|
||||
>
|
||||
<span
|
||||
checked=""
|
||||
class="ant-switch ant-switch-checked"
|
||||
tabindex="0"
|
||||
class="ant-form-item-children"
|
||||
>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
checked=""
|
||||
class="ant-switch ant-switch-checked"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1344,13 +1356,17 @@ exports[`renders ./components/table/demo/dynamic-settings.md correctly 1`] = `
|
||||
class="ant-form-item-control"
|
||||
>
|
||||
<span
|
||||
checked=""
|
||||
class="ant-switch ant-switch-checked"
|
||||
tabindex="0"
|
||||
class="ant-form-item-children"
|
||||
>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
checked=""
|
||||
class="ant-switch ant-switch-checked"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1375,13 +1391,17 @@ exports[`renders ./components/table/demo/dynamic-settings.md correctly 1`] = `
|
||||
class="ant-form-item-control"
|
||||
>
|
||||
<span
|
||||
checked=""
|
||||
class="ant-switch ant-switch-checked"
|
||||
tabindex="0"
|
||||
class="ant-form-item-children"
|
||||
>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
checked=""
|
||||
class="ant-switch ant-switch-checked"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1406,13 +1426,17 @@ exports[`renders ./components/table/demo/dynamic-settings.md correctly 1`] = `
|
||||
class="ant-form-item-control"
|
||||
>
|
||||
<span
|
||||
checked=""
|
||||
class="ant-switch ant-switch-checked"
|
||||
tabindex="0"
|
||||
class="ant-form-item-children"
|
||||
>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
checked=""
|
||||
class="ant-switch ant-switch-checked"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1437,13 +1461,17 @@ exports[`renders ./components/table/demo/dynamic-settings.md correctly 1`] = `
|
||||
class="ant-form-item-control"
|
||||
>
|
||||
<span
|
||||
checked=""
|
||||
class="ant-switch ant-switch-checked"
|
||||
tabindex="0"
|
||||
class="ant-form-item-children"
|
||||
>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
checked=""
|
||||
class="ant-switch ant-switch-checked"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1468,13 +1496,17 @@ exports[`renders ./components/table/demo/dynamic-settings.md correctly 1`] = `
|
||||
class="ant-form-item-control"
|
||||
>
|
||||
<span
|
||||
checked=""
|
||||
class="ant-switch ant-switch-checked"
|
||||
tabindex="0"
|
||||
class="ant-form-item-children"
|
||||
>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
checked=""
|
||||
class="ant-switch ant-switch-checked"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1499,12 +1531,16 @@ exports[`renders ./components/table/demo/dynamic-settings.md correctly 1`] = `
|
||||
class="ant-form-item-control"
|
||||
>
|
||||
<span
|
||||
class="ant-switch"
|
||||
tabindex="0"
|
||||
class="ant-form-item-children"
|
||||
>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
class="ant-switch"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1528,68 +1564,72 @@ exports[`renders ./components/table/demo/dynamic-settings.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-form-item-control"
|
||||
>
|
||||
<div
|
||||
class="ant-radio-group ant-radio-group-default"
|
||||
<span
|
||||
class="ant-form-item-children"
|
||||
>
|
||||
<label
|
||||
class="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
|
||||
<div
|
||||
class="ant-radio-group ant-radio-group-default"
|
||||
>
|
||||
<span
|
||||
class="ant-radio-button ant-radio-button-checked"
|
||||
<label
|
||||
class="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
|
||||
>
|
||||
<input
|
||||
checked=""
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="default"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
Default
|
||||
</span>
|
||||
</label>
|
||||
<label
|
||||
class="ant-radio-button-wrapper"
|
||||
>
|
||||
<span
|
||||
class="ant-radio-button"
|
||||
class="ant-radio-button ant-radio-button-checked"
|
||||
>
|
||||
<input
|
||||
checked=""
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="default"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
Default
|
||||
</span>
|
||||
</label>
|
||||
<label
|
||||
class="ant-radio-button-wrapper"
|
||||
>
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="middle"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
Middle
|
||||
</span>
|
||||
</label>
|
||||
<label
|
||||
class="ant-radio-button-wrapper"
|
||||
>
|
||||
<span
|
||||
class="ant-radio-button"
|
||||
class="ant-radio-button"
|
||||
>
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="middle"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
Middle
|
||||
</span>
|
||||
</label>
|
||||
<label
|
||||
class="ant-radio-button-wrapper"
|
||||
>
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="small"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
Small
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
class="ant-radio-button"
|
||||
>
|
||||
<input
|
||||
class="ant-radio-button-input"
|
||||
type="radio"
|
||||
value="small"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-button-inner"
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
Small
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -6983,7 +7023,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
>
|
||||
<tr>
|
||||
<th
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
rowspan="4"
|
||||
>
|
||||
<span>
|
||||
@@ -7021,7 +7061,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
</tr>
|
||||
<tr>
|
||||
<th
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
rowspan="3"
|
||||
>
|
||||
<span>
|
||||
@@ -7147,7 +7187,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -7156,7 +7196,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
John Brown
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
1
|
||||
</td>
|
||||
@@ -7195,7 +7235,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -7204,7 +7244,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
John Brown
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
2
|
||||
</td>
|
||||
@@ -7243,7 +7283,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -7252,7 +7292,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
John Brown
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
3
|
||||
</td>
|
||||
@@ -7291,7 +7331,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -7300,7 +7340,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
John Brown
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
4
|
||||
</td>
|
||||
@@ -7339,7 +7379,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -7348,7 +7388,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
John Brown
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
5
|
||||
</td>
|
||||
@@ -7387,7 +7427,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -7396,7 +7436,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
John Brown
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
6
|
||||
</td>
|
||||
@@ -7435,7 +7475,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -7444,7 +7484,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
John Brown
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
7
|
||||
</td>
|
||||
@@ -7483,7 +7523,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -7492,7 +7532,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
John Brown
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
8
|
||||
</td>
|
||||
@@ -7531,7 +7571,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -7540,7 +7580,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
John Brown
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
9
|
||||
</td>
|
||||
@@ -7579,7 +7619,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -7588,7 +7628,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
John Brown
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
10
|
||||
</td>
|
||||
@@ -7646,7 +7686,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
>
|
||||
<tr>
|
||||
<th
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
rowspan="4"
|
||||
>
|
||||
<span>
|
||||
@@ -7684,7 +7724,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -7697,7 +7737,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -7710,7 +7750,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -7723,7 +7763,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -7736,7 +7776,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -7749,7 +7789,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -7762,7 +7802,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -7775,7 +7815,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -7788,7 +7828,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -7801,7 +7841,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -8086,7 +8126,7 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
|
||||
>
|
||||
<tr>
|
||||
<th
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span>
|
||||
Name
|
||||
@@ -8117,7 +8157,7 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
|
||||
</span>
|
||||
</th>
|
||||
<th
|
||||
class="ant-table-column-sort"
|
||||
class="ant-table-column-has-filters ant-table-column-sort"
|
||||
>
|
||||
<span>
|
||||
Age
|
||||
@@ -8144,7 +8184,7 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
|
||||
</span>
|
||||
</th>
|
||||
<th
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span>
|
||||
Address
|
||||
@@ -8183,7 +8223,7 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -8192,12 +8232,12 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
|
||||
Jim Green
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-column-sort"
|
||||
class="ant-table-column-has-filters ant-table-column-sort"
|
||||
>
|
||||
42
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
London No. 1 Lake Park
|
||||
</td>
|
||||
@@ -8206,7 +8246,7 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -8215,12 +8255,12 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
|
||||
John Brown
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-column-sort"
|
||||
class="ant-table-column-has-filters ant-table-column-sort"
|
||||
>
|
||||
32
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
New York No. 1 Lake Park
|
||||
</td>
|
||||
@@ -8229,7 +8269,7 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -8238,12 +8278,12 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
|
||||
Joe Black
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-column-sort"
|
||||
class="ant-table-column-has-filters ant-table-column-sort"
|
||||
>
|
||||
32
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
Sidney No. 1 Lake Park
|
||||
</td>
|
||||
@@ -8252,7 +8292,7 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -8261,12 +8301,12 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
|
||||
Jim Red
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-column-sort"
|
||||
class="ant-table-column-has-filters ant-table-column-sort"
|
||||
>
|
||||
32
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
London No. 2 Lake Park
|
||||
</td>
|
||||
@@ -8974,7 +9014,7 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = `
|
||||
>
|
||||
<tr>
|
||||
<th
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span>
|
||||
Name
|
||||
@@ -9005,7 +9045,7 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = `
|
||||
</span>
|
||||
</th>
|
||||
<th
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span>
|
||||
Age
|
||||
@@ -9032,7 +9072,7 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = `
|
||||
</span>
|
||||
</th>
|
||||
<th
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span>
|
||||
Address
|
||||
@@ -9071,7 +9111,7 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -9080,12 +9120,12 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = `
|
||||
John Brown
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
32
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
New York No. 1 Lake Park
|
||||
</td>
|
||||
@@ -9094,7 +9134,7 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -9103,12 +9143,12 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = `
|
||||
Jim Green
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
42
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
London No. 1 Lake Park
|
||||
</td>
|
||||
@@ -9117,7 +9157,7 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -9126,12 +9166,12 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = `
|
||||
Joe Black
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
32
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
Sidney No. 1 Lake Park
|
||||
</td>
|
||||
@@ -9140,7 +9180,7 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = `
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
<span
|
||||
class="ant-table-row-indent indent-level-0"
|
||||
@@ -9149,12 +9189,12 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = `
|
||||
Jim Red
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
32
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-has-filters"
|
||||
>
|
||||
London No. 2 Lake Park
|
||||
</td>
|
||||
@@ -9302,6 +9342,7 @@ exports[`renders ./components/table/demo/row-selection.md correctly 1`] = `
|
||||
>
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
name="John Brown"
|
||||
type="checkbox"
|
||||
/>
|
||||
<span
|
||||
@@ -9350,6 +9391,7 @@ exports[`renders ./components/table/demo/row-selection.md correctly 1`] = `
|
||||
>
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
name="Jim Green"
|
||||
type="checkbox"
|
||||
/>
|
||||
<span
|
||||
@@ -9398,6 +9440,7 @@ exports[`renders ./components/table/demo/row-selection.md correctly 1`] = `
|
||||
>
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
name="Joe Black"
|
||||
type="checkbox"
|
||||
/>
|
||||
<span
|
||||
@@ -9447,6 +9490,7 @@ exports[`renders ./components/table/demo/row-selection.md correctly 1`] = `
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
disabled=""
|
||||
name="Disabled User"
|
||||
type="checkbox"
|
||||
/>
|
||||
<span
|
||||
|
||||
@@ -465,7 +465,7 @@ exports[`Table renders empty table without emptyText when loading 1`] = `
|
||||
class="ant-spin ant-spin-spinning ant-table-without-pagination ant-table-spin-holder"
|
||||
>
|
||||
<span
|
||||
class="ant-spin-dot"
|
||||
class="ant-spin-dot ant-spin-dot-spin"
|
||||
>
|
||||
<i />
|
||||
<i />
|
||||
|
||||
@@ -48,7 +48,7 @@ let BodyRow = (props) => {
|
||||
initialClientOffset,
|
||||
...restProps
|
||||
} = props;
|
||||
const style = { cursor: 'move' };
|
||||
const style = { ...restProps.style, cursor: 'move' };
|
||||
|
||||
let className = restProps.className;
|
||||
if (isOver && initialClientOffset) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
````
|
||||
|
||||
@@ -60,6 +60,7 @@ const rowSelection = {
|
||||
},
|
||||
getCheckboxProps: record => ({
|
||||
disabled: record.name === 'Disabled User', // Column configuration not to be checked
|
||||
name: record.name,
|
||||
}),
|
||||
};
|
||||
|
||||
|
||||
@@ -79,6 +79,27 @@ const columns = [{
|
||||
| onHeaderRow | Set props on per header row | Function(column, index) | - |
|
||||
| onRow | Set props on per row | Function(record, index) | - |
|
||||
|
||||
#### onRow usage
|
||||
|
||||
Same as `onRow` `onHeaderRow` `onCell` `onHeaderCell`
|
||||
|
||||
```jsx
|
||||
<Table
|
||||
onRow={(record) => {
|
||||
return {
|
||||
onClick: () => {}, // click row
|
||||
onMouseEnter: () => {}, // mouse enter row
|
||||
onXxxx...
|
||||
};
|
||||
)}
|
||||
onHeaderRow={(column) => {
|
||||
return {
|
||||
onClick: () => {}, // click header row
|
||||
};
|
||||
)}
|
||||
/>
|
||||
```
|
||||
|
||||
### Column
|
||||
|
||||
One of the Table `columns` prop for describing the table's columns, Column has the same API.
|
||||
|
||||
@@ -80,6 +80,28 @@ const columns = [{
|
||||
| onHeaderRow | 设置头部行属性 | Function(column, index) | - |
|
||||
| onRow | 设置行属性 | Function(record, index) | - |
|
||||
|
||||
|
||||
#### onRow 用法
|
||||
|
||||
适用于 `onRow` `onHeaderRow` `onCell` `onHeaderCell`。
|
||||
|
||||
```jsx
|
||||
<Table
|
||||
onRow={(record) => {
|
||||
return {
|
||||
onClick: () => {}, // 点击行
|
||||
onMouseEnter: () => {}, // 鼠标移入行
|
||||
onXxxx...
|
||||
};
|
||||
)}
|
||||
onHeaderRow={(column) => {
|
||||
return {
|
||||
onClick: () => {}, // 点击表头行
|
||||
};
|
||||
)}
|
||||
/>
|
||||
```
|
||||
|
||||
### Column
|
||||
|
||||
列描述数据对象,是 columns 中的一项,Column 使用相同的 API。
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user