mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 10:59:19 +08:00
Compare commits
25 Commits
master
...
2.x-stable
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eac43ed892 | ||
|
|
f5250cabe1 | ||
|
|
125085398c | ||
|
|
9c78bfaee4 | ||
|
|
35d11d1cb1 | ||
|
|
992c8d1562 | ||
|
|
a3fc715d3a | ||
|
|
03da3efae7 | ||
|
|
97d3422043 | ||
|
|
a609518d28 | ||
|
|
ef6d7a5d90 | ||
|
|
5be1bad67f | ||
|
|
b70fede5de | ||
|
|
358aa84fef | ||
|
|
6f716d1003 | ||
|
|
739c6ead54 | ||
|
|
a7255ee885 | ||
|
|
06ff0d44db | ||
|
|
e96b0fc768 | ||
|
|
8489fedb4c | ||
|
|
adf98d3c19 | ||
|
|
ba87b45903 | ||
|
|
1e8830637f | ||
|
|
2275195e15 | ||
|
|
dcf9d4c294 |
@@ -17,6 +17,41 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi
|
||||
|
||||
---
|
||||
|
||||
## 2.13.14
|
||||
|
||||
`2018-04-28`
|
||||
|
||||
- 🐞 Fix compatibility with less 3. [#7850](https://github.com/ant-design/ant-design/issues/7850)
|
||||
|
||||
|
||||
## 2.13.13
|
||||
|
||||
`2018-03-09`
|
||||
|
||||
- 🐞 Fix `Upload` file list update logic when beforeUpload return false. [626ebf2](https://github.com/ant-design/ant-design/commit/ef6d7a5d9070c0b82deed837a7ebce7de9bc18aa)
|
||||
|
||||
|
||||
## 2.13.12
|
||||
|
||||
`2018-02-26`
|
||||
|
||||
- 🐞 Fix issue resulting in SubMenu can not be shown correctly when `defaultOpenKeys` includes a nonexistent key. [#8475](https://github.com/ant-design/ant-design/issues/8475)
|
||||
- 🐞 Fix issue resulting in DatePicker's value can not be 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`
|
||||
|
||||
@@ -17,6 +17,41 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
## 2.13.14
|
||||
|
||||
`2018-04-28`
|
||||
|
||||
- 🐞 修复对 less 3 的兼容性问题。[#7850](https://github.com/ant-design/ant-design/issues/7850)
|
||||
|
||||
|
||||
## 2.13.13
|
||||
|
||||
`2018-03-09`
|
||||
|
||||
- 🐞 修复 `Upload` 组件当 `beforeUpload` 返回 `false` 时文件列表的更新逻辑。 [626ebf2](https://github.com/ant-design/ant-design/commit/ef6d7a5d9070c0b82deed837a7ebce7de9bc18aa)
|
||||
|
||||
|
||||
## 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`
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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
@@ -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"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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}
|
||||
>
|
||||
|
||||
@@ -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)', () => {
|
||||
|
||||
@@ -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();
|
||||
}),
|
||||
|
||||
@@ -100,6 +100,8 @@
|
||||
};
|
||||
|
||||
this.colorEasing = BezierEasing(0.26, 0.09, 0.37, 0.18);
|
||||
// less 3 requires a return
|
||||
return '';
|
||||
})()`;
|
||||
}
|
||||
// It is hacky way to make this function will be compiled preferentially by less
|
||||
|
||||
@@ -22,7 +22,6 @@ class Demo extends React.Component {
|
||||
value: undefined,
|
||||
}
|
||||
onChange = (value) => {
|
||||
console.log(arguments);
|
||||
this.setState({ value });
|
||||
}
|
||||
render() {
|
||||
|
||||
@@ -50,7 +50,6 @@ class Demo extends React.Component {
|
||||
value: ['0-0-0'],
|
||||
}
|
||||
onChange = (value) => {
|
||||
console.log('onChange ', value, arguments);
|
||||
this.setState({ value });
|
||||
}
|
||||
render() {
|
||||
|
||||
@@ -22,7 +22,6 @@ class Demo extends React.Component {
|
||||
value: undefined,
|
||||
}
|
||||
onChange = (value) => {
|
||||
console.log(arguments);
|
||||
this.setState({ value });
|
||||
}
|
||||
render() {
|
||||
|
||||
@@ -41,7 +41,6 @@ class Demo extends React.Component {
|
||||
value: undefined,
|
||||
}
|
||||
onChange = (value) => {
|
||||
console.log(arguments);
|
||||
this.setState({ value });
|
||||
}
|
||||
render() {
|
||||
|
||||
@@ -37,7 +37,7 @@ exports[`renders ./components/tree/demo/basic.md correctly 1`] = `
|
||||
class="ant-tree-treenode-disabled"
|
||||
>
|
||||
<span
|
||||
class="ant-tree-switcher ant-tree-switcher_open ant-tree-switcher-disabled"
|
||||
class="ant-tree-switcher ant-tree-switcher_open"
|
||||
/>
|
||||
<span
|
||||
class="ant-tree-checkbox ant-tree-checkbox-checked ant-tree-checkbox-disabled"
|
||||
|
||||
@@ -61,7 +61,6 @@ class Demo extends React.Component {
|
||||
selectedKeys: [],
|
||||
}
|
||||
onExpand = (expandedKeys) => {
|
||||
console.log('onExpand', arguments);
|
||||
// if not set autoExpandParent to false, if children expanded, parent can not collapse.
|
||||
// or, you can remove all expanded children keys.
|
||||
this.setState({
|
||||
|
||||
@@ -2,6 +2,7 @@ import React from 'react';
|
||||
import RcUpload from 'rc-upload';
|
||||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import uniqBy from 'lodash.uniqby';
|
||||
import Dragger from './Dragger';
|
||||
import UploadList from './UploadList';
|
||||
import { UploadProps, UploadLocale } from './interface';
|
||||
@@ -194,8 +195,8 @@ export default class Upload extends React.Component<UploadProps, any> {
|
||||
this.handleRemove(file);
|
||||
}
|
||||
|
||||
onChange = (info, updateState = true) => {
|
||||
if (!('fileList' in this.props) && updateState) {
|
||||
onChange = (info) => {
|
||||
if (!('fileList' in this.props)) {
|
||||
this.setState({ fileList: info.fileList });
|
||||
}
|
||||
|
||||
@@ -227,8 +228,8 @@ export default class Upload extends React.Component<UploadProps, any> {
|
||||
if (result === false) {
|
||||
this.onChange({
|
||||
file,
|
||||
fileList,
|
||||
}, false);
|
||||
fileList: uniqBy(fileList.concat(this.state.fileList), (item: any) => item.uid),
|
||||
});
|
||||
return false;
|
||||
} else if (result && (result as PromiseLike<any>).then) {
|
||||
return result;
|
||||
|
||||
@@ -117,7 +117,7 @@ describe('Upload List', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('does not change filelist when beforeUpload returns false', () => {
|
||||
it('does concat filelist when beforeUpload returns false', () => {
|
||||
const handleChange = jest.fn();
|
||||
const wrapper = mount(
|
||||
<Upload
|
||||
@@ -138,8 +138,8 @@ describe('Upload List', () => {
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.state().fileList).toBe(fileList);
|
||||
expect(handleChange.mock.calls[0][0].fileList).toHaveLength(1);
|
||||
expect(wrapper.state().fileList.length).toBe(fileList.length + 1);
|
||||
expect(handleChange.mock.calls[0][0].fileList).toHaveLength(3);
|
||||
});
|
||||
|
||||
// https://github.com/ant-design/ant-design/issues/7762
|
||||
|
||||
11
package.json
11
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "antd",
|
||||
"version": "2.13.10",
|
||||
"version": "2.13.14",
|
||||
"title": "Ant Design",
|
||||
"description": "An enterprise-class UI design language and React-based implementation",
|
||||
"homepage": "http://ant.design/",
|
||||
@@ -46,6 +46,7 @@
|
||||
"css-animation": "^1.2.5",
|
||||
"dom-closest": "^0.2.0",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"lodash.uniqby": "^4.7.0",
|
||||
"moment": "^2.19.3",
|
||||
"omit.js": "^1.0.0",
|
||||
"prop-types": "^15.5.7",
|
||||
@@ -82,12 +83,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",
|
||||
@@ -175,7 +176,7 @@
|
||||
"start:preact": "node ./scripts/generateColorLess.js && cross-env NODE_ENV=development REACT_ENV=preact bisheng start -c ./site/bisheng.config.js --no-livereload",
|
||||
"site": "cross-env NODE_ENV=production bisheng build --ssr -c ./site/bisheng.config.js",
|
||||
"deploy": "antd-tools run clean && npm run site && node ./scripts/generateColorLess.js && bisheng gh-pages --push-only",
|
||||
"pub": "antd-tools run pub",
|
||||
"pub": "antd-tools run pub --npm-tag=latest-2",
|
||||
"prepublish": "antd-tools run guard",
|
||||
"pre-publish": "npm run test-all && node ./scripts/prepub",
|
||||
"authors": "git log --format='%aN <%aE>' | sort -u | grep -v 'users.noreply.github.com' | grep -v 'gitter.im' | grep -v '.local>' | grep -v 'alibaba-inc.com' | grep -v 'alipay.com' | grep -v 'taobao.com' > AUTHORS.txt",
|
||||
|
||||
Reference in New Issue
Block a user