mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 19:09:21 +08:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6a617f2e9 | ||
|
|
1a790a5a9f | ||
|
|
2a411130bc | ||
|
|
bf22853f41 | ||
|
|
4101d182e0 | ||
|
|
14dbcb95ed | ||
|
|
14fa376dff | ||
|
|
6a3e6f55cf | ||
|
|
fa5491a390 | ||
|
|
4ad5985df7 | ||
|
|
bb720aaab9 | ||
|
|
8ab4aeb9c4 | ||
|
|
e444dc5e39 |
@@ -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`
|
||||
|
||||
@@ -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`
|
||||
|
||||
@@ -33,6 +33,10 @@
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
&-dark&-horizontal > &-item > a:before {
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
&-dark &-item,
|
||||
&-dark &-item-group-title,
|
||||
&-dark &-item > a {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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) ? (
|
||||
|
||||
@@ -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, {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
@@ -16,7 +16,7 @@ export interface UploadFile {
|
||||
name: string;
|
||||
filename?: string;
|
||||
lastModified?: number;
|
||||
lastModifiedDate?: Date;
|
||||
lastModrcFlieifiedDate?: Date;
|
||||
url?: string;
|
||||
status?: UploadFileStatus;
|
||||
percent?: number;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
11
package.json
11
package.json
@@ -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/*"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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} />
|
||||
|
||||
Reference in New Issue
Block a user