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,357 +1,357 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="combo-dropdown-content">
|
|
3
|
-
<div>
|
|
4
|
-
<div>
|
|
5
|
-
<div
|
|
6
|
-
:class="['alarm-trigger-combo-box dropdown', { open: isShowList }]"
|
|
7
|
-
@mouseenter="isHover = true"
|
|
8
|
-
@mouseleave="isHover = false"
|
|
9
|
-
>
|
|
10
|
-
<div class="select dropdown-toggle">
|
|
11
|
-
<input
|
|
12
|
-
v-model="selectedLocal"
|
|
13
|
-
:placeholder="localization.inventoryConfigure.selectTrigger"
|
|
14
|
-
:data-id="`${props.testId}-selected-field`"
|
|
15
|
-
type="text"
|
|
16
|
-
class="form-control dropdown-host"
|
|
17
|
-
@click="isShowList = !isShowList"
|
|
18
|
-
/>
|
|
19
|
-
</div>
|
|
20
|
-
<div v-if="isShowList" class="combo-dropdown-menu dropdown-menu">
|
|
21
|
-
<input
|
|
22
|
-
id="search-input"
|
|
23
|
-
v-model="search"
|
|
24
|
-
:data-id="`${props.testId}-search-field`"
|
|
25
|
-
:placeholder="localization.common.search"
|
|
26
|
-
type="search"
|
|
27
|
-
autocomplete="off"
|
|
28
|
-
maxlength="300"
|
|
29
|
-
class="form-control dropdown-search-box"
|
|
30
|
-
@input="onInputSearch"
|
|
31
|
-
/>
|
|
32
|
-
<div class="dropdown-result-holder">
|
|
33
|
-
<p v-if="search && !filteredData.length" class="empty-text">
|
|
34
|
-
<i>{{ localization.common.noItemsDisplay }}</i>
|
|
35
|
-
</p>
|
|
36
|
-
<div>
|
|
37
|
-
<div
|
|
38
|
-
v-for="(item, key) in filteredData"
|
|
39
|
-
:key="key"
|
|
40
|
-
:data-id="item.text"
|
|
41
|
-
:class="[
|
|
42
|
-
'clr-tree-node item-row dropdown-parent-item',
|
|
43
|
-
{ open: arrowKeys[key] },
|
|
44
|
-
{ searched: isSearched },
|
|
45
|
-
]"
|
|
46
|
-
>
|
|
47
|
-
<div
|
|
48
|
-
v-if="!isSearched"
|
|
49
|
-
class="clr-tree-node-content-container"
|
|
50
|
-
>
|
|
51
|
-
<button
|
|
52
|
-
:data-id="`${item.testId}-toggle-button`"
|
|
53
|
-
aria-hidden="true"
|
|
54
|
-
type="button"
|
|
55
|
-
class="clr-treenode-caret"
|
|
56
|
-
@click="arrowKeys[key] = !arrowKeys[key]"
|
|
57
|
-
>
|
|
58
|
-
<atoms-the-icon
|
|
59
|
-
:class="[
|
|
60
|
-
'trigger-icon clr-icon',
|
|
61
|
-
{ open: arrowKeys[key] },
|
|
62
|
-
]"
|
|
63
|
-
name="angle"
|
|
64
|
-
/>
|
|
65
|
-
</button>
|
|
66
|
-
<div class="clr-treenode-content item-title-content">
|
|
67
|
-
<b
|
|
68
|
-
:title="`${item.text} (${item.itemsCount})`"
|
|
69
|
-
class="dropdown-item-text category-name"
|
|
70
|
-
>
|
|
71
|
-
{{ item.text }} </b
|
|
72
|
-
><b
|
|
73
|
-
:title="`${item.text} (${item.itemsCount})`"
|
|
74
|
-
class="dropdown-item-text category-size"
|
|
75
|
-
>
|
|
76
|
-
({{ item.itemsCount }})</b
|
|
77
|
-
>
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
<div
|
|
81
|
-
:class="[
|
|
82
|
-
'clr-treenode-children children-content',
|
|
83
|
-
{ open: arrowKeys[key] },
|
|
84
|
-
]"
|
|
85
|
-
>
|
|
86
|
-
<div
|
|
87
|
-
v-for="(item2, key2) in item.childs"
|
|
88
|
-
:key="key2"
|
|
89
|
-
:data-id="item2.testId"
|
|
90
|
-
class="clr-tree-node"
|
|
91
|
-
@click="onSelect(item2.value)"
|
|
92
|
-
>
|
|
93
|
-
<div class="clr-tree-node-content-container">
|
|
94
|
-
<div class="clr-treenode-content item-title-content">
|
|
95
|
-
<button
|
|
96
|
-
:title="item2.text"
|
|
97
|
-
:data-id="item2.text"
|
|
98
|
-
type="button"
|
|
99
|
-
class="btn-link dropdown-child-item"
|
|
100
|
-
>
|
|
101
|
-
<span :title="item2.text" class="dropdown-item-text"
|
|
102
|
-
>{{ item2.firstText }}<b>{{ item2.secondText }}</b
|
|
103
|
-
>{{ item2.thirdText }}</span
|
|
104
|
-
>
|
|
105
|
-
</button>
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
</div>
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
</div>
|
|
118
|
-
</template>
|
|
119
|
-
|
|
120
|
-
<script setup lang="ts">
|
|
121
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
122
|
-
import type {
|
|
123
|
-
UI_I_ComboDropdown,
|
|
124
|
-
UI_I_ComboDropdownChild,
|
|
125
|
-
UI_I_ComboDropdownSearched,
|
|
126
|
-
UI_I_ComboDropdownSearchedItem,
|
|
127
|
-
} from '~/components/atoms/comboDropdownMenu/lib/models/interfaces'
|
|
128
|
-
|
|
129
|
-
const props = defineProps<{
|
|
130
|
-
selected: string
|
|
131
|
-
items: UI_I_ComboDropdown[]
|
|
132
|
-
testId: string
|
|
133
|
-
}>()
|
|
134
|
-
const emits = defineEmits<{
|
|
135
|
-
(event: 'select', value: string): void
|
|
136
|
-
}>()
|
|
137
|
-
|
|
138
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
139
|
-
|
|
140
|
-
const selectedLocal = ref<string>(props.selected)
|
|
141
|
-
watch(
|
|
142
|
-
() => props.selected,
|
|
143
|
-
(newValue) => {
|
|
144
|
-
selectedLocal.value = newValue
|
|
145
|
-
}
|
|
146
|
-
)
|
|
147
|
-
const search = ref<string>('')
|
|
148
|
-
const isSearched = ref<boolean>(false)
|
|
149
|
-
const onInputSearch = (): void => {
|
|
150
|
-
isSearched.value = !!search.value
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// New Function for search
|
|
154
|
-
// const text = ref<string>('Hello Worlds!')
|
|
155
|
-
// const searchQuery = ref<string>('')
|
|
156
|
-
//
|
|
157
|
-
// const highlightText = computed<string>((): any => {
|
|
158
|
-
// if (!searchQuery.value) return text.value
|
|
159
|
-
// const regex = new RegExp(`(${searchQuery.value})`, 'gi')
|
|
160
|
-
// return text.value.replace(regex, '<bold style="font-weight: 500">$1</bold>')
|
|
161
|
-
// })
|
|
162
|
-
const constructChildesBySearch = (
|
|
163
|
-
data: UI_I_ComboDropdownChild[]
|
|
164
|
-
): UI_I_ComboDropdownSearchedItem[] => {
|
|
165
|
-
if (!isSearched.value)
|
|
166
|
-
return data.map((item) => {
|
|
167
|
-
return {
|
|
168
|
-
text: item.text,
|
|
169
|
-
value: item.value,
|
|
170
|
-
firstText: item.text,
|
|
171
|
-
secondText: '',
|
|
172
|
-
thirdText: '',
|
|
173
|
-
testId: `${item.text}-child`,
|
|
174
|
-
}
|
|
175
|
-
})
|
|
176
|
-
|
|
177
|
-
const searchLower = search.value.toLowerCase()
|
|
178
|
-
const searchLength = searchLower.length
|
|
179
|
-
const result: UI_I_ComboDropdownSearchedItem[] = []
|
|
180
|
-
data.forEach((item) => {
|
|
181
|
-
const showTextLower = item.text.toLowerCase()
|
|
182
|
-
const showText = item.text
|
|
183
|
-
if (showTextLower.includes(searchLower)) {
|
|
184
|
-
const getIndex = showTextLower.indexOf(searchLower)
|
|
185
|
-
|
|
186
|
-
const newValue = {
|
|
187
|
-
text: item.text,
|
|
188
|
-
value: item.value,
|
|
189
|
-
firstText: showText.slice(0, getIndex),
|
|
190
|
-
secondText: showText.slice(getIndex, getIndex + searchLength),
|
|
191
|
-
thirdText: showText.slice(getIndex + searchLength, showText.length),
|
|
192
|
-
testId: `${item.text}-child`,
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
result.push(newValue)
|
|
196
|
-
}
|
|
197
|
-
})
|
|
198
|
-
return result
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
const filteredData = computed<UI_I_ComboDropdownSearched[]>(() => {
|
|
202
|
-
const result: UI_I_ComboDropdownSearched[] = []
|
|
203
|
-
|
|
204
|
-
props.items.forEach((item) => {
|
|
205
|
-
const filteredChilds = constructChildesBySearch(item.childs)
|
|
206
|
-
|
|
207
|
-
if (filteredChilds.length)
|
|
208
|
-
result.push({
|
|
209
|
-
text: item.text,
|
|
210
|
-
itemsCount: item.itemsCount,
|
|
211
|
-
childs: filteredChilds,
|
|
212
|
-
testId: item.testId,
|
|
213
|
-
})
|
|
214
|
-
})
|
|
215
|
-
return result
|
|
216
|
-
})
|
|
217
|
-
|
|
218
|
-
const arrowKeys = ref<boolean[]>([])
|
|
219
|
-
watch(
|
|
220
|
-
() => props.items,
|
|
221
|
-
(newValue) => {
|
|
222
|
-
if (!newValue.length) return
|
|
223
|
-
|
|
224
|
-
newValue.forEach((_, key) => {
|
|
225
|
-
const currentValue = key === 0
|
|
226
|
-
arrowKeys.value.push(currentValue)
|
|
227
|
-
})
|
|
228
|
-
},
|
|
229
|
-
{ immediate: true, deep: true }
|
|
230
|
-
)
|
|
231
|
-
|
|
232
|
-
const isShowList = ref<boolean>(false)
|
|
233
|
-
watch(isShowList, (newValue) => {
|
|
234
|
-
if (!newValue) {
|
|
235
|
-
isSearched.value = false
|
|
236
|
-
return
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
setTimeout(() => {
|
|
240
|
-
document.getElementById('search-input')?.focus()
|
|
241
|
-
}, 0)
|
|
242
|
-
selectedLocal.value && (search.value = selectedLocal.value)
|
|
243
|
-
})
|
|
244
|
-
const isHover = ref<boolean>(false)
|
|
245
|
-
|
|
246
|
-
const hideMenu = (force?: boolean): void => {
|
|
247
|
-
if (isHover.value && !force) return
|
|
248
|
-
|
|
249
|
-
isShowList.value = false
|
|
250
|
-
}
|
|
251
|
-
const windowClick = (): void => {
|
|
252
|
-
hideMenu()
|
|
253
|
-
}
|
|
254
|
-
const windowScroll = (): void => {
|
|
255
|
-
hideMenu()
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
const onSelect = (value: string): void => {
|
|
259
|
-
emits('select', value)
|
|
260
|
-
hideMenu(true)
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
onMounted(() => {
|
|
264
|
-
window.addEventListener('click', windowClick)
|
|
265
|
-
window.addEventListener('scroll', windowScroll, true)
|
|
266
|
-
})
|
|
267
|
-
onUnmounted(() => {
|
|
268
|
-
window.removeEventListener('click', windowClick)
|
|
269
|
-
window.removeEventListener('scroll', windowScroll)
|
|
270
|
-
})
|
|
271
|
-
</script>
|
|
272
|
-
|
|
273
|
-
<style scoped lang="scss">
|
|
274
|
-
.combo-dropdown-content {
|
|
275
|
-
.alarm-trigger-combo-box {
|
|
276
|
-
position: static;
|
|
277
|
-
|
|
278
|
-
.combo-dropdown-menu {
|
|
279
|
-
position: absolute;
|
|
280
|
-
inset: 0 auto auto 0;
|
|
281
|
-
transform: translateX(15px) translateY(24px);
|
|
282
|
-
margin-top: -15px;
|
|
283
|
-
width: 30rem;
|
|
284
|
-
|
|
285
|
-
#search-input {
|
|
286
|
-
margin: 5px 2px 3px;
|
|
287
|
-
width: calc(100% - 4px);
|
|
288
|
-
height: 34px;
|
|
289
|
-
padding: 6px 12px;
|
|
290
|
-
color: #333;
|
|
291
|
-
font-size: 13px;
|
|
292
|
-
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
|
293
|
-
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
|
|
294
|
-
border: 1px solid #949494;
|
|
295
|
-
background-image: none;
|
|
296
|
-
|
|
297
|
-
&:focus {
|
|
298
|
-
outline: none;
|
|
299
|
-
border-color: #3cf;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
.dropdown-result-holder {
|
|
303
|
-
padding-top: 10px;
|
|
304
|
-
max-height: 18rem;
|
|
305
|
-
overflow-x: hidden;
|
|
306
|
-
overflow-y: auto;
|
|
307
|
-
|
|
308
|
-
.empty-text {
|
|
309
|
-
padding: 0 0.24rem 1.2rem 0.72rem;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
.dropdown-parent-item {
|
|
313
|
-
&.open {
|
|
314
|
-
&.searched {
|
|
315
|
-
.children-content {
|
|
316
|
-
.item-title-content {
|
|
317
|
-
.dropdown-child-item {
|
|
318
|
-
padding-left: 14px;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
.trigger-icon {
|
|
325
|
-
transform: rotate(180deg);
|
|
326
|
-
}
|
|
327
|
-
.children-content {
|
|
328
|
-
overflow-y: visible;
|
|
329
|
-
height: auto;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
.trigger-icon {
|
|
334
|
-
transform: rotate(90deg);
|
|
335
|
-
}
|
|
336
|
-
.children-content {
|
|
337
|
-
overflow-x: hidden;
|
|
338
|
-
margin-left: 0;
|
|
339
|
-
height: 0;
|
|
340
|
-
overflow-y: visible;
|
|
341
|
-
|
|
342
|
-
.item-title-content {
|
|
343
|
-
&:first-child {
|
|
344
|
-
padding-left: 0;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
.dropdown-child-item {
|
|
348
|
-
padding-left: 28px;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="combo-dropdown-content">
|
|
3
|
+
<div>
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
:class="['alarm-trigger-combo-box dropdown', { open: isShowList }]"
|
|
7
|
+
@mouseenter="isHover = true"
|
|
8
|
+
@mouseleave="isHover = false"
|
|
9
|
+
>
|
|
10
|
+
<div class="select dropdown-toggle">
|
|
11
|
+
<input
|
|
12
|
+
v-model="selectedLocal"
|
|
13
|
+
:placeholder="localization.inventoryConfigure.selectTrigger"
|
|
14
|
+
:data-id="`${props.testId}-selected-field`"
|
|
15
|
+
type="text"
|
|
16
|
+
class="form-control dropdown-host"
|
|
17
|
+
@click="isShowList = !isShowList"
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
<div v-if="isShowList" class="combo-dropdown-menu dropdown-menu">
|
|
21
|
+
<input
|
|
22
|
+
id="search-input"
|
|
23
|
+
v-model="search"
|
|
24
|
+
:data-id="`${props.testId}-search-field`"
|
|
25
|
+
:placeholder="localization.common.search"
|
|
26
|
+
type="search"
|
|
27
|
+
autocomplete="off"
|
|
28
|
+
maxlength="300"
|
|
29
|
+
class="form-control dropdown-search-box"
|
|
30
|
+
@input="onInputSearch"
|
|
31
|
+
/>
|
|
32
|
+
<div class="dropdown-result-holder">
|
|
33
|
+
<p v-if="search && !filteredData.length" class="empty-text">
|
|
34
|
+
<i>{{ localization.common.noItemsDisplay }}</i>
|
|
35
|
+
</p>
|
|
36
|
+
<div>
|
|
37
|
+
<div
|
|
38
|
+
v-for="(item, key) in filteredData"
|
|
39
|
+
:key="key"
|
|
40
|
+
:data-id="item.text"
|
|
41
|
+
:class="[
|
|
42
|
+
'clr-tree-node item-row dropdown-parent-item',
|
|
43
|
+
{ open: arrowKeys[key] },
|
|
44
|
+
{ searched: isSearched },
|
|
45
|
+
]"
|
|
46
|
+
>
|
|
47
|
+
<div
|
|
48
|
+
v-if="!isSearched"
|
|
49
|
+
class="clr-tree-node-content-container"
|
|
50
|
+
>
|
|
51
|
+
<button
|
|
52
|
+
:data-id="`${item.testId}-toggle-button`"
|
|
53
|
+
aria-hidden="true"
|
|
54
|
+
type="button"
|
|
55
|
+
class="clr-treenode-caret"
|
|
56
|
+
@click="arrowKeys[key] = !arrowKeys[key]"
|
|
57
|
+
>
|
|
58
|
+
<atoms-the-icon
|
|
59
|
+
:class="[
|
|
60
|
+
'trigger-icon clr-icon',
|
|
61
|
+
{ open: arrowKeys[key] },
|
|
62
|
+
]"
|
|
63
|
+
name="angle"
|
|
64
|
+
/>
|
|
65
|
+
</button>
|
|
66
|
+
<div class="clr-treenode-content item-title-content">
|
|
67
|
+
<b
|
|
68
|
+
:title="`${item.text} (${item.itemsCount})`"
|
|
69
|
+
class="dropdown-item-text category-name"
|
|
70
|
+
>
|
|
71
|
+
{{ item.text }} </b
|
|
72
|
+
><b
|
|
73
|
+
:title="`${item.text} (${item.itemsCount})`"
|
|
74
|
+
class="dropdown-item-text category-size"
|
|
75
|
+
>
|
|
76
|
+
({{ item.itemsCount }})</b
|
|
77
|
+
>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
<div
|
|
81
|
+
:class="[
|
|
82
|
+
'clr-treenode-children children-content',
|
|
83
|
+
{ open: arrowKeys[key] },
|
|
84
|
+
]"
|
|
85
|
+
>
|
|
86
|
+
<div
|
|
87
|
+
v-for="(item2, key2) in item.childs"
|
|
88
|
+
:key="key2"
|
|
89
|
+
:data-id="item2.testId"
|
|
90
|
+
class="clr-tree-node"
|
|
91
|
+
@click="onSelect(item2.value)"
|
|
92
|
+
>
|
|
93
|
+
<div class="clr-tree-node-content-container">
|
|
94
|
+
<div class="clr-treenode-content item-title-content">
|
|
95
|
+
<button
|
|
96
|
+
:title="item2.text"
|
|
97
|
+
:data-id="item2.text"
|
|
98
|
+
type="button"
|
|
99
|
+
class="btn-link dropdown-child-item"
|
|
100
|
+
>
|
|
101
|
+
<span :title="item2.text" class="dropdown-item-text"
|
|
102
|
+
>{{ item2.firstText }}<b>{{ item2.secondText }}</b
|
|
103
|
+
>{{ item2.thirdText }}</span
|
|
104
|
+
>
|
|
105
|
+
</button>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
</template>
|
|
119
|
+
|
|
120
|
+
<script setup lang="ts">
|
|
121
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
122
|
+
import type {
|
|
123
|
+
UI_I_ComboDropdown,
|
|
124
|
+
UI_I_ComboDropdownChild,
|
|
125
|
+
UI_I_ComboDropdownSearched,
|
|
126
|
+
UI_I_ComboDropdownSearchedItem,
|
|
127
|
+
} from '~/components/atoms/comboDropdownMenu/lib/models/interfaces'
|
|
128
|
+
|
|
129
|
+
const props = defineProps<{
|
|
130
|
+
selected: string
|
|
131
|
+
items: UI_I_ComboDropdown[]
|
|
132
|
+
testId: string
|
|
133
|
+
}>()
|
|
134
|
+
const emits = defineEmits<{
|
|
135
|
+
(event: 'select', value: string): void
|
|
136
|
+
}>()
|
|
137
|
+
|
|
138
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
139
|
+
|
|
140
|
+
const selectedLocal = ref<string>(props.selected)
|
|
141
|
+
watch(
|
|
142
|
+
() => props.selected,
|
|
143
|
+
(newValue) => {
|
|
144
|
+
selectedLocal.value = newValue
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
const search = ref<string>('')
|
|
148
|
+
const isSearched = ref<boolean>(false)
|
|
149
|
+
const onInputSearch = (): void => {
|
|
150
|
+
isSearched.value = !!search.value
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// New Function for search
|
|
154
|
+
// const text = ref<string>('Hello Worlds!')
|
|
155
|
+
// const searchQuery = ref<string>('')
|
|
156
|
+
//
|
|
157
|
+
// const highlightText = computed<string>((): any => {
|
|
158
|
+
// if (!searchQuery.value) return text.value
|
|
159
|
+
// const regex = new RegExp(`(${searchQuery.value})`, 'gi')
|
|
160
|
+
// return text.value.replace(regex, '<bold style="font-weight: 500">$1</bold>')
|
|
161
|
+
// })
|
|
162
|
+
const constructChildesBySearch = (
|
|
163
|
+
data: UI_I_ComboDropdownChild[]
|
|
164
|
+
): UI_I_ComboDropdownSearchedItem[] => {
|
|
165
|
+
if (!isSearched.value)
|
|
166
|
+
return data.map((item) => {
|
|
167
|
+
return {
|
|
168
|
+
text: item.text,
|
|
169
|
+
value: item.value,
|
|
170
|
+
firstText: item.text,
|
|
171
|
+
secondText: '',
|
|
172
|
+
thirdText: '',
|
|
173
|
+
testId: `${item.text}-child`,
|
|
174
|
+
}
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
const searchLower = search.value.toLowerCase()
|
|
178
|
+
const searchLength = searchLower.length
|
|
179
|
+
const result: UI_I_ComboDropdownSearchedItem[] = []
|
|
180
|
+
data.forEach((item) => {
|
|
181
|
+
const showTextLower = item.text.toLowerCase()
|
|
182
|
+
const showText = item.text
|
|
183
|
+
if (showTextLower.includes(searchLower)) {
|
|
184
|
+
const getIndex = showTextLower.indexOf(searchLower)
|
|
185
|
+
|
|
186
|
+
const newValue = {
|
|
187
|
+
text: item.text,
|
|
188
|
+
value: item.value,
|
|
189
|
+
firstText: showText.slice(0, getIndex),
|
|
190
|
+
secondText: showText.slice(getIndex, getIndex + searchLength),
|
|
191
|
+
thirdText: showText.slice(getIndex + searchLength, showText.length),
|
|
192
|
+
testId: `${item.text}-child`,
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
result.push(newValue)
|
|
196
|
+
}
|
|
197
|
+
})
|
|
198
|
+
return result
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const filteredData = computed<UI_I_ComboDropdownSearched[]>(() => {
|
|
202
|
+
const result: UI_I_ComboDropdownSearched[] = []
|
|
203
|
+
|
|
204
|
+
props.items.forEach((item) => {
|
|
205
|
+
const filteredChilds = constructChildesBySearch(item.childs)
|
|
206
|
+
|
|
207
|
+
if (filteredChilds.length)
|
|
208
|
+
result.push({
|
|
209
|
+
text: item.text,
|
|
210
|
+
itemsCount: item.itemsCount,
|
|
211
|
+
childs: filteredChilds,
|
|
212
|
+
testId: item.testId,
|
|
213
|
+
})
|
|
214
|
+
})
|
|
215
|
+
return result
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
const arrowKeys = ref<boolean[]>([])
|
|
219
|
+
watch(
|
|
220
|
+
() => props.items,
|
|
221
|
+
(newValue) => {
|
|
222
|
+
if (!newValue.length) return
|
|
223
|
+
|
|
224
|
+
newValue.forEach((_, key) => {
|
|
225
|
+
const currentValue = key === 0
|
|
226
|
+
arrowKeys.value.push(currentValue)
|
|
227
|
+
})
|
|
228
|
+
},
|
|
229
|
+
{ immediate: true, deep: true }
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
const isShowList = ref<boolean>(false)
|
|
233
|
+
watch(isShowList, (newValue) => {
|
|
234
|
+
if (!newValue) {
|
|
235
|
+
isSearched.value = false
|
|
236
|
+
return
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
setTimeout(() => {
|
|
240
|
+
document.getElementById('search-input')?.focus()
|
|
241
|
+
}, 0)
|
|
242
|
+
selectedLocal.value && (search.value = selectedLocal.value)
|
|
243
|
+
})
|
|
244
|
+
const isHover = ref<boolean>(false)
|
|
245
|
+
|
|
246
|
+
const hideMenu = (force?: boolean): void => {
|
|
247
|
+
if (isHover.value && !force) return
|
|
248
|
+
|
|
249
|
+
isShowList.value = false
|
|
250
|
+
}
|
|
251
|
+
const windowClick = (): void => {
|
|
252
|
+
hideMenu()
|
|
253
|
+
}
|
|
254
|
+
const windowScroll = (): void => {
|
|
255
|
+
hideMenu()
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const onSelect = (value: string): void => {
|
|
259
|
+
emits('select', value)
|
|
260
|
+
hideMenu(true)
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
onMounted(() => {
|
|
264
|
+
window.addEventListener('click', windowClick)
|
|
265
|
+
window.addEventListener('scroll', windowScroll, true)
|
|
266
|
+
})
|
|
267
|
+
onUnmounted(() => {
|
|
268
|
+
window.removeEventListener('click', windowClick)
|
|
269
|
+
window.removeEventListener('scroll', windowScroll)
|
|
270
|
+
})
|
|
271
|
+
</script>
|
|
272
|
+
|
|
273
|
+
<style scoped lang="scss">
|
|
274
|
+
.combo-dropdown-content {
|
|
275
|
+
.alarm-trigger-combo-box {
|
|
276
|
+
position: static;
|
|
277
|
+
|
|
278
|
+
.combo-dropdown-menu {
|
|
279
|
+
position: absolute;
|
|
280
|
+
inset: 0 auto auto 0;
|
|
281
|
+
transform: translateX(15px) translateY(24px);
|
|
282
|
+
margin-top: -15px;
|
|
283
|
+
width: 30rem;
|
|
284
|
+
|
|
285
|
+
#search-input {
|
|
286
|
+
margin: 5px 2px 3px;
|
|
287
|
+
width: calc(100% - 4px);
|
|
288
|
+
height: 34px;
|
|
289
|
+
padding: 6px 12px;
|
|
290
|
+
color: #333;
|
|
291
|
+
font-size: 13px;
|
|
292
|
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
|
293
|
+
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
|
|
294
|
+
border: 1px solid #949494;
|
|
295
|
+
background-image: none;
|
|
296
|
+
|
|
297
|
+
&:focus {
|
|
298
|
+
outline: none;
|
|
299
|
+
border-color: #3cf;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
.dropdown-result-holder {
|
|
303
|
+
padding-top: 10px;
|
|
304
|
+
max-height: 18rem;
|
|
305
|
+
overflow-x: hidden;
|
|
306
|
+
overflow-y: auto;
|
|
307
|
+
|
|
308
|
+
.empty-text {
|
|
309
|
+
padding: 0 0.24rem 1.2rem 0.72rem;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.dropdown-parent-item {
|
|
313
|
+
&.open {
|
|
314
|
+
&.searched {
|
|
315
|
+
.children-content {
|
|
316
|
+
.item-title-content {
|
|
317
|
+
.dropdown-child-item {
|
|
318
|
+
padding-left: 14px;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.trigger-icon {
|
|
325
|
+
transform: rotate(180deg);
|
|
326
|
+
}
|
|
327
|
+
.children-content {
|
|
328
|
+
overflow-y: visible;
|
|
329
|
+
height: auto;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.trigger-icon {
|
|
334
|
+
transform: rotate(90deg);
|
|
335
|
+
}
|
|
336
|
+
.children-content {
|
|
337
|
+
overflow-x: hidden;
|
|
338
|
+
margin-left: 0;
|
|
339
|
+
height: 0;
|
|
340
|
+
overflow-y: visible;
|
|
341
|
+
|
|
342
|
+
.item-title-content {
|
|
343
|
+
&:first-child {
|
|
344
|
+
padding-left: 0;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.dropdown-child-item {
|
|
348
|
+
padding-left: 28px;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
</style>
|