bfg-common 1.4.745 → 1.4.747

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