@v1nt1248/3nclient-lib 0.2.4 → 0.2.5
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
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
const menuContentElement = ref<HTMLDivElement | null>(null);
|
|
23
23
|
const isShow = ref(false);
|
|
24
24
|
|
|
25
|
+
const outerTriggerElement = computed(() => props.triggerElement || null);
|
|
26
|
+
|
|
25
27
|
const contentBorderRadiusCss = computed(() => {
|
|
26
28
|
if (typeof props.contentBorderRadius === 'number') {
|
|
27
29
|
return `${props.contentBorderRadius}px`;
|
|
@@ -32,27 +34,23 @@
|
|
|
32
34
|
});
|
|
33
35
|
const zIndexCss = computed(() => props.zIndex);
|
|
34
36
|
|
|
35
|
-
const { floatingStyles, isPositioned } = useFloating(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
],
|
|
53
|
-
whileElementsMounted: props.positionAutoupdate || props.positionStrategy === 'fixed' ? autoUpdate : undefined,
|
|
54
|
-
},
|
|
55
|
-
);
|
|
37
|
+
const { floatingStyles, isPositioned } = useFloating(outerTriggerElement || menuTriggerElement, menuContentElement, {
|
|
38
|
+
placement: 'bottom-start',
|
|
39
|
+
strategy: props.positionStrategy,
|
|
40
|
+
middleware: [
|
|
41
|
+
offset({
|
|
42
|
+
mainAxis: props.offsetY,
|
|
43
|
+
crossAxis: props.offsetX + 2,
|
|
44
|
+
}),
|
|
45
|
+
flip({
|
|
46
|
+
fallbackAxisSideDirection: 'end',
|
|
47
|
+
flipAlignment: false,
|
|
48
|
+
fallbackPlacements: ['bottom-end'],
|
|
49
|
+
}),
|
|
50
|
+
shift(),
|
|
51
|
+
],
|
|
52
|
+
whileElementsMounted: props.positionAutoupdate || props.positionStrategy === 'fixed' ? autoUpdate : undefined,
|
|
53
|
+
});
|
|
56
54
|
|
|
57
55
|
function toggleMenu() {
|
|
58
56
|
if (props.disabled) {
|
|
@@ -79,12 +77,9 @@
|
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
79
|
|
|
82
|
-
watch(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
val ? emits('opened') : emits('closed');
|
|
86
|
-
},
|
|
87
|
-
);
|
|
80
|
+
watch(isPositioned, val => {
|
|
81
|
+
val ? emits('opened') : emits('closed');
|
|
82
|
+
});
|
|
88
83
|
|
|
89
84
|
watch(
|
|
90
85
|
() => props.modelValue,
|
|
@@ -92,12 +87,16 @@
|
|
|
92
87
|
if (isShow.value !== val) {
|
|
93
88
|
isShow.value = val;
|
|
94
89
|
}
|
|
95
|
-
},
|
|
90
|
+
},
|
|
91
|
+
{ immediate: true },
|
|
96
92
|
);
|
|
97
93
|
</script>
|
|
98
94
|
|
|
99
95
|
<template>
|
|
100
|
-
<div
|
|
96
|
+
<div
|
|
97
|
+
ref="menuElement"
|
|
98
|
+
:class="$style.ui3nMenu"
|
|
99
|
+
>
|
|
101
100
|
<div
|
|
102
101
|
ref="menuTriggerElement"
|
|
103
102
|
:class="[$style.ui3nMenuTrigger, disabled && $style.ui3nMenuTriggerDisabled]"
|