bfg-common 1.4.575 → 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.
@@ -89,7 +89,7 @@
89
89
  </span>
90
90
  </template>
91
91
  </ui-tooltip>
92
- <div class="divider right-global-refresh" />
92
+ <div class="divider right-divider-global-refresh" />
93
93
  <div class="container-content">
94
94
  <common-layout-the-header-theme-switch
95
95
  :is-dark-theme="props.isDarkTheme"
@@ -276,7 +276,7 @@ const mainMenuTriggerStatus = computed<boolean>(
276
276
  height: 32px;
277
277
  background-color: #394a58;
278
278
 
279
- &.right-global-refresh {
279
+ &.right-divider-global-refresh {
280
280
  margin-left: 16px;
281
281
  }
282
282
  }
@@ -1,356 +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
- const checkLeftPanelWidth = (): void => {
170
- const firstElem = document.querySelector(
171
- `${props.parentElementSelector} .firstPanel`
172
- )
173
-
174
- if (!firstElem) return
175
-
176
- firstElem.style.width = 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
- setTimeout(() => {
185
- checkLeftPanelWidth()
186
- }, 100)
187
- })
188
- onUnmounted(() => {
189
- window.removeEventListener('mouseup', mouseup)
190
- window.removeEventListener('mousemove', mousemove)
191
- window.removeEventListener('keydown', keydown)
192
- })
193
- </script>
194
-
195
- <style>
196
- :root {
197
- --split-horizontal-border-color: #e9ebed;
198
- }
199
- :root.dark-theme {
200
- --split-horizontal-border-color: #e9ebed1f;
201
- }
202
- </style>
203
-
204
- <style scoped lang="scss">
205
- @import '@/assets/scss/common/mixins';
206
- .horizontal {
207
- &.dragging {
208
- .gutter-horizontal.gutter {
209
- background-color: var(--gutter-active-bg-color);
210
-
211
- &:before {
212
- background-color: var(--new-gutter-before-bg-color);
213
- }
214
- }
215
- }
216
- .firstPanel {
217
- width: calc(50% - 1.5px);
218
- background-color: var(--center-pane-container);
219
-
220
- .left-panel {
221
- @include flex($dir: column);
222
- width: 100%;
223
- height: 100%;
224
-
225
- .panel-toggle {
226
- display: flex;
227
- align-items: center;
228
- justify-content: space-between;
229
- min-height: 48px;
230
- border-bottom: 1px solid var(--split-horizontal-border-color);
231
- background-color: var(--horizontal-panel-bg-color);
232
-
233
- &.collapsed {
234
- border: none;
235
-
236
- .btn-trigger {
237
- border-radius: 0 4px 4px 0;
238
-
239
- :deep(svg) {
240
- transform: rotate(-90deg);
241
- }
242
- }
243
- }
244
-
245
- .btn-trigger {
246
- @include flex($align: center, $just: center);
247
- width: 16px;
248
- height: 32px;
249
- flex: 0 0 16px;
250
- border: 0;
251
- padding: 0;
252
- margin: 0;
253
- background-color: var(--trigger-bg-color);
254
- color: var(--trigger-color);
255
- outline: none;
256
- cursor: pointer;
257
- border-radius: 4px 0 0 4px;
258
-
259
- :deep(svg) {
260
- transform: rotate(90deg);
261
- }
262
- }
263
- }
264
- .navigator {
265
- overflow: hidden;
266
- height: 100%;
267
-
268
- .panel-inner {
269
- position: relative;
270
- height: 100%;
271
- background: var(--horizontal-panel-bg-color);
272
- border-radius: 0;
273
- border: 0;
274
-
275
- &.inventory-tree {
276
- padding-left: 4px;
277
- padding-top: 6px;
278
- }
279
- }
280
- }
281
- }
282
- }
283
- .gutter-horizontal {
284
- position: relative;
285
- width: 4px;
286
- //background-color: var(--gutter-bg-color);
287
- background-color: var(--new-gutter-bg-color);
288
- transition-delay: 0.25s;
289
- transition-duration: 0.25s;
290
-
291
- &-handler {
292
- position: absolute;
293
- height: 100%;
294
- width: 10px;
295
- background: transparent;
296
- top: 0;
297
- left: -3.5px;
298
- z-index: 2;
299
- }
300
-
301
- &:focus {
302
- background-color: var(--gutter-active-bg-color);
303
- outline: none;
304
- }
305
-
306
- &:hover {
307
- background-color: var(--new-gutter-hover-bg-color);
308
- cursor: col-resize;
309
- &:before {
310
- background-color: hsla(0, 0%, 100%, 0.5);
311
- box-shadow: inset 0 0 0 1px rgb(0 0 0 / 10%);
312
- }
313
- }
314
-
315
- &:before {
316
- content: '';
317
- position: relative;
318
- display: block;
319
- background: var(--gutter-before-bg);
320
- transition-delay: 0.25s;
321
- transition-duration: 0.25s;
322
- width: 2px;
323
- margin-left: 1px;
324
- border-radius: 4px;
325
- height: 24px;
326
- top: calc(50% - 12.5px);
327
- }
328
- }
329
- .secondPanel {
330
- width: calc(50% - 1.5px);
331
- &.right {
332
- overflow: hidden;
333
- height: 100%;
334
- }
335
- }
336
- }
337
- </style>
338
-
339
- <style>
340
- :root.is-new-view {
341
- --horizontal-panel-bg-color: #fff;
342
- --trigger-bg-color: #e9ebed;
343
- --trigger-color: #213444;
344
- --new-gutter-bg-color: #e9ebed;
345
- --new-gutter-hover-bg-color: #008fd6;
346
- --new-gutter-before-bg-color: rgba(255, 255, 255, 0.8);
347
- }
348
- :root.is-new-view.dark-theme {
349
- --horizontal-panel-bg-color: #213444;
350
- --trigger-bg-color: #314352;
351
- --trigger-color: #e9ebed;
352
- --new-gutter-bg-color: #394a58;
353
- --new-gutter-hover-bg-color: #2ba2de;
354
- --new-gutter-before-bg-color: rgba(33, 52, 68, 0.8);
355
- }
356
- </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>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.575",
4
+ "version": "1.4.576",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",