merge master

This commit is contained in:
zombiej 2019-07-09 10:50:46 +08:00
commit 85a499365d
26 changed files with 189 additions and 44 deletions

View File

@ -15,11 +15,28 @@ timeline: true
---
## 3.20.1
- 💄 Optimize TimePicker focus style. [#17447](https://github.com/ant-design/ant-design/pull/17447)
- 💄 Optimize DatePicker arrow style for resolve messy when not use utf-8. [#17480](https://github.com/ant-design/ant-design/pull/17480)
- 🐞 Remove useless props which Drawer pass to rc-drawer for avoid error. [#17390](https://github.com/ant-design/ant-design/pull/17390)
- 🐞 Fix Tabs disabled tab and next icon style. [#17500](https://github.com/ant-design/ant-design/pull/17500)
- 🐞 Fix Result's problem that the `className` is empty and the class name is wrong. [#17389](https://github.com/ant-design/ant-design/pull/17389)
- 🐞 Fix DatePicker's input box is obscured on safari. [#17421](https://github.com/ant-design/ant-design/pull/17421)
- 🐞 Fix typo icon name `colum-height` to `column-height`. [#17458](https://github.com/ant-design/ant-design/pull/17458)
- TypeScript
- 🐞 Fix Form `onSubmit` type. [#17412](https://github.com/ant-design/ant-design/pull/17412)
- 🐞 Fix omit AutoComplete `loading` type. [#17433](https://github.com/ant-design/ant-design/pull/17433)
- 🐞 Fix Switch `onClick` type. [#17502](https://github.com/ant-design/ant-design/pull/17502) [@DiamondYuan](https://github.com/DiamondYuan)
## 3.20.0
- 🔥🔥🔥 Add [Result](https://ant.design/components/result) Used to feed back the results of a series of operational tasks.
- 🔥 Descriptions support vertical layout. [#17330](https://github.com/ant-design/ant-design/pull/17330) [@hengkx](https://github.com/hengkx)
- 🔥 Progress.Circle support gradient line color. [#17315](https://github.com/ant-design/ant-design/pull/17315) [@hengkx](https://github.com/hengkx) <img class="markdown-inline-image" src="https://gw.alipayobjects.com/zos/antfincdn/WogwW6kA4O/method-draw-image.svg" alt="Progress">
- 🔥 Progress.Circle support gradient line color. [#17315](https://github.com/ant-design/ant-design/pull/17315) [@hengkx](https://github.com/hengkx)
<img class="markdown-inline-image" src="https://gw.alipayobjects.com/zos/antfincdn/WogwW6kA4O/method-draw-image.svg" alt="Progress">
- 🔥 Optimize PageHeader className naming. [#17321](https://github.com/ant-design/ant-design/pull/17321)
- 🐞 Drawer fixes `maskCloseble` to false, keyboard ESC closes invalid. [#17316](https://github.com/ant-design/ant-design/pull/17316)
- 🐞 Fixed an issue where Drawer closes not calling `afterVisibleChange` in Edge. [#17311](https://github.com/ant-design/ant-design/pull/17311)

View File

@ -15,12 +15,29 @@ timeline: true
---
## 3.20.1
- 💄 优化 TimePicker 聚焦状态的样式。[#17447](https://github.com/ant-design/ant-design/pull/17447)
- 💄 优化 DatePicker 箭头样式,解决非 utf-8 编码下箭头样式乱码的问题。[#17480](https://github.com/ant-design/ant-design/pull/17480)
- 🐞 删除 Drawer 中传给 rc-drawer 的不必要的属性避免报错。[#17390](https://github.com/ant-design/ant-design/pull/17390)
- 🐞 修复 Tabs 当前失效页签样式以及切换图标错位 2px 的问题。[#17500](https://github.com/ant-design/ant-design/pull/17500)
- 🐞 修复 Result 组件 `className` 为空造成类名错误的问题。[#17389](https://github.com/ant-design/ant-design/pull/17389)
- 🐞 修复 safari 浏览器 DatePicker 组件输入框被遮挡的问题。[#17421](https://github.com/ant-design/ant-design/pull/17421)
- 🐞 修复图标名 `colum-height``column-height`。[#17458](https://github.com/ant-design/ant-design/pull/17458)
- TypeScript
- 🐞 修复 Form `onSubmit` TypeScript 定义。[#17412](https://github.com/ant-design/ant-design/pull/17412)
- 🐞 修复 AutoComplete 多余的 `loading` 属性 TypeScript 定义。[#17433](https://github.com/ant-design/ant-design/pull/17433)
- 🐞 修复 Switch 的 `onClick` 的 TypeScript 定义。[#17502](https://github.com/ant-design/ant-design/pull/17502) [@DiamondYuan](https://github.com/DiamondYuan)
## 3.20.0
- 🔥🔥🔥 新增 [Result](https://ant.design/components/result) 用于反馈一系列操作任务的处理结果。
- 🔥 Descriptions 支持垂直布局。[#17330](https://github.com/ant-design/ant-design/pull/17330) [@hengkx](https://github.com/hengkx)
- 🔥 优化 PageHeader 的 `className` 定义。[#17321](https://github.com/ant-design/ant-design/pull/17321)
- 🔥 Progress.Circle 支持渐变色。[#17315](https://github.com/ant-design/ant-design/pull/17315) [@hengkx](https://github.com/hengkx) <img class="markdown-inline-image" src="https://gw.alipayobjects.com/zos/antfincdn/WogwW6kA4O/method-draw-image.svg" alt="Progress">
- 🔥 Progress.Circle 支持渐变色。[#17315](https://github.com/ant-design/ant-design/pull/17315) [@hengkx](https://github.com/hengkx)
<img class="markdown-inline-image" src="https://gw.alipayobjects.com/zos/antfincdn/WogwW6kA4O/method-draw-image.svg" alt="Progress">
- 🐞 Drawer 修复 `maskCloseble` 为 false键盘 ESC 关闭无效的问题。[#17316](https://github.com/ant-design/ant-design/pull/17316)
- 🐞 修复在 Edge 下 Drawer 关闭后没有调用 `afterVisibleChange` 的问题。[#17311](https://github.com/ant-design/ant-design/pull/17311)
- 🌟 Drawer 新增 `keyboard`,允许打开关闭对键盘事件的响应。[#17316](https://github.com/ant-design/ant-design/pull/17316)

View File

@ -437,6 +437,7 @@ exports[`renders ./components/badge/demo/change.md correctly 1`] = `
viewBox="64 64 896 896"
width="1em"
>
<defs />
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>

View File

@ -429,4 +429,13 @@ describe('Cascader', () => {
);
});
});
it('should warning if not find `value` in `options`', () => {
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
mount(<Cascader options={[{ label: 'a', value: 'a', children: [{ label: 'b' }] }]} />);
expect(errorSpy).toHaveBeenCalledWith(
'Warning: [antd: Cascader] Not found `value` in `options`.',
);
errorSpy.mockRestore();
});
});

View File

@ -204,6 +204,14 @@ function flattenTree(
const defaultDisplayRender = (label: string[]) => label.join(' / ');
function warningValueNotExist(list: CascaderOptionType[] = [], fieldNames: FieldNamesType = {}) {
list.forEach(item => {
const valueFieldName = fieldNames.value || 'value';
warning(valueFieldName in item, 'Cascader', 'Not found `value` in `options`.');
warningValueNotExist(item[fieldNames.children || 'children'], fieldNames);
});
}
class Cascader extends React.Component<CascaderProps, CascaderState> {
static defaultProps = {
placeholder: 'Please select',
@ -229,6 +237,10 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
newState.flattenOptions = flattenTree(nextProps.options, nextProps);
}
if (process.env.NODE_ENV !== 'production' && nextProps.options) {
warningValueNotExist(nextProps.options, getFieldNames(nextProps));
}
return newState;
}

View File

@ -1,3 +1,64 @@
.calendarLeftArrow() {
height: 100%;
&::before,
&::after {
position: relative;
top: -1px;
display: inline-block;
width: 8px;
height: 8px;
vertical-align: middle;
border: 0 solid #aaa;
border-width: 1.5px 0 0 1.5px;
border-radius: 1px;
transform: rotate(-45deg) scale(0.8);
transition: all 0.3s;
content: '';
}
&:hover::before,
&:hover::after {
border-color: @text-color;
}
&::after {
display: none;
}
}
.calendarLeftDoubleArrow() {
.calendarLeftArrow;
&::after {
position: relative;
left: -3px;
display: inline-block;
}
}
.calendarRightArrow() {
.calendarLeftArrow;
&::before,
&::after {
transform: rotate(135deg) scale(0.8);
}
}
.calendarRightDoubleArrow() {
.calendarRightArrow;
&::before {
position: relative;
left: 3px;
}
&::after {
display: inline-block;
}
}
.calendarPanelHeader(@calendar-prefix-cls) {
height: 40px;
line-height: 40px;
@ -49,36 +110,24 @@
.@{calendar-prefix-cls}-prev-decade-btn,
.@{calendar-prefix-cls}-prev-year-btn {
left: 7px;
&::after {
content: '«';
}
.calendarLeftDoubleArrow;
}
.@{calendar-prefix-cls}-next-century-btn,
.@{calendar-prefix-cls}-next-decade-btn,
.@{calendar-prefix-cls}-next-year-btn {
right: 7px;
&::after {
content: '»';
}
.calendarRightDoubleArrow;
}
.@{calendar-prefix-cls}-prev-month-btn {
left: 29px;
&::after {
content: '';
}
.calendarLeftArrow;
}
.@{calendar-prefix-cls}-next-month-btn {
right: 29px;
&::after {
content: '';
}
.calendarRightArrow;
}
}

View File

@ -96,11 +96,10 @@
.@{calendar-prefix-cls}-input,
.@{calendar-timepicker-prefix-cls}-input {
.input;
height: @input-height-sm;
line-height: @input-height-sm;
padding-right: 0;
padding-left: 0;
line-height: @input-height-sm;
border: 0;
box-shadow: none;

View File

@ -33,6 +33,7 @@ exports[`renders ./components/drawer/demo/form-in-drawer.md correctly 1`] = `
viewBox="64 64 896 896"
width="1em"
>
<defs />
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>

View File

@ -219,6 +219,14 @@ class Drawer extends React.Component<DrawerProps & ConfigConsumerProps, IDrawerS
title,
push,
onClose,
visible,
// ConfigConsumerProps
getPopupContainer,
rootPrefixCls,
getPrefixCls,
renderEmpty,
csp,
autoInsertSpaceInButton,
...rest
} = this.props;
warning(

View File

@ -1,2 +1,3 @@
// deps-lint-skip: empty
import '../../style/index.less';
import './index.less';

View File

@ -871,6 +871,7 @@ exports[`renders ./components/form/demo/dynamic-form-item.md correctly 1`] = `
viewBox="64 64 896 896"
width="1em"
>
<defs />
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>

View File

@ -227,23 +227,23 @@ describe('utils', () => {
]);
});
it('should depracate typo icon name', () => {
it('should report an error when there are deprecated typos in icon names', () => {
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
render(<Icon type="interation" />);
expect(errorSpy).toHaveBeenLastCalledWith(
"Warning: [antd: Icon] Icon 'interation' is typo and depracated, please use 'interaction' instead.",
"Warning: [antd: Icon] Icon 'interation' was a typo and is now deprecated, please use 'interaction' instead.",
);
render(<Icon type="cross" />);
expect(errorSpy).toHaveBeenLastCalledWith(
"Warning: [antd: Icon] Icon 'cross' is typo and depracated, please use 'close' instead.",
"Warning: [antd: Icon] Icon 'cross' was a typo and is now deprecated, please use 'close' instead.",
);
render(<Icon type="canlendar" theme="twoTone" />);
expect(errorSpy).toHaveBeenLastCalledWith(
"Warning: [antd: Icon] Icon 'canlendar' is typo and depracated, please use 'calendar' instead.",
"Warning: [antd: Icon] Icon 'canlendar' was a typo and is now deprecated, please use 'calendar' instead.",
);
render(<Icon type="colum-height" />);
expect(errorSpy).toHaveBeenLastCalledWith(
"Warning: [antd: Icon] Icon 'colum-height' is typo and depracated, please use 'column-height' instead.",
"Warning: [antd: Icon] Icon 'colum-height' was a typo and is now deprecated, please use 'column-height' instead.",
);
expect(errorSpy).toHaveBeenCalledTimes(4);
errorSpy.mockRestore();

View File

@ -1,6 +1,6 @@
import * as React from 'react';
import classNames from 'classnames';
import * as allIcons from '@ant-design/icons/lib/dist';
import * as allIcons from '@ant-design/icons';
import ReactIcon from '@ant-design/icons-react';
import createFromIconfontCN from './IconFont';
import {

View File

@ -72,7 +72,7 @@ export function alias(type: string) {
warning(
newType === type,
'Icon',
`Icon '${type}' is typo and depracated, please use '${newType}' instead.`,
`Icon '${type}' was a typo and is now deprecated, please use '${newType}' instead.`,
);
return newType;
}

View File

@ -373,9 +373,17 @@
color: @input-color;
line-height: 0;
transform: translateY(-50%);
background-color: #fff;
height: calc(100% - 2px);
:not(.anticon) {
line-height: @line-height-base;
}
.anticon {
position: relative;
vertical-align: top;
top: 50%;
transform: translateY(-50%);
}
}
.@{inputClass}-prefix {

View File

@ -28,6 +28,8 @@ A list can be used to display content related to a single subject. The content c
| locale | i18n text including empty text | object | emptyText: 'No Data' <br> |
| pagination | Pagination [config](https://ant.design/components/pagination/), hide it by setting it to false | boolean \| object | false |
| split | Toggles rendering of the split under the list item | boolean | true |
| dataSource | dataSource array for list | any[] | - |
| renderItem | customize list item when using `dataSource` | `item => ReactNode` | - |
### pagination

View File

@ -29,6 +29,8 @@ cols: 1
| pagination | 对应的 `pagination` 配置, 设置 `false` 不显示 | boolean\|object | false |
| size | list 的尺寸 | `default` \| `middle` \| `small` | `default` |
| split | 是否展示分割线 | boolean | true |
| dataSource | 列表数据源 | any[] | - |
| renderItem | 当使用 dataSource 时,可以用 `renderItem` 自定义渲染列表项 | `item => ReactNode` | - |
### pagination

View File

@ -48,3 +48,9 @@ This component aims to provide localization of the built-in text. If you want to
| Property | Description | Type | Default |
| --- | --- | --- | --- |
| locale | language package setting, you can find the packages in [antd/lib/locale-provider](http://unpkg.com/antd/lib/locale-provider/) | object | - |
## FAQ
#### Locale problem is still existed even LocaleProvider is used?
Please make sure you set moment locale by `moment.locale('zh-cn')`, or you don't have two moment of different version.

View File

@ -49,3 +49,9 @@ return <LocaleProvider locale={locales.en_US}><App /></LocaleProvider>;
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| locale | 语言包配置,语言包可到 [antd/lib/locale-provider](http://unpkg.com/antd/lib/locale-provider/) 目录下寻找 | object | - |
## FAQ
#### 为什么我使用了 LocaleProvider 还有问题?
请检查是否设置了 `moment.locale('zh-cn')`,或者是否有两个版本的 moment 共存。

View File

@ -254,6 +254,7 @@ exports[`renders ./components/progress/demo/circle-dynamic.md correctly 1`] = `
viewBox="64 64 896 896"
width="1em"
>
<defs />
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
@ -548,6 +549,7 @@ exports[`renders ./components/progress/demo/dynamic.md correctly 1`] = `
viewBox="64 64 896 896"
width="1em"
>
<defs />
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>

View File

@ -18,7 +18,7 @@ export interface SwitchProps {
checked?: boolean;
defaultChecked?: boolean;
onChange?: SwitchChangeEventHandler;
onClick?: SwitchChangeEventHandler;
onClick?: SwitchClickEventHandler;
checkedChildren?: React.ReactNode;
unCheckedChildren?: React.ReactNode;
disabled?: boolean;

View File

@ -1182,6 +1182,7 @@ exports[`renders ./components/tabs/demo/editable-card.md correctly 1`] = `
viewBox="64 64 896 896"
width="1em"
>
<defs />
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>

View File

@ -29,6 +29,10 @@
border-color: @border-color-split;
border-bottom: @border-width-base solid @component-background;
}
&&-card &-card-bar &-tab-disabled {
color: @tabs-card-active-color;
color: @disabled-color;
}
&&-card &-card-bar &-tab-inactive {
padding: 0;
}

View File

@ -197,6 +197,11 @@
margin-right: 8px;
}
&-active {
color: @tabs-highlight-color;
font-weight: 500;
}
&-disabled {
&,
&:hover {
@ -204,11 +209,6 @@
cursor: not-allowed;
}
}
&-active {
color: @tabs-highlight-color;
font-weight: 500;
}
}
}
@ -259,14 +259,9 @@
.@{tab-prefix-cls}-right-bar {
height: 100%;
border-bottom: 0;
&-tab-prev,
&-tab-next {
width: @tabs-scrolling-size;
height: 0;
transition: height 0.3s @ease-in-out, opacity 0.3s @ease-in-out, color 0.3s @ease-in-out;
}
&-tab-prev.@{tab-prefix-cls}-tab-arrow-show,
&-tab-next.@{tab-prefix-cls}-tab-arrow-show {
.@{tab-prefix-cls}-tab-arrow-show,
.@{tab-prefix-cls}-tab-arrow-show {
width: 100%;
height: @tabs-scrolling-size;
}
@ -320,6 +315,7 @@
}
.@{tab-prefix-cls}-tab-next {
right: 0;
bottom: 0;
width: 100%;
height: @tabs-scrolling-size;

View File

@ -113,6 +113,7 @@ exports[`renders ./components/tag/demo/animation.md correctly 1`] = `
viewBox="64 64 896 896"
width="1em"
>
<defs />
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
@ -388,6 +389,7 @@ exports[`renders ./components/tag/demo/control.md correctly 1`] = `
viewBox="64 64 896 896"
width="1em"
>
<defs />
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>

View File

@ -1,6 +1,6 @@
{
"name": "antd",
"version": "3.20.0",
"version": "3.20.1",
"title": "Ant Design",
"description": "An enterprise-class UI design language and React components implementation",
"homepage": "http://ant.design/",
@ -99,6 +99,7 @@
},
"devDependencies": {
"@ant-design/colors": "^3.1.0",
"@babel/plugin-transform-typescript": "~7.4.5",
"@packtracker/webpack-plugin": "^2.0.1",
"@sentry/browser": "^5.4.0",
"@types/classnames": "^2.2.8",
@ -161,8 +162,8 @@
"react": "^16.5.2",
"react-color": "^2.17.3",
"react-copy-to-clipboard": "^5.0.1",
"react-dnd": "^8.0.0",
"react-dnd-html5-backend": "^8.0.0",
"react-dnd": "^9.0.0",
"react-dnd-html5-backend": "^9.0.0",
"react-document-title": "^2.0.3",
"react-dom": "^16.5.2",
"react-github-button": "^0.1.11",