bfg-common 1.4.591 → 1.4.592

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.
Files changed (96) hide show
  1. package/assets/localization/local_be.json +2 -0
  2. package/assets/localization/local_en.json +3 -1
  3. package/assets/localization/local_hy.json +2 -0
  4. package/assets/localization/local_kk.json +3 -1
  5. package/assets/localization/local_ru.json +2 -0
  6. package/assets/localization/local_zh.json +2 -0
  7. package/components/atoms/TheIcon3.vue +50 -50
  8. package/components/atoms/modal/bySteps/BySteps.vue +253 -253
  9. package/components/atoms/stack/StackBlock.vue +185 -185
  10. package/components/atoms/table/dataGrid/DataGrid.vue +1633 -1633
  11. package/components/atoms/table/dataGrid/DataGridColumnSwitch.vue +222 -222
  12. package/components/common/browse/BrowseNew.vue +237 -237
  13. package/components/common/browse/BrowseOld.vue +217 -217
  14. package/components/common/browse/blocks/contents/Files.vue +35 -35
  15. package/components/common/browse/blocks/contents/FilesOld.vue +70 -70
  16. package/components/common/browse/blocks/contents/filesNew/FilesNew.vue +92 -92
  17. package/components/common/browse/blocks/contents/filesNew/Skeleton.vue +18 -18
  18. package/components/common/context/lib/models/interfaces.ts +30 -30
  19. package/components/common/context/recursion/Recursion.vue +86 -86
  20. package/components/common/context/recursion/RecursionNew.vue +199 -199
  21. package/components/common/context/recursion/RecursionOld.vue +213 -213
  22. package/components/common/layout/theHeader/helpMenu/About.vue +85 -85
  23. package/components/common/layout/theHeader/helpMenu/aboutNew/AboutNew.vue +103 -103
  24. package/components/common/mainNavigationPanel/MainNavigationPanel.vue +152 -152
  25. package/components/common/spiceConsole/Drawer.vue +370 -370
  26. package/components/common/spiceConsole/lib/models/interfaces.ts +5 -5
  27. package/components/common/split/horizontal/HorizontalNew.vue +358 -358
  28. package/components/common/split/vertical/Vertical.vue +160 -160
  29. package/components/common/vm/actions/add/Add.vue +617 -617
  30. package/components/common/vm/actions/clone/lib/config/steps.ts +129 -129
  31. package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +267 -267
  32. package/components/common/vm/actions/common/customizeHardware/CustomizeHardwareNew.vue +264 -264
  33. package/components/common/vm/actions/common/customizeHardware/virtualHardware/browseView/BrowseView.vue +219 -219
  34. package/components/common/vm/actions/common/customizeHardware/virtualHardware/bus/BusNew.vue +118 -118
  35. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDriveNew.vue +161 -161
  36. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDriveOld.vue +165 -165
  37. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/Media.vue +25 -25
  38. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/MediaNew.vue +55 -55
  39. package/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/config/dropdownItems.ts +147 -147
  40. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/mode/ModeOld.vue +55 -55
  41. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/sharing/SharingNew.vue +44 -44
  42. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetworkNew.vue +124 -124
  43. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/LocationOld.vue +134 -134
  44. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/new/New.vue +63 -63
  45. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/new/table/Table.vue +74 -74
  46. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/new/table/lib/config/config.ts +95 -95
  47. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddress.vue +119 -119
  48. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddressNew.vue +69 -69
  49. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddressOld.vue +83 -83
  50. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDeviceNew.vue +85 -85
  51. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDeviceOld.vue +91 -91
  52. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/DirectPathIoNew.vue +35 -35
  53. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/DynamicDirectPathIoNew.vue +48 -48
  54. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/Note.vue +15 -15
  55. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/NoteNew.vue +42 -42
  56. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/NoteOld.vue +30 -30
  57. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/nvidiaGrid/NvidiaGridNew.vue +30 -30
  58. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/typeSelection/TypeSelectionNew.vue +46 -46
  59. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbControllerNew.vue +56 -56
  60. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/Other.vue +16 -16
  61. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/OtherNew.vue +27 -27
  62. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/totalVideoMemory/TotalVideoMemoryNew.vue +54 -54
  63. package/components/common/vm/actions/common/customizeHardware/vmoptions/Vmoptions.vue +145 -145
  64. package/components/common/vm/actions/common/customizeHardware/vmoptions/VmoptionsNew.vue +102 -102
  65. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptionsNew.vue +75 -75
  66. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/delay/Delay.vue +26 -26
  67. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/Firmware.vue +57 -57
  68. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/FirmwareNew.vue +42 -42
  69. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/menu/MenuNew.vue +25 -25
  70. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +171 -171
  71. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/OrderNew.vue +50 -50
  72. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptionsNew.vue +141 -141
  73. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/New.vue +140 -140
  74. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/copyPaste/CopyPasteNew.vue +30 -30
  75. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/fileTransfer/FileTransferNew.vue +30 -30
  76. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/folderSharing/FolderSharingNew.vue +30 -30
  77. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +32 -32
  78. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/KeymapNew.vue +39 -39
  79. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/PasswordNew.vue +100 -100
  80. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirectionNew.vue +38 -38
  81. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirectionOld.vue +44 -44
  82. package/components/common/vm/actions/common/select/storage/Storage.vue +130 -130
  83. package/components/common/vm/actions/common/select/storage/StorageOld.vue +129 -129
  84. package/components/common/vm/actions/common/select/storage/new/New.vue +159 -159
  85. package/components/common/vm/actions/editSettings/EditSettings.vue +214 -214
  86. package/components/common/vm/actions/editSettings/EditSettingsOld.vue +182 -182
  87. package/components/common/vm/actions/editSettings/new/New.vue +176 -176
  88. package/components/common/vm/actions/editSettings/new/Skeleton.vue +88 -88
  89. package/composables/productNameLocal.ts +30 -30
  90. package/package.json +1 -1
  91. package/plugins/date.ts +233 -233
  92. package/plugins/recursion.ts +311 -311
  93. package/public/spice-console/lib/images/bitmap.js +203 -203
  94. package/public/spice-console/network/spicechannel.js +383 -383
  95. package/store/main/mutations.ts +7 -7
  96. package/store/main/state.ts +7 -7
