bfg-common 1.3.280 → 1.3.281
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.
|
@@ -1,97 +1,96 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="context-popup"
|
|
4
|
-
:style="{
|
|
5
|
-
top: currentContextMenuY,
|
|
6
|
-
left: currentContextMenuX,
|
|
7
|
-
}"
|
|
8
|
-
>
|
|
9
|
-
<common-context-recursion
|
|
10
|
-
:action-loading="props.actionLoading"
|
|
11
|
-
:items="props.contextMenu.items"
|
|
12
|
-
@select-item="selectItem"
|
|
13
|
-
/>
|
|
14
|
-
</div>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script setup lang="ts">
|
|
18
|
-
import {
|
|
19
|
-
UI_I_ContextMenuItem,
|
|
20
|
-
UI_I_ContextMenu,
|
|
21
|
-
} from '~/components/common/context/lib/models/interfaces'
|
|
22
|
-
|
|
23
|
-
const props = defineProps<{
|
|
24
|
-
contextMenu: UI_I_ContextMenu
|
|
25
|
-
actionLoading: string | null
|
|
26
|
-
}>()
|
|
27
|
-
const emits = defineEmits<{
|
|
28
|
-
(event: 'select-item', value: UI_I_ContextMenuItem): void
|
|
29
|
-
(event: 'hide'): void
|
|
30
|
-
}>()
|
|
31
|
-
const selectItem = (item: UI_I_ContextMenuItem): void => {
|
|
32
|
-
emits('select-item', item)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="context-popup"
|
|
4
|
+
:style="{
|
|
5
|
+
top: currentContextMenuY,
|
|
6
|
+
left: currentContextMenuX,
|
|
7
|
+
}"
|
|
8
|
+
>
|
|
9
|
+
<common-context-recursion
|
|
10
|
+
:action-loading="props.actionLoading"
|
|
11
|
+
:items="props.contextMenu.items"
|
|
12
|
+
@select-item="selectItem"
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
import {
|
|
19
|
+
UI_I_ContextMenuItem,
|
|
20
|
+
UI_I_ContextMenu,
|
|
21
|
+
} from '~/components/common/context/lib/models/interfaces'
|
|
22
|
+
|
|
23
|
+
const props = defineProps<{
|
|
24
|
+
contextMenu: UI_I_ContextMenu
|
|
25
|
+
actionLoading: string | null
|
|
26
|
+
}>()
|
|
27
|
+
const emits = defineEmits<{
|
|
28
|
+
(event: 'select-item', value: UI_I_ContextMenuItem): void
|
|
29
|
+
(event: 'hide'): void
|
|
30
|
+
}>()
|
|
31
|
+
const selectItem = (item: UI_I_ContextMenuItem): void => {
|
|
32
|
+
emits('select-item', item)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const currentContextMenuY = ref<string>('')
|
|
36
|
+
const currentContextMenuX = ref<string>('')
|
|
37
|
+
const setCurrentPositionsPopup = (): void => {
|
|
38
|
+
const contextMenuY = props.contextMenu.y
|
|
39
|
+
const contextMenuX = props.contextMenu.x
|
|
40
|
+
|
|
41
|
+
const contextWrap: HTMLElement | null =
|
|
42
|
+
document.querySelector('.context-wrap')
|
|
43
|
+
const contextW = contextWrap?.offsetWidth || 0
|
|
44
|
+
const contextH = contextWrap?.offsetHeight || 0
|
|
45
|
+
|
|
46
|
+
const windowW = window.innerWidth
|
|
47
|
+
const windowH = window.innerHeight
|
|
48
|
+
|
|
49
|
+
if (contextMenuY + contextH >= windowH) {
|
|
50
|
+
currentContextMenuY.value = 'auto'
|
|
51
|
+
} else {
|
|
52
|
+
currentContextMenuY.value = `${contextMenuY}px`
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (contextMenuX + contextW >= windowW) {
|
|
56
|
+
const divisionW = windowW - contextW
|
|
57
|
+
currentContextMenuX.value = `${divisionW}px`
|
|
58
|
+
} else {
|
|
59
|
+
currentContextMenuX.value = `${contextMenuX}px`
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const windowMousedown = (): void => {
|
|
64
|
+
emits('hide')
|
|
65
|
+
}
|
|
66
|
+
watch(
|
|
67
|
+
() => props.contextMenu.y,
|
|
68
|
+
(newValue: number) => {
|
|
69
|
+
if (!newValue) return
|
|
70
|
+
|
|
71
|
+
if (newValue < 0) {
|
|
72
|
+
window.removeEventListener('mousedown', windowMousedown)
|
|
73
|
+
} else {
|
|
74
|
+
window.addEventListener('mousedown', windowMousedown)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
setTimeout(() => {
|
|
78
|
+
setCurrentPositionsPopup()
|
|
79
|
+
}, 0)
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<style scoped lang="scss">
|
|
85
|
+
.context-popup {
|
|
86
|
+
top: -9999px;
|
|
87
|
+
left: -9999px;
|
|
88
|
+
bottom: 0;
|
|
89
|
+
border: none;
|
|
90
|
+
box-sizing: content-box;
|
|
91
|
+
overflow: visible;
|
|
92
|
+
display: block;
|
|
93
|
+
position: fixed;
|
|
94
|
+
z-index: 10002;
|
|
95
|
+
}
|
|
96
|
+
</style>
|