diff --git a/components/vc-align/Align.tsx b/components/vc-align/Align.tsx index fdf9afc6b..de1f793ba 100644 --- a/components/vc-align/Align.tsx +++ b/components/vc-align/Align.tsx @@ -1,4 +1,5 @@ -import { nextTick, PropType } from 'vue'; +import type { PropType } from 'vue'; +import { nextTick } from 'vue'; import { defineComponent, ref, computed, onMounted, onUpdated, watch, onUnmounted } from 'vue'; import { alignElement, alignPoint } from 'dom-align'; import addEventListener from '../vc-util/Dom/addEventListener'; diff --git a/components/vc-picker/Picker.tsx b/components/vc-picker/Picker.tsx index deaac2267..e57d59033 100644 --- a/components/vc-picker/Picker.tsx +++ b/components/vc-picker/Picker.tsx @@ -527,7 +527,6 @@ function Picker() { return ( () { transitionName={transitionName} popupPlacement={popupPlacement} direction={direction} + v-slots={{ + popupElement: () => panel, + }} >
- {slots.default?.()} - + v-slots={{ + default: slots.default, + popup: slots.popupElement, + }} + > ); } diff --git a/components/vc-picker/RangePicker.tsx b/components/vc-picker/RangePicker.tsx index 8e20bae8d..7a71bb085 100644 --- a/components/vc-picker/RangePicker.tsx +++ b/components/vc-picker/RangePicker.tsx @@ -1062,7 +1062,6 @@ function RangerPicker() { style={{ minWidth: `${popupMinWidth.value}px` }} >
- {renderPanels()}
); @@ -1128,7 +1127,6 @@ function RangerPicker() { return ( () { transitionName={transitionName} range direction={direction} + v-slots={{ + popupElement: () => rangePanel, + }} >
{}), overlay: PropTypes.any, diff --git a/components/vc-trigger/Popup/MobilePopupInner.tsx b/components/vc-trigger/Popup/MobilePopupInner.tsx index c2235e173..c5b3117f8 100644 --- a/components/vc-trigger/Popup/MobilePopupInner.tsx +++ b/components/vc-trigger/Popup/MobilePopupInner.tsx @@ -1,13 +1,15 @@ -import { CSSProperties, defineComponent, ref, Transition } from 'vue'; -import { flattenChildren } from 'ant-design-vue/es/_util/props-util'; -import classNames from 'ant-design-vue/es/_util/classNames'; -import { MobilePopupProps, mobileProps } from './interface'; +import type { CSSProperties } from 'vue'; +import { defineComponent, ref, Transition } from 'vue'; +import { flattenChildren } from '../../_util/props-util'; +import classNames from '../../_util/classNames'; +import type { MobilePopupProps } from './interface'; +import { mobileProps } from './interface'; export default defineComponent({ + name: 'MobilePopupInner', + inheritAttrs: false, props: mobileProps, emits: ['mouseenter', 'mouseleave', 'mousedown', 'touchstart', 'align'], - inheritAttrs: false, - name: 'MobilePopupInner', setup(props, { expose, slots }) { const elementRef = ref(); diff --git a/components/vc-trigger/Popup/PopupInner.tsx b/components/vc-trigger/Popup/PopupInner.tsx index ec1bad246..8c25c793b 100644 --- a/components/vc-trigger/Popup/PopupInner.tsx +++ b/components/vc-trigger/Popup/PopupInner.tsx @@ -1,9 +1,9 @@ import type { AlignType } from '../interface'; import useVisibleStatus from './useVisibleStatus'; import useStretchStyle from './useStretchStyle'; +import type { CSSProperties } from 'vue'; import { computed, - CSSProperties, defineComponent, nextTick, ref, @@ -12,19 +12,21 @@ import { watch, withModifiers, } from 'vue'; -import Align, { RefAlign } from 'ant-design-vue/es/vc-align/Align'; +import type { RefAlign } from '../../vc-align/Align'; +import Align from '../../vc-align/Align'; import { getMotion } from '../utils/motionUtil'; -import { flattenChildren } from 'ant-design-vue/es/_util/props-util'; -import classNames from 'ant-design-vue/es/_util/classNames'; -import { innerProps, PopupInnerProps } from './interface'; -import { getTransitionProps } from 'ant-design-vue/es/_util/transition'; -import supportsPassive from 'ant-design-vue/es/_util/supportsPassive'; +import { flattenChildren } from '../../_util/props-util'; +import classNames from '../../_util/classNames'; +import type { PopupInnerProps } from './interface'; +import { innerProps } from './interface'; +import { getTransitionProps } from '../../_util/transition'; +import supportsPassive from '../../_util/supportsPassive'; export default defineComponent({ - props: innerProps, name: 'PopupInner', - emits: ['mouseenter', 'mouseleave', 'mousedown', 'touchstart', 'align'], inheritAttrs: false, + props: innerProps, + emits: ['mouseenter', 'mouseleave', 'mousedown', 'touchstart', 'align'], setup(props, { expose, attrs, slots }) { const alignRef = ref(); const elementRef = ref(); @@ -147,36 +149,46 @@ export default defineComponent({ const mergedClassName = classNames(prefixCls, attrs.class, alignedClassName.value); const transitionProps = getTransitionProps(motion.value.name, motion.value); return ( - - {!destroyPopupOnHide || visible ? ( - -
- {childNode} -
-
- ) : null} -
+ { + return !destroyPopupOnHide || visible ? ( + ( +
+ {childNode} +
+ ), + }} + >
+ ) : null; + }, + }} + >
); }; }, diff --git a/components/vc-trigger/Popup/index.tsx b/components/vc-trigger/Popup/index.tsx index 71b42f906..4e482cf81 100644 --- a/components/vc-trigger/Popup/index.tsx +++ b/components/vc-trigger/Popup/index.tsx @@ -5,9 +5,9 @@ import MobilePopupInner from './MobilePopupInner'; import PopupInner from './PopupInner'; export default defineComponent({ - props: popupProps, - inheritAttrs: false, name: 'Popup', + inheritAttrs: false, + props: popupProps, setup(props, { attrs, slots, expose }) { const innerVisible = ref(false); const inMobile = ref(false); diff --git a/components/vc-trigger/Trigger.tsx b/components/vc-trigger/Trigger.tsx index c5909f9ff..57e36354e 100644 --- a/components/vc-trigger/Trigger.tsx +++ b/components/vc-trigger/Trigger.tsx @@ -1,4 +1,5 @@ -import { computed, defineComponent, HTMLAttributes, inject, provide, ref } from 'vue'; +import type { HTMLAttributes } from 'vue'; +import { computed, defineComponent, inject, provide, ref } from 'vue'; import PropTypes from '../_util/vue-types'; import contains from '../vc-util/Dom/contains'; import raf from '../_util/raf'; @@ -411,17 +412,16 @@ export default defineComponent({ return popupAlign; }, getComponent() { - const self = this; const mouseProps: HTMLAttributes = {}; if (this.isMouseEnterToShow()) { - mouseProps.onMouseenter = self.onPopupMouseenter; + mouseProps.onMouseenter = this.onPopupMouseenter; } if (this.isMouseLeaveToHide()) { - mouseProps.onMouseleave = self.onPopupMouseleave; + mouseProps.onMouseleave = this.onPopupMouseleave; } mouseProps.onMousedown = this.onPopupMouseDown; mouseProps[supportsPassive ? 'onTouchstartPassive' : 'onTouchstart'] = this.onPopupMouseDown; - const { handleGetPopupClassFromAlign, getRootDomNode, getContainer, $attrs } = self; + const { handleGetPopupClassFromAlign, getRootDomNode, getContainer, $attrs } = this; const { prefixCls, destroyPopupOnHide, @@ -437,7 +437,7 @@ export default defineComponent({ alignPoint, mobile, forceRender, - } = self.$props; + } = this.$props; const { sPopupVisible, point } = this.$data; const popupProps = { prefixCls, @@ -463,7 +463,12 @@ export default defineComponent({ mobile, forceRender, } as any; - return {getComponent(self, 'popup')}; + return ( + getComponent(this, 'popup')) }} + > + ); }, attachParent(popupContainer) { diff --git a/v2-doc b/v2-doc index 7a7b52df8..2aa53d9c7 160000 --- a/v2-doc +++ b/v2-doc @@ -1 +1 @@ -Subproject commit 7a7b52df8b3b69d8b1a8b8dcd96e1b0f7bb3f8c9 +Subproject commit 2aa53d9c7aae3b172d8837a0ba9118c3fd8c2038