Comparing version 0.7.1 to 0.8.0
@@ -170,7 +170,7 @@ function locate(el, attr = "data-id") { | ||
let x, y, width, pos; | ||
const noPosition = { x: 0, y: 0, z: 0, width: "auto" }; | ||
function calculatePosition(self, parent, at = "bottom", left = 0, top = 0) { | ||
if (!self) return noPosition; | ||
if (!self) return null; | ||
x = left; | ||
y = top; | ||
width = "auto"; | ||
let z = 0; | ||
@@ -180,3 +180,3 @@ let fixLeft = 0; | ||
const cont = isOverlap(at) ? env.getTopNode() : body; | ||
if (!body) return noPosition; | ||
if (!body) return null; | ||
const bodyRect = body.getBoundingClientRect(); | ||
@@ -191,3 +191,3 @@ const selfRect = self.getBoundingClientRect(); | ||
pos = parent.getBoundingClientRect(); | ||
width = isFit(at) ? pos.width + "px" : "auto"; | ||
if (isFit(at)) width = pos.width + "px"; | ||
if (at !== "point") { | ||
@@ -221,3 +221,3 @@ if (isCenter(at)) { | ||
if (!isRight(at)) { | ||
x = pos.right - selfRect.width; | ||
x = contRect.right - selfRect.width; | ||
} else { | ||
@@ -224,0 +224,0 @@ fixLeft = 2; |
@@ -174,7 +174,7 @@ (function(global, factory) { | ||
let x, y, width, pos; | ||
const noPosition = { x: 0, y: 0, z: 0, width: "auto" }; | ||
function calculatePosition(self2, parent, at = "bottom", left = 0, top = 0) { | ||
if (!self2) return noPosition; | ||
if (!self2) return null; | ||
x = left; | ||
y = top; | ||
width = "auto"; | ||
let z = 0; | ||
@@ -184,3 +184,3 @@ let fixLeft = 0; | ||
const cont = isOverlap(at) ? env.getTopNode() : body; | ||
if (!body) return noPosition; | ||
if (!body) return null; | ||
const bodyRect = body.getBoundingClientRect(); | ||
@@ -195,3 +195,3 @@ const selfRect = self2.getBoundingClientRect(); | ||
pos = parent.getBoundingClientRect(); | ||
width = isFit(at) ? pos.width + "px" : "auto"; | ||
if (isFit(at)) width = pos.width + "px"; | ||
if (at !== "point") { | ||
@@ -225,3 +225,3 @@ if (isCenter(at)) { | ||
if (!isRight(at)) { | ||
x = pos.right - selfRect.width; | ||
x = contRect.right - selfRect.width; | ||
} else { | ||
@@ -228,0 +228,0 @@ fixLeft = 2; |
{ | ||
"name": "wx-lib-dom", | ||
"version": "0.7.1", | ||
"version": "0.8.0", | ||
"main": "./dist/dom.umd.js", | ||
@@ -5,0 +5,0 @@ "module": "./dist/dom.es.js", |
@@ -1,3 +0,8 @@ | ||
### 0.7.1 | ||
### 0.8.0 | ||
- [update] calculatePosition returns null when element is not in DOM | ||
- [fix] auto-fit logic of calculatePosition: actual width is returned, shift to left is done relative to the container not to the original menu position | ||
### 0.7.0 | ||
- [add] env, setEnv | ||
@@ -4,0 +9,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
77513