Skip to content

Commit

Permalink
Merge branch 'master' into fixDrawer
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Aug 16, 2018
2 parents 3112816 + e107b03 commit 5a66a0a
Show file tree
Hide file tree
Showing 39 changed files with 635 additions and 153 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
components/**/*.js
components/**/*.jsx
components/*/__tests__/type.tsx
!.eslintrc.js
!components/*/__tests__/**/*.js
!components/*/demo/*
!.*.js
5 changes: 2 additions & 3 deletions .jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ const libDir = process.env.LIB_DIR;

const transformIgnorePatterns = [
'/dist/',
'node_modules\/[^/]+?\/(?!(es|node_modules)\/)', // Ignore modules without es dir
'node_modules/[^/]+?/(?!(es|node_modules)/)', // Ignore modules without es dir
];

module.exports = {
verbose: true,
testURL: "http://localhost/",
setupFiles: [
'./tests/setup.js',
],
Expand Down Expand Up @@ -48,7 +47,7 @@ module.exports = {
globals: {
'ts-jest': {
tsConfigFile: './tsconfig.test.json',
}
},
},
testURL: 'http://localhost',
};
4 changes: 2 additions & 2 deletions .jest.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ module.exports = {
testRegex: 'demo\\.test\\.js$',
testEnvironment: 'node',
snapshotSerializers: [
'enzyme-to-json/serializer'
'enzyme-to-json/serializer',
],
globals: {
'ts-jest': {
tsConfigFile: './tsconfig.test.json',
}
},
},
};
20 changes: 20 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,26 @@ timeline: true

---

## 3.8.1

`2018-08-12`

- 🐞 Fixed TimePicker unexpected long width. [80f8267](https://github.com/ant-design/ant-design/commit/80f82674fb63b068d047651ccba772999139f1b7)
- 🐞 Fixed Tabs that focusable element in inactive panel cause tabs disappear. [#11261](https://github.com/ant-design/ant-design/issues/11261)
- 🐞 Fixed Badge `offset` x y axis order error. [#11648](https://github.com/ant-design/ant-design/pull/11648) [@tangjinzhou](https://github.com/tangjinzhou)
- Upload
- 🐞 Fixed detete button missing in Upload. [#10454](https://github.com/ant-design/ant-design/issues/10454)
- 🐞 Fixed Upload thumbnail which url has no extension. [#11684](https://github.com/ant-design/ant-design/pull/11684) [@elantion](https://github.com/elantion)
- 🐞 Fixed Anchor with `affix=true` doesn't work inside inner scrollable. [#11688](https://github.com/ant-design/ant-design/pull/11688) [@vitaliymaz](https://github.com/vitaliymaz)
- 🐞 Fixed card width in List.Grid. [!11712](https://github.com/ant-design/ant-design/issues/11712)
- 🐞 Fixed Radio align problem in safari. [754a22c](https://github.com/ant-design/ant-design/commit/754a22ca24dee685666554778f53a5fe700959ff)
- 💄 Apply wave click animation to components Switch, Radio.Button and Tag. [9cf6ae6](https://github.com/ant-design/ant-design/commit/9cf6ae601010acbf665d575d34c0cc0918e604e7)
- TypeScript
- 🐞 Fixed missing prop signature `destroyInactivePanel` of Collapse. [#11646](https://github.com/ant-design/ant-design/pull/11646) [@zheeeng](https://github.com/zheeeng)
- 🐞 Fixed missing prop `getPopupContainer` signature of AutoComplete. [#11690](https://github.com/ant-design/ant-design/pull/11690) [@Huanghuiying0624](https://github.com/Huanghuiying0624)
- 🐞 Fixed Upload `lastModifiedDate` signature. [#11709](https://github.com/ant-design/ant-design/pull/11709) [@andycall](https://github.com/andycall)
- 💄 Migrate to new lifecycle methods, include components TimePicker, Upload, CheckboxGroup, Layout.Sider, Tooltip, Popconfirm. [#11666](https://github.com/ant-design/ant-design/pull/11666) [@dancerphil](https://github.com/dancerphil) [#11682](https://github.com/ant-design/ant-design/pull/11682) [@dancerphil](https://github.com/dancerphil)

## 3.8.0

`2018-08-05`
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,26 @@ timeline: true

---

## 3.8.1

`2018-08-12`

- 🐞 修复 TimePicker 面板输入框宽度过长的问题。[80f8267](https://github.com/ant-design/ant-design/commit/80f82674fb63b068d047651ccba772999139f1b7)
- 🐞 修复 Tabs 中隐藏的输入框可能被聚焦的问题。[#11261](https://github.com/ant-design/ant-design/issues/11261)
- 🐞 修复 Badge 组件属性 `offset` 的坐标设置顺序问题。[#11648](https://github.com/ant-design/ant-design/pull/11648) [@tangjinzhou](https://github.com/tangjinzhou)
- Upload
- 🐞 修复 Upload 组件删除按钮可能不展示的问题。[#10454](https://github.com/ant-design/ant-design/issues/10454)
- 🐞 修复 Upload 组件缩略图地址没有文件扩展名时的显示问题。[#11684](https://github.com/ant-design/ant-design/pull/11684) [@elantion](https://github.com/elantion)
- 🐞 修复 Anchor 组件当 `affix=true` 时无法在滚动的窗口中固定的问题。[#11688](https://github.com/ant-design/ant-design/pull/11688) [@vitaliymaz](https://github.com/vitaliymaz)
- 🐞 修复 List.Grid 组件中的卡片宽度问题。[!11712](https://github.com/ant-design/ant-design/issues/11712)
- 🐞 修复 Radio 在 safari 下对齐的问题。[754a22c](https://github.com/ant-design/ant-design/commit/754a22ca24dee685666554778f53a5fe700959ff)
- 💄 添加点击动画效果到组件 Switch, Radio.Button 和 Tag。[9cf6ae6](https://github.com/ant-design/ant-design/commit/9cf6ae601010acbf665d575d34c0cc0918e604e7)
- TypeScript
- 🐞 修复 Collapse 组件缺少的 `destroyInactivePanel` 定义。[#11646](https://github.com/ant-design/ant-design/pull/11646) [@zheeeng](https://github.com/zheeeng)
- 💄 修复 AutoComplete 没有 `getPopupContainer` 属性定义的问题。[#11690](https://github.com/ant-design/ant-design/pull/11690) [@Huanghuiying0624](https://github.com/Huanghuiying0624)
- 🐞 修复 Upload 组件的 `lastModifiedDate` 定义。[#11709](https://github.com/ant-design/ant-design/pull/11709) [@andycall](https://github.com/andycall)
- 💄 使用新的 React 生命周期函数,包括组件 Upload, CheckboxGroup, Layout.Sider, Tooltip, Popconfirm。[#11666](https://github.com/ant-design/ant-design/pull/11666) [@dancerphil](https://github.com/dancerphil) [#11682](https://github.com/ant-design/ant-design/pull/11682) [@dancerphil](https://github.com/dancerphil)

## 3.8.0

`2018-08-05`
Expand Down
103 changes: 103 additions & 0 deletions components/_util/wave.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import * as React from 'react';
import { findDOMNode } from 'react-dom';
import TransitionEvents from 'css-animation/lib/Event';

export default class Wave extends React.Component<{insertExtraNode?: boolean}> {
private instance?: {
cancel: () => void;
};

private styleForPesudo: HTMLStyleElement | null;

isNotGrey(color: string) {
const match = (color || '').match(/rgba?\((\d*), (\d*), (\d*)(, [\.\d]*)?\)/);
if (match && match[1] && match[2] && match[3]) {
return !(match[1] === match[2] && match[2] === match[3]);
}
return true;
}

onClick = (node: HTMLElement) => {
if (node.className.indexOf('-leave') >= 0) {
return;
}
this.removeExtraStyleNode();
const { insertExtraNode } = this.props;
const extraNode = document.createElement('div');
extraNode.className = 'ant-click-animating-node';
const attributeName = insertExtraNode ? 'ant-click-animating' : 'ant-click-animating-without-extra-node';
node.removeAttribute(attributeName);
node.setAttribute(attributeName, 'true');
// Get wave color from target
const waveColor =
getComputedStyle(node).getPropertyValue('border-top-color') || // Firefox Compatible
getComputedStyle(node).getPropertyValue('border-color') ||
getComputedStyle(node).getPropertyValue('background-color');
// Not white or transparnt or grey
if (waveColor &&
waveColor !== '#ffffff' &&
waveColor !== 'rgb(255, 255, 255)' &&
this.isNotGrey(waveColor) &&
!/rgba\(\d*, \d*, \d*, 0\)/.test(waveColor) && // any transparent rgba color
waveColor !== 'transparent') {
extraNode.style.borderColor = waveColor;
this.styleForPesudo = document.createElement('style');
this.styleForPesudo.innerHTML =
`[ant-click-animating-without-extra-node]:after { border-color: ${waveColor}; }`;
document.body.appendChild(this.styleForPesudo);
}
if (insertExtraNode) {
node.appendChild(extraNode);
}
const transitionEnd = () => {
node.removeAttribute(attributeName);
this.removeExtraStyleNode();
if (insertExtraNode) {
node.removeChild(extraNode);
}
TransitionEvents.removeEndEventListener(node, transitionEnd);
};
TransitionEvents.addEndEventListener(node, transitionEnd);
}

bindAnimationEvent = (node: HTMLElement) => {
if (node.getAttribute('disabled') ||
node.className.indexOf('disabled') >= 0) {
return;
}
const onClick = (e: MouseEvent) => {
// Fix radio button click twice
if ((e.target as HTMLElement).tagName === 'INPUT') {
return;
}
setTimeout(() => this.onClick(node), 0);
};
node.addEventListener('click', onClick, true);
return {
cancel: () => {
node.removeEventListener('click', onClick, true);
},
};
}

removeExtraStyleNode() {
if (this.styleForPesudo && document.body.contains(this.styleForPesudo)) {
document.body.removeChild(this.styleForPesudo);
this.styleForPesudo = null;
}
}

componentDidMount() {
this.instance = this.bindAnimationEvent(findDOMNode(this) as HTMLElement);
}

componentWillUnmount() {
if (this.instance) {
this.instance.cancel();
}
}

render() {
return this.props.children;
}
}
3 changes: 2 additions & 1 deletion components/anchor/Anchor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ export default class Anchor extends React.Component<AnchorProps, any> {
affix,
showInkInFixed,
children,
getContainer,
} = this.props;
const { activeLink } = this.state;

Expand Down Expand Up @@ -273,7 +274,7 @@ export default class Anchor extends React.Component<AnchorProps, any> {
);

return !affix ? anchorContent : (
<Affix offsetTop={offsetTop}>
<Affix offsetTop={offsetTop} target={getContainer}>
{anchorContent}
</Affix>
);
Expand Down
5 changes: 1 addition & 4 deletions components/anchor/__tests__/Anchor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,8 @@ describe('Anchor Render', () => {
wrapper.instance().handleScrollTo('##API');
expect(wrapper.instance().state.activeLink).toBe('##API');
expect(scrollToSpy).not.toHaveBeenCalled();
await new Promise(resolve => setTimeout(resolve, 50));
expect(scrollToSpy).toHaveBeenCalled();
expect(wrapper.instance().animating).toBe(true);
await new Promise(resolve => setTimeout(resolve, 1000));
expect(wrapper.instance().animating).toBe(false);
expect(scrollToSpy).toHaveBeenCalled();
});

it('should remove listener when unmount', async () => {
Expand Down
2 changes: 2 additions & 0 deletions components/back-top/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export default class BackTop extends React.Component<BackTopProps, any> {
this.setScrollTop(easeInOutCubic(time, scrollTop, 0, 450));
if (time < 450) {
raf(frameFunc);
} else {
this.setScrollTop(0);
}
};
raf(frameFunc);
Expand Down
29 changes: 12 additions & 17 deletions components/button/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { findDOMNode } from 'react-dom';
import * as PropTypes from 'prop-types';
import classNames from 'classnames';
import clickAnimation from './clickAnimation';
import Wave from '../_util/wave';
import Icon from '../icon';
import Group from './button-group';

Expand Down Expand Up @@ -87,10 +87,7 @@ export default class Button extends React.Component<ButtonProps, any> {
block: PropTypes.bool,
};

delayTimeout: number;
clickAnimation: {
cancel: () => void;
};
private delayTimeout: number;

constructor(props: ButtonProps) {
super(props);
Expand All @@ -102,7 +99,6 @@ export default class Button extends React.Component<ButtonProps, any> {

componentDidMount() {
this.fixTwoCNChar();
this.clickAnimation = clickAnimation(findDOMNode(this) as HTMLElement);
}

componentWillReceiveProps(nextProps: ButtonProps) {
Expand All @@ -128,9 +124,6 @@ export default class Button extends React.Component<ButtonProps, any> {
if (this.delayTimeout) {
clearTimeout(this.delayTimeout);
}
if (this.clickAnimation) {
this.clickAnimation.cancel();
}
}

fixTwoCNChar() {
Expand Down Expand Up @@ -213,14 +206,16 @@ export default class Button extends React.Component<ButtonProps, any> {
const { htmlType, ...otherProps } = rest;

return (
<button
{...otherProps}
type={htmlType || 'button'}
className={classes}
onClick={this.handleClick}
>
{iconNode}{kids}
</button>
<Wave>
<button
{...otherProps}
type={htmlType || 'button'}
className={classes}
onClick={this.handleClick}
>
{iconNode}{kids}
</button>
</Wave>
);
}
}
Expand Down
20 changes: 0 additions & 20 deletions components/button/clickAnimation.tsx

This file was deleted.

30 changes: 0 additions & 30 deletions components/button/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
@btn-ghost-color: @text-color;
@btn-ghost-bg: transparent;
@btn-ghost-border: @border-color-base;
@btn-animation-width: 6px;

// Button styles
// -----------------------------
Expand Down Expand Up @@ -132,10 +131,6 @@
margin-left: 8px;
}

&-danger[ant-click-animating]:after {
border-color: @btn-danger-color;
}

&-background-ghost {
background: transparent !important;
border-color: #fff;
Expand Down Expand Up @@ -164,17 +159,6 @@
}
}

@keyframes buttonEffect {
to {
opacity: 0;
top: -@btn-animation-width;
left: -@btn-animation-width;
bottom: -@btn-animation-width;
right: -@btn-animation-width;
border-width: @btn-animation-width;
}
}

a.@{btn-prefix-cls} {
line-height: @btn-height-base - 2px;
&-lg {
Expand All @@ -184,17 +168,3 @@ a.@{btn-prefix-cls} {
line-height: @btn-height-sm - 2px;
}
}

[ant-click-animating]:after {
content: '';
position: absolute;
top: -1px;
left: -1px;
bottom: -1px;
right: -1px;
border-radius: inherit;
border: 0 solid @primary-color;
opacity: 0.4;
animation: buttonEffect .4s cubic-bezier(.25, .8, .25, 1);
display: block;
}
Loading

0 comments on commit 5a66a0a

Please sign in to comment.