@policystudio/policy-studio-ui-vue 1.1.90-beta.29 → 1.1.90-beta.30
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/package.json
CHANGED
|
@@ -132,17 +132,17 @@ const close = () => {
|
|
|
132
132
|
const updatePosition = () => {
|
|
133
133
|
const dialog = PsTooltipDialog.value
|
|
134
134
|
const trigger = PsTooltipTrigger.value
|
|
135
|
-
const rectDialog = dialog
|
|
136
|
-
const rectTrigger = trigger
|
|
135
|
+
const rectDialog = dialog?.getBoundingClientRect()
|
|
136
|
+
const rectTrigger = trigger?.getBoundingClientRect()
|
|
137
137
|
const windowWidth = document.documentElement.clientWidth
|
|
138
|
-
dialog.style.top = `${rectTrigger.y + rectTrigger.height + 8}px`
|
|
139
|
-
if (rectTrigger.x + rectDialog.width + 20 > windowWidth) {
|
|
138
|
+
if(dialog) dialog.style.top = `${rectTrigger.y + rectTrigger.height + 8}px`
|
|
139
|
+
if (rectTrigger && rectTrigger.x + rectDialog.width + 20 > windowWidth) {
|
|
140
140
|
dialog.style.left = `${windowWidth - rectDialog.width - 30}px`
|
|
141
|
-
} else if (rectTrigger.x - rectDialog.width < 0) {
|
|
141
|
+
} else if (rectTrigger && rectTrigger.x - rectDialog.width < 0) {
|
|
142
142
|
dialog.style.left = `${rectTrigger.x + 10}px`
|
|
143
|
-
} else if (rectDialog.width >= rectTrigger.width && props.position != 'custom') {
|
|
143
|
+
} else if (rectTrigger && rectDialog.width >= rectTrigger.width && props.position != 'custom') {
|
|
144
144
|
dialog.style.left = `${rectTrigger.x - (rectDialog.width - rectTrigger.width) / 2}px`
|
|
145
|
-
} else {
|
|
145
|
+
} else if(dialog) {
|
|
146
146
|
dialog.style.left = `${rectTrigger.x + (rectTrigger.width - rectDialog.width) / 2}px`
|
|
147
147
|
}
|
|
148
148
|
if (props.position == 'top') {
|
|
@@ -154,7 +154,7 @@ const updatePosition = () => {
|
|
|
154
154
|
dialog.style.position = 'absolute'
|
|
155
155
|
}
|
|
156
156
|
setTimeout(() => {
|
|
157
|
-
dialog.style.opacity = 100
|
|
157
|
+
if(dialog) dialog.style.opacity = 100
|
|
158
158
|
}, 100)
|
|
159
159
|
}
|
|
160
160
|
</script>
|