bfg-common 1.4.574 → 1.4.576

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