Merge pull request #17804 from ant-design/master

chore: Merge master into feature
This commit is contained in:
zombieJ 2019-07-23 10:23:55 +08:00 committed by GitHub
commit bdea770670
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 671 additions and 98 deletions

14
.github/main.workflow vendored Normal file
View File

@ -0,0 +1,14 @@
workflow "Deploy website" {
on = "release"
resolves = ["Deploy"]
}
action "Deploy" {
uses = "docker://node:10"
runs = [
"sh",
"-c",
"git remote set-url origin https://${DEPLOY_TOKEN}@github.com/ant-design/ant-design.git && npm install && npm run deploy"
],
secrets = ["DEPLOY_TOKEN"]
}

View File

@ -15,6 +15,38 @@ timeline: true
---
## 3.20.5
`2019-07-19`
- 🐞 Fix `<Button type="danger" ghost />` broken style. [#17743](https://github.com/ant-design/ant-design/pull/17743)
## 3.20.4
`2019-07-19`
- 🐞 Fix multiple level Drawer with falsy `mask`, parent Drawer can not collapse after removing sub component. [#17698](https://github.com/ant-design/ant-design/pull/17698)
- 🐞 Fix Table border radius missing in Firefox. [#17641](https://github.com/ant-design/ant-design/pull/17641)
- 🐞 Fix Menu throw warning `Cannot update during an existing state transition`. [#17657](https://github.com/ant-design/ant-design/pull/17657)
- 🐞 Fix Affix not resize when container size changed. [#17678](https://github.com/ant-design/ant-design/pull/17678)
- 🐞 Fix Anchor not update bind element when `getContainer` changed. [#17677](https://github.com/ant-design/ant-design/pull/17677)
- 🐞 Fix window scroll issue when using Modal and Drawer same time. [#17600](https://github.com/ant-design/ant-design/pull/17600)
- 🌟 Empty `description` supports `false`. [#17659](https://github.com/ant-design/ant-design/pull/17659) [@billfeller](https://github.com/billfeller)
- 💄 Remove Pagination element underline style to avoid polluted by global style. [#17728](https://github.com/ant-design/ant-design/pull/17728)
- 💄 Extends Card action click area. [#17705](https://github.com/ant-design/ant-design/pull/17705) [@lhx6538665](https://github.com/lhx6538665)
- 💄 Tweak less variables and UI to improve style customization. [#17705](https://github.com/ant-design/ant-design/pull/17705)
- Optimize danger Button UI design.
<img width="103" class="markdown-inline-image" alt="image" src="https://user-images.githubusercontent.com/507615/61370809-e37aa480-a8c5-11e9-98b3-51ce06dfba24.png">
- Fix `@border-radius-sm` not working for Slider, TreeSelect.
- Added some less variables for Progress, Tabs, Slider and Timeline.
- TypeScript
- 💄 Improve type definition of Form. [#17676](https://github.com/ant-design/ant-design/pull/17676) [@lixiaoyang1992](https://github.com/lixiaoyang1992)
- 💄 Improve type definition of Tabs. [#17675](https://github.com/ant-design/ant-design/pull/17675)
## 3.20.3
`2019-07-15`
@ -27,9 +59,15 @@ timeline: true
- 📖 Add version description for every features. [#17373](https://github.com/ant-design/ant-design/pull/17373) [@muzea](https://github.com/muzea)
- 🐞 Fix Button transition style when loading. [#17596](https://github.com/ant-design/ant-design/pull/17596) [@LilyWakana](https://github.com/LilyWakana)
- Cascader - 🐞 Fix not display `notFoundContent` when options.length is 0. [#17538](https://github.com/ant-design/ant-design/pull/17538) - 🐞 Fix option's loading not aligned when `isLeaf` is true. [#17550](https://github.com/ant-design/ant-design/pull/17550) - 🐞 Fix over-length text covered by arrow. [#17583](https://github.com/ant-design/ant-design/pull/17583)
- Cascader
- 🐞 Fix not display `notFoundContent` when options.length is 0. [#17538](https://github.com/ant-design/ant-design/pull/17538)
- 🐞 Fix option's loading not aligned when `isLeaf` is true. [#17550](https://github.com/ant-design/ant-design/pull/17550)
- 🐞 Fix over-length text covered by arrow. [#17583](https://github.com/ant-design/ant-design/pull/17583)
- 🐞 Fix Input style when suffix and clear icon exist both. [#17508](https://github.com/ant-design/ant-design/pull/17508) [@LilyWakana](https://github.com/LilyWakana)
- TypeScript - 💄 Improve type definition of Cascader's option. [#17581](https://github.com/ant-design/ant-design/pull/17581) [@MrHeer](https://github.com/MrHeer) - 🐞 Fix type definition of Descriptions.title. [#17412](https://github.com/ant-design/ant-design/pull/17412) - 🐞 Fix type definition of Collapse.activeKey, Collapse.defaultActiveKey and CollapsePanel.key. [#17557](https://github.com/ant-design/ant-design/pull/17557) [@thylsky](https://github.com/thylsky)
- TypeScript
- 💄 Improve type definition of Cascader's option. [#17581](https://github.com/ant-design/ant-design/pull/17581) [@MrHeer](https://github.com/MrHeer)
- 🐞 Fix type definition of Descriptions.title. [#17559](https://github.com/ant-design/ant-design/pull/17559)
- 🐞 Fix type definition of Collapse.activeKey, Collapse.defaultActiveKey and CollapsePanel.key. [#17557](https://github.com/ant-design/ant-design/pull/17557) [@thylsky](https://github.com/thylsky)
## 3.20.1
@ -51,7 +89,7 @@ timeline: true
- 🔥 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">
<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)

View File

@ -15,6 +15,38 @@ timeline: true
---
## 3.20.5
`2019-07-19`
- 🐞 修复 `<Button type="danger" ghost />` 样式问题。[#17743](https://github.com/ant-design/ant-design/pull/17743)
## 3.20.4
`2019-07-19`
- 🐞 修复多层级 Drawer 的 `mask` 为 false 时,卸载子级组件后父抽屉不收回的问题。[#17698](https://github.com/ant-design/ant-design/pull/17698)
- 🐞 修复 Table 圆角样式在 Firefox 下丢失的问题。[#17641](https://github.com/ant-design/ant-design/pull/17641)
- 🐞 修复 Menu 抛出 `Cannot update during an existing state transition` 警告的问题。[#17657](https://github.com/ant-design/ant-design/pull/17657)
- 🐞 修复 Affix 容器变化时尺寸不变的问题。[#17678](https://github.com/ant-design/ant-design/pull/17678)
- 🐞 修复 Anchor 监听元素不随着 `getContainer` 变化的问题。[#17677](https://github.com/ant-design/ant-design/pull/17677)
- 🐞 修复 Modal 和 Drawer 同时使用导致的窗体滚动条冲突的问题。[#17600](https://github.com/ant-design/ant-design/pull/17600)
- 🌟 Empty `description` 支持 `false`。 [#17659](https://github.com/ant-design/ant-design/pull/17659) [@billfeller](https://github.com/billfeller)
- 💄 去除 Pagination 元素下划线以防止被全局样式污染。[#17728](https://github.com/ant-design/ant-design/pull/17728)
- 💄 拓展 Card action 可点击区域。[#17705](https://github.com/ant-design/ant-design/pull/17705) [@lhx6538665](https://github.com/lhx6538665)
- 💄 对 Less 变量进行了一波调整,以适应更多细节风格定制。[#17697](https://github.com/ant-design/ant-design/pull/17697)
- 调整危险按钮样式。
<img width="103" class="markdown-inline-image" alt="image" src="https://user-images.githubusercontent.com/507615/61370809-e37aa480-a8c5-11e9-98b3-51ce06dfba24.png">
- 修复 `@border-radius-sm` 对 Slider、TreeSelect 不生效的问题。
- Progress、Tabs、Slider、Timeline 组件补充 less 变量。
- TypeScript
- 💄 完善 Form 的类型定义。[#17676](https://github.com/ant-design/ant-design/pull/17676) [@lixiaoyang1992](https://github.com/lixiaoyang1992)
- 💄 完善 Tabs 的类型定义。[#17675](https://github.com/ant-design/ant-design/pull/17675)
## 3.20.3
`2019-07-15`
@ -27,9 +59,15 @@ timeline: true
- 📖 文档中增加对组件新特性的版本说明。[#17373](https://github.com/ant-design/ant-design/pull/17373) [@muzea](https://github.com/muzea)
- 🐞 修复 Button 组件的 loading 样式问题。[#17596](https://github.com/ant-design/ant-design/pull/17596) [@LilyWakana](https://github.com/LilyWakana)
- Cascader - 🐞 修复 options 为空时不展示空内容的问题。[#17538](https://github.com/ant-design/ant-design/pull/17538) - 🐞 修复 option 的 isLeaf 为 true 时 loading 样式没有对齐的问题。[#17550](https://github.com/ant-design/ant-design/pull/17550) - 🐞 修复文本过长被箭头遮挡的问题。[#17583](https://github.com/ant-design/ant-design/pull/17583)
- Cascader
- 🐞 修复 options 为空时不展示空内容的问题。[#17538](https://github.com/ant-design/ant-design/pull/17538)
- 🐞 修复 option 的 isLeaf 为 true 时 loading 样式没有对齐的问题。[#17550](https://github.com/ant-design/ant-design/pull/17550)
- 🐞 修复文本过长被箭头遮挡的问题。[#17583](https://github.com/ant-design/ant-design/pull/17583)
- 🐞 修复 Input 组件存在多个后缀图标时的样式错乱问题。[#17508](https://github.com/ant-design/ant-design/pull/17508) [@LilyWakana](https://github.com/LilyWakana)
- TypeScript - 💄 完善 Cascader 的 `option` 类型定义。[#17581](https://github.com/ant-design/ant-design/pull/17581) [@MrHeer](https://github.com/MrHeer) - 🐞 修复 Descriptions 的 `title` 类型定义。[#17412](https://github.com/ant-design/ant-design/pull/17412) - 🐞 修复 Collapse 的 activeKey、defaultActiveKey 以及 Collapse.Panel 的 key 类型定义。[#17557](https://github.com/ant-design/ant-design/pull/17557) [@thylsky](https://github.com/thylsky)
- TypeScript
- 💄 完善 Cascader 的 `option` 类型定义。[#17581](https://github.com/ant-design/ant-design/pull/17581) [@MrHeer](https://github.com/MrHeer)
- 🐞 修复 Descriptions 的 `title` 类型定义。[#17559](https://github.com/ant-design/ant-design/pull/17559)
- 🐞 修复 Collapse 的 activeKey、defaultActiveKey 以及 Collapse.Panel 的 key 类型定义。[#17557](https://github.com/ant-design/ant-design/pull/17557) [@thylsky](https://github.com/thylsky)
## 3.20.1
@ -52,7 +90,7 @@ timeline: true
- 🔥 优化 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">
<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)

View File

@ -167,7 +167,7 @@
}
&-background-ghost&-danger {
.button-variant-ghost(@btn-danger-color);
.button-variant-ghost(@btn-danger-border);
}
&-background-ghost&-link {

View File

@ -451,4 +451,24 @@ describe('Cascader', () => {
);
errorSpy.mockRestore();
});
// https://github.com/ant-design/ant-design/issues/17690
it('should not breaks when children is null', () => {
const optionsWithChildrenNull = [
{
value: 'zhejiang',
label: 'Zhejiang',
children: [
{
value: 'hangzhou',
label: 'Hangzhou',
children: null,
},
],
},
];
expect(() => {
mount(<Cascader options={optionsWithChildrenNull} />);
}).not.toThrow();
});
});

View File

@ -206,8 +206,8 @@ function flattenTree(
const defaultDisplayRender = (label: string[]) => label.join(' / ');
function warningValueNotExist(list: CascaderOptionType[] = [], fieldNames: FieldNamesType = {}) {
list.forEach(item => {
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);

View File

@ -150,7 +150,6 @@
}
}
.@{checkbox-prefix-cls}-wrapper + span,
.@{checkbox-prefix-cls} + span {
padding-right: 8px;
padding-left: 8px;

View File

@ -150,6 +150,9 @@ class RangePicker extends React.Component<any, RangePickerState> {
showDate: getShowDateFromValue(value) || showDate,
}));
}
if (value[0] && value[0].diff(value[1]) > 0) {
value[1] = undefined;
}
const [start, end] = value;
props.onChange(value, [formatDate(start, props.format), formatDate(end, props.format)]);
};

View File

@ -387,4 +387,17 @@ describe('RangePicker', () => {
).toBe(false);
});
});
// https://github.com/ant-design/ant-design/issues/17135
it('the end time should be less than the start time', () => {
const wrapper = mount(
<RangePicker defaultValue={[moment(), moment()]} />,
);
wrapper.find('.ant-calendar-picker-input').simulate('click');
const firstInput = wrapper.find('.ant-calendar-input').first();
const secondInput = wrapper.find('.ant-calendar-input').last();
firstInput.simulate('change', { target: { value: moment().add(1, 'day').format('YYYY-MM-DD')}});
expect(firstInput.getDOMNode().value).toBe(moment().add(1, 'day').format('YYYY-MM-DD'));
expect(secondInput.getDOMNode().value).toBe('');
});
});

View File

@ -55,7 +55,7 @@
}
&:hover &-input:not(.@{ant-prefix}-input-disabled) {
border-color: @primary-color;
border-color: @input-hover-border-color;
}
&:focus &-input:not(.@{ant-prefix}-input-disabled) {

View File

@ -61,6 +61,8 @@
}
.@{ant-prefix}-col {
// Prevent columns from collapsing when empty
min-height: 1px;
position: relative;
}

View File

@ -22,8 +22,6 @@
.col(@index, @list) when (@index > @grid-columns) {
@{list} {
position: relative;
// Prevent columns from collapsing when empty
min-height: 1px;
padding-right: (@grid-gutter-width / 2);
padding-left: (@grid-gutter-width / 2);
}

View File

@ -45,7 +45,6 @@ class Input extends React.Component<InputProps, any> {
static defaultProps = {
type: 'text',
disabled: false,
};
static propTypes = {

View File

@ -3,7 +3,6 @@
exports[`Input allowClear should change type when click 1`] = `
<Input
allowClear={true}
disabled={false}
type="text"
>
<span
@ -11,7 +10,6 @@ exports[`Input allowClear should change type when click 1`] = `
>
<input
className="ant-input"
disabled={false}
onChange={[Function]}
onKeyDown={[Function]}
style={null}
@ -70,7 +68,6 @@ exports[`Input allowClear should change type when click 1`] = `
exports[`Input allowClear should change type when click 2`] = `
<Input
allowClear={true}
disabled={false}
type="text"
>
<span
@ -78,7 +75,6 @@ exports[`Input allowClear should change type when click 2`] = `
>
<input
className="ant-input"
disabled={false}
onChange={[Function]}
onKeyDown={[Function]}
style={null}
@ -96,7 +92,6 @@ exports[`Input allowClear should not show icon if defaultValue is undefined, nul
<Input
allowClear={true}
defaultValue={null}
disabled={false}
type="text"
>
<span
@ -104,7 +99,6 @@ exports[`Input allowClear should not show icon if defaultValue is undefined, nul
>
<input
className="ant-input"
disabled={false}
onChange={[Function]}
onKeyDown={[Function]}
style={null}
@ -121,7 +115,6 @@ exports[`Input allowClear should not show icon if defaultValue is undefined, nul
exports[`Input allowClear should not show icon if defaultValue is undefined, null or empty string 2`] = `
<Input
allowClear={true}
disabled={false}
type="text"
>
<span
@ -129,7 +122,6 @@ exports[`Input allowClear should not show icon if defaultValue is undefined, nul
>
<input
className="ant-input"
disabled={false}
onChange={[Function]}
onKeyDown={[Function]}
style={null}
@ -147,7 +139,6 @@ exports[`Input allowClear should not show icon if defaultValue is undefined, nul
<Input
allowClear={true}
defaultValue=""
disabled={false}
type="text"
>
<span
@ -155,7 +146,6 @@ exports[`Input allowClear should not show icon if defaultValue is undefined, nul
>
<input
className="ant-input"
disabled={false}
onChange={[Function]}
onKeyDown={[Function]}
style={null}
@ -172,7 +162,6 @@ exports[`Input allowClear should not show icon if defaultValue is undefined, nul
exports[`Input allowClear should not show icon if value is undefined, null or empty string 1`] = `
<Input
allowClear={true}
disabled={false}
type="text"
value={null}
>
@ -181,7 +170,6 @@ exports[`Input allowClear should not show icon if value is undefined, null or em
>
<input
className="ant-input"
disabled={false}
onChange={[Function]}
onKeyDown={[Function]}
style={null}
@ -198,7 +186,6 @@ exports[`Input allowClear should not show icon if value is undefined, null or em
exports[`Input allowClear should not show icon if value is undefined, null or empty string 2`] = `
<Input
allowClear={true}
disabled={false}
type="text"
>
<span
@ -206,7 +193,6 @@ exports[`Input allowClear should not show icon if value is undefined, null or em
>
<input
className="ant-input"
disabled={false}
onChange={[Function]}
onKeyDown={[Function]}
style={null}
@ -223,7 +209,6 @@ exports[`Input allowClear should not show icon if value is undefined, null or em
exports[`Input allowClear should not show icon if value is undefined, null or empty string 3`] = `
<Input
allowClear={true}
disabled={false}
type="text"
value=""
>
@ -232,7 +217,6 @@ exports[`Input allowClear should not show icon if value is undefined, null or em
>
<input
className="ant-input"
disabled={false}
onChange={[Function]}
onKeyDown={[Function]}
style={null}
@ -248,13 +232,11 @@ exports[`Input allowClear should not show icon if value is undefined, null or em
exports[`Input should support maxLength 1`] = `
<Input
disabled={false}
maxLength={3}
type="text"
>
<input
className="ant-input"
disabled={false}
maxLength={3}
onChange={[Function]}
onKeyDown={[Function]}
@ -274,7 +256,6 @@ exports[`Input.Password should change type when click 1`] = `
<Input
action="click"
className="ant-input-password"
disabled={false}
prefixCls="ant-input"
suffix={
<Icon
@ -292,7 +273,6 @@ exports[`Input.Password should change type when click 1`] = `
<input
action="click"
className="ant-input"
disabled={false}
onChange={[Function]}
onKeyDown={[Function]}
style={null}
@ -363,7 +343,6 @@ exports[`Input.Password should change type when click 2`] = `
<Input
action="click"
className="ant-input-password"
disabled={false}
prefixCls="ant-input"
suffix={
<Icon
@ -381,7 +360,6 @@ exports[`Input.Password should change type when click 2`] = `
<input
action="click"
className="ant-input"
disabled={false}
onChange={[Function]}
onKeyDown={[Function]}
style={null}
@ -448,7 +426,6 @@ exports[`Input.Password should change type when click 3`] = `
<Input
action="click"
className="ant-input-password"
disabled={false}
prefixCls="ant-input"
suffix={
<Icon
@ -466,7 +443,6 @@ exports[`Input.Password should change type when click 3`] = `
<input
action="click"
className="ant-input"
disabled={false}
onChange={[Function]}
onKeyDown={[Function]}
style={null}
@ -534,7 +510,6 @@ exports[`Input.Search should support suffix 1`] = `
>
<Input
className="ant-input-search"
disabled={false}
onPressEnter={[Function]}
prefixCls="ant-input"
suffix={
@ -554,7 +529,6 @@ exports[`Input.Search should support suffix 1`] = `
>
<input
className="ant-input"
disabled={false}
onChange={[Function]}
onKeyDown={[Function]}
style={null}

View File

@ -9,12 +9,14 @@
padding: @input-padding-vertical-lg @input-padding-horizontal-lg;
font-size: @font-size-lg;
line-height: @input-height-lg;
line-height: ~'@{line-height-base} \9'; // https://github.com/ant-design/ant-design/issues/17753
}
.input-sm() {
height: @input-height-sm;
padding: @input-padding-vertical-sm @input-padding-horizontal-sm;
line-height: @input-height-sm;
line-height: ~'@{line-height-base} \9'; // https://github.com/ant-design/ant-design/issues/17753
}
// input status
@ -52,6 +54,7 @@
color: @input-color;
font-size: @font-size-base;
line-height: @input-height-base;
line-height: ~'@{line-height-base} \9'; // https://github.com/ant-design/ant-design/issues/17753
background-color: @input-bg;
background-image: none;
border: @border-width-base @border-style-base @input-border-color;

View File

@ -0,0 +1,14 @@
import createContext from '@ant-design/create-react-context';
export type MenuTheme = 'light' | 'dark';
export interface MenuContextProps {
inlineCollapsed: boolean;
antdMenuTheme?: MenuTheme;
}
const MenuContext = createContext<MenuContextProps>({
inlineCollapsed: false,
});
export default MenuContext;

View File

@ -1,7 +1,7 @@
import * as React from 'react';
import { Item } from 'rc-menu';
import { ClickParam } from '.';
import { MenuContext, MenuContextProps } from './';
import MenuContext, { MenuContextProps } from './MenuContext';
import Tooltip, { TooltipProps } from '../tooltip';
import { SiderContext, SiderContextProps } from '../layout/Sider';

View File

@ -3,7 +3,7 @@ import * as PropTypes from 'prop-types';
import { SubMenu as RcSubMenu } from 'rc-menu';
import classNames from 'classnames';
import { MenuContext, MenuContextProps } from './index';
import MenuContext, { MenuContextProps } from './MenuContext';
interface TitleEventEntity {
key: string;

View File

@ -1,6 +1,5 @@
import * as React from 'react';
import RcMenu, { Divider, ItemGroup } from 'rc-menu';
import createContext from '@ant-design/create-react-context';
import classNames from 'classnames';
import omit from 'omit.js';
import SubMenu from './SubMenu';
@ -11,6 +10,7 @@ import warning from '../_util/warning';
import { polyfill } from 'react-lifecycles-compat';
import { SiderContext, SiderContextProps } from '../layout/Sider';
import raf from '../_util/raf';
import MenuContext, { MenuTheme } from './MenuContext';
export interface SelectParam {
key: string;
@ -29,8 +29,6 @@ export interface ClickParam {
export type MenuMode = 'vertical' | 'vertical-left' | 'vertical-right' | 'horizontal' | 'inline';
export type MenuTheme = 'light' | 'dark';
export interface MenuProps {
id?: string;
theme?: MenuTheme;
@ -74,15 +72,6 @@ export interface MenuState {
mounted: boolean;
}
export interface MenuContextProps {
inlineCollapsed: boolean;
antdMenuTheme?: MenuTheme;
}
export const MenuContext = createContext<MenuContextProps>({
inlineCollapsed: false,
});
class InternalMenu extends React.Component<InternalMenuProps, MenuState> {
static defaultProps: Partial<MenuProps> = {
className: '',

View File

@ -26,7 +26,6 @@ function getCheckedValue(children: React.ReactNode) {
class RadioGroup extends React.Component<RadioGroupProps, RadioGroupState> {
static defaultProps = {
disabled: false,
buttonStyle: 'outline' as RadioGroupButtonStyle,
};

View File

@ -231,16 +231,18 @@ span.@{radio-prefix-cls} + * {
pointer-events: none;
}
&-checked {
&-checked:not(&-disabled) {
z-index: 1;
color: @radio-dot-color;
background: @radio-button-checked-bg;
border-color: @radio-dot-color;
box-shadow: -1px 0 0 0 @radio-dot-color;
&::before {
background-color: @radio-dot-color !important;
opacity: 0.1;
}
&:first-child {
border-color: @radio-dot-color;
box-shadow: none !important;

View File

@ -1133,7 +1133,11 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
</div>
</li>
</ul>
allowClear: true
<span
class="ant-rate-text"
>
allowClear: true
</span>
<br />
<ul
class="ant-rate"
@ -1431,7 +1435,11 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
</div>
</li>
</ul>
allowClear: false
<span
class="ant-rate-text"
>
allowClear: false
</span>
</div>
`;

View File

@ -18,9 +18,11 @@ import { Rate } from 'antd';
ReactDOM.render(
<div>
<Rate defaultValue={3} /> allowClear: true
<Rate defaultValue={3} />
<span className="ant-rate-text">allowClear: true</span>
<br />
<Rate allowClear={false} defaultValue={3} /> allowClear: false
<Rate allowClear={false} defaultValue={3} />
<span className="ant-rate-text">allowClear: false</span>
</div>,
mountNode,
);

View File

@ -26,12 +26,15 @@
position: relative;
display: inline-block;
margin: 0;
margin-right: 8px;
padding: 0;
color: inherit;
cursor: pointer;
transition: all 0.3s;
&:not(:last-child) {
margin-right: 8px;
}
> div {
&:focus {
outline: 0;

View File

@ -15,4 +15,8 @@
&::-webkit-input-placeholder {
color: @color;
}
&:placeholder-shown {
text-overflow: ellipsis;
}
}

View File

@ -25,7 +25,12 @@ const ResizeableTitle = props => {
}
return (
<Resizable width={width} height={0} onResize={onResize}>
<Resizable
width={width}
height={0}
onResize={onResize}
draggableOpts={{ enableUserSelectHack: false }}
>
<th {...restProps} />
</Resizable>
);

View File

@ -473,6 +473,10 @@
overflow: hidden;
}
.@{ant-prefix}-checkbox-wrapper + span {
padding-left: 8px;
}
> .@{ant-prefix}-dropdown-menu > .@{ant-prefix}-dropdown-menu-item:last-child,
> .@{ant-prefix}-dropdown-menu
> .@{ant-prefix}-dropdown-menu-submenu:last-child

View File

@ -66,7 +66,6 @@ class TimePicker extends React.Component<TimePickerProps, any> {
align: {
offset: [0, -2],
},
disabled: false,
disabledHours: undefined,
disabledMinutes: undefined,
disabledSeconds: undefined,

View File

@ -37,7 +37,7 @@ export default class ListItem extends React.Component<any, any> {
onClick={disabled || item.disabled ? undefined : () => onClick(item)}
>
<Checkbox checked={checked} disabled={disabled || item.disabled} />
<span>{renderedEl}</span>
<span className={`${prefixCls}-content-item-text`}>{renderedEl}</span>
</li>
);
let children: JSX.Element | null = null;

View File

@ -62,7 +62,9 @@ exports[`Transfer should render correctly 1`] = `
/>
</span>
</label>
<span />
<span
class="ant-transfer-list-content-item-text"
/>
</li>
<li
class="ant-transfer-list-content-item ant-transfer-list-content-item-disabled"
@ -83,7 +85,9 @@ exports[`Transfer should render correctly 1`] = `
/>
</span>
</label>
<span />
<span
class="ant-transfer-list-content-item-text"
/>
</li>
</ul>
</div>
@ -197,7 +201,9 @@ exports[`Transfer should render correctly 1`] = `
/>
</span>
</label>
<span />
<span
class="ant-transfer-list-content-item-text"
/>
</li>
</ul>
</div>
@ -266,7 +272,9 @@ exports[`Transfer should show sorted targetkey 1`] = `
/>
</span>
</label>
<span>
<span
class="ant-transfer-list-content-item-text"
>
a
</span>
</li>
@ -384,7 +392,9 @@ exports[`Transfer should show sorted targetkey 1`] = `
/>
</span>
</label>
<span>
<span
class="ant-transfer-list-content-item-text"
>
c
</span>
</li>
@ -407,7 +417,9 @@ exports[`Transfer should show sorted targetkey 1`] = `
/>
</span>
</label>
<span>
<span
class="ant-transfer-list-content-item-text"
>
b
</span>
</li>

View File

@ -60,7 +60,9 @@ exports[`Transfer.List should render correctly 1`] = `
/>
</span>
</label>
<span />
<span
class="ant-transfer-list-content-item-text"
/>
</li>
<li
class="ant-transfer-list-content-item"
@ -81,7 +83,9 @@ exports[`Transfer.List should render correctly 1`] = `
/>
</span>
</label>
<span />
<span
class="ant-transfer-list-content-item-text"
/>
</li>
<li
class="ant-transfer-list-content-item ant-transfer-list-content-item-disabled"
@ -103,7 +107,9 @@ exports[`Transfer.List should render correctly 1`] = `
/>
</span>
</label>
<span />
<span
class="ant-transfer-list-content-item-text"
/>
</li>
</ul>
</div>

View File

@ -7,7 +7,6 @@ exports[`Transfer.Search should show cross icon when input value exists 1`] = `
>
<div>
<Input
disabled={false}
onChange={[Function]}
placeholder=""
type="text"
@ -15,7 +14,6 @@ exports[`Transfer.Search should show cross icon when input value exists 1`] = `
>
<input
className="ant-input"
disabled={false}
onChange={[Function]}
onKeyDown={[Function]}
placeholder=""
@ -72,7 +70,6 @@ exports[`Transfer.Search should show cross icon when input value exists 2`] = `
>
<div>
<Input
disabled={false}
onChange={[Function]}
placeholder=""
type="text"
@ -80,7 +77,6 @@ exports[`Transfer.Search should show cross icon when input value exists 2`] = `
>
<input
className="ant-input"
disabled={false}
onChange={[Function]}
onKeyDown={[Function]}
placeholder=""

View File

@ -1,4 +1,5 @@
import * as React from 'react';
import { findDOMNode } from 'react-dom';
import Animate from 'rc-animate';
import raf from '../_util/raf';
import { Omit, tuple } from '../_util/type';
@ -29,6 +30,7 @@ class ListBody extends React.Component<TransferListBodyProps> {
};
private mountId: number;
private lazyId: number;
componentDidMount() {
this.mountId = raf(() => {
@ -36,8 +38,27 @@ class ListBody extends React.Component<TransferListBodyProps> {
});
}
componentDidUpdate(prevProps: TransferListBodyProps) {
if (
prevProps.filteredRenderItems.length !== this.props.filteredRenderItems.length &&
this.props.lazy !== false
) {
// TODO: Replace this with ref when react 15 support removed.
const container = findDOMNode(this);
raf.cancel(this.lazyId);
this.lazyId = raf(() => {
if (container) {
const scrollEvent = new Event('scroll', { bubbles: true });
container.dispatchEvent(scrollEvent);
}
});
}
}
componentWillUnmount() {
raf.cancel(this.mountId);
raf.cancel(this.lazyId);
}
onItemSelect = (item: TransferItem) => {

View File

@ -76,6 +76,10 @@
position: absolute;
right: 12px;
}
.@{ant-prefix}-checkbox-wrapper + span {
padding-left: 8px;
}
}
&-body {
@ -116,6 +120,9 @@
> span {
padding-right: 0;
}
&-text {
padding-left: 8px;
}
}
&-item:not(&-item-disabled):hover {

View File

@ -332,12 +332,13 @@ class Upload extends React.Component<UploadProps, UploadState> {
if (listType === 'picture-card') {
return (
<span className={className}>
<span className={classNames(className, `${prefixCls}-picture-card-wrapper`)}>
{uploadList}
{uploadButton}
</span>
);
}
return (
<span className={className}>
{uploadButton}

View File

@ -89,7 +89,11 @@ export default class UploadList extends React.Component<UploadListProps, any> {
);
} else {
const thumbnail = isImageUrl(file) ? (
<img src={file.thumbUrl || file.url} alt={file.name} />
<img
src={file.thumbUrl || file.url}
alt={file.name}
className={`${prefixCls}-list-item-image`}
/>
) : (
<Icon type="file" className={`${prefixCls}-list-item-icon`} theme="twoTone" />
);

View File

@ -2,7 +2,7 @@
exports[`renders ./components/upload/demo/avatar.md correctly 1`] = `
<span
class="avatar-uploader"
class="avatar-uploader ant-upload-picture-card-wrapper"
>
<div
class="ant-upload ant-upload-select ant-upload-select-picture-card"
@ -318,7 +318,7 @@ exports[`renders ./components/upload/demo/picture-card.md correctly 1`] = `
class="clearfix"
>
<span
class=""
class="ant-upload-picture-card-wrapper"
>
<div
class="ant-upload-list ant-upload-list-picture-card"
@ -337,7 +337,8 @@ exports[`renders ./components/upload/demo/picture-card.md correctly 1`] = `
target="_blank"
>
<img
alt="xxx.png"
alt="image.png"
class="ant-upload-list-item-image"
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
/>
</a>
@ -346,9 +347,337 @@ exports[`renders ./components/upload/demo/picture-card.md correctly 1`] = `
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
rel="noopener noreferrer"
target="_blank"
title="xxx.png"
title="image.png"
>
xxx.png
image.png
</a>
</span>
</div>
<span
class="ant-upload-list-item-actions"
>
<a
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
rel="noopener noreferrer"
target="_blank"
title="Preview file"
>
<i
aria-label="icon: eye-o"
class="anticon anticon-eye-o"
>
<svg
aria-hidden="true"
class=""
data-icon="eye"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 0 0 0 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"
/>
</svg>
</i>
</a>
<i
aria-label="icon: delete"
class="anticon anticon-delete"
tabindex="-1"
title="Remove file"
>
<svg
aria-hidden="true"
class=""
data-icon="delete"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"
/>
</svg>
</i>
</span>
</div>
<div
class="ant-upload-list-item ant-upload-list-item-done"
>
<div
class="ant-upload-list-item-info"
>
<span>
<a
class="ant-upload-list-item-thumbnail"
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
rel="noopener noreferrer"
target="_blank"
>
<img
alt="image.png"
class="ant-upload-list-item-image"
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
/>
</a>
<a
class="ant-upload-list-item-name"
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
rel="noopener noreferrer"
target="_blank"
title="image.png"
>
image.png
</a>
</span>
</div>
<span
class="ant-upload-list-item-actions"
>
<a
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
rel="noopener noreferrer"
target="_blank"
title="Preview file"
>
<i
aria-label="icon: eye-o"
class="anticon anticon-eye-o"
>
<svg
aria-hidden="true"
class=""
data-icon="eye"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 0 0 0 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"
/>
</svg>
</i>
</a>
<i
aria-label="icon: delete"
class="anticon anticon-delete"
tabindex="-1"
title="Remove file"
>
<svg
aria-hidden="true"
class=""
data-icon="delete"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"
/>
</svg>
</i>
</span>
</div>
<div
class="ant-upload-list-item ant-upload-list-item-done"
>
<div
class="ant-upload-list-item-info"
>
<span>
<a
class="ant-upload-list-item-thumbnail"
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
rel="noopener noreferrer"
target="_blank"
>
<img
alt="image.png"
class="ant-upload-list-item-image"
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
/>
</a>
<a
class="ant-upload-list-item-name"
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
rel="noopener noreferrer"
target="_blank"
title="image.png"
>
image.png
</a>
</span>
</div>
<span
class="ant-upload-list-item-actions"
>
<a
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
rel="noopener noreferrer"
target="_blank"
title="Preview file"
>
<i
aria-label="icon: eye-o"
class="anticon anticon-eye-o"
>
<svg
aria-hidden="true"
class=""
data-icon="eye"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 0 0 0 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"
/>
</svg>
</i>
</a>
<i
aria-label="icon: delete"
class="anticon anticon-delete"
tabindex="-1"
title="Remove file"
>
<svg
aria-hidden="true"
class=""
data-icon="delete"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"
/>
</svg>
</i>
</span>
</div>
<div
class="ant-upload-list-item ant-upload-list-item-done"
>
<div
class="ant-upload-list-item-info"
>
<span>
<a
class="ant-upload-list-item-thumbnail"
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
rel="noopener noreferrer"
target="_blank"
>
<img
alt="image.png"
class="ant-upload-list-item-image"
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
/>
</a>
<a
class="ant-upload-list-item-name"
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
rel="noopener noreferrer"
target="_blank"
title="image.png"
>
image.png
</a>
</span>
</div>
<span
class="ant-upload-list-item-actions"
>
<a
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
rel="noopener noreferrer"
target="_blank"
title="Preview file"
>
<i
aria-label="icon: eye-o"
class="anticon anticon-eye-o"
>
<svg
aria-hidden="true"
class=""
data-icon="eye"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 0 0 0 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"
/>
</svg>
</i>
</a>
<i
aria-label="icon: delete"
class="anticon anticon-delete"
tabindex="-1"
title="Remove file"
>
<svg
aria-hidden="true"
class=""
data-icon="delete"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"
/>
</svg>
</i>
</span>
</div>
<div
class="ant-upload-list-item ant-upload-list-item-done"
>
<div
class="ant-upload-list-item-info"
>
<span>
<a
class="ant-upload-list-item-thumbnail"
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
rel="noopener noreferrer"
target="_blank"
>
<img
alt="image.png"
class="ant-upload-list-item-image"
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
/>
</a>
<a
class="ant-upload-list-item-name"
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
rel="noopener noreferrer"
target="_blank"
title="image.png"
>
image.png
</a>
</span>
</div>
@ -438,6 +767,7 @@ exports[`renders ./components/upload/demo/picture-style.md correctly 1`] = `
>
<img
alt="xxx.png"
class="ant-upload-list-item-image"
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
/>
</a>
@ -489,6 +819,7 @@ exports[`renders ./components/upload/demo/picture-style.md correctly 1`] = `
>
<img
alt="yyy.png"
class="ant-upload-list-item-image"
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
/>
</a>
@ -553,6 +884,7 @@ exports[`renders ./components/upload/demo/picture-style.md correctly 1`] = `
>
<img
alt="xxx.png"
class="ant-upload-list-item-image"
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
/>
</a>
@ -604,6 +936,7 @@ exports[`renders ./components/upload/demo/picture-style.md correctly 1`] = `
>
<img
alt="yyy.png"
class="ant-upload-list-item-image"
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
/>
</a>

View File

@ -440,6 +440,7 @@ exports[`Upload List should non-image format file preview 1`] = `
>
<img
alt="image"
class="ant-upload-list-item-image"
src="https://cdn.xxx.com/aaa"
/>
</a>
@ -633,6 +634,7 @@ exports[`Upload List should non-image format file preview 1`] = `
>
<img
alt="image"
class="ant-upload-list-item-image"
src="https://cdn.xxx.com/xx.xx/aaa.png"
/>
</a>
@ -684,6 +686,7 @@ exports[`Upload List should non-image format file preview 1`] = `
>
<img
alt="image"
class="ant-upload-list-item-image"
src="data:image/png;base64,UEsDBAoAAAAAADYZYkwAAAAAAAAAAAAAAAAdAAk"
/>
</a>
@ -735,6 +738,7 @@ exports[`Upload List should non-image format file preview 1`] = `
>
<img
alt="image"
class="ant-upload-list-item-image"
src="https://cdn.xxx.com/xx.xx/aaa.png?query=123"
/>
</a>
@ -786,6 +790,7 @@ exports[`Upload List should non-image format file preview 1`] = `
>
<img
alt="image"
class="ant-upload-list-item-image"
src="https://cdn.xxx.com/xx.xx/aaa.png#anchor"
/>
</a>
@ -837,6 +842,7 @@ exports[`Upload List should non-image format file preview 1`] = `
>
<img
alt="image"
class="ant-upload-list-item-image"
src="https://cdn.xxx.com/xx.xx/aaa.png?query=some.query.with.dot"
/>
</a>
@ -888,6 +894,7 @@ exports[`Upload List should non-image format file preview 1`] = `
>
<img
alt="image"
class="ant-upload-list-item-image"
src="https://publish-pic-cpu.baidu.com/1296beb3-50d9-4276-885f-52645cbb378e.jpeg@w_228%2ch_152"
/>
</a>

View File

@ -27,15 +27,15 @@ function getBase64(img, callback) {
}
function beforeUpload(file) {
const isJPG = file.type === 'image/jpeg';
if (!isJPG) {
message.error('You can only upload JPG file!');
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
if (!isJpgOrPng) {
message.error('You can only upload JPG/PNG file!');
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error('Image must smaller than 2MB!');
}
return isJPG && isLt2M;
return isJpgOrPng && isLt2M;
}
class Avatar extends React.Component {
@ -77,7 +77,7 @@ class Avatar extends React.Component {
beforeUpload={beforeUpload}
onChange={this.handleChange}
>
{imageUrl ? <img src={imageUrl} alt="avatar" /> : uploadButton}
{imageUrl ? <img src={imageUrl} alt="avatar" style={{ width: '100%' }} /> : uploadButton}
</Upload>
);
}

View File

@ -32,7 +32,31 @@ class PicturesWall extends React.Component {
fileList: [
{
uid: '-1',
name: 'xxx.png',
name: 'image.png',
status: 'done',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
},
{
uid: '-2',
name: 'image.png',
status: 'done',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
},
{
uid: '-3',
name: 'image.png',
status: 'done',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
},
{
uid: '-4',
name: 'image.png',
status: 'done',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
},
{
uid: '-5',
name: 'image.png',
status: 'done',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
},
@ -71,7 +95,7 @@ class PicturesWall extends React.Component {
onPreview={this.handlePreview}
onChange={this.handleChange}
>
{fileList.length >= 3 ? null : uploadButton}
{fileList.length >= 8 ? null : uploadButton}
</Upload>
<Modal visible={previewVisible} footer={null} onCancel={this.handleCancel}>
<img alt="example" style={{ width: '100%' }} src={previewImage} />

View File

@ -35,6 +35,7 @@
&&-select-picture-card {
display: table;
float: left;
width: @upload-picture-card-size;
height: @upload-picture-card-size;
margin-right: 8px;
@ -127,6 +128,10 @@
color: @text-color-secondary;
}
}
&-picture-card-wrapper {
.clearfix;
}
}
.@{upload-prefix-cls}-list {
@ -257,6 +262,10 @@
transform: translate(-50%, -50%);
}
.@{upload-item}-image {
max-width: 100%;
}
.@{upload-item}-thumbnail img {
display: block;
width: 48px;
@ -299,9 +308,6 @@
}
&-picture-card {
// https://github.com/ant-design/ant-design/issues/11183
float: left;
&.@{upload-prefix-cls}-list::after {
display: none;
}

View File

@ -129,6 +129,13 @@ You must import styles as less format. A common mistake would be importing multi
- If you import styles by specifying the `style` option of [babel-plugin-import](https://github.com/ant-design/babel-plugin-import), change it from `'css'` to `true`, which will import the `less` version of antd.
- If you import styles from `'antd/dist/antd.css'`, change it to `antd/dist/antd.less`.
## Offcial Themes 🌈
We have some offcial themes, try on and give us feedback!
- [Dark Theme (Beta)](https://github.com/ant-design/ant-design-dark-theme)
- [Aliyun Console Theme (Beta)](https://github.com/ant-design/ant-design-aliyun-theme)
## Related Articles
- [Using Ant Design in Sass-Styled Webpack Projects with `antd-scss-theme-plugin`](https://intoli.com/blog/antd-scss-theme-plugin/)

View File

@ -107,6 +107,13 @@ module.exports = {
- 如果你在使用 [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) 的 `style` 配置来引入样式,需要将配置值从 `'css'` 改为 `true`,这样会引入 less 文件。
- 如果你是通过 `'antd/dist/antd.css'` 引入样式的,改为 `antd/dist/antd.less`
## 官方主题 🌈
我们提供了一些官方主题,欢迎在项目中试用,并且给我们提供反馈。
- [黑色主题Beta](https://github.com/ant-design/ant-design-dark-theme)
- [阿里云控制台主题Beta](https://github.com/ant-design/ant-design-aliyun-theme)
## 社区教程
- [Using Ant Design in Sass-Styled Webpack Projects with `antd-scss-theme-plugin`](https://intoli.com/blog/antd-scss-theme-plugin/)

View File

@ -36,7 +36,7 @@ title: Ant Design of React
- 现代浏览器和 IE9 及以上(需要 [polyfills](https://ant.design/docs/react/getting-started-cn#兼容性))。
- 支持服务端渲染。
- [Electron](http://electron.atom.io/)
- [Electron](https://electronjs.org/)
## 版本

View File

@ -98,4 +98,16 @@ Please find below some of the design resources and tools about Ant Design that w
<span class="resource-card-description">Large library of components and styles for Desktop</span>
</div>
</a>
<a target="_blank" href="https://store.framer.com/package/bhaveshchow/ant-design-system" class="resource-card">
<div class="resource-card-icon">
<img width="65" src="https://raw.githubusercontent.com/bhaveshc20/antdesign-framer/master/framerant-icon.png">
</div>
<div class="resource-card-content">
<span class="resource-card-title">
UI Kit for Framer X
<span class="resource-card-hot-badge">NEW</span>
</span>
<span class="resource-card-description">Library of fully customizable components</span>
</div>
</a>
</div>

View File

@ -1,6 +1,6 @@
{
"name": "antd",
"version": "3.20.3",
"version": "3.20.5",
"title": "Ant Design",
"description": "An enterprise-class UI design language and React components implementation",
"homepage": "http://ant.design/",
@ -53,7 +53,7 @@
"css-animation": "^1.5.0",
"dom-closest": "^0.2.0",
"enquire.js": "^2.1.6",
"lodash": "^4.17.11",
"lodash": "^4.17.13",
"moment": "^2.24.0",
"omit.js": "^1.0.2",
"prop-types": "^15.7.2",

View File

@ -18,7 +18,7 @@
}
.markdown p > img.markdown-inline-image {
margin: 0 34px;
margin: 0;
box-shadow: none;
}