From 203e42382f548347519d996a629fd9553642ad35 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Tue, 6 Jul 2021 21:58:05 +0800 Subject: [PATCH 01/13] fix: timepicker error border not show #4331 --- .../__snapshots__/index.test.js.snap | 102 +++++++++--------- .../__snapshots__/index.test.js.snap | 2 +- components/time-picker/index.tsx | 4 + components/vc-time-picker/TimePicker.jsx | 4 +- 4 files changed, 59 insertions(+), 53 deletions(-) diff --git a/components/locale-provider/__tests__/__snapshots__/index.test.js.snap b/components/locale-provider/__tests__/__snapshots__/index.test.js.snap index e7de8ecd5..c002bb226 100644 --- a/components/locale-provider/__tests__/__snapshots__/index.test.js.snap +++ b/components/locale-provider/__tests__/__snapshots__/index.test.js.snap @@ -609,7 +609,7 @@ exports[`Locale Provider should display the text as ar 1`] = `
- + ~ @@ -1151,7 +1151,7 @@ exports[`Locale Provider should display the text as bg 1`] = `
- + ~ @@ -1693,7 +1693,7 @@ exports[`Locale Provider should display the text as ca 1`] = `
- + ~ @@ -2235,7 +2235,7 @@ exports[`Locale Provider should display the text as cs 1`] = `
- + ~ @@ -2777,7 +2777,7 @@ exports[`Locale Provider should display the text as da 1`] = `
- + ~ @@ -3319,7 +3319,7 @@ exports[`Locale Provider should display the text as de 1`] = `
- + ~ @@ -3861,7 +3861,7 @@ exports[`Locale Provider should display the text as el 1`] = `
- + ~ @@ -4403,7 +4403,7 @@ exports[`Locale Provider should display the text as en 1`] = `
- + ~ @@ -4945,7 +4945,7 @@ exports[`Locale Provider should display the text as en-gb 1`] = `
- + ~ @@ -5487,7 +5487,7 @@ exports[`Locale Provider should display the text as es 1`] = `
- + ~ @@ -6029,7 +6029,7 @@ exports[`Locale Provider should display the text as et 1`] = `
- + ~ @@ -6571,7 +6571,7 @@ exports[`Locale Provider should display the text as fa 1`] = `
- + ~ @@ -7113,7 +7113,7 @@ exports[`Locale Provider should display the text as fi 1`] = `
- + ~ @@ -7655,7 +7655,7 @@ exports[`Locale Provider should display the text as fr 1`] = `
- + ~ @@ -8197,7 +8197,7 @@ exports[`Locale Provider should display the text as fr 2`] = `
- + ~ @@ -8739,7 +8739,7 @@ exports[`Locale Provider should display the text as he 1`] = `
- + ~ @@ -9281,7 +9281,7 @@ exports[`Locale Provider should display the text as hi 1`] = `
- + ~ @@ -9823,7 +9823,7 @@ exports[`Locale Provider should display the text as hr 1`] = `
- + ~ @@ -10365,7 +10365,7 @@ exports[`Locale Provider should display the text as hu 1`] = `
- + ~ @@ -10907,7 +10907,7 @@ exports[`Locale Provider should display the text as hy 1`] = `
- + ~ @@ -11449,7 +11449,7 @@ exports[`Locale Provider should display the text as id 1`] = `
- + ~ @@ -11991,7 +11991,7 @@ exports[`Locale Provider should display the text as is 1`] = `
- + ~ @@ -12533,7 +12533,7 @@ exports[`Locale Provider should display the text as it 1`] = `
- + ~ @@ -13075,7 +13075,7 @@ exports[`Locale Provider should display the text as ja 1`] = `
- + ~ @@ -13617,7 +13617,7 @@ exports[`Locale Provider should display the text as kn 1`] = `
- + ~ @@ -14159,7 +14159,7 @@ exports[`Locale Provider should display the text as ko 1`] = `
- + ~ @@ -14701,7 +14701,7 @@ exports[`Locale Provider should display the text as ku-iq 1`] = `
- + ~ @@ -15243,7 +15243,7 @@ exports[`Locale Provider should display the text as lv 1`] = `
- + ~ @@ -15785,7 +15785,7 @@ exports[`Locale Provider should display the text as mk 1`] = `
- + ~ @@ -16327,7 +16327,7 @@ exports[`Locale Provider should display the text as mn-mn 1`] = `
- + ~ @@ -16869,7 +16869,7 @@ exports[`Locale Provider should display the text as ms-my 1`] = `
- + ~ @@ -17411,7 +17411,7 @@ exports[`Locale Provider should display the text as nb 1`] = `
- + ~ @@ -17953,7 +17953,7 @@ exports[`Locale Provider should display the text as ne-np 1`] = `
- + ~ @@ -18495,7 +18495,7 @@ exports[`Locale Provider should display the text as nl 1`] = `
- + ~ @@ -19037,7 +19037,7 @@ exports[`Locale Provider should display the text as nl-be 1`] = `
- + ~ @@ -19579,7 +19579,7 @@ exports[`Locale Provider should display the text as pl 1`] = `
- + ~ @@ -20121,7 +20121,7 @@ exports[`Locale Provider should display the text as pt 1`] = `
- + ~ @@ -20663,7 +20663,7 @@ exports[`Locale Provider should display the text as pt-br 1`] = `
- + ~ @@ -21205,7 +21205,7 @@ exports[`Locale Provider should display the text as ro 1`] = `
- + ~ @@ -21747,7 +21747,7 @@ exports[`Locale Provider should display the text as ru 1`] = `
- + ~ @@ -22289,7 +22289,7 @@ exports[`Locale Provider should display the text as sk 1`] = `
- + ~ @@ -22831,7 +22831,7 @@ exports[`Locale Provider should display the text as sl 1`] = `
- + ~ @@ -23373,7 +23373,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- + ~ @@ -23915,7 +23915,7 @@ exports[`Locale Provider should display the text as sv 1`] = `
- + ~ @@ -24457,7 +24457,7 @@ exports[`Locale Provider should display the text as ta 1`] = `
- + ~ @@ -24999,7 +24999,7 @@ exports[`Locale Provider should display the text as th 1`] = `
- + ~ @@ -25541,7 +25541,7 @@ exports[`Locale Provider should display the text as tr 1`] = `
- + ~ @@ -26083,7 +26083,7 @@ exports[`Locale Provider should display the text as uk 1`] = `
- + ~ @@ -26625,7 +26625,7 @@ exports[`Locale Provider should display the text as vi 1`] = `
- + ~ @@ -27167,7 +27167,7 @@ exports[`Locale Provider should display the text as zh-cn 1`] = `
- + ~ @@ -27709,7 +27709,7 @@ exports[`Locale Provider should display the text as zh-tw 1`] = `
- + ~ diff --git a/components/time-picker/__tests__/__snapshots__/index.test.js.snap b/components/time-picker/__tests__/__snapshots__/index.test.js.snap index efdd99b93..20ee54124 100644 --- a/components/time-picker/__tests__/__snapshots__/index.test.js.snap +++ b/components/time-picker/__tests__/__snapshots__/index.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`TimePicker not render clean icon when allowClear is false 1`] = ` - + `; diff --git a/components/time-picker/index.tsx b/components/time-picker/index.tsx index 479561920..8103baf17 100644 --- a/components/time-picker/index.tsx +++ b/components/time-picker/index.tsx @@ -20,6 +20,7 @@ import { TimeOrTimesType, } from '../_util/moment-util'; import { tuple, withInstall } from '../_util/type'; +import classNames from '../_util/classNames'; export function generateShowHourMinuteSecond(format: string) { // Ref: http://momentjs.com/docs/#/parsing/string-format/ @@ -213,6 +214,8 @@ const TimePicker = defineComponent({ const { prefixCls: customizePrefixCls, getPopupContainer, placeholder, size } = props; const getPrefixCls = this.configProvider.getPrefixCls; const prefixCls = getPrefixCls('time-picker', customizePrefixCls); + const inputPrefixCls = getPrefixCls('input'); + const pickerInputClass = classNames(`${prefixCls}-input`, inputPrefixCls); const format = this.getDefaultFormat(); const pickerClassName = { @@ -236,6 +239,7 @@ const TimePicker = defineComponent({ ...this.$attrs, allowEmpty: this.getAllowClear(), prefixCls, + pickerInputClass, getPopupContainer: getPopupContainer || getContextPopupContainer, format, value: this.sValue, diff --git a/components/vc-time-picker/TimePicker.jsx b/components/vc-time-picker/TimePicker.jsx index 8f16b52be..acf433302 100644 --- a/components/vc-time-picker/TimePicker.jsx +++ b/components/vc-time-picker/TimePicker.jsx @@ -35,6 +35,7 @@ export default defineComponent({ return moment(); }, }, + pickerInputClass: String, inputReadOnly: PropTypes.looseBool, disabled: PropTypes.looseBool, allowEmpty: PropTypes.looseBool, @@ -346,6 +347,7 @@ export default defineComponent({ onFocus, onBlur, popupStyle, + pickerInputClass, } = this; const { class: className, style } = this.$attrs; const popupClassName = this.getPopupClassName(); @@ -368,7 +370,7 @@ export default defineComponent({ > Date: Wed, 7 Jul 2021 21:24:14 +0800 Subject: [PATCH 02/13] fix(UploadDragger): fix UploadDrager no export (#4334) --- components/components.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/components.ts b/components/components.ts index f02cb7ad8..e901d6a9a 100644 --- a/components/components.ts +++ b/components/components.ts @@ -192,6 +192,6 @@ export { export type { UploadProps } from './upload'; -export { default as Upload } from './upload'; +export { default as Upload, UploadDragger } from './upload'; export { default as LocaleProvider } from './locale-provider'; From 427cf36eaa47f41e9f9e34231fb2d74db3a1abf8 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 7 Jul 2021 21:35:41 +0800 Subject: [PATCH 03/13] refactor(switch): support customize checked value #4329 (#4332) * refactor(switch): support customize checked value #4329 * test: add test case * refactor: update props name * refactor: update ts * refactor: optimize --- components/switch/__tests__/index.test.js | 28 +++++++++ components/switch/index.tsx | 74 ++++++++++++++--------- 2 files changed, 74 insertions(+), 28 deletions(-) diff --git a/components/switch/__tests__/index.test.js b/components/switch/__tests__/index.test.js index 73061036f..55980437b 100644 --- a/components/switch/__tests__/index.test.js +++ b/components/switch/__tests__/index.test.js @@ -4,6 +4,7 @@ import focusTest from '../../../tests/shared/focusTest'; import { resetWarned } from '../../_util/warning'; import mountTest from '../../../tests/shared/mountTest'; import { ref } from 'vue'; +import { asyncExpect } from '@/tests/utils'; describe('Switch', () => { focusTest(Switch); @@ -42,4 +43,31 @@ describe('Switch', () => { ); errorSpy.mockRestore(); }); + + it('customize checked value should work', async () => { + resetWarned(); + const checked = ref(1); + const onUpdate = val => (checked.value = val); + const wrapper = mount({ + render() { + return ( + + ); + }, + }); + await asyncExpect(() => { + wrapper.find('button').trigger('click'); + }); + expect(checked.value).toBe(2); + + await asyncExpect(() => { + wrapper.find('button').trigger('click'); + }); + expect(checked.value).toBe(1); + }); }); diff --git a/components/switch/index.tsx b/components/switch/index.tsx index 4febcce82..647b3961f 100644 --- a/components/switch/index.tsx +++ b/components/switch/index.tsx @@ -1,4 +1,4 @@ -import type { ExtractPropTypes } from 'vue'; +import type { ExtractPropTypes, PropType } from 'vue'; import { defineComponent, inject, @@ -19,23 +19,35 @@ import { tuple, withInstall } from '../_util/type'; import { getPropsSlot } from '../_util/props-util'; import Omit from 'omit.js'; -export const SwitchSizes = tuple('small', 'default', 'large'); +export const SwitchSizes = tuple('small', 'default'); const switchProps = { prefixCls: PropTypes.string, size: PropTypes.oneOf(SwitchSizes), disabled: PropTypes.looseBool, - checkedChildren: PropTypes.any, - unCheckedChildren: PropTypes.any, + checkedChildren: PropTypes.VNodeChild, + unCheckedChildren: PropTypes.VNodeChild, tabindex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), autofocus: PropTypes.looseBool, loading: PropTypes.looseBool, - checked: PropTypes.looseBool, - onChange: PropTypes.func, - onClick: PropTypes.func, - onKeydown: PropTypes.func, - onMouseup: PropTypes.func, - 'onUpdate:checked': PropTypes.func, + checked: PropTypes.any, + checkedValue: PropTypes.any.def(true), + uncheckedValue: PropTypes.any.def(false), + onChange: { + type: Function as PropType<(checked: any, e: Event) => void>, + }, + onClick: { + type: Function as PropType<(checked: any, e: Event) => void>, + }, + onKeydown: { + type: Function as PropType<(e: Event) => void>, + }, + onMouseup: { + type: Function as PropType<(e: Event) => void>, + }, + 'onUpdate:checked': { + type: Function as PropType<(checked: any) => void>, + }, }; export type SwitchProps = Partial>; @@ -46,7 +58,7 @@ const Switch = defineComponent({ inheritAttrs: false, props: switchProps, emits: ['update:checked', 'mouseup', 'change', 'click', 'keydown'], - setup(props: SwitchProps, { attrs, slots, expose, emit }) { + setup(props, { attrs, slots, expose, emit }) { onBeforeMount(() => { warning( !('defaultChecked' in attrs), @@ -59,12 +71,13 @@ const Switch = defineComponent({ '`value` is not validate prop, do you mean `checked`?', ); }); - const checked = ref(props.checked !== undefined ? !!props.checked : !!attrs.defaultChecked); + const checked = ref(props.checked !== undefined ? props.checked : attrs.defaultChecked); + const checkedStatus = computed(() => checked.value === props.checkedValue); watch( () => props.checked, () => { - checked.value = !!props.checked; + checked.value = props.checked; }, ); @@ -92,29 +105,26 @@ const Switch = defineComponent({ }); }); - const setChecked = (check: boolean, e: MouseEvent | KeyboardEvent) => { + const setChecked = (check: any, e: MouseEvent | KeyboardEvent) => { if (props.disabled) { return; } - if (props.checked === undefined) { - checked.value = check; - } emit('update:checked', check); emit('change', check, e); }; const handleClick = (e: MouseEvent) => { focus(); - const newChecked = !checked.value; + const newChecked = checkedStatus.value ? props.uncheckedValue : props.checkedValue; setChecked(newChecked, e); emit('click', newChecked, e); }; const handleKeyDown = (e: KeyboardEvent) => { if (e.keyCode === KeyCode.LEFT) { - setChecked(false, e); + setChecked(props.uncheckedValue, e); } else if (e.keyCode === KeyCode.RIGHT) { - setChecked(true, e); + setChecked(props.checkedValue, e); } emit('keydown', e); }; @@ -123,6 +133,13 @@ const Switch = defineComponent({ refSwitchNode.value?.blur(); emit('mouseup', e); }; + + const classNames = computed(() => ({ + [`${prefixCls.value}-small`]: props.size === 'small', + [`${prefixCls.value}-loading`]: props.loading, + [`${prefixCls.value}-checked`]: checkedStatus.value, + [`${prefixCls.value}-disabled`]: props.disabled, + })); return () => ( `; diff --git a/components/switch/__tests__/index.test.js b/components/switch/__tests__/index.test.js index 55980437b..5fb8e501c 100644 --- a/components/switch/__tests__/index.test.js +++ b/components/switch/__tests__/index.test.js @@ -54,7 +54,7 @@ describe('Switch', () => { ); diff --git a/tests/__snapshots__/index.test.js.snap b/tests/__snapshots__/index.test.js.snap index 15eaac19f..a203e4711 100644 --- a/tests/__snapshots__/index.test.js.snap +++ b/tests/__snapshots__/index.test.js.snap @@ -126,6 +126,7 @@ Array [ "TypographyText", "TypographyTitle", "Upload", + "UploadDragger", "LocaleProvider", ] `; From cf2ffa2bd943ecaa839cf656f7701f559ec4eb59 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Wed, 7 Jul 2021 22:09:09 +0800 Subject: [PATCH 06/13] feat: udpate switch ts --- components/switch/index.tsx | 22 ++++++++++++++-------- v2-doc | 2 +- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/components/switch/index.tsx b/components/switch/index.tsx index cfd7e2591..0d038946a 100644 --- a/components/switch/index.tsx +++ b/components/switch/index.tsx @@ -11,7 +11,7 @@ import Omit from 'omit.js'; import useConfigInject from '../_util/hooks/useConfigInject'; export const SwitchSizes = tuple('small', 'default'); - +type CheckedType = boolean | string | number; const switchProps = { prefixCls: PropTypes.string, size: PropTypes.oneOf(SwitchSizes), @@ -21,14 +21,20 @@ const switchProps = { tabindex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), autofocus: PropTypes.looseBool, loading: PropTypes.looseBool, - checked: PropTypes.any, - checkedValue: PropTypes.any.def(true), - unCheckedValue: PropTypes.any.def(false), + checked: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.looseBool]), + checkedValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.looseBool]).def( + true, + ), + unCheckedValue: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.number, + PropTypes.looseBool, + ]).def(false), onChange: { - type: Function as PropType<(checked: any, e: Event) => void>, + type: Function as PropType<(checked: CheckedType, e: Event) => void>, }, onClick: { - type: Function as PropType<(checked: any, e: Event) => void>, + type: Function as PropType<(checked: CheckedType, e: Event) => void>, }, onKeydown: { type: Function as PropType<(e: Event) => void>, @@ -37,7 +43,7 @@ const switchProps = { type: Function as PropType<(e: Event) => void>, }, 'onUpdate:checked': { - type: Function as PropType<(checked: any) => void>, + type: Function as PropType<(checked: CheckedType) => void>, }, }; @@ -92,7 +98,7 @@ const Switch = defineComponent({ }); }); - const setChecked = (check: any, e: MouseEvent | KeyboardEvent) => { + const setChecked = (check: CheckedType, e: MouseEvent | KeyboardEvent) => { if (props.disabled) { return; } diff --git a/v2-doc b/v2-doc index 89612874e..b9934e0de 160000 --- a/v2-doc +++ b/v2-doc @@ -1 +1 @@ -Subproject commit 89612874e476dc788711cdaedfd037b9497e5e78 +Subproject commit b9934e0de1052a73978cdb9fb401fa7b5eaf8ecc From 60aeec7033b226efb424c084502ee8db4f643b37 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Wed, 7 Jul 2021 22:16:13 +0800 Subject: [PATCH 07/13] docs: remove ie11 --- CHANGELOG.en-US.md | 1 - CHANGELOG.zh-CN.md | 1 - README-zh_CN.md | 2 +- README.md | 2 +- v2-doc | 2 +- 5 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 43818f861..890318196 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -437,7 +437,6 @@ ### Compatibility adjustment -- The minimum supported version of IE is IE 11. - The minimum supported version of Vue is Vue 3.0. #### Adjusted API diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 80f6cda2d..72155c3eb 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -440,7 +440,6 @@ ### 兼容性调整 -- IE 最低支持版本为 IE 11。 - Vue 最低支持版本为 Vue 3.0。 #### 调整的 API diff --git a/README-zh_CN.md b/README-zh_CN.md index f1af042d8..b45bf577f 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -28,7 +28,7 @@ An enterprise-class UI components based on Ant Design and Vue 3. ## 支持环境 -- 现代浏览器和 IE11 及以上。1.x 版本支持 IE 9+(需要 [polyfills](https://www.antdv.com/docs/vue/getting-started-cn/#兼容性)) +- 现代浏览器。1.x 版本支持 IE 9+(需要 [polyfills](https://www.antdv.com/docs/vue/getting-started-cn/#兼容性)) - 支持服务端渲染。 - [Electron](https://electronjs.org/) - 支持 Vue 2 和 Vue 3 diff --git a/README.md b/README.md index 437cb6931..744b89e36 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ English | [简体中文](./README-zh_CN.md) ## Environment Support -- Modern browsers and Internet Explorer 11+. v1.x support Internet Explorer 9+ (with [polyfills](https://www.antdv.com/docs/vue/getting-started/#Compatibility)) +- Modern browsers. v1.x support Internet Explorer 9+ (with [polyfills](https://www.antdv.com/docs/vue/getting-started/#Compatibility)) - Server-side Rendering - Support Vue 2 & Vue 3 - [Electron](https://electronjs.org/) diff --git a/v2-doc b/v2-doc index b9934e0de..d965edbb9 160000 --- a/v2-doc +++ b/v2-doc @@ -1 +1 @@ -Subproject commit b9934e0de1052a73978cdb9fb401fa7b5eaf8ecc +Subproject commit d965edbb9045771095acf91489145e13c975cb51 From 1152e8cd71cadf9e8fb4797916adca20c0e35974 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Thu, 8 Jul 2021 11:36:32 +0800 Subject: [PATCH 08/13] fix: tree-select throw error when use slot title --- components/vc-tree-select/src/Selector/SingleSelector.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/vc-tree-select/src/Selector/SingleSelector.jsx b/components/vc-tree-select/src/Selector/SingleSelector.jsx index 1f1ab4e0a..cff257733 100644 --- a/components/vc-tree-select/src/Selector/SingleSelector.jsx +++ b/components/vc-tree-select/src/Selector/SingleSelector.jsx @@ -64,7 +64,7 @@ const SingleSelector = { if (selectorValueList.length && !this.mirrorSearchValue) { const { label, value } = selectorValueList[0]; selectedValueNodes.push( - + {label || value} , ); From fb94726a1e1a7a7e4395facfc224ed3aa420a5cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=89=BE=E6=96=AF=E7=89=B9=E6=B4=9B?= Date: Sun, 11 Jul 2021 10:00:52 +0800 Subject: [PATCH 09/13] fix: TypeScript definition of Table interface for typescript 4.3.5 (#4353) * fix type for typescript 4.3.5 * Update interface.ts close #4296 --- components/table/interface.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/table/interface.ts b/components/table/interface.ts index 1784ecf21..fe56d5133 100644 --- a/components/table/interface.ts +++ b/components/table/interface.ts @@ -60,7 +60,7 @@ export type ColumnProps = Partial> & { filterIcon?: string; filterDropdown?: string; customRender?: string; - [key: string]: string; + [key: string]: string | undefined; }; }; From c20c1f2a32664c12f9f5320f97503868b575c7e3 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Sun, 11 Jul 2021 14:13:07 +0800 Subject: [PATCH 10/13] fix: dropdown submenu style error #4351 close #4351 --- components/dropdown/dropdown.tsx | 2 +- components/dropdown/style/index.less | 4 +++- components/menu/src/Menu.tsx | 4 ++++ components/menu/src/SubMenu.tsx | 9 ++++++--- components/menu/src/hooks/useMenuContext.ts | 2 +- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/components/dropdown/dropdown.tsx b/components/dropdown/dropdown.tsx index ffc160b8f..3021a4d7c 100644 --- a/components/dropdown/dropdown.tsx +++ b/components/dropdown/dropdown.tsx @@ -63,7 +63,7 @@ const Dropdown = defineComponent({ // menu should be focusable in dropdown defaultly const overlayProps = overlayNode && getPropsData(overlayNode); const { selectable = false, focusable = true } = (overlayProps || {}) as any; - const expandIcon = ( + const expandIcon = () => ( diff --git a/components/dropdown/style/index.less b/components/dropdown/style/index.less index 835adb321..f61c38aba 100644 --- a/components/dropdown/style/index.less +++ b/components/dropdown/style/index.less @@ -68,6 +68,9 @@ &-submenu-popup { position: absolute; z-index: @zindex-dropdown; + background: transparent; + box-shadow: none; + transform-origin: 0 0; > .@{dropdown-prefix-cls}-menu { transform-origin: 0 0; @@ -81,7 +84,6 @@ ul { margin-right: 0.3em; margin-left: 0.3em; - padding: 0; } } diff --git a/components/menu/src/Menu.tsx b/components/menu/src/Menu.tsx index 45cd20b19..1f94f1453 100644 --- a/components/menu/src/Menu.tsx +++ b/components/menu/src/Menu.tsx @@ -49,6 +49,8 @@ export const menuProps = { triggerSubMenuAction: { type: String as PropType, default: 'hover' }, getPopupContainer: Function as PropType<(node: HTMLElement) => HTMLElement>, + + expandIcon: Function as PropType<(p?: { isOpen: boolean; [key: string]: any }) => any>, }; export type MenuProps = Partial>; @@ -66,6 +68,7 @@ export default defineComponent({ 'click', 'update:activeKey', ], + slots: ['expandIcon'], setup(props, { slots, emit }) { const { prefixCls, direction } = useConfigInject('menu', props); const store = ref>({}); @@ -371,6 +374,7 @@ export default defineComponent({ unRegisterMenuInfo, selectedSubMenuEventKeys, isRootMenu: true, + expandIcon: props.expandIcon || slots.expandIcon, }); return () => { const childList = flattenChildren(slots.default?.()); diff --git a/components/menu/src/SubMenu.tsx b/components/menu/src/SubMenu.tsx index 762da791b..0aadbd0c7 100644 --- a/components/menu/src/SubMenu.tsx +++ b/components/menu/src/SubMenu.tsx @@ -24,6 +24,7 @@ const subMenuProps = { popupOffset: Array as PropType, internalPopupClose: Boolean, eventKey: String, + expandIcon: Function as PropType<(p?: { isOpen: boolean; [key: string]: any }) => any>, }; export type SubMenuProps = Partial>; @@ -32,7 +33,7 @@ export default defineComponent({ name: 'ASubMenu', inheritAttrs: false, props: subMenuProps, - slots: ['icon', 'title'], + slots: ['icon', 'title', 'expandIcon'], emits: ['titleClick', 'mouseenter', 'mouseleave'], setup(props, { slots, attrs, emit }) { useProvideFirstLevel(false); @@ -84,6 +85,7 @@ export default defineComponent({ selectedSubMenuEventKeys, motion, defaultMotions, + expandIcon: menuExpandIcon, } = useInjectMenu(); registerMenuInfo(eventKey, menuInfo); @@ -226,6 +228,7 @@ export default defineComponent({ const icon = getPropsSlot(slots, props, 'icon'); const title = renderTitle(getPropsSlot(slots, props, 'title'), icon); const subMenuPrefixClsValue = subMenuPrefixCls.value; + const expandIcon = props.expandIcon || slots.expandIcon || menuExpandIcon; let titleNode = (
)} diff --git a/components/menu/src/hooks/useMenuContext.ts b/components/menu/src/hooks/useMenuContext.ts index c200c613e..c7815f2b3 100644 --- a/components/menu/src/hooks/useMenuContext.ts +++ b/components/menu/src/hooks/useMenuContext.ts @@ -77,7 +77,7 @@ export interface MenuContextProps { // // Icon // itemIcon?: RenderIconType; - // expandIcon?: RenderIconType; + expandIcon?: (p?: { isOpen: boolean; [key: string]: any }) => any; // // Function onItemClick: MenuClickEventHandler; From 8ce46ab1a1653dc1ec0fe1fa5fd7428022b265bc Mon Sep 17 00:00:00 2001 From: zanllp Date: Sun, 11 Jul 2021 14:46:45 +0800 Subject: [PATCH 11/13] =?UTF-8?q?fix(notification):=20=E5=AE=8C=E5=96=84no?= =?UTF-8?q?tification=E7=B1=BB=E5=9E=8B=20(#4346)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/notification/index.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/notification/index.tsx b/components/notification/index.tsx index 21b573052..c6a8b712c 100644 --- a/components/notification/index.tsx +++ b/components/notification/index.tsx @@ -212,7 +212,7 @@ function notice(args: NotificationArgsProps) { ); } -const api: any = { +const apiBase = { open: notice, close(key: string) { Object.keys(notificationInstance).forEach(cacheKey => @@ -228,7 +228,11 @@ const api: any = { }, }; -['success', 'info', 'warning', 'error'].forEach(type => { +type NotificationApi = typeof apiBase & + Record) => void>; +const api = apiBase as any as NotificationApi; +const iconTypes: IconType[] = ['success', 'info', 'warning', 'error']; +iconTypes.forEach(type => { api[type] = args => api.open({ ...args, From cf60f9c46f323c9405500d93fcb335d303cd7b3e Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Sun, 11 Jul 2021 21:12:47 +0800 Subject: [PATCH 12/13] release 2.2.2 --- CHANGELOG.en-US.md | 14 ++++++++++++++ CHANGELOG.zh-CN.md | 14 ++++++++++++++ package.json | 2 +- v2-doc | 2 +- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 890318196..ca7d1a36a 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -10,6 +10,20 @@ --- +## 2.2.2 + +`2021-07-11` + +- 🌟 Switch added checkedValue and unCheckedValue attributes to customize checked binding value [#4329](https://github.com/vueComponent/ant-design-vue/issues/4329) +- 🐞 Fix the issue of missing SubMenu animation [#4325](https://github.com/vueComponent/ant-design-vue/issues/4325) +- 🐞 Fix that there is no red box problem when TimePicker validates the error under Form [#4331](https://github.com/vueComponent/ant-design-vue/issues/4331) +- 🐞 Fix UploadDragger does not support vite-plugin-components on-demand loading problem [#4334](https://github.com/vueComponent/ant-design-vue/issues/4334) +- 🐞 Fix the error when TreeSelect customize title through slot [1152e8](https://github.com/vueComponent/ant-design-vue/commit/1152e8cd71cadf9e8fb4797916adca20c0e35974) +- 🐞 Fix the dropdown submenu style loss issue [#4351](https://github.com/vueComponent/ant-design-vue/issues/4351) +- TS + - Fix the type error of Table in ts 4.3.5 version [#4296](https://github.com/vueComponent/ant-design-vue/issues/4296) + - Improve notification type [#4346](https://github.com/vueComponent/ant-design-vue/issues/4346) + ## 2.2.1 `2021-07-06` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 72155c3eb..37bb28086 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -10,6 +10,20 @@ --- +## 2.2.2 + +`2021-07-11` + +- 🌟 Switch 新增 checkedValue、unCheckedValue 属性用于自定义 checked 绑定值 [#4329](https://github.com/vueComponent/ant-design-vue/issues/4329) +- 🐞 修复 SubMenu 动画丢失的问题 [#4325](https://github.com/vueComponent/ant-design-vue/issues/4325) +- 🐞 修复 TimePicker 在 Form 下验证错误时没有红框问题 [#4331](https://github.com/vueComponent/ant-design-vue/issues/4331) +- 🐞 修复 UploadDragger 不支持 vite-plugin-components 按需加载问题 [#4334](https://github.com/vueComponent/ant-design-vue/issues/4334) +- 🐞 修复 TreeSelect 通过 slot 自定义 title 时报错问题 [1152e8](https://github.com/vueComponent/ant-design-vue/commit/1152e8cd71cadf9e8fb4797916adca20c0e35974) +- 🐞 修复 Dropdown submenu 样式丢失问题 [#4351](https://github.com/vueComponent/ant-design-vue/issues/4351) +- TS + - 修复 Table 在 ts 4.3.5 版本下类型报错问题 [#4296](https://github.com/vueComponent/ant-design-vue/issues/4296) + - 完善 notification 类型 [#4346](https://github.com/vueComponent/ant-design-vue/issues/4346) + ## 2.2.1 `2021-07-06` diff --git a/package.json b/package.json index 8c262020b..7db46b41e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ant-design-vue", - "version": "2.2.1", + "version": "2.2.2", "title": "Ant Design Vue", "description": "An enterprise-class UI design language and Vue-based implementation", "keywords": [ diff --git a/v2-doc b/v2-doc index d965edbb9..128334b46 160000 --- a/v2-doc +++ b/v2-doc @@ -1 +1 @@ -Subproject commit d965edbb9045771095acf91489145e13c975cb51 +Subproject commit 128334b46af72232ea0dcc31540128ae53ae747d From 39c866eb029448208c99fa0937fe13d20e91ac8c Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Mon, 12 Jul 2021 10:00:10 +0800 Subject: [PATCH 13/13] feat: useForm ts type --- components/form/Form.tsx | 3 +++ components/form/index.tsx | 1 - v2-doc | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/form/Form.tsx b/components/form/Form.tsx index 350fdc654..4e982fa25 100755 --- a/components/form/Form.tsx +++ b/components/form/Form.tsx @@ -27,6 +27,7 @@ import { useInjectSize } from '../_util/hooks/useSize'; import useConfigInject from '../_util/hooks/useConfigInject'; import { useProvideForm } from './context'; import type { SizeType } from '../config-provider'; +import useForm from './useForm'; export type RequiredMark = boolean | 'optional'; export type FormLayout = 'horizontal' | 'inline' | 'vertical'; @@ -97,6 +98,7 @@ const Form = defineComponent({ colon: true, }), Item: FormItem, + useForm, emits: ['finishFailed', 'submit', 'finish'], setup(props, { emit, slots, expose, attrs }) { const size = useInjectSize(props); @@ -371,4 +373,5 @@ const Form = defineComponent({ export default Form as typeof Form & { readonly Item: typeof FormItem; + readonly useForm: typeof useForm; }; diff --git a/components/form/index.tsx b/components/form/index.tsx index 66b6d8c86..cfb6c6135 100644 --- a/components/form/index.tsx +++ b/components/form/index.tsx @@ -15,7 +15,6 @@ Form.install = function (app: App) { export { FormItem, formItemProps, formProps, useForm }; -Form.useForm = useForm; export default Form as typeof Form & Plugin & { readonly Item: typeof Form.Item; diff --git a/v2-doc b/v2-doc index 128334b46..d2c096476 160000 --- a/v2-doc +++ b/v2-doc @@ -1 +1 @@ -Subproject commit 128334b46af72232ea0dcc31540128ae53ae747d +Subproject commit d2c096476ee3e8d27fbb9e1cb7933887501b1fab