Compare commits

...

13 Commits
3.4.2 ... 3.4.4

Author SHA1 Message Date
afc163
b6a617f2e9 Fix ts error temporarily, DefinitelyTyped/DefinitelyTyped#25342 2018-04-28 15:02:25 +08:00
afc163
1a790a5a9f 3.4.4 2018-04-28 14:32:20 +08:00
afc163
2a411130bc Fix upload onChange arg type when beforeUpload return false, close #10293 2018-04-28 14:17:29 +08:00
Wu Haotian
bf22853f41 add lib/**/style/* as sideEffects (#10217) 2018-04-28 14:17:01 +08:00
愚指导
4101d182e0 Bump 3.4.3 (#10198) 2018-04-23 17:23:35 +08:00
薛定谔的猫
14dbcb95ed fix: sideEffects: false cause css file not bundled (fixes #10190) (#10197) 2018-04-23 17:08:24 +08:00
dependabot[bot]
14fa376dff Update majo requirement to ^0.6.2 (#10195)
Updates the requirements on [majo](https://github.com/egoist/majo) to permit the latest version.
- [Release notes](https://github.com/egoist/majo/releases)
- [Commits](https://github.com/egoist/majo/commits/v0.6.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-04-23 16:00:37 +08:00
Zheeeng
6a3e6f55cf Fix typo (#10193) 2018-04-23 16:00:24 +08:00
Wei Zhu
fa5491a390 Add @babel/types@7.0.0-beta.44 as devDependencies 2018-04-23 15:03:17 +08:00
Zheeeng
4ad5985df7 Prefer using 'truthy' over 'falsyless' (#10191) 2018-04-23 11:23:25 +08:00
Jiabin Peng
bb720aaab9 Fix menu item's clickable region in dark theme (#10187)
* remove redundant style for submenu

* Fix menu item's clickable region in dark theme
2018-04-23 00:31:36 +08:00
afc163
8ab4aeb9c4 site: fix ad flush 2018-04-22 22:37:58 +08:00
Benjy Cui
e444dc5e39 chore: add ad for yuque (#10182) 2018-04-22 18:58:40 +08:00
13 changed files with 126 additions and 31 deletions

View File

@@ -15,6 +15,20 @@ timeline: true
---
## 3.4.4
`2018-04-28`
- 🐞 Fix that Upload file in`onChange({ file })` is not a File instance introduced in `3.4.2`. [#10293](https://github.com/ant-design/ant-design/issues/10293)
- 🐞 Fix style lose bug when use tree shaking in webpack@4. [#10217](https://github.com/ant-design/ant-design/pull/10217) [@whtsky](https://github.com/whtsky)
## 3.4.3
`2018-04-23`
- 🐞 Fix style lose bug when use tree shaking in webpack@4. [#10197](https://github.com/ant-design/ant-design/pull/10197) [@Aladdin-ADD](https://github.com/Aladdin-ADD)
- 🐞 Fix `Menu` item's clickable region in dark theme. [#10187](https://github.com/ant-design/ant-design/pull/10187) [@dgeibi ](https://github.com/dgeibi )
## 3.4.2
`2018-04-22`

View File

@@ -15,6 +15,20 @@ timeline: true
---
## 3.4.4
`2018-04-28`
- 🐞 修复 3.4.2 中引入的 Upload 中 onChange 参数 `{ file }` file 不是 File 实例的问题。[#10293](https://github.com/ant-design/ant-design/issues/10293)
- 🐞 修复 webpack@4 下使用 Tree Shaking 样式丢失的问题。[#10217](https://github.com/ant-design/ant-design/pull/10217) [@whtsky](https://github.com/whtsky)
## 3.4.3
`2018-04-23`
- 🐞 修复了 webpack@4 下使用 Tree Shaking 样式丢失的问题。[#10197](https://github.com/ant-design/ant-design/pull/10197) [@Aladdin-ADD](https://github.com/Aladdin-ADD)
- 🐞 修复 `Menu` 组件在 `dark` 主题下点击区域的问题。[#10187](https://github.com/ant-design/ant-design/pull/10187) [@dgeibi](https://github.com/dgeibi)
## 3.4.2
`2018-04-22`

View File

@@ -33,6 +33,10 @@
border-bottom: 0;
}
&-dark&-horizontal > &-item > a:before {
bottom: 0;
}
&-dark &-item,
&-dark &-item-group-title,
&-dark &-item > a {

View File

@@ -277,16 +277,16 @@
border-bottom: 2px solid @menu-highlight-color;
color: @menu-highlight-color;
}
}
> a {
display: block;
color: @menu-item-color;
&:hover {
color: @menu-highlight-color;
}
&:before {
bottom: -2px;
}
> .@{menu-prefix-cls}-item > a {
display: block;
color: @menu-item-color;
&:hover {
color: @menu-highlight-color;
}
&:before {
bottom: -2px;
}
}

View File

@@ -25,10 +25,10 @@ export default class Timeline extends React.Component<TimelineProps, any> {
[`${prefixCls}-pending`]: !!pending,
}, className);
// Remove falsy items
const falsylessItems = React.Children.toArray(children).filter(item => !!item);
const items = React.Children.map(falsylessItems, (ele: React.ReactElement<any>, idx) =>
const truthyItems = React.Children.toArray(children).filter(item => !!item);
const items = React.Children.map(truthyItems, (ele: React.ReactElement<any>, idx) =>
React.cloneElement(ele, {
last: idx === (React.Children.count(falsylessItems) - 1),
last: idx === (React.Children.count(truthyItems) - 1),
}),
);
const pendingItem = (!!pending) ? (

View File

@@ -46,14 +46,14 @@ export interface TooltipProps extends AbstractTooltipProps {
const splitObject = (obj: any, keys: string[]) => {
const picked: any = {};
const omited: any = { ...obj };
const omitted: any = { ...obj };
keys.forEach(key => {
if (obj && key in obj) {
picked[key] = obj[key];
delete omited[key];
delete omitted[key];
}
});
return { picked, omited };
return { picked, omitted };
};
export default class Tooltip extends React.Component<TooltipProps, any> {
@@ -125,7 +125,7 @@ export default class Tooltip extends React.Component<TooltipProps, any> {
element.props.disabled && this.isHoverTrigger()) {
// Pick some layout related style properties up to span
// Prevent layout bugs like https://github.com/ant-design/ant-design/issues/5254
const { picked, omited } = splitObject(
const { picked, omitted } = splitObject(
element.props.style,
['position', 'left', 'right', 'top', 'bottom', 'float', 'display', 'zIndex'],
);
@@ -135,7 +135,7 @@ export default class Tooltip extends React.Component<TooltipProps, any> {
cursor: 'not-allowed',
};
const buttonStyle = {
...omited,
...omitted,
pointerEvents: 'none',
};
const child = cloneElement(element, {

View File

@@ -195,7 +195,7 @@ export default class Upload extends React.Component<UploadProps, UploadState> {
const result = this.props.beforeUpload(file, fileList);
if (result === false) {
this.onChange({
file: fileToObject(file),
file,
fileList: uniqBy(fileList.map(fileToObject).concat(this.state.fileList), (item: UploadFile) => item.uid),
});
return false;

View File

@@ -54,13 +54,17 @@ describe('Upload', () => {
});
});
it('should not stop upload when return value of beforeUpload is not false', (done) => {
it('should not stop upload when return value of beforeUpload is false', (done) => {
const mockFile = new File(['foo'], 'foo.png', {
type: 'image/png',
});
const data = jest.fn();
const props = {
action: 'http://upload.com',
beforeUpload: () => false,
data,
onChange: () => {
onChange: ({ file }) => {
expect(file instanceof File).toBe(true);
expect(data).not.toBeCalled();
done();
},
@@ -75,7 +79,7 @@ describe('Upload', () => {
wrapper.find('input').simulate('change', {
target: {
files: [
{ file: 'foo.png' },
mockFile,
],
},
});

View File

@@ -16,7 +16,7 @@ export interface UploadFile {
name: string;
filename?: string;
lastModified?: number;
lastModifiedDate?: Date;
lastModrcFlieifiedDate?: Date;
url?: string;
status?: UploadFileStatus;
percent?: number;

View File

@@ -8,13 +8,8 @@ export function T() {
// via coping a new Object
export function fileToObject(file: RcFile): UploadFile {
return {
lastModified: file.lastModified,
lastModifiedDate: file.lastModifiedDate,
name: file.name,
size: file.size,
type: file.type,
...file,
percent: 0,
uid: file.uid,
originFileObj: file,
} as UploadFile;
}

View File

@@ -1,6 +1,6 @@
{
"name": "antd",
"version": "3.4.2",
"version": "3.4.4",
"title": "Ant Design",
"description": "An enterprise-class UI design language and React-based implementation",
"homepage": "http://ant.design/",
@@ -83,6 +83,8 @@
"warning": "~3.0.0"
},
"devDependencies": {
"@babel/types": "7.0.0-beta.44",
"@types/node": "^9.6.7",
"@types/react": "^16.0.0",
"@types/react-dom": "^16.0.0",
"ansi-styles": "^3.2.0",
@@ -128,7 +130,7 @@
"jsonml.js": "^0.1.0",
"lint-staged": "^7.0.0",
"lz-string": "^1.4.4",
"majo": "^0.5.1",
"majo": "^0.6.2",
"mockdate": "^2.0.1",
"moment-timezone": "^0.5.5",
"pre-commit": "^1.2.2",
@@ -211,5 +213,8 @@
"pre-commit": [
"lint-staged"
],
"sideEffects": false
"sideEffects": [
"es/**/style/*",
"lib/**/style/*"
]
}

View File

@@ -142,3 +142,27 @@
right: 16px;
}
}
.promote-banner {
position: relative;
display: block;
text-align: center;
background-color: #a5d6d3;
img {
max-width: 100%;
}
.anticon-cross {
position: absolute;
font-size: 24px;
cursor: pointer;
right: 24px;
top: 28px;
color: #fff;
transition: all .3s;
opacity: 0;
}
&:hover .anticon-cross {
opacity: 1;
}
}

View File

@@ -1,6 +1,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import { Icon } from 'antd';
import { enquireScreen } from 'enquire-js';
import { addLocaleData, IntlProvider } from 'react-intl';
import Header from './Header';
@@ -25,6 +26,8 @@ enquireScreen((b) => {
isMobile = b;
});
const promoteBannerImageUrl = 'https://gw.alipayobjects.com/zos/rmsportal/bpKcpwimYnZMTarUxCEd.png';
export default class Layout extends React.Component {
static contextTypes = {
router: PropTypes.object.isRequired,
@@ -44,9 +47,15 @@ export default class Layout extends React.Component {
const { pathname } = props.location;
const appLocale = utils.isZhCN(pathname) ? cnLocale : enLocale;
addLocaleData(appLocale.data);
const adBannerClosed = typeof window === 'undefined' ? true : (
window.localStorage &&
window.localStorage.getItem(`adBannerClosed-${promoteBannerImageUrl}`) === 'true'
);
this.state = {
appLocale,
isMobile,
adBannerClosed,
};
}
@@ -75,12 +84,38 @@ export default class Layout extends React.Component {
clearTimeout(this.timer);
}
closePromoteBanner = (e) => {
e.preventDefault();
this.makeAdBannerClosed();
}
makeAdBannerClosed = () => {
this.setState({
adBannerClosed: true,
});
if (window.localStorage) {
window.localStorage.setItem(`adBannerClosed-${promoteBannerImageUrl}`, 'true');
}
}
render() {
const { children, ...restProps } = this.props;
const { appLocale } = this.state;
const promoteBanner = this.state.adBannerClosed ? null : (
<a href="http://www.anijue.com/p/q/yuque423/pages/home/index.html?chInfo=ch_yuquebooks__chsub_antd" className="promote-banner" onClick={this.makeAdBannerClosed}>
<img
src={promoteBannerImageUrl}
alt="seeconf"
/>
<Icon type="cross" title="close ad" onClick={this.closePromoteBanner} />
</a>
);
return (
<IntlProvider locale={appLocale.locale} messages={appLocale.messages}>
<div className="page-wrapper">
{promoteBanner}
<Header {...restProps} />
{children}
<Footer {...restProps} />