@v1nt1248/3nclient-lib 0.2.50 → 0.2.53
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/components/ui3n-menu/types.d.ts +5 -1
- package/dist/components/ui3n-menu/ui3n-menu.vue.d.ts +4 -1
- package/dist/style.css +1 -1
- package/dist/ui3n-components.js +2394 -2385
- package/package.json +1 -1
- package/src/components/ui3n-menu/types.ts +6 -1
- package/src/components/ui3n-menu/ui3n-menu.vue +34 -18
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VNode } from 'vue';
|
|
1
|
+
import type { Ref, VNode } from 'vue';
|
|
2
2
|
|
|
3
3
|
export interface Ui3nMenuProps {
|
|
4
4
|
modelValue?: boolean;
|
|
@@ -27,3 +27,8 @@ export interface Ui3nMenuSlots {
|
|
|
27
27
|
default: () => VNode;
|
|
28
28
|
menu?: () => VNode;
|
|
29
29
|
}
|
|
30
|
+
|
|
31
|
+
export interface Ui3nMenuExpose {
|
|
32
|
+
isPositioned: Readonly<Ref<boolean>>;
|
|
33
|
+
update: () => void;
|
|
34
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { computed, ref, watch } from 'vue';
|
|
3
3
|
import { autoUpdate, flip, useFloating, offset, shift } from '@floating-ui/vue';
|
|
4
4
|
import { default as vClickOutside } from '../../directives/ui3n-click-outside';
|
|
5
|
-
import type { Ui3nMenuEmits, Ui3nMenuProps, Ui3nMenuSlots } from './types';
|
|
5
|
+
import type { Ui3nMenuEmits, Ui3nMenuProps, Ui3nMenuSlots, Ui3nMenuExpose } from './types';
|
|
6
6
|
import { Nullable } from '@/types';
|
|
7
7
|
|
|
8
8
|
const props = withDefaults(defineProps<Ui3nMenuProps>(), {
|
|
@@ -40,26 +40,27 @@
|
|
|
40
40
|
const {
|
|
41
41
|
floatingStyles,
|
|
42
42
|
isPositioned,
|
|
43
|
+
update,
|
|
43
44
|
} = useFloating(
|
|
44
45
|
usedTriggerElement,
|
|
45
46
|
menuContentElement,
|
|
46
47
|
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
48
|
+
placement: 'bottom-start',
|
|
49
|
+
strategy: props.positionStrategy,
|
|
50
|
+
middleware: [
|
|
51
|
+
offset({
|
|
52
|
+
mainAxis: props.offsetY,
|
|
53
|
+
crossAxis: props.offsetX + 2,
|
|
54
|
+
}),
|
|
55
|
+
flip({
|
|
56
|
+
fallbackAxisSideDirection: 'end',
|
|
57
|
+
flipAlignment: false,
|
|
58
|
+
fallbackPlacements: ['bottom-end'],
|
|
59
|
+
}),
|
|
60
|
+
shift(),
|
|
61
|
+
],
|
|
62
|
+
whileElementsMounted: props.positionAutoupdate || props.positionStrategy === 'fixed' ? autoUpdate : undefined,
|
|
63
|
+
});
|
|
63
64
|
|
|
64
65
|
function toggleMenu() {
|
|
65
66
|
if (props.disabled) {
|
|
@@ -105,9 +106,24 @@
|
|
|
105
106
|
val => {
|
|
106
107
|
if (val) {
|
|
107
108
|
outerTriggerElement.value = val;
|
|
109
|
+
update();
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
watch(
|
|
115
|
+
[() => props.offsetX, () => props.offsetY],
|
|
116
|
+
([offsetX, offsetY], [oldOffsetX, oldOffsetY]) => {
|
|
117
|
+
if (offsetX !== oldOffsetX || offsetY !== oldOffsetY) {
|
|
118
|
+
update();
|
|
108
119
|
}
|
|
109
120
|
},
|
|
110
|
-
)
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
defineExpose<Ui3nMenuExpose>({
|
|
124
|
+
isPositioned,
|
|
125
|
+
update,
|
|
126
|
+
});
|
|
111
127
|
</script>
|
|
112
128
|
|
|
113
129
|
<template>
|