itube-specs 0.0.546 → 0.0.548
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.
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
class="s-dropdown"
|
|
5
5
|
:style="`--max-height: ${getMaxHeight}`"
|
|
6
6
|
:class="[
|
|
7
|
-
{'--top': top},
|
|
7
|
+
{'--top': top || autoTop},
|
|
8
8
|
{'--right': right},
|
|
9
9
|
{'--center': center},
|
|
10
10
|
{'--open': open},
|
|
@@ -73,6 +73,7 @@ const props = withDefaults(defineProps<{
|
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
const open = ref(false);
|
|
76
|
+
const autoTop = ref(false);
|
|
76
77
|
|
|
77
78
|
onClickOutside(dropdownRef, () => {
|
|
78
79
|
open.value = false;
|
|
@@ -82,8 +83,17 @@ const { scrollLock, scrollUnlock } = useGlobalScrollLock();
|
|
|
82
83
|
|
|
83
84
|
const breakpoints = useAppConfig().cssBreakpoints as Record<CssBreakpoints, number>;
|
|
84
85
|
|
|
86
|
+
function checkPosition() {
|
|
87
|
+
if (!dropdownRef.value || !menuRef.value || isMobileWidth(breakpoints).value) return
|
|
88
|
+
const triggerRect = dropdownRef.value.getBoundingClientRect()
|
|
89
|
+
const menuHeight = menuRef.value.scrollHeight
|
|
90
|
+
const spaceBelow = window.innerHeight - triggerRect.bottom
|
|
91
|
+
autoTop.value = menuHeight > spaceBelow
|
|
92
|
+
}
|
|
93
|
+
|
|
85
94
|
function openDropdown() {
|
|
86
95
|
open.value = !open.value
|
|
96
|
+
if (open.value) nextTick(() => checkPosition())
|
|
87
97
|
|
|
88
98
|
if (isMobileWidth(breakpoints).value) {
|
|
89
99
|
nextTick(() => {
|
|
@@ -114,6 +124,7 @@ function mouseHandler(event: boolean) {
|
|
|
114
124
|
|
|
115
125
|
if (event) {
|
|
116
126
|
open.value = true
|
|
127
|
+
nextTick(() => checkPosition())
|
|
117
128
|
} else {
|
|
118
129
|
hoverTimeout = setTimeout(() => {
|
|
119
130
|
open.value = false
|
package/package.json
CHANGED