Skip to content

Commit 9ce43be

Browse files
committed
Merge branch 'next' into v3
2 parents 810c8e6 + 700d04b commit 9ce43be

32 files changed

+406
-337
lines changed

CHANGELOG.en-US.md

+15
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@
1010

1111
---
1212

13+
## 2.2.0-beta.3
14+
15+
`2021-06-11`
16+
17+
- 🎉 Refactor Breadcrumb, Statistic, Tag components
18+
- 🌟 Statistic supports loading attribute
19+
- 🐞 Fix the problem of Menu rendering multiple sub-components to improve performance [6ae707](https://github.com/vueComponent/ant-design-vue/commit/6ae707edf508a9c5e8dca7dacf1410de5251bcf8)
20+
- 🐞 Fix FormItem custom class invalidation [617e53](https://github.com/vueComponent/ant-design-vue/commit/617e534fda2ae6d468b5e9d3eb43370f8a4b0000)
21+
- 🐞 Fix MenuDivider class error [#4195](https://github.com/vueComponent/ant-design-vue/issues/4195)
22+
- 🐞 Fix Tag and Image type errors
23+
- 🐞 Fix the issue of missing component animations such as Modal [#4191](https://github.com/vueComponent/ant-design-vue/issues/4191)
24+
- 🐞 Fix the issue that Select class cannot be dynamically updated [#4194](https://github.com/vueComponent/ant-design-vue/issues/4194)
25+
- 🐞 Fix the problem that the Dropdown mail expands and cannot be collapsed by clicking [#4198](https://github.com/vueComponent/ant-design-vue/issues/4198)
26+
- 🐞 Fix the issue of missing some export methods of FormItem [#4183](https://github.com/vueComponent/ant-design-vue/issues/4183)
27+
1328
## 2.2.0-beta.2
1429

1530
`2021-06-08`

CHANGELOG.zh-CN.md

+15
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@
1010

1111
---
1212

13+
## 2.2.0-beta.3
14+
15+
`2021-06-11`
16+
17+
- 🎉 重构 Breadcrumb、Statistic、Tag 组件
18+
- 🌟 Statistic 支持 loading 属性
19+
- 🐞 修复 Menu 渲染多次子组件问题,提升性能 [6ae707](https://github.com/vueComponent/ant-design-vue/commit/6ae707edf508a9c5e8dca7dacf1410de5251bcf8)
20+
- 🐞 修复 FormItem 自定义 class 失效 [617e53](https://github.com/vueComponent/ant-design-vue/commit/617e534fda2ae6d468b5e9d3eb43370f8a4b0000)
21+
- 🐞 修复 MenuDivider class 错误问题 [#4195](https://github.com/vueComponent/ant-design-vue/issues/4195)
22+
- 🐞 修复 Tag、Image 类型错误
23+
- 🐞 修复 Modal 等组件动画丢失问题 [#4191](https://github.com/vueComponent/ant-design-vue/issues/4191)
24+
- 🐞 修复 Select class 不能动态更新问题 [#4194](https://github.com/vueComponent/ant-design-vue/issues/4194)
25+
- 🐞 修复 Dropdown 邮件展开,不能点击收起的问题 [#4198](https://github.com/vueComponent/ant-design-vue/issues/4198)
26+
- 🐞 修复 FormItem 缺少部分导出方法问题 [#4183](https://github.com/vueComponent/ant-design-vue/issues/4183)
27+
1328
## 2.2.0-beta.2
1429

1530
`2021-06-08`

components/config-provider/index.tsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,13 @@ const ConfigProvider = defineComponent({
139139
getPrefixCls: getPrefixClsWrapper,
140140
renderEmpty: renderEmptyComponent,
141141
});
142-
143-
watch(props, () => {
144-
Object.assign(configProvider, props);
142+
Object.keys(props).forEach(key => {
143+
watch(
144+
() => props[key],
145+
() => {
146+
configProvider[key] = props[key];
147+
},
148+
);
145149
});
146150

147151
provide('configProvider', configProvider);

components/dropdown/dropdown.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ const Dropdown = defineComponent({
9292
class: classNames(child?.props?.class, `${prefixCls}-trigger`),
9393
disabled,
9494
});
95-
const triggerActions = disabled ? [] : trigger;
95+
const triggerActions = disabled ? [] : typeof trigger === 'string' ? [trigger] : trigger;
9696
let alignPoint;
9797
if (triggerActions && triggerActions.indexOf('contextmenu') !== -1) {
9898
alignPoint = true;

components/dropdown/getDropdownProps.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import { PropType } from 'vue';
33
import PropTypes from '../_util/vue-types';
44
export default () => ({
55
trigger: {
6-
type: Array as PropType<('click' | 'hover' | 'contextmenu')[]>,
7-
default: () => ['hover'],
6+
type: [Array, String] as PropType<
7+
('click' | 'hover' | 'contextmenu')[] | 'click' | 'hover' | 'contextmenu'
8+
>,
9+
default: 'hover',
810
},
911
overlay: PropTypes.any,
1012
visible: PropTypes.looseBool,

components/form/ErrorList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default defineComponent({
2121
const { prefixCls, status } = useInjectFormItemPrefix();
2222
const visible = ref(!!(props.errors && props.errors.length));
2323
const innerStatus = ref(status.value);
24-
let timeout = ref();
24+
const timeout = ref();
2525
const cacheErrors = ref([...props.errors]);
2626
watch([() => [...props.errors], () => props.help], newValues => {
2727
window.clearTimeout(timeout.value);

components/form/FormItem.tsx

+9-41
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export default defineComponent({
108108
__ANT_NEW_FORM_ITEM: true,
109109
props: formItemProps,
110110
slots: ['help', 'label', 'extra'],
111-
setup(props, { slots }) {
111+
setup(props, { slots, attrs, expose }) {
112112
warning(props.prop === undefined, `\`prop\` is deprecated. Please use \`name\` instead.`);
113113
const eventKey = `form-item-${++indexGuid}`;
114114
const { prefixCls } = useConfigInject('form', props);
@@ -272,6 +272,12 @@ export default defineComponent({
272272
control.focus();
273273
}
274274
};
275+
expose({
276+
onFieldBlur,
277+
onFieldChange,
278+
clearValidate,
279+
resetField,
280+
});
275281
formContext.addField(eventKey, {
276282
fieldValue,
277283
fieldId,
@@ -336,9 +342,11 @@ export default defineComponent({
336342
}
337343
return (
338344
<Row
345+
{...attrs}
339346
class={[
340347
itemClassName.value,
341348
domErrorVisible.value || !!help ? `${prefixCls.value}-item-with-help` : '',
349+
attrs.class,
342350
]}
343351
key="row"
344352
>
@@ -370,44 +378,4 @@ export default defineComponent({
370378
);
371379
};
372380
},
373-
// data() {
374-
// warning(!hasProp(this, 'prop'), `\`prop\` is deprecated. Please use \`name\` instead.`);
375-
// return {
376-
// validateState: this.validateStatus,
377-
// validateMessage: '',
378-
// validateDisabled: false,
379-
// validator: {},
380-
// helpShow: false,
381-
// errors: [],
382-
// initialValue: undefined,
383-
// };
384-
// },
385-
// render() {
386-
// const { autoLink } = getOptionProps(this);
387-
// const children = getSlot(this);
388-
// let firstChildren = children[0];
389-
// if (this.fieldName && autoLink && isValidElement(firstChildren)) {
390-
// const originalEvents = getEvents(firstChildren);
391-
// const originalBlur = originalEvents.onBlur;
392-
// const originalChange = originalEvents.onChange;
393-
// firstChildren = cloneElement(firstChildren, {
394-
// ...(this.fieldId ? { id: this.fieldId } : undefined),
395-
// onBlur: (...args: any[]) => {
396-
// originalBlur && originalBlur(...args);
397-
// this.onFieldBlur();
398-
// },
399-
// onChange: (...args: any[]) => {
400-
// if (Array.isArray(originalChange)) {
401-
// for (let i = 0, l = originalChange.length; i < l; i++) {
402-
// originalChange[i](...args);
403-
// }
404-
// } else if (originalChange) {
405-
// originalChange(...args);
406-
// }
407-
// this.onFieldChange();
408-
// },
409-
// });
410-
// }
411-
// return this.renderFormItem([firstChildren, children.slice(1)]);
412-
// },
413381
});

components/grid/Col.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function parseFlex(flex: FlexType): string {
2929
}
3030

3131
const stringOrNumber = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
32-
export const colSize = PropTypes.shape({
32+
export const colSize = PropTypes.shape<ColSize>({
3333
span: stringOrNumber,
3434
order: stringOrNumber,
3535
offset: stringOrNumber,

components/grid/context.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { computed } from 'vue';
12
import { Ref, inject, InjectionKey, provide, ComputedRef } from 'vue';
23

34
export interface RowContext {
@@ -13,7 +14,11 @@ const useProvideRow = (state: RowContext) => {
1314
};
1415

1516
const useInjectRow = () => {
16-
return inject(RowContextKey);
17+
return inject(RowContextKey, {
18+
gutter: computed(() => undefined),
19+
wrap: computed(() => undefined),
20+
supportFlexGap: computed(() => undefined),
21+
});
1722
};
1823

1924
export { useInjectRow, useProvideRow };

components/image/index.tsx

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
import { App, defineComponent, inject, Plugin } from 'vue';
1+
import { App, defineComponent, ExtractPropTypes, ImgHTMLAttributes, inject, Plugin } from 'vue';
22
import { defaultConfigProvider } from '../config-provider';
33
import ImageInternal from '../vc-image';
4-
import { ImageProps, ImagePropsType } from '../vc-image/src/Image';
5-
4+
import { imageProps } from '../vc-image/src/Image';
65
import PreviewGroup from './PreviewGroup';
7-
const Image = defineComponent({
6+
7+
export type ImageProps = Partial<
8+
ExtractPropTypes<typeof imageProps> & Omit<ImgHTMLAttributes, 'placeholder' | 'onClick'>
9+
>;
10+
const Image = defineComponent<ImageProps>({
811
name: 'AImage',
912
inheritAttrs: false,
10-
props: ImageProps,
13+
props: imageProps as any,
1114
setup(props, ctx) {
1215
const { slots, attrs } = ctx;
1316
const configProvider = inject('configProvider', defaultConfigProvider);
@@ -19,7 +22,7 @@ const Image = defineComponent({
1922
},
2023
});
2124

22-
export { ImageProps, ImagePropsType };
25+
export { imageProps };
2326

2427
Image.PreviewGroup = PreviewGroup;
2528

components/menu/src/Divider.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import { defineComponent } from 'vue';
2+
import { useInjectMenu } from './hooks/useMenuContext';
23

34
export default defineComponent({
45
name: 'AMenuDivider',
5-
props: {
6-
prefixCls: String,
7-
},
8-
setup(props) {
6+
setup() {
7+
const { prefixCls } = useInjectMenu();
98
return () => {
10-
return <li class={`${props.prefixCls}-item-divider`} />;
9+
return <li class={`${prefixCls.value}-item-divider`} />;
1110
};
1211
},
1312
});

components/menu/src/Menu.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ export default defineComponent({
372372
siderCollapsed,
373373
defaultMotions: computed(() => (isMounted.value ? defaultMotions : null)),
374374
motion: computed(() => (isMounted.value ? props.motion : null)),
375-
overflowDisabled: computed(() => props.disabledOverflow),
375+
overflowDisabled: computed(() => undefined),
376376
onOpenChange: onInternalOpenChange,
377377
onItemClick: onInternalClick,
378378
registerMenuInfo,

components/menu/src/SubMenu.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,13 @@ export default defineComponent({
260260
</div>
261261
);
262262

263-
if (!overflowDisabled.value) {
263+
if (!overflowDisabled.value && mode.value !== 'inline') {
264264
const triggerMode = triggerModeRef.value;
265265
titleNode = (
266266
<PopupTrigger
267267
mode={triggerMode}
268268
prefixCls={subMenuPrefixClsValue}
269-
visible={!props.internalPopupClose && open.value && mode.value !== 'inline'}
269+
visible={!props.internalPopupClose && open.value}
270270
popupClassName={popupClassName.value}
271271
popupOffset={props.popupOffset}
272272
disabled={mergedDisabled.value}

0 commit comments

Comments
 (0)