@@ -1,358 +1,358 @@
1
- <template>
2
- <!-- TODO нужно объеденить с компонентой Horizontal.vue-->
3
- <div
4
- :id="elementId"
5
- :class="['fill-parent horizontal', { dragging: isDrag }]"
6
- >
7
- <div class="firstPanel" :style="leftPanelStyle">
8
- <div class="left-panel">
9
- <div
10
- v-if="props.showToggleButton"
11
- :class="['panel-toggle', { collapsed: leftPanelCollapsed }]"
12
- >
13
- <div v-show="!leftPanelCollapsed">
14
- <slot name="toggleContent" />
15
- </div>
16
- <button
17
- id="collapse-left-panel-button"
18
- data-id="collapse-left-panel-button"
19
- class="btn-trigger"
20
- @click="collapseLeftPanel"
21
- >
22
- <ui-icon-icon2 name="tree-arrow" />
23
- </button>
24
- </div>
25
-
26
- <div v-show="!leftPanelCollapsed" class="navigator">
27
- <slot name="firstPanel" />
28
- </div>
29
- </div>
30
- </div>
31
- <div
32
- v-show="!leftPanelCollapsed"
33
- :id="`gutter-${elementId}`"
34
- class="gutter gutter-horizontal"
35
- tabindex="0"
36
- @mousedown="isGrab = true"
37
- @focus="isFocus = true"
38
- @blur="isFocus = false"
39
- >
40
- <div class="gutter-horizontal-handler"></div>
41
- </div>
42
-
43
- <div class="secondPanel right" :style="rightPanelStyle">
44
- <slot name="secondPanel" />
45
- </div>
46
- </div>
47
- </template>
48
-
49
- <script setup lang="ts">
50
- const props = withDefaults(
51
- defineProps<{
52
- parentElementSelector: string
53
- leftPanelW?: number
54
- leftPanelMinWidth?: number
55
- rightPanelMinWidth?: number
56
- showToggleButton?: boolean
57
- hideLeftPanel?: boolean
58
- }>(),
59
- {
60
- leftPanelMinWidth: 200, // 200px
61
- rightPanelMinWidth: 200, // 200px
62
- leftPanelW: undefined,
63
- showToggleButton: true,
64
- hideLeftPanel: false,
65
- }
66
- )
67
- const emits = defineEmits<{
68
- (event: 'dragend', value: number): void
69
- }>()
70
-
71
- const leftPanelStyle = computed(() => {
72
- let width = `calc(${leftPanelWLocal.value}% - 1.5px)`
73
- if (props.showToggleButton && leftPanelCollapsed.value) {
74
- width = '20px'
75
- }
76
- if (props.hideLeftPanel && leftPanelCollapsed.value) width = '0px'
77
-
78
- return { width }
79
- })
80
- const rightPanelStyle = computed(() => {
81
- let width = `calc(${100 - leftPanelWLocal.value}% - 1.5px)`
82
- if (props.showToggleButton && leftPanelCollapsed.value) {
83
- width = 'calc(100% - 20px)'
84
- }
85
-
86
- if (props.hideLeftPanel && leftPanelCollapsed.value)
87
- width = 'calc(100% - 0px)'
88
-
89
- return { width }
90
- })
91
- const leftPanelCollapsed = ref<boolean>(false)
92
- const collapseLeftPanel = (): void => {
93
- leftPanelCollapsed.value = !leftPanelCollapsed.value
94
-
95
- checkLeftPanelWidth()
96
- }
97
-
98
- const isGrab = ref<boolean>(false)
99
- const isFocus = ref<boolean>(false)
100
- const isDrag = ref<boolean>(false)
101
- const leftPanelWLocal = ref<number>(20) // 0%
102
- watch(
103
- () => props.leftPanelW,
104
- (newValue) => {
105
- if (newValue === undefined) return
106
- leftPanelWLocal.value = newValue
107
- },
108
- { immediate: true }
109
- )
110
-
111
- watch(
112
- () => props.hideLeftPanel,
113
- () => {
114
- collapseLeftPanel()
115
- }
116
- )
117
-
118
- let parentElem: HTMLElement | null
119
- const mouseup = (): void => {
120
- if (!isGrab.value) {
121
- return
122
- }
123
-
124
- isGrab.value = false
125
- isDrag.value = false
126
-
127
- emits('dragend', leftPanelWLocal.value)
128
- }
129
-
130
- let mousemove = (e: MouseEvent): void => {
131
- if (!isGrab.value) return
132
-
133
- e.preventDefault()
134
- isDrag.value = true
135
- doDrag(e.clientX)
136
- }
137
- mousemove = useThrottle(mousemove)
138
-
139
- const doDrag = (clientX: number): void => {
140
- const parentElemRect = parentElem?.getBoundingClientRect()
141
- const parentElemWidth = parentElemRect?.width || 0
142
- const parentElemLeft = parentElemRect?.left || 0
143
- const onePercent = parentElemWidth / 100
144
- const layerX = clientX - parentElemLeft
145
-
146
- const leftLimit = layerX <= props.leftPanelMinWidth
147
- const rightLimit = parentElemWidth - layerX <= props.rightPanelMinWidth
148
- if (leftLimit || rightLimit) return
149
-
150
- leftPanelWLocal.value = layerX / onePercent
151
- }
152
-
153
- const elementId = `horizontal${useUniqueId()}`
154
-
155
- const keydown = (e: KeyboardEvent): void => {
156
- if (!isFocus.value) return
157
-
158
- const gutter = document.getElementById(`gutter-${elementId}`)
159
-
160
- if (!gutter) return
161
-
162
- const gutterLeft = ~~(gutter.getBoundingClientRect().left + 1.5)
163
-
164
- if (e.keyCode === 39) {
165
- doDrag(gutterLeft + 10)
166
- }
167
- if (e.keyCode === 37) {
168
- doDrag(gutterLeft - 10)
169
- }
170
- }
171
- const checkLeftPanelWidth = (): void => {
172
- const firstElem = document.querySelector(
173
- `${props.parentElementSelector} .firstPanel`
174
- )
175
-
176
- if (!firstElem) return
177
-
178
- firstElem.style.minWidth = leftPanelCollapsed.value
179
- ? 'unset'
180
- : props.leftPanelMinWidth + 'px'
181
- }
182
- onMounted(() => {
183
- parentElem = document.querySelector(props.parentElementSelector)
184
-
185
- window.addEventListener('mousemove', mousemove)
186
- window.addEventListener('mouseup', mouseup)
187
- window.addEventListener('keydown', keydown)
188
- checkLeftPanelWidth()
189
- })
190
- onUnmounted(() => {
191
- window.removeEventListener('mouseup', mouseup)
192
- window.removeEventListener('mousemove', mousemove)
193
- window.removeEventListener('keydown', keydown)
194
- })
195
- </script>
196
-
197
- <style>
198
- :root {
199
- --split-horizontal-border-color: #e9ebed;
200
- }
201
- :root.dark-theme {
202
- --split-horizontal-border-color: #e9ebed1f;
203
- }
204
- </style>
205
-
206
- <style scoped lang="scss">
207
- @import '@/assets/scss/common/mixins';
208
- .horizontal {
209
- &.dragging {
210
- .gutter-horizontal.gutter {
211
- background-color: var(--gutter-active-bg-color);
212
-
213
- &:before {
214
- background-color: var(--new-gutter-before-bg-color);
215
- }
216
- }
217
- }
218
- .firstPanel {
219
- width: calc(50% - 1.5px);
220
- background-color: var(--center-pane-container);
221
-
222
- .left-panel {
223
- @include flex($dir: column);
224
- width: 100%;
225
- height: 100%;
226
-
227
- .panel-toggle {
228
- display: flex;
229
- align-items: center;
230
- justify-content: space-between;
231
- min-height: 48px;
232
- border-bottom: 1px solid var(--split-horizontal-border-color);
233
- background-color: var(--horizontal-panel-bg-color);
234
-
235
- &.collapsed {
236
- border: none;
237
-
238
- .btn-trigger {
239
- border-radius: 0 4px 4px 0;
240
-
241
- :deep(svg) {
242
- transform: rotate(-90deg);
243
- }
244
- }
245
- }
246
-
247
- .btn-trigger {
248
- @include flex($align: center, $just: center);
249
- width: 16px;
250
- height: 32px;
251
- flex: 0 0 16px;
252
- border: 0;
253
- padding: 0;
254
- margin: 0;
255
- background-color: var(--trigger-bg-color);
256
- color: var(--trigger-color);
257
- outline: none;
258
- cursor: pointer;
259
- border-radius: 4px 0 0 4px;
260
-
261
- :deep(svg) {
262
- transform: rotate(90deg);
263
- }
264
- }
265
- }
266
- .navigator {
267
- overflow: hidden;
268
- height: 100%;
269
-
270
- .panel-inner {
271
- position: relative;
272
- height: 100%;
273
- background: var(--horizontal-panel-bg-color);
274
- border-radius: 0;
275
- border: 0;
276
-
277
- &.inventory-tree {
278
- padding-left: 4px;
279
- padding-top: 6px;
280
- }
281
- }
282
- }
283
- }
284
- }
285
- .gutter-horizontal {
286
- position: relative;
287
- width: 4px;
288
- //background-color: var(--gutter-bg-color);
289
- background-color: var(--new-gutter-bg-color);
290
- transition-delay: 0.25s;
291
- transition-duration: 0.25s;
292
-
293
- &-handler {
294
- position: absolute;
295
- height: 100%;
296
- width: 10px;
297
- background: transparent;
298
- top: 0;
299
- left: -3.5px;
300
- z-index: 2;
301
- }
302
-
303
- &:focus {
304
- background-color: var(--gutter-active-bg-color);
305
- outline: none;
306
- }
307
-
308
- &:hover {
309
- background-color: var(--new-gutter-hover-bg-color);
310
- cursor: col-resize;
311
- &:before {
312
- background-color: hsla(0, 0%, 100%, 0.5);
313
- box-shadow: inset 0 0 0 1px rgb(0 0 0 / 10%);
314
- }
315
- }
316
-
317
- &:before {
318
- content: '';
319
- position: relative;
320
- display: block;
321
- background: var(--gutter-before-bg);
322
- transition-delay: 0.25s;
323
- transition-duration: 0.25s;
324
- width: 2px;
325
- margin-left: 1px;
326
- border-radius: 4px;
327
- height: 24px;
328
- top: calc(50% - 12.5px);
329
- }
330
- }
331
- .secondPanel {
332
- width: calc(50% - 1.5px);
333
- &.right {
334
- overflow: hidden;
335
- height: 100%;
336
- }
337
- }
338
- }
339
- </style>
340
-
341
- <style>
342
- :root.is-new-view {
343
- --horizontal-panel-bg-color: #fff;
344
- --trigger-bg-color: #e9ebed;
345
- --trigger-color: #213444;
346
- --new-gutter-bg-color: #e9ebed;
347
- --new-gutter-hover-bg-color: #008fd6;
348
- --new-gutter-before-bg-color: rgba(255, 255, 255, 0.8);
349
- }
350
- :root.is-new-view.dark-theme {
351
- --horizontal-panel-bg-color: #213444;
352
- --trigger-bg-color: #314352;
353
- --trigger-color: #e9ebed;
354
- --new-gutter-bg-color: #394a58;
355
- --new-gutter-hover-bg-color: #2ba2de;
356
- --new-gutter-before-bg-color: rgba(33, 52, 68, 0.8);
357
- }
358
- </style>
1
+ <template>
2
+ <!-- TODO нужно объеденить с компонентой Horizontal.vue-->
3
+ <div
4
+ :id="elementId"
5
+ :class="['fill-parent horizontal', { dragging: isDrag }]"
6
+ >
7
+ <div class="firstPanel" :style="leftPanelStyle">
8
+ <div class="left-panel">
9
+ <div
10
+ v-if="props.showToggleButton"
11
+ :class="['panel-toggle', { collapsed: leftPanelCollapsed }]"
12
+ >
13
+ <div v-show="!leftPanelCollapsed">
14
+ <slot name="toggleContent" />
15
+ </div>
16
+ <button
17
+ id="collapse-left-panel-button"
18
+ data-id="collapse-left-panel-button"
19
+ class="btn-trigger"
20
+ @click="collapseLeftPanel"
21
+ >
22
+ <ui-icon-icon2 name="tree-arrow" />
23
+ </button>
24
+ </div>
25
+
26
+ <div v-show="!leftPanelCollapsed" class="navigator">
27
+ <slot name="firstPanel" />
28
+ </div>
29
+ </div>
30
+ </div>
31
+ <div
32
+ v-show="!leftPanelCollapsed"
33
+ :id="`gutter-${elementId}`"
34
+ class="gutter gutter-horizontal"
35
+ tabindex="0"
36
+ @mousedown="isGrab = true"
37
+ @focus="isFocus = true"
38
+ @blur="isFocus = false"
39
+ >
40
+ <div class="gutter-horizontal-handler"></div>
41
+ </div>
42
+
43
+ <div class="secondPanel right" :style="rightPanelStyle">
44
+ <slot name="secondPanel" />
45
+ </div>
46
+ </div>
47
+ </template>
48
+
49
+ <script setup lang="ts">
50
+ const props = withDefaults(
51
+ defineProps<{
52
+ parentElementSelector: string
53
+ leftPanelW?: number
54
+ leftPanelMinWidth?: number
55
+ rightPanelMinWidth?: number
56
+ showToggleButton?: boolean
57
+ hideLeftPanel?: boolean
58
+ }>(),
59
+ {
60
+ leftPanelMinWidth: 200, // 200px
61
+ rightPanelMinWidth: 200, // 200px
62
+ leftPanelW: undefined,
63
+ showToggleButton: true,
64
+ hideLeftPanel: false,
65
+ }
66
+ )
67
+ const emits = defineEmits<{
68
+ (event: 'dragend', value: number): void
69
+ }>()
70
+
71
+ const leftPanelStyle = computed(() => {
72
+ let width = `calc(${leftPanelWLocal.value}% - 1.5px)`
73
+ if (props.showToggleButton && leftPanelCollapsed.value) {
74
+ width = '20px'
75
+ }
76
+ if (props.hideLeftPanel && leftPanelCollapsed.value) width = '0px'
77
+
78
+ return { width }
79
+ })
80
+ const rightPanelStyle = computed(() => {
81
+ let width = `calc(${100 - leftPanelWLocal.value}% - 1.5px)`
82
+ if (props.showToggleButton && leftPanelCollapsed.value) {
83
+ width = 'calc(100% - 20px)'
84
+ }
85
+
86
+ if (props.hideLeftPanel && leftPanelCollapsed.value)
87
+ width = 'calc(100% - 0px)'
88
+
89
+ return { width }
90
+ })
91
+ const leftPanelCollapsed = ref<boolean>(false)
92
+ const collapseLeftPanel = (): void => {
93
+ leftPanelCollapsed.value = !leftPanelCollapsed.value
94
+
95
+ checkLeftPanelWidth()
96
+ }
97
+
98
+ const isGrab = ref<boolean>(false)
99
+ const isFocus = ref<boolean>(false)
100
+ const isDrag = ref<boolean>(false)
101
+ const leftPanelWLocal = ref<number>(20) // 0%
102
+ watch(
103
+ () => props.leftPanelW,
104
+ (newValue) => {
105
+ if (newValue === undefined) return
106
+ leftPanelWLocal.value = newValue
107
+ },
108
+ { immediate: true }
109
+ )
110
+
111
+ watch(
112
+ () => props.hideLeftPanel,
113
+ () => {
114
+ collapseLeftPanel()
115
+ }
116
+ )
117
+
118
+ let parentElem: HTMLElement | null
119
+ const mouseup = (): void => {
120
+ if (!isGrab.value) {
121
+ return
122
+ }
123
+
124
+ isGrab.value = false
125
+ isDrag.value = false
126
+
127
+ emits('dragend', leftPanelWLocal.value)
128
+ }
129
+
130
+ let mousemove = (e: MouseEvent): void => {
131
+ if (!isGrab.value) return
132
+
133
+ e.preventDefault()
134
+ isDrag.value = true
135
+ doDrag(e.clientX)
136
+ }
137
+ mousemove = useThrottle(mousemove)
138
+
139
+ const doDrag = (clientX: number): void => {
140
+ const parentElemRect = parentElem?.getBoundingClientRect()
141
+ const parentElemWidth = parentElemRect?.width || 0
142
+ const parentElemLeft = parentElemRect?.left || 0
143
+ const onePercent = parentElemWidth / 100
144
+ const layerX = clientX - parentElemLeft
145
+
146
+ const leftLimit = layerX <= props.leftPanelMinWidth
147
+ const rightLimit = parentElemWidth - layerX <= props.rightPanelMinWidth
148
+ if (leftLimit || rightLimit) return
149
+
150
+ leftPanelWLocal.value = layerX / onePercent
151
+ }
152
+
153
+ const elementId = `horizontal${useUniqueId()}`
154
+
155
+ const keydown = (e: KeyboardEvent): void => {
156
+ if (!isFocus.value) return
157
+
158
+ const gutter = document.getElementById(`gutter-${elementId}`)
159
+
160
+ if (!gutter) return
161
+
162
+ const gutterLeft = ~~(gutter.getBoundingClientRect().left + 1.5)
163
+
164
+ if (e.keyCode === 39) {
165
+ doDrag(gutterLeft + 10)
166
+ }
167
+ if (e.keyCode === 37) {
168
+ doDrag(gutterLeft - 10)
169
+ }
170
+ }
171
+ const checkLeftPanelWidth = (): void => {
172
+ const firstElem = document.querySelector(
173
+ `${props.parentElementSelector} .firstPanel`
174
+ )
175
+
176
+ if (!firstElem) return
177
+
178
+ firstElem.style.minWidth = leftPanelCollapsed.value
179
+ ? 'unset'
180
+ : props.leftPanelMinWidth + 'px'
181
+ }
182
+ onMounted(() => {
183
+ parentElem = document.querySelector(props.parentElementSelector)
184
+
185
+ window.addEventListener('mousemove', mousemove)
186
+ window.addEventListener('mouseup', mouseup)
187
+ window.addEventListener('keydown', keydown)
188
+ checkLeftPanelWidth()
189
+ })
190
+ onUnmounted(() => {
191
+ window.removeEventListener('mouseup', mouseup)
192
+ window.removeEventListener('mousemove', mousemove)
193
+ window.removeEventListener('keydown', keydown)
194
+ })
195
+ </script>
196
+
197
+ <style>
198
+ :root {
199
+ --split-horizontal-border-color: #e9ebed;
200
+ }
201
+ :root.dark-theme {
202
+ --split-horizontal-border-color: #e9ebed1f;
203
+ }
204
+ </style>
205
+
206
+ <style scoped lang="scss">
207
+ @import '@/assets/scss/common/mixins';
208
+ .horizontal {
209
+ &.dragging {
210
+ .gutter-horizontal.gutter {
211
+ background-color: var(--gutter-active-bg-color);
212
+
213
+ &:before {
214
+ background-color: var(--new-gutter-before-bg-color);
215
+ }
216
+ }
217
+ }
218
+ .firstPanel {
219
+ width: calc(50% - 1.5px);
220
+ background-color: var(--center-pane-container);
221
+
222
+ .left-panel {
223
+ @include flex($dir: column);
224
+ width: 100%;
225
+ height: 100%;
226
+
227
+ .panel-toggle {
228
+ display: flex;
229
+ align-items: center;
230
+ justify-content: space-between;
231
+ min-height: 48px;
232
+ border-bottom: 1px solid var(--split-horizontal-border-color);
233
+ background-color: var(--horizontal-panel-bg-color);
234
+
235
+ &.collapsed {
236
+ border: none;
237
+
238
+ .btn-trigger {
239
+ border-radius: 0 4px 4px 0;
240
+
241
+ :deep(svg) {
242
+ transform: rotate(-90deg);
243
+ }
244
+ }
245
+ }
246
+
247
+ .btn-trigger {
248
+ @include flex($align: center, $just: center);
249
+ width: 16px;
250
+ height: 32px;
251
+ flex: 0 0 16px;
252
+ border: 0;
253
+ padding: 0;
254
+ margin: 0;
255
+ background-color: var(--trigger-bg-color);
256
+ color: var(--trigger-color);
257
+ outline: none;
258
+ cursor: pointer;
259
+ border-radius: 4px 0 0 4px;
260
+
261
+ :deep(svg) {
262
+ transform: rotate(90deg);
263
+ }
264
+ }
265
+ }
266
+ .navigator {
267
+ overflow: hidden;
268
+ height: 100%;
269
+
270
+ .panel-inner {
271
+ position: relative;
272
+ height: 100%;
273
+ background: var(--horizontal-panel-bg-color);
274
+ border-radius: 0;
275
+ border: 0;
276
+
277
+ &.inventory-tree {
278
+ padding-left: 4px;
279
+ padding-top: 6px;
280
+ }
281
+ }
282
+ }
283
+ }
284
+ }
285
+ .gutter-horizontal {
286
+ position: relative;
287
+ width: 4px;
288
+ //background-color: var(--gutter-bg-color);
289
+ background-color: var(--new-gutter-bg-color);
290
+ transition-delay: 0.25s;
291
+ transition-duration: 0.25s;
292
+
293
+ &-handler {
294
+ position: absolute;
295
+ height: 100%;
296
+ width: 10px;
297
+ background: transparent;
298
+ top: 0;
299
+ left: -3.5px;
300
+ z-index: 2;
301
+ }
302
+
303
+ &:focus {
304
+ background-color: var(--gutter-active-bg-color);
305
+ outline: none;
306
+ }
307
+
308
+ &:hover {
309
+ background-color: var(--new-gutter-hover-bg-color);
310
+ cursor: col-resize;
311
+ &:before {
312
+ background-color: hsla(0, 0%, 100%, 0.5);
313
+ box-shadow: inset 0 0 0 1px rgb(0 0 0 / 10%);
314
+ }
315
+ }
316
+
317
+ &:before {
318
+ content: '';
319
+ position: relative;
320
+ display: block;
321
+ background: var(--gutter-before-bg);
322
+ transition-delay: 0.25s;
323
+ transition-duration: 0.25s;
324
+ width: 2px;
325
+ margin-left: 1px;
326
+ border-radius: 4px;
327
+ height: 24px;
328
+ top: calc(50% - 12.5px);
329
+ }
330
+ }
331
+ .secondPanel {
332
+ width: calc(50% - 1.5px);
333
+ &.right {
334
+ overflow: hidden;
335
+ height: 100%;
336
+ }
337
+ }
338
+ }
339
+ </style>
340
+
341
+ <style>
342
+ :root.is-new-view {
343
+ --horizontal-panel-bg-color: #fff;
344
+ --trigger-bg-color: #e9ebed;
345
+ --trigger-color: #213444;
346
+ --new-gutter-bg-color: #e9ebed;
347
+ --new-gutter-hover-bg-color: #008fd6;
348
+ --new-gutter-before-bg-color: rgba(255, 255, 255, 0.8);
349
+ }
350
+ :root.is-new-view.dark-theme {
351
+ --horizontal-panel-bg-color: #213444;
352
+ --trigger-bg-color: #314352;
353
+ --trigger-color: #e9ebed;
354
+ --new-gutter-bg-color: #394a58;
355
+ --new-gutter-hover-bg-color: #2ba2de;
356
+ --new-gutter-before-bg-color: rgba(33, 52, 68, 0.8);
357
+ }
358
+ </style>