Skip to content

Commit 4a0fce5

Browse files
committed
release 2.2.0-beta.6
1 parent e8b9578 commit 4a0fce5

File tree

11 files changed

+102
-82
lines changed

11 files changed

+102
-82
lines changed

CHANGELOG.en-US.md

+7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010

1111
---
1212

13+
## 2.2.0-beta.6
14+
15+
`2021-06-26`
16+
17+
- 🌟 Menu performance optimization [e8b957](https://github.com/vueComponent/ant-design-vue/commit/e8b95784eb1ee0554b0d6b17bdc14e18775f2ae6)
18+
- 🐞 Fix `Layout` `RangePicker` `WeekPicker` `Textarea` on-demand loading failure
19+
1320
## 2.2.0-beta.5
1421

1522
`2021-06-24`

CHANGELOG.zh-CN.md

+7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010

1111
---
1212

13+
## 2.2.0-beta.6
14+
15+
`2021-06-26`
16+
17+
- 🌟 Menu 性能优化 [e8b957](https://github.com/vueComponent/ant-design-vue/commit/e8b95784eb1ee0554b0d6b17bdc14e18775f2ae6)
18+
- 🐞 修复 Layout、RangePicker、WeekPicker、Textarea 按需加载失效
19+
1320
## 2.2.0-beta.5
1421

1522
`2021-06-24`

components/_util/transition.tsx

+24-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import type { BaseTransitionProps, CSSProperties, Ref } from 'vue';
1+
import { BaseTransitionProps, CSSProperties, getCurrentInstance, onUpdated, Ref } from 'vue';
22
import { defineComponent, nextTick, Transition as T, TransitionGroup as TG } from 'vue';
3-
import { findDOMNode } from './props-util';
43

54
export const getTransitionProps = (transitionName: string, opt: object = {}) => {
65
if (process.env.NODE_ENV === 'test') {
@@ -46,23 +45,30 @@ let Transition = T;
4645
let TransitionGroup = TG;
4746

4847
if (process.env.NODE_ENV === 'test') {
49-
Transition = (props, { slots }) => {
50-
const child = slots.default?.()[0];
51-
if (child && child.dirs && child.dirs[0]) {
52-
const value = child.dirs[0].value;
53-
const oldValue = child.dirs[0].oldValue;
54-
if (!value && value !== oldValue) {
55-
nextTick(() => {
56-
if (props.onAfterLeave) {
57-
props.onAfterLeave(findDOMNode(this));
48+
Transition = defineComponent({
49+
name: 'TransitionForTest',
50+
inheritAttrs: false,
51+
setup(_props, { slots, attrs }) {
52+
const instance = getCurrentInstance();
53+
onUpdated(() => {
54+
const child = instance.subTree.children[0];
55+
if (child && child.dirs && child.dirs[0]) {
56+
const value = child.dirs[0].value;
57+
const oldValue = child.dirs[0].oldValue;
58+
if (!value && value !== oldValue) {
59+
nextTick(() => {
60+
if (attrs.onAfterLeave) {
61+
(attrs as any).onAfterLeave(instance.vnode.el);
62+
}
63+
});
5864
}
59-
});
60-
}
61-
}
62-
return slots.default?.();
63-
};
64-
Transition.displayName = 'TransitionForTest';
65-
Transition.inheritAttrs = false;
65+
}
66+
});
67+
return () => {
68+
return slots.default?.();
69+
};
70+
},
71+
}) as any;
6672
TransitionGroup = defineComponent({
6773
name: 'TransitionGroupForTest',
6874
inheritAttrs: false,

components/back-top/__tests__/index.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('BackTop', () => {
1717
});
1818
window.scrollTo(0, 400);
1919
expect(document.documentElement.scrollTop).toBe(400);
20-
await sleep(10);
20+
await sleep(100);
2121
wrapper.find('.ant-back-top').trigger('click');
2222
await sleep(500);
2323
expect(document.documentElement.scrollTop).toBe(0);

components/form/ErrorList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useInjectFormItemPrefix } from './context';
22
import type { VueNode } from '../_util/type';
3-
import { defineComponent, onBeforeUnmount, ref, watch } from '@vue/runtime-core';
3+
import { defineComponent, onBeforeUnmount, ref, watch } from 'vue';
44
import classNames from '../_util/classNames';
55
import Transition, { getTransitionProps } from '../_util/transition';
66
import useConfigInject from '../_util/hooks/useConfigInject';

components/menu/__tests__/index.test.js

+57-57
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,14 @@ describe('Menu', () => {
187187
await asyncExpect(() => {
188188
expect($$('.ant-menu-sub')[0].style.display).not.toBe('none');
189189
}, 0);
190-
// openKeys.value = [];
191-
// await asyncExpect(() => {
192-
// expect($$('.ant-menu-sub')[0].style.display).toBe('none');
193-
// }, 100);
194-
// wrapper.setProps({ openKeys: ['1'] });
195-
// await asyncExpect(() => {
196-
// expect($$('.ant-menu-sub')[0].style.display).not.toBe('none');
197-
// }, 0);
190+
openKeys.value = [];
191+
await asyncExpect(() => {
192+
expect($$('.ant-menu-sub')[0].style.display).toBe('none');
193+
}, 100);
194+
openKeys.value = ['1'];
195+
await asyncExpect(() => {
196+
expect($$('.ant-menu-sub')[0].style.display).not.toBe('none');
197+
}, 100);
198198
});
199199

200200
it('vertical', async () => {
@@ -376,69 +376,69 @@ describe('Menu', () => {
376376
{ attachTo: 'body', sync: false },
377377
);
378378
await asyncExpect(() => {
379-
expect(wrapper.findAll('.ant-menu-sub').length).toBe(0);
379+
expect(wrapper.findAll('.ant-menu-sub').length).toBe(1);
380380
});
381381
wrapper.setProps({ inlineCollapsed: true });
382-
await asyncExpect(() => {
383-
// 动画完成后的回调
384-
wrapper.vm.$refs.menu.switchModeFromInline = false;
385-
wrapper.vm.$forceUpdate();
386-
});
387382
// await asyncExpect(() => {
388-
// wrapper.trigger('transitionend', { propertyName: 'width' });
383+
// // 动画完成后的回调
384+
// wrapper.vm.$refs.menu.switchModeFromInline = false;
385+
// wrapper.vm.$forceUpdate();
389386
// });
390387
// await asyncExpect(() => {
391-
// $$('.ant-menu-submenu-title')[0].dispatchEvent(new MouseEvent('mouseenter'));
388+
// wrapper.trigger('transitionend', { propertyName: 'width' });
392389
// });
393-
// await asyncExpect(() => {
394-
// expect(wrapper.findAll('.ant-menu-submenu')[0].classes()).toContain(
395-
// 'ant-menu-submenu-vertical',
396-
// );
397-
// expect(wrapper.findAll('.ant-menu-submenu')[0].classes()).toContain('ant-menu-submenu-open');
398-
// expect($$('ul.ant-menu-sub')[0].className).toContain('ant-menu-vertical');
399-
// expect($$('ul.ant-menu-sub')[0].style.display).not.toBe('none');
400-
// }, 500);
390+
await asyncExpect(() => {
391+
$$('.ant-menu-submenu-title')[0].dispatchEvent(new MouseEvent('mouseenter'));
392+
});
393+
await asyncExpect(() => {
394+
expect(wrapper.findAll('.ant-menu-submenu')[0].classes()).toContain(
395+
'ant-menu-submenu-vertical',
396+
);
397+
expect(wrapper.findAll('.ant-menu-submenu')[0].classes()).toContain('ant-menu-submenu-open');
398+
expect($$('ul.ant-menu-sub')[0].className).toContain('ant-menu-vertical');
399+
expect($$('ul.ant-menu-sub')[0].style.display).not.toBe('none');
400+
}, 500);
401401
});
402402

403403
// describe('open submenu when click submenu title', () => {
404404
// beforeEach(() => {
405405
// document.body.innerHTML = '';
406406
// });
407407

408-
// const toggleMenu = (wrapper, index, event) => {
409-
// wrapper.findAll('.ant-menu-submenu-title')[index].trigger(event);
410-
// };
408+
const toggleMenu = (wrapper, index, event) => {
409+
wrapper.findAll('.ant-menu-submenu-title')[index].trigger(event);
410+
};
411411

412-
// it('inline', async () => {
413-
// const wrapper = mount(
414-
// {
415-
// render() {
416-
// return (
417-
// <Menu mode="inline">
418-
// <SubMenu key="1" title="submenu1">
419-
// <Menu.Item key="submenu1">Option 1</Menu.Item>
420-
// <Menu.Item key="submenu2">Option 2</Menu.Item>
421-
// </SubMenu>
422-
// <Menu.Item key="2">menu2</Menu.Item>
423-
// </Menu>
424-
// );
425-
// },
426-
// },
427-
// { attachTo: 'body', sync: false },
428-
// );
429-
// await asyncExpect(() => {
430-
// expect($$('.ant-menu-sub').length).toBe(0);
431-
// toggleMenu(wrapper, 0, 'click');
432-
// }, 0);
433-
// await asyncExpect(() => {
434-
// expect($$('.ant-menu-sub').length).toBe(1);
435-
// expect($$('.ant-menu-sub')[0].style.display).not.toBe('none');
436-
// toggleMenu(wrapper, 0, 'click');
437-
// }, 500);
438-
// await asyncExpect(() => {
439-
// expect($$('.ant-menu-sub')[0].style.display).toBe('none');
440-
// }, 500);
441-
// });
412+
it('inline', async () => {
413+
const wrapper = mount(
414+
{
415+
render() {
416+
return (
417+
<Menu mode="inline">
418+
<SubMenu key="1" title="submenu1">
419+
<Menu.Item key="submenu1">Option 1</Menu.Item>
420+
<Menu.Item key="submenu2">Option 2</Menu.Item>
421+
</SubMenu>
422+
<Menu.Item key="2">menu2</Menu.Item>
423+
</Menu>
424+
);
425+
},
426+
},
427+
{ attachTo: 'body', sync: false },
428+
);
429+
await asyncExpect(() => {
430+
expect($$('.ant-menu-sub').length).toBe(1);
431+
toggleMenu(wrapper, 0, 'click');
432+
}, 0);
433+
await asyncExpect(() => {
434+
expect($$('.ant-menu-sub').length).toBe(1);
435+
expect($$('.ant-menu-sub')[0].style.display).not.toBe('none');
436+
toggleMenu(wrapper, 0, 'click');
437+
}, 500);
438+
await asyncExpect(() => {
439+
expect($$('.ant-menu-sub')[0].style.display).toBe('none');
440+
}, 500);
441+
});
442442

443443
// it('vertical', async () => {
444444
// const wrapper = mount(

components/menu/src/InlineSubMenuList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { computed, defineComponent, ref, watch } from '@vue/runtime-core';
1+
import { computed, defineComponent, ref, watch } from 'vue';
22
import Transition from '../../_util/transition';
33
import { useInjectMenu, MenuContextProvider } from './hooks/useMenuContext';
44
import SubMenuList from './SubMenuList';

components/skeleton/Element.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { CSSProperties, ExtractPropTypes, FunctionalComponent } from '@vue/runtime-dom';
1+
import type { CSSProperties, ExtractPropTypes, FunctionalComponent } from 'vue';
22
import classNames from '../_util/classNames';
33
import { tuple } from '../_util/type';
44
import PropTypes from '../_util/vue-types';

components/vc-select/Selector/MultipleSelector.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { computed, defineComponent, onMounted, ref, watch } from 'vue';
1414
import classNames from '../../_util/classNames';
1515
import pickAttrs from '../../_util/pickAttrs';
1616
import PropTypes from '../../_util/vue-types';
17-
import type { VueNode } from 'ant-design-vue/es/_util/type';
17+
import type { VueNode } from '../../_util/type';
1818
import Overflow from '../../vc-overflow';
1919

2020
interface SelectorProps extends InnerSelectorProps {

components/vc-util/Children/toArray.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { VNodeTypes } from '@vue/runtime-core';
1+
import type { VNodeTypes } from 'vue';
22
import { isFragment } from '../../_util/props-util';
33

44
export interface Option {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ant-design-vue",
3-
"version": "2.2.0-beta.5",
3+
"version": "2.2.0-beta.6",
44
"title": "Ant Design Vue",
55
"description": "An enterprise-class UI design language and Vue-based implementation",
66
"keywords": [

0 commit comments

Comments
 (0)