bfg-common 1.4.180 → 1.4.181
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/localization/local_be.json +1 -2
- package/assets/localization/local_en.json +1 -2
- package/assets/localization/local_hy.json +1 -2
- package/assets/localization/local_kk.json +1 -2
- package/assets/localization/local_ru.json +1 -2
- package/assets/localization/local_zh.json +1 -2
- package/components/atoms/datepicker/Datepicker.vue +639 -630
- package/components/atoms/datepicker/lib/config/{datapicker.ts → datepicker.ts} +46 -43
- package/package.json +1 -1
- package/components/atoms/comboDropdownMenu/ComboDropdownMenu.vue +0 -357
- package/components/atoms/comboDropdownMenu/lib/models/interfaces.ts +0 -26
|
@@ -1,43 +1,46 @@
|
|
|
1
|
-
import type{ UI_I_Localization } from '~/lib/models/interfaces'
|
|
2
|
-
|
|
3
|
-
export const getMonthsFunc = (localization: UI_I_Localization): string[] => {
|
|
4
|
-
return [
|
|
5
|
-
localization.common.january,
|
|
6
|
-
localization.common.february,
|
|
7
|
-
localization.common.march,
|
|
8
|
-
localization.common.april,
|
|
9
|
-
localization.common.may,
|
|
10
|
-
localization.common.june,
|
|
11
|
-
localization.common.july,
|
|
12
|
-
localization.common.august,
|
|
13
|
-
localization.common.september,
|
|
14
|
-
localization.common.october,
|
|
15
|
-
localization.common.november,
|
|
16
|
-
localization.common.december,
|
|
17
|
-
]
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const getWeekdaysFunc = (
|
|
21
|
-
localization: UI_I_Localization,
|
|
22
|
-
languageCode: string
|
|
23
|
-
): string[] => {
|
|
24
|
-
let result = [
|
|
25
|
-
localization.common.sunday,
|
|
26
|
-
localization.common.monday,
|
|
27
|
-
localization.common.tuesday,
|
|
28
|
-
localization.common.wednesday,
|
|
29
|
-
localization.common.thursday,
|
|
30
|
-
localization.common.friday,
|
|
31
|
-
localization.common.saturday,
|
|
32
|
-
]
|
|
33
|
-
result = result.map((week: string, key: number) =>
|
|
34
|
-
languageCode === 'hy_AM' && key === 5 ? week[0] + week[1] : week[0]
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
if (languageCode !== 'en_US') {
|
|
38
|
-
const first = result.shift()
|
|
39
|
-
first && result.push(first)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return result
|
|
43
|
-
}
|
|
1
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
2
|
+
|
|
3
|
+
export const getMonthsFunc = (localization: UI_I_Localization): string[] => {
|
|
4
|
+
return [
|
|
5
|
+
localization.common.january,
|
|
6
|
+
localization.common.february,
|
|
7
|
+
localization.common.march,
|
|
8
|
+
localization.common.april,
|
|
9
|
+
localization.common.may,
|
|
10
|
+
localization.common.june,
|
|
11
|
+
localization.common.july,
|
|
12
|
+
localization.common.august,
|
|
13
|
+
localization.common.september,
|
|
14
|
+
localization.common.october,
|
|
15
|
+
localization.common.november,
|
|
16
|
+
localization.common.december,
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const getWeekdaysFunc = (
|
|
21
|
+
localization: UI_I_Localization,
|
|
22
|
+
languageCode: string
|
|
23
|
+
): string[] => {
|
|
24
|
+
let result = [
|
|
25
|
+
localization.common.sunday,
|
|
26
|
+
localization.common.monday,
|
|
27
|
+
localization.common.tuesday,
|
|
28
|
+
localization.common.wednesday,
|
|
29
|
+
localization.common.thursday,
|
|
30
|
+
localization.common.friday,
|
|
31
|
+
localization.common.saturday,
|
|
32
|
+
]
|
|
33
|
+
result = result.map((week: string, key: number) =>
|
|
34
|
+
languageCode === 'hy_AM' && key === 5 ? week[0] + week[1] : week[0]
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
if (languageCode !== 'en_US') {
|
|
38
|
+
const first = result.shift()
|
|
39
|
+
first && result.push(first)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return result
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const datepickerWidth = 314
|
|
46
|
+
export const datepickerHeight = 278
|
package/package.json
CHANGED
|
@@ -1,357 +0,0 @@
|
|
|
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
|
-
type="search"
|
|
26
|
-
autocomplete="off"
|
|
27
|
-
maxlength="300"
|
|
28
|
-
class="form-control dropdown-search-box"
|
|
29
|
-
:placeholder="localization.common.search"
|
|
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,26 +0,0 @@
|
|
|
1
|
-
export interface UI_I_ComboDropdownChild {
|
|
2
|
-
text: string
|
|
3
|
-
value: string
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export interface UI_I_ComboDropdown {
|
|
7
|
-
text: string
|
|
8
|
-
itemsCount: number
|
|
9
|
-
childs: UI_I_ComboDropdownChild[]
|
|
10
|
-
testId: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface UI_I_ComboDropdownSearchedItem {
|
|
14
|
-
text: string
|
|
15
|
-
firstText: string
|
|
16
|
-
secondText: string
|
|
17
|
-
thirdText: string
|
|
18
|
-
testId: string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface UI_I_ComboDropdownSearched {
|
|
22
|
-
text: string
|
|
23
|
-
itemsCount: number
|
|
24
|
-
childs: UI_I_ComboDropdownSearchedItem[]
|
|
25
|
-
testId: string
|
|
26
|
-
}
|