Skip to content

Commit 6dfb2e5

Browse files
committed
Merge remote-tracking branch 'next' into v2.3
2 parents 5f1734c + 4135161 commit 6dfb2e5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1176
-913
lines changed

.github/workflows/issue-reply.yml

+14-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
steps:
1111
- name: Need Reproduce
1212
if: github.event.label.name == '🤔 Need Reproduce'
13-
uses: actions-cool/issues-helper@v1
13+
uses: actions-cool/issues-helper@v1.2
1414
with:
1515
actions: 'create-comment'
1616
issue-number: ${{ github.event.issue.number }}
@@ -21,11 +21,23 @@ jobs:
2121
2222
- name: help wanted
2323
if: github.event.label.name == 'help wanted'
24-
uses: actions-cool/issues-helper@v1
24+
uses: actions-cool/issues-helper@v1.2
2525
with:
2626
actions: 'create-comment'
2727
issue-number: ${{ github.event.issue.number }}
2828
body: |
2929
Hello @${{ github.event.issue.user.login }}. We totally like your proposal/feedback, welcome to send us a Pull Request for it. Please send your Pull Request to proper branch, fill the Pull Request Template here, provide changelog/TypeScript/documentation/test cases if needed and make sure CI passed, we will review it soon. We appreciate your effort in advance and looking forward to your contribution!
3030
3131
你好 @${{ github.event.issue.user.login }},我们完全同意你的提议/反馈,欢迎直接在此仓库创建一个 Pull Request 来解决这个问题。请将 Pull Request 发到正确的分支,务必填写 Pull Request 内的预设模板,提供改动所需相应的 changelog、TypeScript 定义、测试用例、文档等,并确保 CI 通过,我们会尽快进行 Review,提前感谢和期待您的贡献。
32+
33+
- name: Usage
34+
if: github.event.label.name == 'Usage'
35+
uses: actions-cool/[email protected]
36+
with:
37+
actions: 'create-comment, close-issue'
38+
issue-number: ${{ github.event.issue.number }}
39+
body: |
40+
Hello @${{ github.event.issue.user.login }}, we use GitHub issues to trace bugs or discuss plans of Ant Design Vue. So, please don't ask usage questions here. You can try to open a new discussion in [antdv discussions](https://github.com/vueComponent/ant-design-vue/discussions), select `Q&A` to ask questions, also can ask questions on [Stack Overflow](http://stackoverflow.com/questions/) or [Segment Fault](https://segmentfault.com).
41+
42+
你好 @${{ github.event.issue.user.login }},Ant Design Vue Issue 板块是用于 bug 反馈与需求讨论的地方。请勿询问如何使用的问题,你可以试着在 [antdv discussions](https://github.com/vueComponent/ant-design-vue/discussions) 新开一个 discussion,选择 `Q&A` 类别进行提问,也可以在 [Stack Overflow](http://stackoverflow.com/questions/) 或者 [Segment Fault](https://segmentfault.com/) 中提问。
43+

.github/workflows/pr-labeled.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: PR Labeled
2+
3+
on:
4+
pull_request_target:
5+
types: [labeled]
6+
7+
jobs:
8+
reply:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Usage
12+
if: github.event.label.name == 'Usage'
13+
uses: actions-cool/[email protected]
14+
with:
15+
actions: 'create-comment, close-issue'
16+
issue-number: ${{ github.event.pull_request.number }}
17+
body: |
18+
Hello @${{ github.event.pull_request.user.login }}, we use GitHub PR to build and perfect of Ant Design Vue. So, please don't ask usage questions here. You can try to open a new discussion in [antdv discussions](https://github.com/vueComponent/ant-design-vue/discussions), select `Q&A` to ask questions, also can ask questions on [Stack Overflow](http://stackoverflow.com/questions/) or [Segment Fault](https://segmentfault.com).
19+
20+
你好 @${{ github.event.pull_request.user.login }},Ant Design Vue PR 是用于建设、完善项目的地方。请勿询问如何使用的问题,你可以试着在 [antdv discussions](https://github.com/vueComponent/ant-design-vue/discussions) 新开一个 discussion,选择 `Q&A` 类别进行提问,也可以在 [Stack Overflow](http://stackoverflow.com/questions/) 或者 [Segment Fault](https://segmentfault.com/) 中提问。

CHANGELOG.en-US.md

+14
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@
1010

1111
---
1212

13+
## 2.2.3
14+
15+
`2021-08-07`
16+
17+
- 🌟 Use `position: sticky` for the fixed column of `Table` to improve performance and solve the problem of misalignment in some scenes [38569c](https://github.com/vueComponent/ant-design-vue/commit/38569c28c7eb4eaa34f2cc096982daea901062d4)
18+
- 🌟 `Collapse` supports number type key [#4405](https://github.com/vueComponent/ant-design-vue/issues/4405)
19+
- 🌟 Optimize the flickering problem of `Tabs` when selected under windows [#4241](https://github.com/vueComponent/ant-design-vue/issues/4241)
20+
- 🌟 `InputPassword` supports global setting prefixCls [#4430](https://github.com/vueComponent/ant-design-vue/issues/4430)
21+
- 🐞 Fix `Select` cannot scroll issue [#4396](https://github.com/vueComponent/ant-design-vue/issues/4396)
22+
- 🐞 Fix `Badge` error reporting under ssr [#4384](https://github.com/vueComponent/ant-design-vue/issues/4384)
23+
- 🐞 Fix the issue of invalid data fields in `Form` [#4435](https://github.com/vueComponent/ant-design-vue/issues/4435)
24+
- 🐞 Fix an error when the child element of `FormItem` is a native label [#4383](https://github.com/vueComponent/ant-design-vue/issues/4383)
25+
- 🐞 Fix the error when `TreeSelect` customize title through slot [#4459](https://github.com/vueComponent/ant-design-vue/issues/4459)
26+
1327
## 2.2.2
1428

1529
`2021-07-11`

CHANGELOG.zh-CN.md

+14
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@
1010

1111
---
1212

13+
## 2.2.3
14+
15+
`2021-08-07`
16+
17+
- 🌟 `Table` 固定列使用 `position: sticky` , 提升性能,解决部分场景不对齐问题 [38569c](https://github.com/vueComponent/ant-design-vue/commit/38569c28c7eb4eaa34f2cc096982daea901062d4)
18+
- 🌟 `Collapse` 支持 number 类型 key [#4405](https://github.com/vueComponent/ant-design-vue/issues/4405)
19+
- 🌟 优化 `Tabs` 在 windows 下选中时闪动问题 [#4241](https://github.com/vueComponent/ant-design-vue/issues/4241)
20+
- 🌟 `InputPassword` 支持全局设置 prefixCls [#4430](https://github.com/vueComponent/ant-design-vue/issues/4430)
21+
- 🐞 修复 `Select` 无法滚动问题 [#4396](https://github.com/vueComponent/ant-design-vue/issues/4396)
22+
- 🐞 修复 `Badge` 在 ssr 下报错问题 [#4384](https://github.com/vueComponent/ant-design-vue/issues/4384)
23+
- 🐞 修复 `Form` 多出无效数据字段问题 [#4435](https://github.com/vueComponent/ant-design-vue/issues/4435)
24+
- 🐞 修复 `FormItem` 子元素是原生标签时报错问题 [#4383](https://github.com/vueComponent/ant-design-vue/issues/4383)
25+
- 🐞 修复 `TreeSelect` 通过 slot 自定义 title 时报错问题 [#4459](https://github.com/vueComponent/ant-design-vue/issues/4459)
26+
1327
## 2.2.2
1428

1529
`2021-07-11`
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import type { Ref } from 'vue';
2+
import { onBeforeUnmount, ref } from 'vue';
3+
import wrapperRaf from '../raf';
4+
5+
export type Updater<State> = (prev: State) => State;
6+
/**
7+
* Execute code before next frame but async
8+
*/
9+
export function useLayoutState<State>(
10+
defaultState: State,
11+
): [Ref<State>, (updater: Updater<State>) => void] {
12+
const stateRef = ref(defaultState);
13+
let tempState = stateRef.value;
14+
15+
let updateBatchRef = [];
16+
const rafRef = ref();
17+
function setFrameState(updater: Updater<State>) {
18+
wrapperRaf.cancel(rafRef.value);
19+
updateBatchRef.push(updater);
20+
21+
rafRef.value = wrapperRaf(() => {
22+
const prevBatch = updateBatchRef;
23+
// const prevState = stateRef.value;
24+
updateBatchRef = [];
25+
26+
prevBatch.forEach(batchUpdater => {
27+
tempState = batchUpdater(tempState);
28+
});
29+
30+
// if (tempState !== stateRef.value) {
31+
stateRef.value = tempState;
32+
// }
33+
});
34+
}
35+
36+
onBeforeUnmount(() => {
37+
wrapperRaf.cancel(rafRef.value);
38+
});
39+
40+
return [stateRef as Ref<State>, setFrameState];
41+
}

components/_util/pickAttrs.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const eventsName = `onCopy onCut onPaste onCompositionend onCompositionstart onC
1515
onKeypress onKeyup onFocus onBlur onChange onInput onSubmit onClick onContextmenu onDoubleclick onDblclick
1616
onDrag onDragend onDragenter onDragexit onDragleave onDragover onDragstart onDrop onMousedown
1717
onMouseenter onMouseleave onMousemove onMouseout onMouseover onMouseup onSelect onTouchcancel
18-
onTouchend onTouchmove onTouchstart onScroll onWheel onAbort onCanplay onCanplaythrough
18+
onTouchend onTouchmove onTouchstart onTouchstartPassive onTouchmovePassive onScroll onWheel onAbort onCanplay onCanplaythrough
1919
onDurationchange onEmptied onEncrypted onEnded onError onLoadeddata onLoadedmetadata
2020
onLoadstart onPause onPlay onPlaying onProgress onRatechange onSeeked onSeeking onStalled onSuspend onTimeupdate onVolumechange onWaiting onLoad onError`;
2121

components/_util/props-util/index.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,10 @@ export function isEmptyContent(c) {
339339

340340
export function isEmptyElement(c) {
341341
return (
342-
c.type === Comment ||
343-
(c.type === Fragment && c.children.length === 0) ||
344-
(c.type === Text && c.children.trim() === '')
342+
c &&
343+
(c.type === Comment ||
344+
(c.type === Fragment && c.children.length === 0) ||
345+
(c.type === Text && c.children.trim() === ''))
345346
);
346347
}
347348

components/_util/type.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { App, PropType, VNodeChild, Plugin } from 'vue';
22

3-
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
43
// https://stackoverflow.com/questions/46176165/ways-to-get-string-literal-type-of-array-values-without-enum-overhead
54
export const tuple = <T extends string[]>(...args: T) => args;
65

components/badge/Badge.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export default defineComponent({
114114
[`${prefixCls.value}-count-sm`]: props.size === 'small',
115115
[`${prefixCls.value}-multiple-words`]:
116116
!isDotRef.value && displayCount.value && displayCount.value.toString().length > 1,
117-
[`${prefixCls.value}-status-${status}`]: !!status,
117+
[`${prefixCls.value}-status-${props.status}`]: !!props.status,
118118
[`${prefixCls.value}-status-${props.color}`]: isPresetColor(props.color),
119119
}));
120120

components/breadcrumb/Breadcrumb.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { flattenChildren, getPropsSlot } from '../_util/props-util';
55
import warning from '../_util/warning';
66
import BreadcrumbItem from './BreadcrumbItem';
77
import Menu from '../menu';
8-
import type { Omit, VueNode } from '../_util/type';
8+
import type { VueNode } from '../_util/type';
99
import useConfigInject from '../_util/hooks/useConfigInject';
1010

1111
export interface Route {

components/form/FormItem.tsx

+26-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { PropType, ExtractPropTypes, ComputedRef } from 'vue';
2+
import { watch } from 'vue';
23
import { defineComponent, computed, nextTick, ref, watchEffect, onBeforeUnmount } from 'vue';
34
import cloneDeep from 'lodash-es/cloneDeep';
45
import PropTypes from '../_util/vue-types';
@@ -271,16 +272,31 @@ export default defineComponent({
271272
clearValidate,
272273
resetField,
273274
});
274-
formContext.addField(eventKey, {
275-
fieldValue,
276-
fieldId,
275+
let registered = false;
276+
watch(
277277
fieldName,
278-
resetField,
279-
clearValidate,
280-
namePath,
281-
validateRules,
282-
rules: rulesRef,
283-
});
278+
val => {
279+
if (val) {
280+
if (!registered) {
281+
registered = true;
282+
formContext.addField(eventKey, {
283+
fieldValue,
284+
fieldId,
285+
fieldName,
286+
resetField,
287+
clearValidate,
288+
namePath,
289+
validateRules,
290+
rules: rulesRef,
291+
});
292+
}
293+
} else {
294+
registered = false;
295+
formContext.removeField(eventKey);
296+
}
297+
},
298+
{ immediate: true },
299+
);
284300
onBeforeUnmount(() => {
285301
formContext.removeField(eventKey);
286302
});
@@ -306,7 +322,7 @@ export default defineComponent({
306322
const children = flattenChildren(slots.default?.());
307323
let firstChildren = children[0];
308324
if (fieldName.value && props.autoLink && isValidElement(firstChildren)) {
309-
const originalEvents = firstChildren.props;
325+
const originalEvents = firstChildren.props || {};
310326
const originalBlur = originalEvents.onBlur;
311327
const originalChange = originalEvents.onChange;
312328
firstChildren = cloneElement(firstChildren, {

components/form/useForm.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ function useForm(
108108
resetFields: (newValues?: Props) => void;
109109
validate: <T = any>(names?: namesType, option?: validateOptions) => Promise<T>;
110110
validateField: (
111-
name?: string,
112-
value?: any,
113-
rules?: [Record<string, unknown>],
111+
name: string,
112+
value: any,
113+
rules: Record<string, unknown>[],
114114
option?: validateOptions,
115115
) => Promise<RuleError[]>;
116116
mergeValidateInfo: (items: ValidateInfo | ValidateInfo[]) => ValidateInfo;
@@ -236,8 +236,8 @@ function useForm(
236236
const validateField = (
237237
name: string,
238238
value: any,
239-
rules: any,
240-
option: validateOptions,
239+
rules: Record<string, unknown>[],
240+
option: validateOptions = {},
241241
): Promise<RuleError[]> => {
242242
const promise = validateRules(
243243
[name],

components/input/Password.tsx

+15-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import EyeInvisibleOutlined from '@ant-design/icons-vue/EyeInvisibleOutlined';
77
import inputProps from './inputProps';
88
import PropTypes from '../_util/vue-types';
99
import BaseMixin from '../_util/BaseMixin';
10-
import { defineComponent } from 'vue';
10+
import { defineComponent, inject } from 'vue';
11+
import { defaultConfigProvider } from '../config-provider';
1112

1213
const ActionMap = {
1314
click: 'onClick',
@@ -20,8 +21,8 @@ export default defineComponent({
2021
inheritAttrs: false,
2122
props: {
2223
...inputProps,
23-
prefixCls: PropTypes.string.def('ant-input-password'),
24-
inputPrefixCls: PropTypes.string.def('ant-input'),
24+
prefixCls: PropTypes.string,
25+
inputPrefixCls: PropTypes.string,
2526
action: PropTypes.string.def('click'),
2627
visibilityToggle: PropTypes.looseBool.def(true),
2728
iconRender: PropTypes.func.def((visible: boolean) =>
@@ -31,6 +32,7 @@ export default defineComponent({
3132
setup() {
3233
return {
3334
input: null,
35+
configProvider: inject('configProvider', defaultConfigProvider),
3436
};
3537
},
3638
data() {
@@ -56,8 +58,8 @@ export default defineComponent({
5658
visible: !this.visible,
5759
});
5860
},
59-
getIcon() {
60-
const { prefixCls, action } = this.$props;
61+
getIcon(prefixCls) {
62+
const { action } = this.$props;
6163
const iconTrigger = ActionMap[action] || '';
6264
const iconRender = this.$slots.iconRender || this.$props.iconRender;
6365
const icon = iconRender(this.visible);
@@ -81,8 +83,8 @@ export default defineComponent({
8183
},
8284
render() {
8385
const {
84-
prefixCls,
85-
inputPrefixCls,
86+
prefixCls: customizePrefixCls,
87+
inputPrefixCls: customizeInputPrefixCls,
8688
size,
8789
suffix,
8890
action,
@@ -91,7 +93,12 @@ export default defineComponent({
9193
...restProps
9294
} = getOptionProps(this);
9395
const { class: className } = this.$attrs;
94-
const suffixIcon = visibilityToggle && this.getIcon();
96+
97+
const getPrefixCls = this.configProvider.getPrefixCls;
98+
const inputPrefixCls = getPrefixCls('input', customizeInputPrefixCls);
99+
const prefixCls = getPrefixCls('input-password', customizePrefixCls);
100+
101+
const suffixIcon = visibilityToggle && this.getIcon(prefixCls);
95102
const inputClassName = classNames(prefixCls, className, {
96103
[`${prefixCls}-${size}`]: !!size,
97104
});

0 commit comments

Comments
 (0)