Compare commits

...

12 Commits

Author SHA1 Message Date
Wei Zhu
358aa84fef Bump 2.13.12 2018-02-26 20:01:00 +08:00
Wei Zhu
6f716d1003 Add 2.13.12 change log 2018-02-26 20:00:36 +08:00
Wei Zhu
739c6ead54 Lock @types/react and @types/react-dom version 2018-02-26 19:46:55 +08:00
Wei Zhu
a7255ee885 Fix #8885 2018-02-26 19:21:24 +08:00
junjing.zhang
06ff0d44db fix lint fail - use babel-eslint-8.0.2 2018-01-03 19:06:37 +08:00
junjing.zhang
e96b0fc768 fix components/collapse test fail 2018-01-03 19:06:37 +08:00
junjing.zhang
8489fedb4c anchor scroll supports complete href link - test
anchor scroll supports complete href link, e.g. http://www.example.com/#id, not just #id
2018-01-03 19:06:37 +08:00
junjing.zhang
adf98d3c19 anchor scroll supports complete href link
anchor scroll supports complete href link, e.g. http://www.example.com/#id, not just #id
2018-01-03 19:06:37 +08:00
afc163
ba87b45903 Fix snapshot for moment@2.20 2017-12-17 18:57:10 +08:00
afc163
1e8830637f Fix submenu popup issue when specified unexisted defaultOpenKeys
close #8475
2017-12-17 18:54:31 +08:00
nikogu
2275195e15 bump 2.13.11 2017-12-02 17:47:19 +08:00
niko
dcf9d4c294 2.13.11 changelog (#8403) 2017-12-02 17:38:41 +08:00
11 changed files with 501 additions and 355 deletions

View File

@@ -17,6 +17,27 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi
---
## 2.13.12
`2018-02-26`
- 🐞 Fix issue resulting in SubMenu can not been shown correctly when `defaultOpenKeys` includes nonexistent key. [#8475](https://github.com/ant-design/ant-design/issues/8475)
- 🐞 Fix issue resulting in DatePicker's value can not been controlled correctly. [#8885](https://github.com/ant-design/ant-design/issues/8885)
## 2.13.11
`2017-12-01`
- 📝 Improve support of TypeScript. [#8394](https://github.com/ant-design/ant-design/pull/8394) [#8395](https://github.com/ant-design/ant-design/pull/8395) [@burdell](https://github.com/burdell) [@khayalan-mathew](https://github.com/khayalan-mathew)
- 🐞 Fixed Tooltip missing `defaultVisible` property. [#8257](https://github.com/ant-design/ant-design/issues/8257)
- 🐞 Fixed Modal `footer` property is overwrited when customing this property. [#8379](https://github.com/ant-design/ant-design/issues/8379)
- 🐞 Fixed `fileList` shown incorrect when `beforeUpload` of Upload return `false`. [#8036](https://github.com/ant-design/ant-design/issues/8036)
- 🐞 Fixed vertical align of Form.Item's feedback shown incorrect when Input `size` property is `default\small`. [#8243](https://github.com/ant-design/ant-design/issues/8243)
- 🐞 Fixed nested Form.Item style incorrect. [#8320](https://github.com/ant-design/ant-design/issues/8320)
- 🐞 Fixed Form.Item height are different between Chrome with Safari. [#8220](https://github.com/ant-design/ant-design/issues/8220)
- 🐞 Fixed links where inside Form.Item's label are unavailable to click. [bf70d30](https://github.com/ant-design/ant-design/commit/bf70d30a60595916a38671f384ed17cbd0c4ba5d)
- 🐞 Fixed Progress word wrap. [#8239](https://github.com/ant-design/ant-design/issues/8239)
## 2.13.10
`2017-11-12`

View File

@@ -17,6 +17,27 @@ timeline: true
---
## 2.13.12
`2018-02-26`
- 🐞 修复 Menu 的 `defaultOpenKeys` 包含不存在的 key 时,子菜单不能正确显示的问题。 [#8475](https://github.com/ant-design/ant-design/issues/8475)
- 🐞 修复 DatePicker 的值不能正确受控的问题。[#8885](https://github.com/ant-design/ant-design/issues/8885)
## 2.13.11
`2017-12-01`
- 📝 完善组件对 TypeScript 的支持。[#8394](https://github.com/ant-design/ant-design/pull/8394) [#8395](https://github.com/ant-design/ant-design/pull/8395) [@burdell](https://github.com/burdell) [@khayalan-mathew](https://github.com/khayalan-mathew)
- 🐞 修复了 Tooltip 不支持 `defaultVisible` 属性的问题。[#8257](https://github.com/ant-design/ant-design/issues/8257)
- 🐞 修复了 Modal 组件在传入自定义 `footer` 的时候默认 `footer` 被覆盖的问题。[#8379](https://github.com/ant-design/ant-design/issues/8379)
- 🐞 修复了 Upload 组件在 `beforeUpload` 中返回 `false` 时,修改 `fileList` 导致上传列表展示不正常的问题。[#8036](https://github.com/ant-design/ant-design/issues/8036)
- 🐞 修复了 Form 表单的信息回显在当 Input 组件 `size` 属性为 `default\small` 时没有对齐的问题。[#8243](https://github.com/ant-design/ant-design/issues/8243)
- 🐞 修复了 Form.Item 在互相嵌套时样式异常的问题。[#8320](https://github.com/ant-design/ant-design/issues/8320)
- 🐞 修复了 Form.Item 在 Chrome 和 Safari 下高度不一致的问题。 [#8220](https://github.com/ant-design/ant-design/issues/8220)
- 🐞 修复了 Form.Item 在部分情况下 label 内链接无法点击的问题。 [bf70d30](https://github.com/ant-design/ant-design/commit/bf70d30a60595916a38671f384ed17cbd0c4ba5d)
- 🐞 修复了 Progress 对于折行的场景兼容性问题。[#8239](https://github.com/ant-design/ant-design/issues/8239)
## 2.13.10
`2017-11-12`

View File

@@ -42,9 +42,12 @@ function easeInOutCubic(t: number, b: number, c: number, d: number) {
}
const reqAnimFrame = getRequestAnimationFrame();
const sharpMatcherRegx = /#([^#]+)$/;
function scrollTo(href: string, offsetTop = 0, target, callback = () => { }) {
const scrollTop = getScroll(target(), true);
const targetElement = document.getElementById(href.substring(1));
const sharpLinkMatch = sharpMatcherRegx.exec(href);
if (!sharpLinkMatch) { return; }
const targetElement = document.getElementById(sharpLinkMatch[1]);
if (!targetElement) {
return;
}
@@ -174,7 +177,9 @@ export default class Anchor extends React.Component<AnchorProps, any> {
const linkSections: Array<Section> = [];
this.links.forEach(link => {
const target = document.getElementById(link.substring(1));
const sharpLinkMatch = sharpMatcherRegx.exec(link.toString());
if (!sharpLinkMatch) { return; }
const target = document.getElementById(sharpLinkMatch[1]);
if (target && getOffsetTop(target) < offsetTop + bounds) {
const top = getOffsetTop(target);
linkSections.push({

View File

@@ -17,4 +17,48 @@ describe('Anchor Render', () => {
wrapper.node.handleScroll();
expect(wrapper.node.state).not.toBe(null);
});
it('Anchor render perfectly for complete href - click', () => {
const wrapper = mount(
<Anchor>
<Link href="http://www.example.com/#API" title="API" />
</Anchor>
);
wrapper.find('a[href="http://www.example.com/#API"]').simulate('click');
expect(wrapper.node.state.activeLink).toBe('http://www.example.com/#API');
});
it('Anchor render perfectly for complete href - scoll', () => {
let root = document.getElementById('root');
if (!root) {
root = document.createElement('div', { id: 'root' });
root.id = 'root';
document.body.appendChild(root);
}
mount(<div id="API">Hello</div>, { attachTo: root });
const wrapper = mount(
<Anchor>
<Link href="http://www.example.com/#API" title="API" />
</Anchor>
);
wrapper.node.handleScroll();
expect(wrapper.node.state.activeLink).toBe('http://www.example.com/#API');
});
it('Anchor render perfectly for complete href - scollTo', () => {
let root = document.getElementById('root');
if (!root) {
root = document.createElement('div', { id: 'root' });
root.id = 'root';
document.body.appendChild(root);
}
mount(<div id="API">Hello</div>, { attachTo: root });
const wrapper = mount(
<Anchor>
<Link href="##API" title="API" />
</Anchor>
);
wrapper.node.handleScrollTo('##API');
expect(wrapper.node.state.activeLink).toBe('##API');
});
});

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,7 @@ exports[`renders ./components/collapse/demo/accordion.md correctly 1`] = `
>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
@@ -20,6 +21,7 @@ exports[`renders ./components/collapse/demo/accordion.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
@@ -34,6 +36,7 @@ exports[`renders ./components/collapse/demo/accordion.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
@@ -55,6 +58,7 @@ exports[`renders ./components/collapse/demo/basic.md correctly 1`] = `
>
<div
class="ant-collapse-item ant-collapse-item-active"
role="tablist"
>
<div
aria-expanded="true"
@@ -85,6 +89,7 @@ exports[`renders ./components/collapse/demo/basic.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
@@ -99,6 +104,7 @@ exports[`renders ./components/collapse/demo/basic.md correctly 1`] = `
</div>
<div
class="ant-collapse-item ant-collapse-item-disabled"
role="tablist"
>
<div
aria-expanded="false"
@@ -120,6 +126,7 @@ exports[`renders ./components/collapse/demo/borderless.md correctly 1`] = `
>
<div
class="ant-collapse-item ant-collapse-item-active"
role="tablist"
>
<div
aria-expanded="true"
@@ -150,6 +157,7 @@ exports[`renders ./components/collapse/demo/borderless.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
@@ -164,6 +172,7 @@ exports[`renders ./components/collapse/demo/borderless.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
@@ -185,6 +194,7 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
>
<div
class="ant-collapse-item ant-collapse-item-active"
role="tablist"
style="background:#f7f7f7;border-radius:4px;margin-bottom:24px;border:0;overflow:hidden;"
>
<div
@@ -216,6 +226,7 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
style="background:#f7f7f7;border-radius:4px;margin-bottom:24px;border:0;overflow:hidden;"
>
<div
@@ -231,6 +242,7 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
style="background:#f7f7f7;border-radius:4px;margin-bottom:24px;border:0;overflow:hidden;"
>
<div
@@ -253,6 +265,7 @@ exports[`renders ./components/collapse/demo/mix.md correctly 1`] = `
>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
@@ -267,6 +280,7 @@ exports[`renders ./components/collapse/demo/mix.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"
@@ -281,6 +295,7 @@ exports[`renders ./components/collapse/demo/mix.md correctly 1`] = `
</div>
<div
class="ant-collapse-item"
role="tablist"
>
<div
aria-expanded="false"

View File

@@ -37,6 +37,7 @@ export default function createPicker(TheCalendar): any {
}
this.state = {
value,
showDate: value,
};
}
@@ -44,6 +45,7 @@ export default function createPicker(TheCalendar): any {
if ('value' in nextProps) {
this.setState({
value: nextProps.value,
showDate: nextProps.value,
});
}
}
@@ -66,13 +68,20 @@ export default function createPicker(TheCalendar): any {
handleChange = (value) => {
const props = this.props;
if (!('value' in props)) {
this.setState({ value });
this.setState({
value,
showDate: value,
});
}
props.onChange(value, (value && value.format(props.format)) || '');
}
handleCalendarChange = (value: moment.Moment) => {
this.setState({ showDate: value });
}
render() {
const { value } = this.state;
const { value, showDate } = this.state;
const props = omit(this.props, ['onChange']);
const { prefixCls, locale } = props;
@@ -116,6 +125,8 @@ export default function createPicker(TheCalendar): any {
showToday={props.showToday}
monthCellContentRender={props.monthCellContentRender}
renderFooter={this.renderFooter}
onChange={this.handleCalendarChange}
value={showDate}
/>
);
@@ -156,13 +167,14 @@ export default function createPicker(TheCalendar): any {
...props.style,
...pickerStyle,
};
return (
<span className={classNames(props.className, props.pickerClass)} style={style}>
<RcDatePicker
{...props}
{...pickerChangeHandler}
calendar={calendar}
value={pickerValue}
value={value}
prefixCls={`${prefixCls}-picker-container`}
style={props.popupStyle}
>

View File

@@ -138,7 +138,6 @@ describe('Menu', () => {
});
it('should always follow openKeys when mode is switched', () => {
jest.useRealTimers();
const wrapper = mount(
<Menu defaultOpenKeys={['1']} mode="inline">
<Menu.Item key="menu1">
@@ -158,14 +157,39 @@ describe('Menu', () => {
expect(wrapper.find('.ant-menu-sub').at(0).hasClass('ant-menu-inline')).toBe(true);
expect(wrapper.find('.ant-menu-sub').at(0).hasClass('ant-menu-hidden')).toBe(false);
wrapper.setProps({ inlineCollapsed: true });
setTimeout(() => {
// 动画结束后套样式;
expect(wrapper.find('.ant-menu-sub').at(0).hasClass('ant-menu-vertical')).toBe(true);
expect(wrapper.find('.ant-menu-sub').at(0).hasClass('ant-menu-hidden')).toBe(true);
wrapper.setProps({ inlineCollapsed: false });
expect(wrapper.find('.ant-menu-sub').at(0).hasClass('ant-menu-inline')).toBe(true);
expect(wrapper.find('.ant-menu-sub').at(0).hasClass('ant-menu-hidden')).toBe(false);
}, 300);
jest.runAllTimers();
expect(wrapper.find('.ant-menu-sub').at(0).hasClass('ant-menu-vertical')).toBe(true);
expect(wrapper.find('.ant-menu-sub').at(0).hasClass('ant-menu-hidden')).toBe(true);
wrapper.setProps({ inlineCollapsed: false });
expect(wrapper.find('.ant-menu-sub').at(0).hasClass('ant-menu-inline')).toBe(true);
expect(wrapper.find('.ant-menu-sub').at(0).hasClass('ant-menu-hidden')).toBe(false);
});
it('inlineCollapsed should works well when specify a not existed default openKeys', () => {
const wrapper = mount(
<Menu defaultOpenKeys={['not-existed']} mode="inline">
<Menu.Item key="menu1">
<Icon type="inbox" />
<span>Option</span>
</Menu.Item>
<SubMenu key="1" title="submenu1">
<Menu.Item key="submenu1">
Option
</Menu.Item>
<Menu.Item key="submenu2">
Option
</Menu.Item>
</SubMenu>
</Menu>
);
expect(wrapper.find('.ant-menu-sub').length).toBe(0);
wrapper.setProps({ inlineCollapsed: true });
jest.runAllTimers();
wrapper.find('.ant-menu-submenu-title').at(0).simulate('mouseEnter');
jest.runAllTimers();
expect(wrapper.find('.ant-menu-submenu').at(0).hasClass('ant-menu-submenu-vertical')).toBe(true);
expect(wrapper.find('.ant-menu-submenu').at(0).hasClass('ant-menu-submenu-open')).toBe(true);
expect(wrapper.find('.ant-menu-sub').length).toBe(1);
});
it('should open submenu when click submenu title (inline)', () => {

View File

@@ -63,6 +63,7 @@ export default class Menu extends React.Component<MenuProps, any> {
siderCollapsed: PropTypes.bool,
};
switchModeFromInline: boolean;
leaveAnimationExecutedWhenInlineCollapsed: boolean;
inlineOpenKeys = [];
constructor(props) {
super(props);
@@ -138,7 +139,8 @@ export default class Menu extends React.Component<MenuProps, any> {
}
getRealMenuMode() {
const inlineCollapsed = this.getInlineCollapsed();
if (this.switchModeFromInline && inlineCollapsed) {
if (this.switchModeFromInline && inlineCollapsed && this.leaveAnimationExecutedWhenInlineCollapsed) {
this.leaveAnimationExecutedWhenInlineCollapsed = false;
return 'inline';
}
const { mode } = this.props;
@@ -175,6 +177,8 @@ export default class Menu extends React.Component<MenuProps, any> {
leave: (node, done) => animation.leave(node, () => {
// Make sure inline menu leave animation finished before mode is switched
this.switchModeFromInline = false;
// Fix https://github.com/ant-design/ant-design/issues/8475
this.leaveAnimationExecutedWhenInlineCollapsed = true;
this.setState({});
done();
}),

View File

@@ -1,6 +1,6 @@
{
"name": "antd",
"version": "2.13.10",
"version": "2.13.12",
"title": "Ant Design",
"description": "An enterprise-class UI design language and React-based implementation",
"homepage": "http://ant.design/",
@@ -82,12 +82,12 @@
"warning": "~3.0.0"
},
"devDependencies": {
"@types/react": "^16.0.21",
"@types/react-dom": "~0.14.18",
"@types/react": "16.0.21",
"@types/react-dom": "0.14.18",
"ansi-styles": "^3.2.0",
"antd-tools": "~2.1.0",
"babel-cli": "^6.18.0",
"babel-eslint": "^8.0.1",
"babel-eslint": "8.0.2",
"babel-plugin-import": "^1.0.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.18.0",