bfg-common 1.3.411 → 1.3.412

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.
@@ -0,0 +1,373 @@
1
+ <template>
2
+ <div
3
+ :class="['main-navigation-panel', { pinned: menuPined }]"
4
+ @mouseenter="mainMenuHovered = true"
5
+ @mouseleave="mainMenuHovered = false"
6
+ >
7
+ <div
8
+ v-show="showMenu"
9
+ :class="['nav-context', { collapsed: menuCollapsed }]"
10
+ >
11
+ <div class="category-wrap">
12
+ <div class="clr-vertical-nav">
13
+ <button
14
+ v-if="menuPined"
15
+ id="nav-trigger"
16
+ data-id="navigation-panel-trigger"
17
+ class="nav-trigger"
18
+ @click="collapseMenu"
19
+ >
20
+ <span class="nav-trigger-icon">
21
+ <atoms-the-icon name="doubleArrows" />
22
+ </span>
23
+ </button>
24
+ <div class="nav-content">
25
+ <template v-for="(item, key) in navigationItems" :key="key">
26
+ <nuxt-link
27
+ v-for="(item2, key2) in item"
28
+ :id="`nav-item-${key}-${key2}`"
29
+ :key="item2.id"
30
+ :data-id="item2.testId"
31
+ class="nav-link"
32
+ active-class="active"
33
+ :to="item2.to"
34
+ :title="item2.title"
35
+ @click="hideMainMenu"
36
+ >
37
+ <span class="nav-text">
38
+ <span
39
+ :class="['clr-flex-shrink-0 category-icon', item2.iconName]"
40
+ />
41
+ <span class="category-text" :title="item2.title">{{
42
+ item2.title
43
+ }}</span>
44
+ </span>
45
+ </nuxt-link>
46
+ <div
47
+ v-show="key !== navigationItems.length - 1"
48
+ class="nav-divider"
49
+ />
50
+ </template>
51
+ </div>
52
+ </div>
53
+ </div>
54
+
55
+ <div v-show="!menuCollapsed" class="pin-wrap">
56
+ <div class="clr-checkbox-wrapper">
57
+ <input
58
+ id="pin-menu-control"
59
+ v-model="menuPined"
60
+ data-id="navigation-panel-pin-menu-control"
61
+ type="checkbox"
62
+ :disabled="props.disabledPin"
63
+ @change="changeMenuPin"
64
+ />
65
+ <label for="pin-menu-control">{{ localization.pinMenu }}</label>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ </div>
70
+ </template>
71
+
72
+ <script setup lang="ts">
73
+ import { UI_I_Localization } from '~/lib/models/interfaces'
74
+ import { UI_I_NavigationItem } from '~/components/common/mainNavigationPanel/lib/models/interfaces'
75
+ import { UI_T_ParentStatus } from '~/components/common/mainNavigationPanel/lib/models/types'
76
+
77
+ const props = defineProps<{
78
+ mainMenuStatus: boolean
79
+ navigationItems: UI_I_NavigationItem[][]
80
+ parentStatus: UI_T_ParentStatus
81
+ disabledPin: boolean
82
+ }>()
83
+ const emits = defineEmits<{
84
+ (event: 'toggle', value: boolean): void
85
+ }>()
86
+
87
+ // const { $store } = useNuxtApp()
88
+
89
+ const localization = computed<UI_I_Localization>(() => useLocal())
90
+ const route = useRoute()
91
+
92
+ const showMenu = computed<boolean>(
93
+ () => props.mainMenuStatus || menuPined.value
94
+ )
95
+
96
+ const menuPined = ref<boolean>(false)
97
+ const changeMenuPin = (): void => {
98
+ useLocalStorage('menuPined', menuPined.value)
99
+ }
100
+ const setMenuPined = (): void => {
101
+ menuPined.value = props.disabledPin ? false : useLocalStorage('menuPined')
102
+ }
103
+ watch(
104
+ () => props.disabledPin,
105
+ () => {
106
+ setMenuPined()
107
+ },
108
+ { immediate: true }
109
+ )
110
+
111
+ const menuCollapsed = ref<boolean>(false)
112
+ const collapseMenu = (): void => {
113
+ menuCollapsed.value = !menuCollapsed.value
114
+ useLocalStorage('menuCollapsed', menuCollapsed.value)
115
+ }
116
+
117
+ const mainMenuHovered = ref<boolean>(false)
118
+
119
+ const clickWindow = (event: Event): void => {
120
+ const target = event.target as any
121
+ if (
122
+ menuPined.value ||
123
+ mainMenuHovered.value ||
124
+ target.className.baseVal?.includes('menu-icon') ||
125
+ target.className.baseVal?.includes('clr-i-outline')
126
+ ) {
127
+ return
128
+ }
129
+
130
+ emits('toggle', false)
131
+ }
132
+
133
+ const mountedReady = ref<boolean>(false)
134
+ onMounted(() => {
135
+ mountedReady.value = true
136
+ window.addEventListener('click', clickWindow)
137
+ })
138
+
139
+ onUnmounted(() => {
140
+ window.removeEventListener('click', clickWindow)
141
+ })
142
+
143
+ watch(
144
+ [mountedReady, () => route.fullPath, () => props.parentStatus],
145
+ ([mountedReadyNewValue, routeNewValue, parentStatusNewValue]: [
146
+ boolean,
147
+ any,
148
+ UI_T_ParentStatus
149
+ ]): void => {
150
+ if (parentStatusNewValue === 1) return
151
+
152
+ const name = location.pathname.split('/')[1]
153
+
154
+ if (!mountedReadyNewValue || name === 'auth') return
155
+
156
+ setSidebarOptions()
157
+ useLocalStorage('navigationHistoryRoute', routeNewValue)
158
+ },
159
+ { immediate: true, deep: true }
160
+ )
161
+
162
+ const setSidebarOptions = (): void => {
163
+ setMenuPined()
164
+ menuCollapsed.value = useLocalStorage('menuCollapsed')
165
+
166
+ if (menuPined.value) {
167
+ emits('toggle', true)
168
+ }
169
+ }
170
+
171
+ const hideMainMenu = (): void => {
172
+ if (menuPined.value) return
173
+ emits('toggle', false)
174
+ }
175
+ </script>
176
+
177
+ <style scoped lang="scss">
178
+ .main-navigation-panel {
179
+ display: flex;
180
+ flex: 1 1 auto;
181
+ &.pinned {
182
+ .nav-context {
183
+ position: relative;
184
+ }
185
+ }
186
+ .nav-context {
187
+ position: absolute;
188
+ z-index: 1001;
189
+ height: 100%;
190
+ display: flex;
191
+ flex-direction: column;
192
+ background-color: var(--vertical-nav-bg-color);
193
+ border-right: 0.05rem solid var(--vertical-border-color);
194
+ &.collapsed {
195
+ .category-wrap .clr-vertical-nav {
196
+ width: 48px;
197
+ .nav-trigger {
198
+ svg {
199
+ transform: rotate(90deg);
200
+ }
201
+ }
202
+ .nav-content {
203
+ overflow-y: hidden;
204
+
205
+ &:hover {
206
+ overflow-y: auto;
207
+ }
208
+ .nav-link {
209
+ display: flex;
210
+ padding: 2px 0.6rem 2px 0.7rem;
211
+ width: fit-content;
212
+ .category-text {
213
+ opacity: 0;
214
+ }
215
+ }
216
+ }
217
+ }
218
+ }
219
+ .nav-trigger {
220
+ margin-top: 0;
221
+ outline: none;
222
+ .nav-trigger-icon {
223
+ height: 16px;
224
+ svg {
225
+ fill: var(--arrows-icon);
226
+ width: 16px;
227
+ height: 16px;
228
+ transform: rotate(-90deg);
229
+ }
230
+ }
231
+ }
232
+ .category-wrap {
233
+ overflow: hidden;
234
+ flex: 1 1 auto;
235
+ .clr-vertical-nav {
236
+ padding-top: 0;
237
+ background: none;
238
+ width: 100%;
239
+ height: 100%;
240
+ overflow-y: auto;
241
+ }
242
+ .nav-content {
243
+ padding: 0 12px 12px;
244
+ height: 100%;
245
+
246
+ .nav-link {
247
+ padding: 8px 12px;
248
+ font-weight: 400;
249
+ height: auto;
250
+ line-height: 21px;
251
+ flex-basis: auto;
252
+ border-radius: 8px;
253
+
254
+ &.active {
255
+ //background-color: var(--row-selected-bg-color);
256
+ background-color: #213444;
257
+ border-bottom: 1px solid transparent;
258
+ .nav-text {
259
+ .category-icon {
260
+ &.icon-lifecycle-manager {
261
+ background-image: url('assets/img/icons/icon-life-m-light.svg');
262
+
263
+ html.dark-theme & {
264
+ background-image: url('assets/img/icons/icon-life-m-dark.svg');
265
+ }
266
+ }
267
+ &.icon-realize-operations {
268
+ background-image: url('assets/img/icons/icon-ro-light.svg');
269
+ html.dark-theme & {
270
+ background-image: url('assets/img/icons/icon-ro-dark.svg');
271
+ }
272
+ }
273
+ }
274
+ .category-text {
275
+ color: var(--vertical-nav-active-item-color);
276
+ }
277
+ }
278
+ }
279
+
280
+ &:hover:not(.active) {
281
+ background-color: #D3D6DA;
282
+ //background-color: var(--row-hover-bg-color);
283
+ }
284
+ .nav-text {
285
+ display: flex;
286
+ align-items: center;
287
+
288
+ .category-icon {
289
+ margin-right: 12px;
290
+ min-width: 16px;
291
+ display: inline-block;
292
+
293
+ &.icon-hybrid-cloud-services {
294
+ background: url('assets/img/icons/icon-hcs.svg');
295
+ width: 16px;
296
+ height: 16px;
297
+ min-height: 16px;
298
+ }
299
+ &.icon-realize-operations,
300
+ &.icon-cloud-provider-services,
301
+ &.icon-lifecycle-manager {
302
+ background-size: contain;
303
+ background-repeat: no-repeat;
304
+ width: 18px;
305
+ height: 18px;
306
+ display: inline-block;
307
+ vertical-align: text-bottom;
308
+ }
309
+ &.icon-lifecycle-manager {
310
+ background-image: url('assets/img/icons/icon-life-m-light.svg');
311
+ html.dark-theme & {
312
+ background-image: url('assets/img/icons/icon-life-m-dark.svg');
313
+ }
314
+ }
315
+ &.icon-cloud-provider-services {
316
+ background-image: url('assets/img/icons/icon-cps.png');
317
+ html.dark-theme & {
318
+ background-image: url('assets/img/icons/icon-cps-dark-mode.png');
319
+ }
320
+ }
321
+ &.icon-realize-operations {
322
+ background-image: url('assets/img/icons/icon-ro-light.svg');
323
+ html.dark-theme & {
324
+ background-image: url('assets/img/icons/icon-ro-dark.svg');
325
+ }
326
+ }
327
+ }
328
+ .category-text {
329
+ white-space: nowrap;
330
+ overflow: hidden;
331
+ text-overflow: ellipsis;
332
+ font-size: 13px;
333
+ }
334
+ }
335
+ }
336
+
337
+ .nav-divider {
338
+ border: 1px solid #D3D6DA;
339
+ margin: 12px 0;
340
+ }
341
+ }
342
+ }
343
+ .pin-wrap {
344
+ padding: 6px 4px 5px 12px;
345
+ border-top: 0.05rem solid var(--vertical-nav-divider-border-color);
346
+ label {
347
+ font-size: 13px;
348
+ }
349
+ input[disabled] + label {
350
+ cursor: not-allowed;
351
+ opacity: 0.5;
352
+ }
353
+ }
354
+ }
355
+ }
356
+ </style>
357
+
358
+ <style>
359
+ :root {
360
+ --vertical-nav-bg-color: rgba(232, 232, 232, 0.85);
361
+ --vertical-nav-item-color: #565656;
362
+ --vertical-nav-active-item-color: #fff;
363
+ --vertical-nav-divider-border-color: #ccc;
364
+ --vertical-border-color: tranparent;
365
+ }
366
+ :root.dark-theme {
367
+ --vertical-nav-bg-color: #17242b;
368
+ --vertical-nav-item-color: #e9ecef;
369
+ --vertical-nav-active-item-color: #000;
370
+ --vertical-nav-divider-border-color: #495865;
371
+ --vertical-border-color: #495865;
372
+ }
373
+ </style>