@v-c/trigger 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/useAlign.js +7 -2
- package/dist/index.js +3 -0
- package/package.json +2 -2
package/dist/hooks/useAlign.js
CHANGED
|
@@ -72,6 +72,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
72
72
|
prevFlipRef.value = {};
|
|
73
73
|
};
|
|
74
74
|
let cacheTargetRect = null;
|
|
75
|
+
let cacheScale = null;
|
|
75
76
|
const _onAlign = (cache = false) => {
|
|
76
77
|
if (cache && !cacheTargetRect) return;
|
|
77
78
|
if (popupEle.value && target.value && open.value && !mobile?.value) {
|
|
@@ -166,8 +167,12 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
166
167
|
const popupHeight = popupRect.height;
|
|
167
168
|
const popupWidth = popupRect.width;
|
|
168
169
|
const popupMirrorRect = rawPopupMirrorRect;
|
|
169
|
-
const scaleX$1 = toNum(Math.round(popupWidth / parseFloat(width) * 1e3) / 1e3);
|
|
170
|
-
const scaleY$1 = toNum(Math.round(popupHeight / parseFloat(height) * 1e3) / 1e3);
|
|
170
|
+
const scaleX$1 = cache && cacheScale ? cacheScale?.scaleX : toNum(Math.round(popupWidth / parseFloat(width) * 1e3) / 1e3);
|
|
171
|
+
const scaleY$1 = cache && cacheScale ? cacheScale?.scaleY : toNum(Math.round(popupHeight / parseFloat(height) * 1e3) / 1e3);
|
|
172
|
+
if (!cache) cacheScale = {
|
|
173
|
+
scaleX: scaleX$1,
|
|
174
|
+
scaleY: scaleY$1
|
|
175
|
+
};
|
|
171
176
|
if (scaleX$1 === 0 || scaleY$1 === 0 || isDOM(target) && !isVisible(target)) return;
|
|
172
177
|
const { offset, targetOffset } = placementInfo;
|
|
173
178
|
let [popupOffsetX, popupOffsetY] = getNumberOffset(popupRect, offset);
|
package/dist/index.js
CHANGED
|
@@ -117,6 +117,9 @@ function generateTrigger(PortalComponent = Portal) {
|
|
|
117
117
|
} else uniqueContext?.hide(props.mouseLeaveDelay || 0);
|
|
118
118
|
});
|
|
119
119
|
const openRef = shallowRef(mergedOpen.value);
|
|
120
|
+
watch(mergedOpen, () => {
|
|
121
|
+
openRef.value = mergedOpen.value;
|
|
122
|
+
});
|
|
120
123
|
const internalTriggerOpen = (nextOpen) => {
|
|
121
124
|
if (mergedOpen.value !== nextOpen) {
|
|
122
125
|
internalOpen.value = nextOpen;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/trigger",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.11",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@v-c/portal": "^1.0.7",
|
|
33
33
|
"@v-c/resize-observer": "^1.0.8",
|
|
34
|
-
"@v-c/util": "^1.0.
|
|
34
|
+
"@v-c/util": "^1.0.13"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "vite build",
|