bfg-common 1.5.92 → 1.5.94
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.
- package/assets/scss/common/normalize.scss +347 -347
- package/components/atoms/alert/Notification.vue +169 -169
- package/components/atoms/autocomplete/Autocomplete.vue +361 -362
- package/components/atoms/collapse/CollapseNav.vue +169 -169
- package/components/atoms/comboDropdownMenu/ComboDropdownMenu.vue +357 -357
- package/components/atoms/combobox/Combobox.vue +154 -154
- package/components/atoms/datepicker/Datepicker.vue +639 -639
- package/components/atoms/dropdown/Portlet.vue +113 -113
- package/components/atoms/dropdown/dropdown/Dropdown.vue +168 -168
- package/components/atoms/dropdown/tree/Tree.vue +137 -137
- package/components/atoms/list/SelectList.vue +63 -63
- package/components/atoms/list/dragDropList/DragDropList.vue +148 -148
- package/components/atoms/modal/Modal.vue +250 -250
- package/components/atoms/modal/bySteps/BySteps.vue +253 -253
- package/components/atoms/notificationBar/NotificationBar.vue +178 -178
- package/components/atoms/popover/Popover.vue +58 -58
- package/components/atoms/popover/lib/models/interfaces.ts +4 -4
- package/components/atoms/select/TheSelect.vue +187 -187
- package/components/atoms/stack/StackBlock.vue +185 -185
- package/components/atoms/stack/StackContent.vue +63 -63
- package/components/atoms/step/lib/models/verticalStepItem.ts +5 -5
- package/components/atoms/switch/Switch.vue +111 -111
- package/components/atoms/table/compact/Compact.vue +529 -529
- package/components/atoms/table/dataGrid/DataGrid.vue +1716 -1713
- package/components/atoms/table/dataGrid/DataGridPage.vue +195 -195
- package/components/atoms/table/info/Info.vue +2 -2
- package/components/atoms/table/simpleEvent/SimpleEvent.vue +98 -98
- package/components/atoms/table/simpleInfo/SimpleInfo.vue +73 -73
- package/components/atoms/tabs/Tabs.vue +217 -217
- package/components/atoms/wizard/Wizard.vue +341 -341
- package/components/common/accordion/Recursion.vue +222 -222
- package/components/common/adapterManager/AddAdapterModal.vue +561 -561
- package/components/common/adapterManager/ui/actions/AddAdapterButton.vue +30 -30
- package/components/common/adapterManager/ui/table/Table.vue +162 -162
- package/components/common/browse/BrowseNew.vue +237 -237
- package/components/common/browse/BrowseOld.vue +217 -217
- package/components/common/browse/blocks/TitleNew.vue +145 -145
- package/components/common/browse/blocks/TitleOld.vue +91 -91
- package/components/common/browse/blocks/contents/FilesOld.vue +72 -72
- package/components/common/chartOptionsModal/counters/timespan/form/FormNew.vue +262 -262
- package/components/common/context/Context.vue +111 -111
- package/components/common/context/recursion/RecursionOld.vue +228 -228
- package/components/common/details/DetailsItem.vue +109 -109
- package/components/common/feedback/Buttons.vue +229 -229
- package/components/common/feedback/Feedback.vue +270 -270
- package/components/common/feedback/Message.vue +519 -519
- package/components/common/graph/graphNew/GraphNew.vue +194 -194
- package/components/common/graph/lib/utils/renderGraph.ts +389 -389
- package/components/common/layout/theHeader/feedback/new/New.vue +227 -227
- package/components/common/layout/theHeader/feedback/new/additionalDetails/AdditionalDetails.vue +606 -606
- package/components/common/layout/theHeader/feedback/new/additionalDetails/Headline.vue +98 -98
- package/components/common/layout/theHeader/feedback/new/description/Description.vue +59 -59
- package/components/common/layout/theHeader/feedback/new/email/Email.vue +43 -43
- package/components/common/layout/theHeader/feedback/new/subtitle/Subtitle.vue +103 -103
- package/components/common/layout/theHeader/helpMenu/aboutNew/AboutNew.vue +112 -112
- package/components/common/layout/theHeader/helpMenu/aboutOld/AboutOld.vue +80 -80
- package/components/common/layout/theHeader/helpMenu/helpMenuOld/HelpMenuOld.vue +1 -1
- package/components/common/layout/theHeader/modals/Reconnect.vue +2 -2
- package/components/common/layout/theHeader/modals/RedirectLogin.vue +3 -3
- package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePassword.vue +1 -1
- package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePasswordNew.vue +8 -8
- package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePasswordOld.vue +3 -3
- package/components/common/layout/theHeader/userMenu/modals/preferences/PreferencesNew.vue +1 -1
- package/components/common/layout/theHeader/userMenu/modals/preferences/PreferencesOld.vue +1 -1
- package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/ChangeLanguage.vue +1 -1
- package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/ChangeLanguageNew.vue +1 -1
- package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/ChangeLanguageOld.vue +2 -5
- package/components/common/layout/theHeader/userMenu/modals/preferences/defaultConsole/DefaultConsoleOld.vue +1 -1
- package/components/common/layout/theHeader/userMenu/modals/preferences/inventory/InventoryNew.vue +1 -1
- package/components/common/layout/theHeader/userMenu/userMenuNew/UserMenuNew.vue +2 -2
- package/components/common/layout/theHeader/userMenu/userMenuNew/lib/config/dropMenu.ts +1 -1
- package/components/common/layout/theHeader/userMenu/userMenuOld/UserMenuOld.vue +1 -1
- package/components/common/mainNavigationPanel/MainNavigationPanelOld.vue +2 -2
- package/components/common/modals/Rename.vue +2 -2
- package/components/common/modals/confirmByInput/ConfirmByInput.vue +2 -3
- package/components/common/modals/confirmByInput/ConfirmByInputOld.vue +3 -3
- package/components/common/modals/confirmation/ConfirmationOld.vue +1 -1
- package/components/common/modals/unsavedChanges/UnsavedChanges.vue +1 -1
- package/components/common/monitor/advanced/Advanced.vue +1 -1
- package/components/common/monitor/advanced/AdvancedNew.vue +1 -1
- package/components/common/monitor/advanced/AdvancedOld.vue +1 -1
- package/components/common/monitor/advanced/graphView/GraphViewNew.vue +1 -1
- package/components/common/monitor/advanced/graphView/GraphViewOld.vue +1 -1
- package/components/common/monitor/advanced/table/Table.vue +1 -1
- package/components/common/monitor/advanced/table/tableNew/TableNew.vue +2 -2
- package/components/common/monitor/advanced/table/tableOld/lib/config/performanceDatatable.ts +2 -2
- package/components/common/monitor/advanced/tools/ToolsOld.vue +2 -2
- package/components/common/monitor/advanced/tools/chartOptionsModal/ChartOptionsModalOld.vue +1 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/NotificationOld.vue +1 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/actions/ActionsOld.vue +1 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/actions/saveOptionsModal/SaveOptionsModal.vue +1 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/CountersNew.vue +1 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/tableOld/lib/config/tableConfig.ts +2 -2
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/lib/config/objectTable.ts +10 -3
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/objectNew/ObjectNew.vue +1 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/objectOld/ObjectOld.vue +2 -2
- package/components/common/monitor/advanced/tools/lib/utils/countCores.ts +1 -1
- package/components/common/monitor/lib/models/interfaces.ts +1 -1
- package/components/common/monitor/overview/filters/customIntervalModal/CustomIntervalModalOld.vue +3 -3
- package/components/common/monitor/overview/filters/customIntervalModal/customIntervalModalNew/CustomIntervalModalNew.vue +4 -3
- package/components/common/monitor/resourceAllocation/lib/models/interfaces.ts +8 -8
- package/components/common/monitor/resourceAllocation/resourceAllocation.vue +2 -2
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/ChartOptionsModal.vue +1 -1
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/Notification.vue +1 -1
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/actions/SaveOptionsModal.vue +1 -1
- package/components/common/pages/hardwareHealth/tableView/lib/config/alertWarningTable.ts +1 -1
- package/components/common/pages/hardwareHealth/tableView/lib/config/historyTestimonyTable.ts +5 -5
- package/components/common/wizards/vm/migrate/Migrate.vue +39 -2
- package/components/common/wizards/vm/migrate/vmOrigin/VmOrigin.vue +92 -0
- package/components/common/wizards/vm/migrate/vmOrigin/lib/models/interfaces.ts +19 -0
- package/components/common/wizards/vm/migrate/vmOrigin/lib/utils/constructItems.ts +62 -0
- package/package.json +1 -1
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="table-wrap">
|
|
3
|
-
<table ref="table">
|
|
4
|
-
<tbody>
|
|
5
|
-
<tr>
|
|
6
|
-
<td v-for="item in props.headItems" :key="item.text" class="row">
|
|
7
|
-
<span> {{ item.text }}</span>
|
|
8
|
-
<span
|
|
9
|
-
:data-id="`${item.testId}-select-node`"
|
|
10
|
-
class="underlined"
|
|
11
|
-
@click="selectNode(item.value)"
|
|
12
|
-
>
|
|
13
|
-
{{ item.value }}
|
|
14
|
-
</span>
|
|
15
|
-
</td>
|
|
16
|
-
</tr>
|
|
17
|
-
</tbody>
|
|
18
|
-
</table>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script setup lang="ts">
|
|
23
|
-
import type { UI_I_TableInfo } from '~/components/atoms/table/simpleInfo/lib/models/interfaces'
|
|
24
|
-
|
|
25
|
-
const props = defineProps<{
|
|
26
|
-
headItems: UI_I_TableInfo[]
|
|
27
|
-
testId?: string
|
|
28
|
-
}>()
|
|
29
|
-
const emits = defineEmits(['select-node'])
|
|
30
|
-
|
|
31
|
-
const selectNode = (node: string | number): void => {
|
|
32
|
-
emits('select-node', node)
|
|
33
|
-
}
|
|
34
|
-
</script>
|
|
35
|
-
|
|
36
|
-
<style scoped lang="scss">
|
|
37
|
-
.row {
|
|
38
|
-
display: inline-block;
|
|
39
|
-
width: 100%;
|
|
40
|
-
span {
|
|
41
|
-
width: 35%;
|
|
42
|
-
line-height: 30px;
|
|
43
|
-
}
|
|
44
|
-
.underlined {
|
|
45
|
-
color: #0072a3;
|
|
46
|
-
text-decoration: underline;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
.table-wrap {
|
|
50
|
-
border: 1px solid #ddd;
|
|
51
|
-
border-radius: 3px;
|
|
52
|
-
|
|
53
|
-
table {
|
|
54
|
-
width: 100%;
|
|
55
|
-
|
|
56
|
-
tbody {
|
|
57
|
-
tr {
|
|
58
|
-
color: #565656;
|
|
59
|
-
td {
|
|
60
|
-
border-width: 0 0 1px;
|
|
61
|
-
border-color: #ddd;
|
|
62
|
-
font-size: 13px;
|
|
63
|
-
font-weight: 400;
|
|
64
|
-
line-height: 24px;
|
|
65
|
-
padding: 0 12px;
|
|
66
|
-
border-bottom: 1px solid #ddd;
|
|
67
|
-
background-color: #fafafa;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="table-wrap">
|
|
3
|
+
<table ref="table">
|
|
4
|
+
<tbody>
|
|
5
|
+
<tr>
|
|
6
|
+
<td v-for="item in props.headItems" :key="item.text" class="row">
|
|
7
|
+
<span> {{ item.text }}</span>
|
|
8
|
+
<span
|
|
9
|
+
:data-id="`${item.testId}-select-node`"
|
|
10
|
+
class="underlined"
|
|
11
|
+
@click="selectNode(item.value)"
|
|
12
|
+
>
|
|
13
|
+
{{ item.value }}
|
|
14
|
+
</span>
|
|
15
|
+
</td>
|
|
16
|
+
</tr>
|
|
17
|
+
</tbody>
|
|
18
|
+
</table>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import type { UI_I_TableInfo } from '~/components/atoms/table/simpleInfo/lib/models/interfaces'
|
|
24
|
+
|
|
25
|
+
const props = defineProps<{
|
|
26
|
+
headItems: UI_I_TableInfo[]
|
|
27
|
+
testId?: string
|
|
28
|
+
}>()
|
|
29
|
+
const emits = defineEmits(['select-node'])
|
|
30
|
+
|
|
31
|
+
const selectNode = (node: string | number): void => {
|
|
32
|
+
emits('select-node', node)
|
|
33
|
+
}
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<style scoped lang="scss">
|
|
37
|
+
.row {
|
|
38
|
+
display: inline-block;
|
|
39
|
+
width: 100%;
|
|
40
|
+
span {
|
|
41
|
+
width: 35%;
|
|
42
|
+
line-height: 30px;
|
|
43
|
+
}
|
|
44
|
+
.underlined {
|
|
45
|
+
color: #0072a3;
|
|
46
|
+
text-decoration: underline;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
.table-wrap {
|
|
50
|
+
border: 1px solid #ddd;
|
|
51
|
+
border-radius: 3px;
|
|
52
|
+
|
|
53
|
+
table {
|
|
54
|
+
width: 100%;
|
|
55
|
+
|
|
56
|
+
tbody {
|
|
57
|
+
tr {
|
|
58
|
+
color: #565656;
|
|
59
|
+
td {
|
|
60
|
+
border-width: 0 0 1px;
|
|
61
|
+
border-color: #ddd;
|
|
62
|
+
font-size: 13px;
|
|
63
|
+
font-weight: 400;
|
|
64
|
+
line-height: 24px;
|
|
65
|
+
padding: 0 12px;
|
|
66
|
+
border-bottom: 1px solid #ddd;
|
|
67
|
+
background-color: #fafafa;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
@@ -1,217 +1,217 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<nav :id="id" class="btn-group">
|
|
3
|
-
<ul class="nav">
|
|
4
|
-
<li
|
|
5
|
-
v-for="(item, key) in props.items"
|
|
6
|
-
:key="item.path"
|
|
7
|
-
:class="[
|
|
8
|
-
'nav-item',
|
|
9
|
-
detectButtonRemainderCount === key && 'last-button',
|
|
10
|
-
]"
|
|
11
|
-
>
|
|
12
|
-
<atoms-collapse-nav-item
|
|
13
|
-
:is-link="props.isLink"
|
|
14
|
-
:item="item"
|
|
15
|
-
:value="props.modelValue"
|
|
16
|
-
:btn-class="classes"
|
|
17
|
-
@change="change"
|
|
18
|
-
/>
|
|
19
|
-
</li>
|
|
20
|
-
<atoms-collapse-nav
|
|
21
|
-
v-show="collapsedItems.length"
|
|
22
|
-
:test-id="`${props.testId}-item`"
|
|
23
|
-
:items="collapsedItems"
|
|
24
|
-
:is-link="props.isLink"
|
|
25
|
-
/>
|
|
26
|
-
</ul>
|
|
27
|
-
</nav>
|
|
28
|
-
</template>
|
|
29
|
-
|
|
30
|
-
<script setup lang="ts">
|
|
31
|
-
import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
|
|
32
|
-
import type { UI_T_ButtonSize } from '~/components/atoms/tabs/lib/models/types'
|
|
33
|
-
|
|
34
|
-
const props = withDefaults(
|
|
35
|
-
defineProps<{
|
|
36
|
-
items: UI_I_CollapseNavItem[]
|
|
37
|
-
modelValue?: number | string
|
|
38
|
-
isLink?: boolean
|
|
39
|
-
size?: UI_T_ButtonSize
|
|
40
|
-
testId?: string
|
|
41
|
-
}>(),
|
|
42
|
-
{
|
|
43
|
-
size: 'large',
|
|
44
|
-
modelValue: '',
|
|
45
|
-
isLink: false,
|
|
46
|
-
testId: 'ui-tabs',
|
|
47
|
-
}
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
const emits = defineEmits<{
|
|
51
|
-
(event: 'update:model-value', value: number): void
|
|
52
|
-
(event: 'change', value: number): void
|
|
53
|
-
}>()
|
|
54
|
-
|
|
55
|
-
const change = (value: number): void => {
|
|
56
|
-
emits('update:model-value', value)
|
|
57
|
-
emits('change', value)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const detectButtonRemainderCount = computed<number>(() => {
|
|
61
|
-
return props.items.length - collapsedItems.value.length - 1
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
const visibleCount = ref<number>(props.items.length)
|
|
65
|
-
const collapsedItems = computed<UI_I_CollapseNavItem[]>(() => {
|
|
66
|
-
return props.items
|
|
67
|
-
.filter((_, index) => {
|
|
68
|
-
return index >= visibleCount.value
|
|
69
|
-
})
|
|
70
|
-
.map((item) => {
|
|
71
|
-
return {
|
|
72
|
-
text: item.text,
|
|
73
|
-
path: item.path,
|
|
74
|
-
disabled: item.disabled,
|
|
75
|
-
development: item.development,
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
const classes = computed<string>(() => `btn btn--${props.size}`)
|
|
81
|
-
|
|
82
|
-
let triggerElementWidth = 0
|
|
83
|
-
const setTriggerElementWidth = (): void => {
|
|
84
|
-
if (!id.value || !props.testId) return
|
|
85
|
-
|
|
86
|
-
const element = document.querySelector(`#${id.value} #${props.testId}-item`)
|
|
87
|
-
if (
|
|
88
|
-
element &&
|
|
89
|
-
element?.style?.display !== 'none' &&
|
|
90
|
-
collapsedItems.value.length
|
|
91
|
-
) {
|
|
92
|
-
const { width, right, left } = element.getBoundingClientRect()
|
|
93
|
-
triggerElementWidth = width + (right - left)
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const outputSize = (): void => {
|
|
98
|
-
const el = document.getElementById(id.value)
|
|
99
|
-
if (!el) return
|
|
100
|
-
|
|
101
|
-
const elWidth = el.clientWidth
|
|
102
|
-
const elItems = el.children[0].children
|
|
103
|
-
const elItemsMarginLeft = parseInt(getComputedStyle(elItems[0]).marginLeft)
|
|
104
|
-
const elItemsMarginRight = parseInt(getComputedStyle(elItems[0]).marginRight)
|
|
105
|
-
const childrenMarginY = elItemsMarginLeft + elItemsMarginRight
|
|
106
|
-
|
|
107
|
-
let childrenWidth = 0
|
|
108
|
-
let count = 0
|
|
109
|
-
setTriggerElementWidth()
|
|
110
|
-
for (let i = 0; i < elItems.length; i++) {
|
|
111
|
-
childrenWidth += elItems[i].clientWidth + childrenMarginY
|
|
112
|
-
const isWrap = collapsedItems.value.length
|
|
113
|
-
? elWidth - triggerElementWidth < childrenWidth
|
|
114
|
-
: elWidth < childrenWidth
|
|
115
|
-
|
|
116
|
-
if (isWrap) break
|
|
117
|
-
count++
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
visibleCount.value = count
|
|
121
|
-
|
|
122
|
-
const element = document.querySelector(`#${id.value} ul`)
|
|
123
|
-
if (element) {
|
|
124
|
-
element.style.paddingRight = collapsedItems.value.length
|
|
125
|
-
? `${triggerElementWidth}px`
|
|
126
|
-
: ''
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const id = ref<string>(`tabs-${useUniqueId()}`)
|
|
131
|
-
const setResizeObserve = (): void => {
|
|
132
|
-
const element = document.getElementById(id.value)
|
|
133
|
-
|
|
134
|
-
if (!element) {
|
|
135
|
-
setTimeout(setResizeObserve, 0)
|
|
136
|
-
return
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
new ResizeObserver(outputSize).observe(element)
|
|
140
|
-
}
|
|
141
|
-
onMounted(() => {
|
|
142
|
-
setResizeObserve()
|
|
143
|
-
})
|
|
144
|
-
</script>
|
|
145
|
-
|
|
146
|
-
<style lang="scss" scoped>
|
|
147
|
-
%active-mode {
|
|
148
|
-
background-color: var(--btn-primary-border-color);
|
|
149
|
-
border-color: var(--btn-primary-border-color);
|
|
150
|
-
color: var(--btn-primary-color);
|
|
151
|
-
}
|
|
152
|
-
.btn-group {
|
|
153
|
-
position: relative;
|
|
154
|
-
}
|
|
155
|
-
.nav {
|
|
156
|
-
margin-top: 10px;
|
|
157
|
-
box-shadow: none;
|
|
158
|
-
position: relative;
|
|
159
|
-
//height: 36px;
|
|
160
|
-
overflow: hidden;
|
|
161
|
-
display: flex;
|
|
162
|
-
flex-wrap: wrap;
|
|
163
|
-
grid-row-gap: 11px;
|
|
164
|
-
|
|
165
|
-
.nav-item {
|
|
166
|
-
margin-right: 0;
|
|
167
|
-
|
|
168
|
-
:deep(.btn) {
|
|
169
|
-
border-color: var(--btn-primary-border-color);
|
|
170
|
-
color: var(--btn-primary-border-color);
|
|
171
|
-
text-transform: capitalize;
|
|
172
|
-
border-radius: 0;
|
|
173
|
-
&.active {
|
|
174
|
-
@extend %active-mode;
|
|
175
|
-
&:active {
|
|
176
|
-
box-shadow: none;
|
|
177
|
-
}
|
|
178
|
-
&:hover {
|
|
179
|
-
background-color: var(--btn-outline-hover-color);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
&.disabled {
|
|
183
|
-
box-shadow: none;
|
|
184
|
-
& > span {
|
|
185
|
-
pointer-events: none;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
&:hover:not(.disabled, .active) {
|
|
189
|
-
background-color: var(--btn-outline-hover-bg-color);
|
|
190
|
-
color: var(--btn-outline-hover-color);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
:deep(a:not(.router-link-active)) {
|
|
194
|
-
.btn {
|
|
195
|
-
&:hover:not(.disabled, .active) {
|
|
196
|
-
background-color: var(--btn-outline-hover-bg-color);
|
|
197
|
-
color: var(--btn-outline-hover-color);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
:deep(.router-link-active) {
|
|
203
|
-
.btn {
|
|
204
|
-
@extend %active-mode;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
&:first-child :deep(button) {
|
|
208
|
-
border-top-left-radius: 0.15rem;
|
|
209
|
-
border-bottom-left-radius: 0.15rem;
|
|
210
|
-
}
|
|
211
|
-
&.last-button :deep(button) {
|
|
212
|
-
border-top-right-radius: 0.15rem;
|
|
213
|
-
border-bottom-right-radius: 0.15rem;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<nav :id="id" class="btn-group">
|
|
3
|
+
<ul class="nav">
|
|
4
|
+
<li
|
|
5
|
+
v-for="(item, key) in props.items"
|
|
6
|
+
:key="item.path"
|
|
7
|
+
:class="[
|
|
8
|
+
'nav-item',
|
|
9
|
+
detectButtonRemainderCount === key && 'last-button',
|
|
10
|
+
]"
|
|
11
|
+
>
|
|
12
|
+
<atoms-collapse-nav-item
|
|
13
|
+
:is-link="props.isLink"
|
|
14
|
+
:item="item"
|
|
15
|
+
:value="props.modelValue"
|
|
16
|
+
:btn-class="classes"
|
|
17
|
+
@change="change"
|
|
18
|
+
/>
|
|
19
|
+
</li>
|
|
20
|
+
<atoms-collapse-nav
|
|
21
|
+
v-show="collapsedItems.length"
|
|
22
|
+
:test-id="`${props.testId}-item`"
|
|
23
|
+
:items="collapsedItems"
|
|
24
|
+
:is-link="props.isLink"
|
|
25
|
+
/>
|
|
26
|
+
</ul>
|
|
27
|
+
</nav>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script setup lang="ts">
|
|
31
|
+
import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
|
|
32
|
+
import type { UI_T_ButtonSize } from '~/components/atoms/tabs/lib/models/types'
|
|
33
|
+
|
|
34
|
+
const props = withDefaults(
|
|
35
|
+
defineProps<{
|
|
36
|
+
items: UI_I_CollapseNavItem[]
|
|
37
|
+
modelValue?: number | string
|
|
38
|
+
isLink?: boolean
|
|
39
|
+
size?: UI_T_ButtonSize
|
|
40
|
+
testId?: string
|
|
41
|
+
}>(),
|
|
42
|
+
{
|
|
43
|
+
size: 'large',
|
|
44
|
+
modelValue: '',
|
|
45
|
+
isLink: false,
|
|
46
|
+
testId: 'ui-tabs',
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
const emits = defineEmits<{
|
|
51
|
+
(event: 'update:model-value', value: number): void
|
|
52
|
+
(event: 'change', value: number): void
|
|
53
|
+
}>()
|
|
54
|
+
|
|
55
|
+
const change = (value: number): void => {
|
|
56
|
+
emits('update:model-value', value)
|
|
57
|
+
emits('change', value)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const detectButtonRemainderCount = computed<number>(() => {
|
|
61
|
+
return props.items.length - collapsedItems.value.length - 1
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const visibleCount = ref<number>(props.items.length)
|
|
65
|
+
const collapsedItems = computed<UI_I_CollapseNavItem[]>(() => {
|
|
66
|
+
return props.items
|
|
67
|
+
.filter((_, index) => {
|
|
68
|
+
return index >= visibleCount.value
|
|
69
|
+
})
|
|
70
|
+
.map((item) => {
|
|
71
|
+
return {
|
|
72
|
+
text: item.text,
|
|
73
|
+
path: item.path,
|
|
74
|
+
disabled: item.disabled,
|
|
75
|
+
development: item.development,
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
const classes = computed<string>(() => `btn btn--${props.size}`)
|
|
81
|
+
|
|
82
|
+
let triggerElementWidth = 0
|
|
83
|
+
const setTriggerElementWidth = (): void => {
|
|
84
|
+
if (!id.value || !props.testId) return
|
|
85
|
+
|
|
86
|
+
const element = document.querySelector(`#${id.value} #${props.testId}-item`)
|
|
87
|
+
if (
|
|
88
|
+
element &&
|
|
89
|
+
element?.style?.display !== 'none' &&
|
|
90
|
+
collapsedItems.value.length
|
|
91
|
+
) {
|
|
92
|
+
const { width, right, left } = element.getBoundingClientRect()
|
|
93
|
+
triggerElementWidth = width + (right - left)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const outputSize = (): void => {
|
|
98
|
+
const el = document.getElementById(id.value)
|
|
99
|
+
if (!el) return
|
|
100
|
+
|
|
101
|
+
const elWidth = el.clientWidth
|
|
102
|
+
const elItems = el.children[0].children
|
|
103
|
+
const elItemsMarginLeft = parseInt(getComputedStyle(elItems[0]).marginLeft)
|
|
104
|
+
const elItemsMarginRight = parseInt(getComputedStyle(elItems[0]).marginRight)
|
|
105
|
+
const childrenMarginY = elItemsMarginLeft + elItemsMarginRight
|
|
106
|
+
|
|
107
|
+
let childrenWidth = 0
|
|
108
|
+
let count = 0
|
|
109
|
+
setTriggerElementWidth()
|
|
110
|
+
for (let i = 0; i < elItems.length; i++) {
|
|
111
|
+
childrenWidth += elItems[i].clientWidth + childrenMarginY
|
|
112
|
+
const isWrap = collapsedItems.value.length
|
|
113
|
+
? elWidth - triggerElementWidth < childrenWidth
|
|
114
|
+
: elWidth < childrenWidth
|
|
115
|
+
|
|
116
|
+
if (isWrap) break
|
|
117
|
+
count++
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
visibleCount.value = count
|
|
121
|
+
|
|
122
|
+
const element = document.querySelector(`#${id.value} ul`)
|
|
123
|
+
if (element) {
|
|
124
|
+
element.style.paddingRight = collapsedItems.value.length
|
|
125
|
+
? `${triggerElementWidth}px`
|
|
126
|
+
: ''
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const id = ref<string>(`tabs-${useUniqueId()}`)
|
|
131
|
+
const setResizeObserve = (): void => {
|
|
132
|
+
const element = document.getElementById(id.value)
|
|
133
|
+
|
|
134
|
+
if (!element) {
|
|
135
|
+
setTimeout(setResizeObserve, 0)
|
|
136
|
+
return
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
new ResizeObserver(outputSize).observe(element)
|
|
140
|
+
}
|
|
141
|
+
onMounted(() => {
|
|
142
|
+
setResizeObserve()
|
|
143
|
+
})
|
|
144
|
+
</script>
|
|
145
|
+
|
|
146
|
+
<style lang="scss" scoped>
|
|
147
|
+
%active-mode {
|
|
148
|
+
background-color: var(--btn-primary-border-color);
|
|
149
|
+
border-color: var(--btn-primary-border-color);
|
|
150
|
+
color: var(--btn-primary-color);
|
|
151
|
+
}
|
|
152
|
+
.btn-group {
|
|
153
|
+
position: relative;
|
|
154
|
+
}
|
|
155
|
+
.nav {
|
|
156
|
+
margin-top: 10px;
|
|
157
|
+
box-shadow: none;
|
|
158
|
+
position: relative;
|
|
159
|
+
//height: 36px;
|
|
160
|
+
overflow: hidden;
|
|
161
|
+
display: flex;
|
|
162
|
+
flex-wrap: wrap;
|
|
163
|
+
grid-row-gap: 11px;
|
|
164
|
+
|
|
165
|
+
.nav-item {
|
|
166
|
+
margin-right: 0;
|
|
167
|
+
|
|
168
|
+
:deep(.btn) {
|
|
169
|
+
border-color: var(--btn-primary-border-color);
|
|
170
|
+
color: var(--btn-primary-border-color);
|
|
171
|
+
text-transform: capitalize;
|
|
172
|
+
border-radius: 0;
|
|
173
|
+
&.active {
|
|
174
|
+
@extend %active-mode;
|
|
175
|
+
&:active {
|
|
176
|
+
box-shadow: none;
|
|
177
|
+
}
|
|
178
|
+
&:hover {
|
|
179
|
+
background-color: var(--btn-outline-hover-color);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
&.disabled {
|
|
183
|
+
box-shadow: none;
|
|
184
|
+
& > span {
|
|
185
|
+
pointer-events: none;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
&:hover:not(.disabled, .active) {
|
|
189
|
+
background-color: var(--btn-outline-hover-bg-color);
|
|
190
|
+
color: var(--btn-outline-hover-color);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
:deep(a:not(.router-link-active)) {
|
|
194
|
+
.btn {
|
|
195
|
+
&:hover:not(.disabled, .active) {
|
|
196
|
+
background-color: var(--btn-outline-hover-bg-color);
|
|
197
|
+
color: var(--btn-outline-hover-color);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
:deep(.router-link-active) {
|
|
203
|
+
.btn {
|
|
204
|
+
@extend %active-mode;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
&:first-child :deep(button) {
|
|
208
|
+
border-top-left-radius: 0.15rem;
|
|
209
|
+
border-bottom-left-radius: 0.15rem;
|
|
210
|
+
}
|
|
211
|
+
&.last-button :deep(button) {
|
|
212
|
+
border-top-right-radius: 0.15rem;
|
|
213
|
+
border-bottom-right-radius: 0.15rem;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
</style>
|