bfg-common 1.4.365 → 1.4.367
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/assets/img/icons/icons-sprite-dark-1.svg +407 -407
- package/assets/img/icons/icons-sprite-dark-2.svg +343 -343
- package/assets/img/icons/icons-sprite-dark-3.svg +227 -227
- package/assets/img/icons/icons-sprite-dark-4.svg +255 -255
- package/assets/img/icons/icons-sprite-dark-5.svg +488 -488
- package/assets/img/icons/icons-sprite-dark-6.svg +94 -94
- package/assets/img/icons/icons-sprite-light-1.svg +407 -407
- package/assets/img/icons/icons-sprite-light-2.svg +343 -343
- package/assets/img/icons/icons-sprite-light-3.svg +227 -227
- package/assets/img/icons/icons-sprite-light-4.svg +255 -255
- package/assets/img/icons/icons-sprite-light-5.svg +488 -488
- package/assets/img/icons/icons-sprite-light-6.svg +94 -94
- package/assets/localization/local_en.json +1 -1
- package/components/atoms/TheIcon3.vue +50 -50
- package/components/atoms/modal/bySteps/BySteps.vue +253 -253
- package/components/atoms/stack/StackBlock.vue +185 -185
- package/components/common/context/lib/models/interfaces.ts +30 -30
- package/components/common/context/recursion/Recursion.vue +86 -86
- package/components/common/context/recursion/RecursionNew.vue +199 -199
- package/components/common/context/recursion/RecursionOld.vue +213 -213
- package/components/common/modals/confirmation/Confirmation.vue +65 -65
- package/components/common/vm/actions/add/Add.vue +617 -617
- package/components/common/vm/actions/clone/lib/config/steps.ts +129 -129
- package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +2 -2
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/bus/lib/config/options.ts +20 -20
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Cpu.vue +403 -403
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Hv.vue +99 -99
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/{location/Location.vue → Location.vue} +173 -172
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +2 -2
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +201 -201
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/streamingMode/StreamingMode.vue +85 -85
- package/components/common/vm/actions/common/select/storage/Storage.vue +198 -202
- package/components/common/vm/actions/editSettings/EditSettings.vue +1 -1
- package/composables/productNameLocal.ts +30 -30
- package/package.json +1 -1
- package/plugins/date.ts +181 -181
- package/plugins/recursion.ts +311 -311
- package/public/spice-console/lib/images/bitmap.js +203 -203
- package/public/spice-console/network/spicechannel.js +383 -383
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/StorageModalOld.vue +0 -52
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/storageModalNew/StorageModalNew.vue +0 -175
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/storageModalNew/lib/config/table.ts +0 -167
|
@@ -1,185 +1,185 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
:class="[
|
|
4
|
-
'stack-block',
|
|
5
|
-
open ? 'stack-block-expanded' : 'stack-block-expandable',
|
|
6
|
-
{ 'not-children': !props.hasChildren },
|
|
7
|
-
]"
|
|
8
|
-
>
|
|
9
|
-
<div
|
|
10
|
-
:id="`${props.testId}-toggle`"
|
|
11
|
-
:data-id="`${props.testId}-toggle`"
|
|
12
|
-
class="stack-block-label"
|
|
13
|
-
@click="onToggle"
|
|
14
|
-
>
|
|
15
|
-
<atoms-the-icon name="angle" class="angle-icon" fill="#565656" />
|
|
16
|
-
|
|
17
|
-
<div class="stack-view-key">
|
|
18
|
-
<slot name="stackBlockKey" />
|
|
19
|
-
</div>
|
|
20
|
-
<div class="stack-block-content">
|
|
21
|
-
<slot name="stackBlockContent" />
|
|
22
|
-
</div>
|
|
23
|
-
|
|
24
|
-
<span
|
|
25
|
-
v-if="props.removable && props.isRollBack"
|
|
26
|
-
class="icon-roll-back"
|
|
27
|
-
:data-id="`${props.testId}-roll-back`"
|
|
28
|
-
@mousedown="onRollBack"
|
|
29
|
-
@click.stop
|
|
30
|
-
/>
|
|
31
|
-
<atoms-the-icon
|
|
32
|
-
v-else-if="props.removable"
|
|
33
|
-
:data-id="`${props.testId}-remove`"
|
|
34
|
-
class="remove-icon"
|
|
35
|
-
name="close-circle"
|
|
36
|
-
@mousedown="onRemove"
|
|
37
|
-
@click.stop
|
|
38
|
-
/>
|
|
39
|
-
<span v-else class="empty-icon"></span>
|
|
40
|
-
</div>
|
|
41
|
-
|
|
42
|
-
<div v-show="open" class="stack-children">
|
|
43
|
-
<div style="height: auto">
|
|
44
|
-
<slot name="stackChildren" />
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
</template>
|
|
49
|
-
|
|
50
|
-
<script setup lang="ts">
|
|
51
|
-
const props = withDefaults(
|
|
52
|
-
defineProps<{
|
|
53
|
-
hasChildren: boolean
|
|
54
|
-
removable?: boolean
|
|
55
|
-
testId?: string
|
|
56
|
-
openByDefault?: boolean
|
|
57
|
-
isRollBack?: boolean
|
|
58
|
-
}>(),
|
|
59
|
-
{ testId: 'ui-stack-block', openByDefault: false }
|
|
60
|
-
)
|
|
61
|
-
const emits = defineEmits<{
|
|
62
|
-
(event: 'toggle', value: boolean): void
|
|
63
|
-
(event: 'remove'): void
|
|
64
|
-
(event: 'roll-back'): void
|
|
65
|
-
}>()
|
|
66
|
-
|
|
67
|
-
const open = ref<boolean>(props.openByDefault || false)
|
|
68
|
-
const onToggle = (): void => {
|
|
69
|
-
if (!props.hasChildren) return
|
|
70
|
-
setTimeout(() => {
|
|
71
|
-
open.value = !open.value
|
|
72
|
-
emits('toggle', open.value)
|
|
73
|
-
}, 0)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const onRemove = (): void => {
|
|
77
|
-
emits('remove')
|
|
78
|
-
}
|
|
79
|
-
const onRollBack = (): void => {
|
|
80
|
-
emits('roll-back')
|
|
81
|
-
}
|
|
82
|
-
</script>
|
|
83
|
-
|
|
84
|
-
<style scoped lang="scss">
|
|
85
|
-
.stack-block {
|
|
86
|
-
cursor: pointer;
|
|
87
|
-
background-color: var(--block-view-bg-color);
|
|
88
|
-
border-color: var(--global-border-color);
|
|
89
|
-
|
|
90
|
-
&.stack-block-expandable:hover {
|
|
91
|
-
border-bottom: 1px solid #666;
|
|
92
|
-
|
|
93
|
-
.stack-block-label {
|
|
94
|
-
background-color: var(--block-view-bg-color);
|
|
95
|
-
border-color: var(--global-border-color);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.stack-block-label {
|
|
100
|
-
padding: 6px 12px;
|
|
101
|
-
flex: 1 1 auto;
|
|
102
|
-
max-width: unset;
|
|
103
|
-
display: flex;
|
|
104
|
-
background-color: var(--block-view-bg-color);
|
|
105
|
-
border-color: var(--global-border-color);
|
|
106
|
-
|
|
107
|
-
&:hover {
|
|
108
|
-
.remove-icon {
|
|
109
|
-
opacity: 1;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
&::before {
|
|
114
|
-
display: none;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.angle-icon {
|
|
118
|
-
width: 14px;
|
|
119
|
-
height: 14px;
|
|
120
|
-
margin-right: 4px;
|
|
121
|
-
transform: rotate(90deg);
|
|
122
|
-
align-self: center;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.remove-icon {
|
|
126
|
-
width: 18px;
|
|
127
|
-
height: 18px;
|
|
128
|
-
opacity: 0;
|
|
129
|
-
cursor: pointer;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.stack-view-key {
|
|
133
|
-
flex: 0 0 40%;
|
|
134
|
-
max-width: 40%;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.stack-block-content {
|
|
138
|
-
padding: 0;
|
|
139
|
-
flex: 1 1 auto;
|
|
140
|
-
width: 60%;
|
|
141
|
-
background-color: transparent;
|
|
142
|
-
word-break: break-all;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.empty-icon {
|
|
146
|
-
width: 18px;
|
|
147
|
-
height: 18px;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
&.stack-block-expanded {
|
|
152
|
-
.stack-block-label {
|
|
153
|
-
color: #ffffff;
|
|
154
|
-
background-color: #29414e;
|
|
155
|
-
|
|
156
|
-
.angle-icon {
|
|
157
|
-
fill: #ffffff;
|
|
158
|
-
transform: rotate(180deg);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.remove-icon {
|
|
162
|
-
fill: #ffffff;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
&.not-children {
|
|
168
|
-
cursor: default;
|
|
169
|
-
.stack-block-label {
|
|
170
|
-
background-color: transparent;
|
|
171
|
-
color: #333333;
|
|
172
|
-
|
|
173
|
-
&:hover {
|
|
174
|
-
cursor: default;
|
|
175
|
-
background-color: transparent;
|
|
176
|
-
border-bottom: none;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.angle-icon {
|
|
180
|
-
opacity: 0;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="[
|
|
4
|
+
'stack-block',
|
|
5
|
+
open ? 'stack-block-expanded' : 'stack-block-expandable',
|
|
6
|
+
{ 'not-children': !props.hasChildren },
|
|
7
|
+
]"
|
|
8
|
+
>
|
|
9
|
+
<div
|
|
10
|
+
:id="`${props.testId}-toggle`"
|
|
11
|
+
:data-id="`${props.testId}-toggle`"
|
|
12
|
+
class="stack-block-label"
|
|
13
|
+
@click="onToggle"
|
|
14
|
+
>
|
|
15
|
+
<atoms-the-icon name="angle" class="angle-icon" fill="#565656" />
|
|
16
|
+
|
|
17
|
+
<div class="stack-view-key">
|
|
18
|
+
<slot name="stackBlockKey" />
|
|
19
|
+
</div>
|
|
20
|
+
<div class="stack-block-content">
|
|
21
|
+
<slot name="stackBlockContent" />
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<span
|
|
25
|
+
v-if="props.removable && props.isRollBack"
|
|
26
|
+
class="icon-roll-back"
|
|
27
|
+
:data-id="`${props.testId}-roll-back`"
|
|
28
|
+
@mousedown="onRollBack"
|
|
29
|
+
@click.stop
|
|
30
|
+
/>
|
|
31
|
+
<atoms-the-icon
|
|
32
|
+
v-else-if="props.removable"
|
|
33
|
+
:data-id="`${props.testId}-remove`"
|
|
34
|
+
class="remove-icon"
|
|
35
|
+
name="close-circle"
|
|
36
|
+
@mousedown="onRemove"
|
|
37
|
+
@click.stop
|
|
38
|
+
/>
|
|
39
|
+
<span v-else class="empty-icon"></span>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div v-show="open" class="stack-children">
|
|
43
|
+
<div style="height: auto">
|
|
44
|
+
<slot name="stackChildren" />
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script setup lang="ts">
|
|
51
|
+
const props = withDefaults(
|
|
52
|
+
defineProps<{
|
|
53
|
+
hasChildren: boolean
|
|
54
|
+
removable?: boolean
|
|
55
|
+
testId?: string
|
|
56
|
+
openByDefault?: boolean
|
|
57
|
+
isRollBack?: boolean
|
|
58
|
+
}>(),
|
|
59
|
+
{ testId: 'ui-stack-block', openByDefault: false }
|
|
60
|
+
)
|
|
61
|
+
const emits = defineEmits<{
|
|
62
|
+
(event: 'toggle', value: boolean): void
|
|
63
|
+
(event: 'remove'): void
|
|
64
|
+
(event: 'roll-back'): void
|
|
65
|
+
}>()
|
|
66
|
+
|
|
67
|
+
const open = ref<boolean>(props.openByDefault || false)
|
|
68
|
+
const onToggle = (): void => {
|
|
69
|
+
if (!props.hasChildren) return
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
open.value = !open.value
|
|
72
|
+
emits('toggle', open.value)
|
|
73
|
+
}, 0)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const onRemove = (): void => {
|
|
77
|
+
emits('remove')
|
|
78
|
+
}
|
|
79
|
+
const onRollBack = (): void => {
|
|
80
|
+
emits('roll-back')
|
|
81
|
+
}
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<style scoped lang="scss">
|
|
85
|
+
.stack-block {
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
background-color: var(--block-view-bg-color);
|
|
88
|
+
border-color: var(--global-border-color);
|
|
89
|
+
|
|
90
|
+
&.stack-block-expandable:hover {
|
|
91
|
+
border-bottom: 1px solid #666;
|
|
92
|
+
|
|
93
|
+
.stack-block-label {
|
|
94
|
+
background-color: var(--block-view-bg-color);
|
|
95
|
+
border-color: var(--global-border-color);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.stack-block-label {
|
|
100
|
+
padding: 6px 12px;
|
|
101
|
+
flex: 1 1 auto;
|
|
102
|
+
max-width: unset;
|
|
103
|
+
display: flex;
|
|
104
|
+
background-color: var(--block-view-bg-color);
|
|
105
|
+
border-color: var(--global-border-color);
|
|
106
|
+
|
|
107
|
+
&:hover {
|
|
108
|
+
.remove-icon {
|
|
109
|
+
opacity: 1;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&::before {
|
|
114
|
+
display: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.angle-icon {
|
|
118
|
+
width: 14px;
|
|
119
|
+
height: 14px;
|
|
120
|
+
margin-right: 4px;
|
|
121
|
+
transform: rotate(90deg);
|
|
122
|
+
align-self: center;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.remove-icon {
|
|
126
|
+
width: 18px;
|
|
127
|
+
height: 18px;
|
|
128
|
+
opacity: 0;
|
|
129
|
+
cursor: pointer;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.stack-view-key {
|
|
133
|
+
flex: 0 0 40%;
|
|
134
|
+
max-width: 40%;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.stack-block-content {
|
|
138
|
+
padding: 0;
|
|
139
|
+
flex: 1 1 auto;
|
|
140
|
+
width: 60%;
|
|
141
|
+
background-color: transparent;
|
|
142
|
+
word-break: break-all;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.empty-icon {
|
|
146
|
+
width: 18px;
|
|
147
|
+
height: 18px;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&.stack-block-expanded {
|
|
152
|
+
.stack-block-label {
|
|
153
|
+
color: #ffffff;
|
|
154
|
+
background-color: #29414e;
|
|
155
|
+
|
|
156
|
+
.angle-icon {
|
|
157
|
+
fill: #ffffff;
|
|
158
|
+
transform: rotate(180deg);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.remove-icon {
|
|
162
|
+
fill: #ffffff;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&.not-children {
|
|
168
|
+
cursor: default;
|
|
169
|
+
.stack-block-label {
|
|
170
|
+
background-color: transparent;
|
|
171
|
+
color: #333333;
|
|
172
|
+
|
|
173
|
+
&:hover {
|
|
174
|
+
cursor: default;
|
|
175
|
+
background-color: transparent;
|
|
176
|
+
border-bottom: none;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.angle-icon {
|
|
180
|
+
opacity: 0;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
</style>
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
|
|
2
|
-
|
|
3
|
-
export interface UI_I_ContextMenuByEvent {
|
|
4
|
-
event: any
|
|
5
|
-
node: UI_I_TreeNode
|
|
6
|
-
}
|
|
7
|
-
export interface UI_I_ContextMenu<T = string> {
|
|
8
|
-
x: number
|
|
9
|
-
y: number
|
|
10
|
-
id: string | number
|
|
11
|
-
type: T
|
|
12
|
-
titleText: string
|
|
13
|
-
titleIconClassName: string
|
|
14
|
-
items: UI_I_ContextMenuItem[]
|
|
15
|
-
}
|
|
16
|
-
export interface UI_I_ContextMenuItem<T = string> {
|
|
17
|
-
name: string
|
|
18
|
-
actionType: T | ''
|
|
19
|
-
iconClassName: string
|
|
20
|
-
items: UI_I_ContextMenuItem<T>[]
|
|
21
|
-
shortcut?: string
|
|
22
|
-
hasBorderTop?: boolean
|
|
23
|
-
isHeader?: boolean
|
|
24
|
-
disabled?: boolean
|
|
25
|
-
isShowItems?: boolean
|
|
26
|
-
testId?: string
|
|
27
|
-
style?: {
|
|
28
|
-
color: string
|
|
29
|
-
}
|
|
30
|
-
}
|
|
1
|
+
import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
|
|
2
|
+
|
|
3
|
+
export interface UI_I_ContextMenuByEvent {
|
|
4
|
+
event: any
|
|
5
|
+
node: UI_I_TreeNode
|
|
6
|
+
}
|
|
7
|
+
export interface UI_I_ContextMenu<T = string> {
|
|
8
|
+
x: number
|
|
9
|
+
y: number
|
|
10
|
+
id: string | number
|
|
11
|
+
type: T
|
|
12
|
+
titleText: string
|
|
13
|
+
titleIconClassName: string
|
|
14
|
+
items: UI_I_ContextMenuItem[]
|
|
15
|
+
}
|
|
16
|
+
export interface UI_I_ContextMenuItem<T = string> {
|
|
17
|
+
name: string
|
|
18
|
+
actionType: T | ''
|
|
19
|
+
iconClassName: string
|
|
20
|
+
items: UI_I_ContextMenuItem<T>[]
|
|
21
|
+
shortcut?: string
|
|
22
|
+
hasBorderTop?: boolean
|
|
23
|
+
isHeader?: boolean
|
|
24
|
+
disabled?: boolean
|
|
25
|
+
isShowItems?: boolean
|
|
26
|
+
testId?: string
|
|
27
|
+
style?: {
|
|
28
|
+
color: string
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<common-context-recursion-new
|
|
3
|
-
v-if="isNewView"
|
|
4
|
-
:items="props.items"
|
|
5
|
-
:action-loading="props.actionLoading"
|
|
6
|
-
:is-loading="isLoading"
|
|
7
|
-
:test-id="props.testId"
|
|
8
|
-
@select-item="selectItem"
|
|
9
|
-
@toggle-items="toggleItems"
|
|
10
|
-
/>
|
|
11
|
-
<common-context-recursion-old
|
|
12
|
-
v-else
|
|
13
|
-
:items="props.items"
|
|
14
|
-
:action-loading="props.actionLoading"
|
|
15
|
-
:is-loading="isLoading"
|
|
16
|
-
:test-id="props.testId"
|
|
17
|
-
@select-item="selectItem"
|
|
18
|
-
@toggle-items="toggleItems"
|
|
19
|
-
/>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script setup lang="ts">
|
|
23
|
-
import type { UI_I_ContextMenuItem } from '~/components/common/context/lib/models/interfaces'
|
|
24
|
-
import type { I_HTMLLiElement } from '~/components/common/context/recursion/lib/models/interfaces'
|
|
25
|
-
|
|
26
|
-
const props = defineProps<{
|
|
27
|
-
items: UI_I_ContextMenuItem[]
|
|
28
|
-
actionLoading: string | null
|
|
29
|
-
testId?: string
|
|
30
|
-
}>()
|
|
31
|
-
const emits = defineEmits<{
|
|
32
|
-
(event: 'select-item', value: UI_I_ContextMenuItem): void
|
|
33
|
-
}>()
|
|
34
|
-
|
|
35
|
-
const { $store }: any = useNuxtApp()
|
|
36
|
-
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
|
37
|
-
|
|
38
|
-
const isLoading = computed<boolean>(
|
|
39
|
-
() => !!props.items.find((item) => item.actionType === props.actionLoading)
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
const selectItem = (item: UI_I_ContextMenuItem): void => {
|
|
43
|
-
if (item.disabled) return
|
|
44
|
-
|
|
45
|
-
emits('select-item', item)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const setElementPosition = (event: I_HTMLLiElement): void => {
|
|
49
|
-
const top = event.target.getBoundingClientRect().top
|
|
50
|
-
const childMenu = event.target.children[1].children[0]
|
|
51
|
-
childMenu.style.top = `${top}px`
|
|
52
|
-
|
|
53
|
-
const childMenuRect = (childMenu.getBoundingClientRect() as DOMRect) || null
|
|
54
|
-
|
|
55
|
-
// Обрабатываем, если попап вишел за viewport (с права)
|
|
56
|
-
if (childMenuRect.right > window.innerWidth) {
|
|
57
|
-
event.target.classList.add('left')
|
|
58
|
-
} else {
|
|
59
|
-
event.target.classList.remove('left')
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Обрабатываем, если попап вишел за viewport (с низу)
|
|
63
|
-
if (childMenuRect.bottom > window.innerHeight) {
|
|
64
|
-
childMenu.style.top = 'auto'
|
|
65
|
-
childMenu.style.bottom = '0px'
|
|
66
|
-
} else {
|
|
67
|
-
childMenu.style.bottom = 'unset'
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const toggleItems = (
|
|
72
|
-
data: [UI_I_ContextMenuItem, boolean, I_HTMLLiElement]
|
|
73
|
-
): void => {
|
|
74
|
-
const [item, show, e] = data
|
|
75
|
-
if (!item.items.length || item.disabled) {
|
|
76
|
-
return
|
|
77
|
-
}
|
|
78
|
-
item.isShowItems = show
|
|
79
|
-
|
|
80
|
-
nextTick(() => {
|
|
81
|
-
setElementPosition(e)
|
|
82
|
-
})
|
|
83
|
-
}
|
|
84
|
-
</script>
|
|
85
|
-
|
|
86
|
-
<style scoped lang="scss"></style>
|
|
1
|
+
<template>
|
|
2
|
+
<common-context-recursion-new
|
|
3
|
+
v-if="isNewView"
|
|
4
|
+
:items="props.items"
|
|
5
|
+
:action-loading="props.actionLoading"
|
|
6
|
+
:is-loading="isLoading"
|
|
7
|
+
:test-id="props.testId"
|
|
8
|
+
@select-item="selectItem"
|
|
9
|
+
@toggle-items="toggleItems"
|
|
10
|
+
/>
|
|
11
|
+
<common-context-recursion-old
|
|
12
|
+
v-else
|
|
13
|
+
:items="props.items"
|
|
14
|
+
:action-loading="props.actionLoading"
|
|
15
|
+
:is-loading="isLoading"
|
|
16
|
+
:test-id="props.testId"
|
|
17
|
+
@select-item="selectItem"
|
|
18
|
+
@toggle-items="toggleItems"
|
|
19
|
+
/>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import type { UI_I_ContextMenuItem } from '~/components/common/context/lib/models/interfaces'
|
|
24
|
+
import type { I_HTMLLiElement } from '~/components/common/context/recursion/lib/models/interfaces'
|
|
25
|
+
|
|
26
|
+
const props = defineProps<{
|
|
27
|
+
items: UI_I_ContextMenuItem[]
|
|
28
|
+
actionLoading: string | null
|
|
29
|
+
testId?: string
|
|
30
|
+
}>()
|
|
31
|
+
const emits = defineEmits<{
|
|
32
|
+
(event: 'select-item', value: UI_I_ContextMenuItem): void
|
|
33
|
+
}>()
|
|
34
|
+
|
|
35
|
+
const { $store }: any = useNuxtApp()
|
|
36
|
+
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
|
37
|
+
|
|
38
|
+
const isLoading = computed<boolean>(
|
|
39
|
+
() => !!props.items.find((item) => item.actionType === props.actionLoading)
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
const selectItem = (item: UI_I_ContextMenuItem): void => {
|
|
43
|
+
if (item.disabled) return
|
|
44
|
+
|
|
45
|
+
emits('select-item', item)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const setElementPosition = (event: I_HTMLLiElement): void => {
|
|
49
|
+
const top = event.target.getBoundingClientRect().top
|
|
50
|
+
const childMenu = event.target.children[1].children[0]
|
|
51
|
+
childMenu.style.top = `${top}px`
|
|
52
|
+
|
|
53
|
+
const childMenuRect = (childMenu.getBoundingClientRect() as DOMRect) || null
|
|
54
|
+
|
|
55
|
+
// Обрабатываем, если попап вишел за viewport (с права)
|
|
56
|
+
if (childMenuRect.right > window.innerWidth) {
|
|
57
|
+
event.target.classList.add('left')
|
|
58
|
+
} else {
|
|
59
|
+
event.target.classList.remove('left')
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Обрабатываем, если попап вишел за viewport (с низу)
|
|
63
|
+
if (childMenuRect.bottom > window.innerHeight) {
|
|
64
|
+
childMenu.style.top = 'auto'
|
|
65
|
+
childMenu.style.bottom = '0px'
|
|
66
|
+
} else {
|
|
67
|
+
childMenu.style.bottom = 'unset'
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const toggleItems = (
|
|
72
|
+
data: [UI_I_ContextMenuItem, boolean, I_HTMLLiElement]
|
|
73
|
+
): void => {
|
|
74
|
+
const [item, show, e] = data
|
|
75
|
+
if (!item.items.length || item.disabled) {
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
item.isShowItems = show
|
|
79
|
+
|
|
80
|
+
nextTick(() => {
|
|
81
|
+
setElementPosition(e)
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
<style scoped lang="scss"></style>
|