From 62e5a1abf7fa70d02cc8c2e0ba99f7401a44265a Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Sat, 14 Aug 2021 15:09:36 +0800 Subject: [PATCH] refactor: trigger --- components/vc-trigger/LazyRenderBox.jsx | 27 - components/vc-trigger/Popup/PopupInner.tsx | 12 +- components/vc-trigger/Popup/index.tsx | 10 +- components/vc-trigger/Popup1.jsx | 317 --------- components/vc-trigger/PopupInner.jsx | 21 - components/vc-trigger/Trigger.jsx | 2 +- components/vc-trigger/Trigger2.jsx | 659 ------------------- components/vc-trigger/Trigger2.tsx | 20 +- components/vc-trigger/index.md | 160 ----- components/vc-trigger/{index.js => index.ts} | 2 +- 10 files changed, 32 insertions(+), 1198 deletions(-) delete mode 100644 components/vc-trigger/LazyRenderBox.jsx delete mode 100644 components/vc-trigger/Popup1.jsx delete mode 100644 components/vc-trigger/PopupInner.jsx delete mode 100644 components/vc-trigger/Trigger2.jsx delete mode 100644 components/vc-trigger/index.md rename components/vc-trigger/{index.js => index.ts} (65%) diff --git a/components/vc-trigger/LazyRenderBox.jsx b/components/vc-trigger/LazyRenderBox.jsx deleted file mode 100644 index 5cefd4447..000000000 --- a/components/vc-trigger/LazyRenderBox.jsx +++ /dev/null @@ -1,27 +0,0 @@ -import { Text } from 'vue'; -import PropTypes from '../_util/vue-types'; -import { getSlot } from '../_util/props-util'; - -export default { - name: 'LazyRenderBox', - props: { - visible: PropTypes.looseBool, - hiddenClassName: PropTypes.string, - }, - render() { - const { hiddenClassName } = this.$props; - const child = getSlot(this); - if ( - hiddenClassName || - (child && child.length > 1) || - (child && child[0] && child[0].type === Text) - ) { - // const cls = ''; - // if (!visible && hiddenClassName) { - // // cls += ` ${hiddenClassName}` - // } - return
name | -type | -default | -description | -
---|---|---|---|
popupClassName | -string | -- | additional className added to popup | -
forceRender | -boolean | -false | -whether render popup before first show | -
destroyPopupOnHide | -boolean | -false | -whether destroy popup when hide | -
getPopupClassNameFromAlign | -getPopupClassNameFromAlign(align: Object):String | -- | additional className added to popup according to align | -
action | -string[] | -['hover'] | -which actions cause popup shown. enum of 'hover','click','focus','contextmenu' | -
mouseEnterDelay | -number | -0 | -delay time to show when mouse enter. unit: s. | -
mouseLeaveDelay | -number | -0.1 | -delay time to hide when mouse leave. unit: s. | -
popupStyle | -Object | -- | additional style of popup | -
prefixCls | -String | -rc-trigger-popup | -prefix class name | -
popupTransitionName | -String|Object | -- | https://github.com/react-component/animate | -
maskTransitionName | -String|Object | -- | https://github.com/react-component/animate | -
mask | -boolean | -false | -whether to support mask | -
maskClosable | -boolean | -true | -whether to support click mask to hide | -
popupVisible | -boolean | -- | whether popup is visible | -
zIndex | -number | -- | popup's zIndex | -
defaultPopupVisible | -boolean | -- | whether popup is visible initially | -
popupAlign | -Object: alignConfig of [dom-align](https://github.com/yiminghe/dom-align) | -- | popup 's align config | -
getPopupContainer | -getPopupContainer(): HTMLElement | -- | function returning html node which will act as popup container | -
getDocument | -getDocument(): HTMLElement | -- | function returning document node which will be attached click event to close trigger | -
popupPlacement | -string | -- | use preset popup align config from builtinPlacements, can be merged by popupAlign prop | -
builtinPlacements | -object | -- | builtin placement align map. used by placement prop | -
popupVisibleChange | -$emit | -- | call when popup visible is changed | -
popupAlign | -$emit | -- | callback when popup node is aligned | -
popup | -slot='popup' | -- | popup content | -