Skip to content

Commit a7f2793

Browse files
committed
Merge remote-tracking branch 'origin/next' into feat-update-ts
2 parents b1b9b53 + 790f83f commit a7f2793

17 files changed

+157
-101
lines changed

CHANGELOG.en-US.md

+26
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,32 @@
1010

1111
---
1212

13+
## 3.1.0-rc.4
14+
15+
`2022-03-25`
16+
17+
### 🔥🔥🔥 The official version is expected to be released at the end of March or early April, when 3.x will become the default version, and the documentation will also point to the 3.x documentation by default 🔥🔥🔥
18+
19+
- 🐞 Fix `Select` options do not support push and other variant methods [#5398](https://github.com/vueComponent/ant-design-vue/issues/5398)
20+
- 🐞 Fix `MenuItem` custom icon, the original icon class name is lost [#5390](https://github.com/vueComponent/ant-design-vue/issues/5390)
21+
22+
## 3.1.0-rc.3
23+
24+
`2022-03-24`
25+
26+
### 🔥🔥🔥 The official version is expected to be released at the end of March or early April, when 3.x will become the default version, and the documentation will also point to the 3.x documentation by default 🔥🔥🔥
27+
28+
- 🌟 Optimize the search and click performance of `Tree` `TreeSelect` [#5365](https://github.com/vueComponent/ant-design-vue/issues/5365)
29+
- 🌟 `Menu` selectedKeys, openKeys support depth watch [7bf1e0](https://github.com/vueComponent/ant-design-vue/commit/7bf1e0dda1fe8f70f6c8b17ba90b217df2a75bd4)
30+
- 🐞 Fix `Checkbox` `Radio` triggering two `click` events for one click [#5363](https://github.com/vueComponent/ant-design-vue/issues/5363) [#5389](https://github.com/vueComponent/ant-design-vue/issues/5389)
31+
- 🐞 Fix `FormItem` `htmlFor` property invalid issue [#5384](https://github.com/vueComponent/ant-design-vue/issues/5384)
32+
- 🐞 Fix `Upload` limit the number, the last upload is abort issue [#5385](https://github.com/vueComponent/ant-design-vue/issues/5385)
33+
- 🐞 Fix `RangePicker` `showTime`, disabled does not consider time issue [#5286](https://github.com/vueComponent/ant-design-vue/issues/5286)
34+
- 🐞 Fix `Layout.Sidebar` cannot be expanded after responsive collapse [#5373](https://github.com/vueComponent/ant-design-vue/issues/5373)
35+
- 🐞 Fix `AutoComplete` custom children's class not mounted [414e7a](https://github.com/vueComponent/ant-design-vue/commit/414e7a1c56455017dbc3780ce7b1b4abd0f1c4d7)
36+
- 🐞 Fix `TimeRangePicker` disabledTime not taking effect [#5387](https://github.com/vueComponent/ant-design-vue/issues/5387)
37+
- 🐞 Fix `Dropdown` automatic correction of pop-up window position is invalid [#5391](https://github.com/vueComponent/ant-design-vue/issues/5391)
38+
1339
## 3.1.0-rc.2
1440

1541
`2022-03-19`

CHANGELOG.zh-CN.md

+26
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,32 @@
1010

1111
---
1212

13+
## 3.1.0-rc.4
14+
15+
`2022-03-25`
16+
17+
### 🔥🔥🔥 预计 3 月底或 4 月初发布正式版,届时 3.x 将成为默认版本,文档也将默认指向 3.x 文档 🔥🔥🔥
18+
19+
- 🐞 修复 `Select` options 不支持 push 等变种方法 [#5398](https://github.com/vueComponent/ant-design-vue/issues/5398)
20+
- 🐞 修复 `MenuItem` 自定义 icon 时,icon 原始类名丢失 [#5390](https://github.com/vueComponent/ant-design-vue/issues/5390)
21+
22+
## 3.1.0-rc.3
23+
24+
`2022-03-24`
25+
26+
### 🔥🔥🔥 预计 3 月底或 4 月初发布正式版,届时 3.x 将成为默认版本,文档也将默认指向 3.x 文档 🔥🔥🔥
27+
28+
- 🌟 优化 `Tree` `TreeSelect` 的搜索、点击性能 [#5365](https://github.com/vueComponent/ant-design-vue/issues/5365)
29+
- 🌟 `Menu` selectedKeys、openKeys 支持深度 watch [7bf1e0](https://github.com/vueComponent/ant-design-vue/commit/7bf1e0dda1fe8f70f6c8b17ba90b217df2a75bd4)
30+
- 🐞 修复 `Checkbox` `Radio` 一次点击触发两次 `click` 事件问题 [#5363](https://github.com/vueComponent/ant-design-vue/issues/5363) [#5389](https://github.com/vueComponent/ant-design-vue/issues/5389)
31+
- 🐞 修复 `FormItem` `htmlFor` 属性失效问题 [#5384](https://github.com/vueComponent/ant-design-vue/issues/5384)
32+
- 🐞 修复 `Upload` 限制数量时,最后一个上传被 abort 问题 [#5385](https://github.com/vueComponent/ant-design-vue/issues/5385)
33+
- 🐞 修复 `RangePicker` `showTime`时, disabled 未考虑 time 问题 [#5286](https://github.com/vueComponent/ant-design-vue/issues/5286)
34+
- 🐞 修复 `Layout.Sidebar` 响应式折叠后,无法展开问题 [#5373](https://github.com/vueComponent/ant-design-vue/issues/5373)
35+
- 🐞 修复 `AutoComplete` 自定义 children 的 class 未挂载问题 [414e7a](https://github.com/vueComponent/ant-design-vue/commit/414e7a1c56455017dbc3780ce7b1b4abd0f1c4d7)
36+
- 🐞 修复 `TimeRangePicker` disabledTime 未生效问题 [#5387](https://github.com/vueComponent/ant-design-vue/issues/5387)
37+
- 🐞 修复 `Dropdown` 自动修正弹窗位置失效问题 [#5391](https://github.com/vueComponent/ant-design-vue/issues/5391)
38+
1339
## 3.1.0-rc.2
1440

1541
`2022-03-19`

components/dropdown/dropdown.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ const Dropdown = defineComponent({
136136

137137
const builtinPlacements = getPlacements({
138138
arrowPointAtCenter: typeof arrow === 'object' && arrow.pointAtCenter,
139+
autoAdjustOverflow: true,
139140
});
140141
const dropdownProps = omit(
141142
{

components/menu/src/MenuItem.tsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,13 @@ export default defineComponent({
233233
onFocus={onInternalFocus}
234234
title={typeof title === 'string' ? title : undefined}
235235
>
236-
{cloneElement(icon, {
237-
class: `${prefixCls.value}-item-icon`,
238-
})}
236+
{cloneElement(
237+
icon,
238+
{
239+
class: `${prefixCls.value}-item-icon`,
240+
},
241+
false,
242+
)}
239243
{renderItemChildren(icon, children)}
240244
</Overflow.Item>
241245
</Tooltip>

components/radio/Radio.tsx

+2-7
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,7 @@ export default defineComponent({
6161

6262
return () => {
6363
const radioGroup = radioGroupContext;
64-
const {
65-
prefixCls: customizePrefixCls,
66-
id = formItemContext.id.value,
67-
onClick,
68-
...restProps
69-
} = props;
64+
const { prefixCls: customizePrefixCls, id = formItemContext.id.value, ...restProps } = props;
7065

7166
const rProps: RadioProps = {
7267
prefixCls: prefixCls.value,
@@ -90,7 +85,7 @@ export default defineComponent({
9085
});
9186

9287
return (
93-
<label class={wrapperClassString} onClick={onClick}>
88+
<label class={wrapperClassString}>
9489
<VcCheckbox {...rProps} type="radio" ref={vcCheckbox} />
9590
{slots.default && <span>{slots.default()}</span>}
9691
</label>

components/style/themes/variable.less

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
// An override for the html selector for theme prefixes
1010
@html-selector: html;
1111

12-
html {
13-
@base-primary: @blue-6;
12+
@base-primary: @blue-6;
1413

14+
html {
1515
// ========= Primary Color =========
1616
--@{ant-prefix}-primary-color: @base-primary;
1717
--@{ant-prefix}-primary-color-hover: color(~`colorPalette('@{base-primary}', 5) `);

components/vc-select/Select.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import { toArray } from './utils/commonUtil';
4242
import useFilterOptions from './hooks/useFilterOptions';
4343
import useCache from './hooks/useCache';
4444
import type { Key, VueNode } from '../_util/type';
45-
import { computed, defineComponent, ref, toRef, watchEffect } from 'vue';
45+
import { computed, defineComponent, ref, shallowRef, toRef, watchEffect } from 'vue';
4646
import type { ExtractPropTypes, PropType } from 'vue';
4747
import PropTypes from '../_util/vue-types';
4848
import { initDefaultProps } from '../_util/props-util';
@@ -314,13 +314,15 @@ export default defineComponent({
314314
};
315315

316316
// Fill tag as option if mode is `tags`
317-
const filledTagOptions = computed(() => {
317+
const filledTagOptions = shallowRef();
318+
watchEffect(() => {
318319
if (props.mode !== 'tags') {
319-
return mergedOptions.value;
320+
filledTagOptions.value = mergedOptions.value;
321+
return;
320322
}
321323

322324
// >>> Tag mode
323-
const cloneOptions = [...mergedOptions.value];
325+
const cloneOptions = mergedOptions.value.slice();
324326

325327
// Check if value exist in options (include new patch item)
326328
const existOptions = (val: RawValueType) => valueOptions.value.has(val);
@@ -336,7 +338,7 @@ export default defineComponent({
336338
}
337339
});
338340

339-
return cloneOptions;
341+
filledTagOptions.value = cloneOptions;
340342
});
341343

342344
const filteredOptions = useFilterOptions(

components/vc-select/hooks/useFilterOptions.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import type {
77
BaseOptionType,
88
} from '../Select';
99
import { injectPropsWithOption } from '../utils/valueUtil';
10-
import type { Ref } from 'vue';
11-
import { toRaw, computed } from 'vue';
10+
import type { Ref, ShallowRef } from 'vue';
11+
import { computed } from 'vue';
1212

1313
function includes(test: any, search: string) {
1414
return toArray(test).join('').toUpperCase().includes(search);
1515
}
1616

1717
export default (
18-
options: Ref<DefaultOptionType[]>,
18+
options: ShallowRef<DefaultOptionType[]>,
1919
fieldNames: Ref<FieldNames>,
2020
searchValue?: Ref<string>,
2121
filterOption?: Ref<SelectProps['filterOption']>,
@@ -55,7 +55,7 @@ export default (
5555
? opt => injectPropsWithOption(opt)
5656
: opt => opt;
5757

58-
toRaw(options.value).forEach(item => {
58+
options.value.forEach(item => {
5959
// Group should check child options
6060
if (item[fieldOptions]) {
6161
// Check group first

components/vc-select/hooks/useOptions.ts

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Ref } from 'vue';
2-
import { toRaw, shallowRef, watchEffect } from 'vue';
2+
import { toRaw, shallowRef, watchEffect, watch } from 'vue';
33
import type { FieldNames, RawValueType } from '../Select';
44
import { convertChildrenToData } from '../utils/legacyUtil';
55

@@ -15,13 +15,20 @@ export default function useOptions<OptionType>(
1515
const mergedOptions = shallowRef();
1616
const valueOptions = shallowRef();
1717
const labelOptions = shallowRef();
18+
const tempMergedOptions = shallowRef([]);
19+
watch(
20+
[options, children],
21+
() => {
22+
if (options.value) {
23+
tempMergedOptions.value = toRaw(options.value).slice();
24+
} else {
25+
tempMergedOptions.value = convertChildrenToData(children.value);
26+
}
27+
},
28+
{ immediate: true, deep: true },
29+
);
1830
watchEffect(() => {
19-
let newOptions = toRaw(options.value);
20-
const childrenAsData = !options.value;
21-
22-
if (childrenAsData) {
23-
newOptions = convertChildrenToData(children.value);
24-
}
31+
const newOptions = tempMergedOptions.value;
2532

2633
const newValueOptions = new Map<RawValueType, OptionType>();
2734
const newLabelOptions = new Map<any, OptionType>();

components/vc-tree-select/OptionList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export default defineComponent({
9898
);
9999
const mergedExpandedKeys = computed(() => {
100100
if (legacyContext.treeExpandedKeys) {
101-
return toRaw(legacyContext.treeExpandedKeys).slice();
101+
return legacyContext.treeExpandedKeys.slice();
102102
}
103103
return baseProps.searchValue ? searchExpandedKeys.value : expandedKeys.value;
104104
});

components/vc-tree-select/hooks/useCache.ts

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Ref } from 'vue';
2-
import { toRaw, computed, shallowRef } from 'vue';
2+
import { watch, toRaw, computed, shallowRef } from 'vue';
33
import type { LabeledValueType, RawValueType } from '../TreeSelect';
44

55
/**
@@ -10,12 +10,19 @@ export default (values: Ref<LabeledValueType[]>): [Ref<LabeledValueType[]>] => {
1010
const cacheRef = shallowRef({
1111
valueLabels: new Map<RawValueType, any>(),
1212
});
13-
13+
const mergedValues = shallowRef();
14+
watch(
15+
values,
16+
() => {
17+
mergedValues.value = toRaw(values.value);
18+
},
19+
{ immediate: true },
20+
);
1421
const newFilledValues = computed(() => {
1522
const { valueLabels } = cacheRef.value;
1623
const valueLabelsCache = new Map<RawValueType, any>();
1724

18-
const filledValues = toRaw(values.value).map(item => {
25+
const filledValues = mergedValues.value.map(item => {
1926
const { value } = item;
2027
const mergedLabel = item.label ?? valueLabels.get(value);
2128

components/vc-tree-select/hooks/useCheckedKeys.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import type { DataEntity } from '../../vc-tree/interface';
33
import { conductCheck } from '../../vc-tree/utils/conductUtil';
44
import type { LabeledValueType, RawValueType } from '../TreeSelect';
55
import type { Ref, ShallowRef } from 'vue';
6-
import { toRaw, shallowRef, watchEffect } from 'vue';
6+
import { shallowRef, watchEffect } from 'vue';
77

88
export default (
9-
rawLabeledValues: Ref<LabeledValueType[]>,
10-
rawHalfCheckedValues: Ref<LabeledValueType[]>,
9+
rawLabeledValues: ShallowRef<LabeledValueType[]>,
10+
rawHalfCheckedValues: ShallowRef<LabeledValueType[]>,
1111
treeConduction: Ref<boolean>,
1212
keyEntities: Ref<Record<Key, DataEntity>>,
1313
maxLevel: Ref<number>,
@@ -17,10 +17,8 @@ export default (
1717
const newRawHalfCheckedValues = shallowRef<RawValueType[]>([]);
1818

1919
watchEffect(() => {
20-
let checkedKeys: RawValueType[] = toRaw(rawLabeledValues.value).map(({ value }) => value);
21-
let halfCheckedKeys: RawValueType[] = toRaw(rawHalfCheckedValues.value).map(
22-
({ value }) => value,
23-
);
20+
let checkedKeys: RawValueType[] = rawLabeledValues.value.map(({ value }) => value);
21+
let halfCheckedKeys: RawValueType[] = rawHalfCheckedValues.value.map(({ value }) => value);
2422

2523
const missingValues = checkedKeys.filter(key => !keyEntities.value[key]);
2624

components/vc-tree-select/hooks/useDataEntities.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ import type { DataEntity } from '../../vc-tree/interface';
33
import type { FieldNames, RawValueType } from '../TreeSelect';
44

55
import { isNil } from '../utils/valueUtil';
6-
import type { Ref } from 'vue';
7-
import { toRaw, ref, watchEffect } from 'vue';
6+
import type { Ref, ShallowRef } from 'vue';
7+
import { shallowRef, watchEffect } from 'vue';
88
import { warning } from '../../vc-util/warning';
99

10-
export default (treeData: Ref<any>, fieldNames: Ref<FieldNames>) => {
11-
const valueEntities = ref<Map<RawValueType, DataEntity>>(new Map());
12-
const keyEntities = ref<Record<string, DataEntity>>({});
10+
export default (treeData: ShallowRef<any>, fieldNames: Ref<FieldNames>) => {
11+
const valueEntities = shallowRef<Map<RawValueType, DataEntity>>(new Map());
12+
const keyEntities = shallowRef<Record<string, DataEntity>>({});
1313
watchEffect(() => {
1414
const fieldNamesValue = fieldNames.value;
15-
const collection = convertDataToEntities(toRaw(treeData.value), {
15+
const collection = convertDataToEntities(treeData.value, {
1616
fieldNames: fieldNamesValue,
1717
initWrapper: wrapper => ({
1818
...wrapper,

components/vc-tree-select/hooks/useFilterTreeData.ts

+4-20
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import type { Ref } from 'vue';
2-
import { toRaw, computed } from 'vue';
1+
import type { Ref, ShallowRef } from 'vue';
2+
import { computed } from 'vue';
33
import type { DefaultOptionType, InternalFieldName, TreeSelectProps } from '../TreeSelect';
44
import { fillLegacyProps } from '../utils/legacyUtil';
55

66
type GetFuncType<T> = T extends boolean ? never : T;
77
type FilterFn = GetFuncType<TreeSelectProps['filterTreeNode']>;
88

99
export default (
10-
treeData: Ref<DefaultOptionType[]>,
10+
treeData: ShallowRef<DefaultOptionType[]>,
1111
searchValue: Ref<string>,
1212
{
1313
treeNodeFilterProp,
@@ -56,24 +56,8 @@ export default (
5656
}
5757
}
5858
return res;
59-
// return list
60-
// .map(dataNode => {
61-
// const children = dataNode[fieldChildren];
62-
63-
// const match = keepAll || filterOptionFunc(searchValueVal, fillLegacyProps(dataNode));
64-
// const childList = dig(children || [], match);
65-
66-
// if (match || childList.length) {
67-
// return {
68-
// ...dataNode,
69-
// [fieldChildren]: childList,
70-
// };
71-
// }
72-
// return null;
73-
// })
74-
// .filter(node => node);
7559
}
7660

77-
return dig(toRaw(treeData.value));
61+
return dig(treeData.value);
7862
});
7963
};

0 commit comments

Comments
 (0)