@eturnity/eturnity_reusable_components 6.46.0-EPDM-9083 → 6.46.1
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/package.json
CHANGED
@@ -93,9 +93,11 @@
|
|
93
93
|
ref="dropdown"
|
94
94
|
v-show="isDropdownOpen"
|
95
95
|
:hoveredIndex="hoveredIndex"
|
96
|
+
:hoveredValue="hoveredValue"
|
96
97
|
:isActive="isActive"
|
97
98
|
:optionWidth="optionWidth"
|
98
|
-
:hoveredBgColor="colorMode == 'dark' ? '
|
99
|
+
:hoveredBgColor="colorMode == 'dark' ? '#000000' : dropdownBgColor"
|
100
|
+
:bgColor="colorMode == 'dark' ? 'black' : dropdownBgColor"
|
99
101
|
:fontColor="
|
100
102
|
dropdownFontColor || colorMode == 'dark' ? 'white' : 'black'
|
101
103
|
"
|
@@ -233,10 +235,12 @@ const selectButton = styled('div', selectButtonAttrs)`
|
|
233
235
|
`
|
234
236
|
const selectDropdownAttrs = {
|
235
237
|
hoveredBgColor: String,
|
238
|
+
bgColor: String,
|
236
239
|
fontColor: String,
|
237
240
|
selectWidth: String,
|
238
241
|
optionWidth: String,
|
239
242
|
hoveredIndex: Number,
|
243
|
+
hoveredValue: Number | String,
|
240
244
|
selectedValue: Number | String
|
241
245
|
}
|
242
246
|
const selectDropdown = styled('div', selectDropdownAttrs)`
|
@@ -253,16 +257,16 @@ const selectDropdown = styled('div', selectDropdownAttrs)`
|
|
253
257
|
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
254
258
|
width: ${(props) => (props.optionWidth ? props.optionWidth : '100%')};
|
255
259
|
background-color:${(props) =>
|
256
|
-
props.theme.colors[props.
|
257
|
-
? props.theme.colors[props.
|
258
|
-
: props.
|
260
|
+
props.theme.colors[props.bgColor]
|
261
|
+
? props.theme.colors[props.bgColor]
|
262
|
+
: props.bgColor};
|
259
263
|
color:${(props) =>
|
260
264
|
props.theme.colors[props.fontColor]
|
261
265
|
? props.theme.colors[props.fontColor]
|
262
266
|
: props.fontColor};
|
263
267
|
max-height:300px;
|
264
268
|
overflow-y:auto;
|
265
|
-
&>div
|
269
|
+
&>div[data-value="${(props) => props.hoveredValue}"]{
|
266
270
|
background-color:${(props) =>
|
267
271
|
props.theme.colors[props.hoveredBgColor]
|
268
272
|
? props.theme.colors[props.hoveredBgColor]
|
@@ -404,6 +408,7 @@ export default {
|
|
404
408
|
isActive: false,
|
405
409
|
textSearch: '',
|
406
410
|
hoveredIndex: 0,
|
411
|
+
hoveredValue:null,
|
407
412
|
isClickOutsideActive: false
|
408
413
|
}
|
409
414
|
},
|
@@ -442,13 +447,7 @@ export default {
|
|
442
447
|
this.$emit('input-change', e)
|
443
448
|
},
|
444
449
|
optionHovered(e) {
|
445
|
-
|
446
|
-
if (this.$refs.dropdown) {
|
447
|
-
this.hoveredIndex =
|
448
|
-
this.$refs.dropdown.$children
|
449
|
-
.map((component) => component.$el)
|
450
|
-
.indexOf(optionElement) + 1
|
451
|
-
}
|
450
|
+
this.hoveredValue=e
|
452
451
|
},
|
453
452
|
mouseEnterHandler() {
|
454
453
|
if (this.hoverDropdown) {
|
@@ -502,16 +501,20 @@ export default {
|
|
502
501
|
}
|
503
502
|
},
|
504
503
|
onArrowPress(dir) {
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
504
|
+
let newHoveredElem
|
505
|
+
const currentHoveredElem=this.$refs.dropdown.$el.querySelector(`[data-value="${this.hoveredValue}"]`);
|
506
|
+
if(currentHoveredElem){
|
507
|
+
if(dir>0){
|
508
|
+
newHoveredElem=currentHoveredElem.nextElementSibling
|
509
|
+
}else{
|
510
|
+
newHoveredElem=currentHoveredElem.previousElementSibling
|
511
|
+
}
|
512
|
+
if(newHoveredElem){
|
513
|
+
this.hoveredValue = newHoveredElem.getAttribute('data-value')
|
514
|
+
const topPos = newHoveredElem.offsetTop
|
515
|
+
this.$refs.dropdown.$el.scrollTop = topPos
|
516
|
+
}
|
517
|
+
}
|
515
518
|
}
|
516
519
|
},
|
517
520
|
computed: {
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<optionContainer
|
3
3
|
:data-value="value"
|
4
4
|
:hoveredBgColor="colorMode == 'dark' ? '#000000' : 'hoveredBgColor'"
|
5
|
-
:backgroundColor="colorMode == 'dark' ? '
|
5
|
+
:backgroundColor="colorMode == 'dark' ? 'eturnityGrey' : '#fff'"
|
6
6
|
@click="clickHandler"
|
7
7
|
@mouseover="hoverHandler"
|
8
8
|
>
|
@@ -24,13 +24,13 @@ const optionContainer = styled('div', optionProps)`
|
|
24
24
|
padding: 12px 10px;
|
25
25
|
gap: 14px;
|
26
26
|
width: 100%;
|
27
|
-
background-color: ${(props) => props.backgroundColor};
|
27
|
+
background-color: ${(props) => props.theme.colors[props.backgroundColor]?props.theme.colors[props.backgroundColor]:props.backgroundColor};
|
28
28
|
box-sizing: inherit;
|
29
29
|
&:hover {
|
30
30
|
background-color: ${(props) =>
|
31
31
|
props.theme.colors[props.hoveredBgColor]
|
32
32
|
? props.theme.colors[props.hoveredBgColor]
|
33
|
-
: props.hoveredBgColor};
|
33
|
+
: props.hoveredBgColor} !important;
|
34
34
|
}
|
35
35
|
`
|
36
36
|
|
@@ -91,7 +91,7 @@ export const stringToNumber = ({
|
|
91
91
|
return parseFloat(newVal)
|
92
92
|
}
|
93
93
|
|
94
|
-
export const numberToString = ({ value, numberPrecision
|
94
|
+
export const numberToString = ({ value, numberPrecision }) => {
|
95
95
|
value = parseFloat(value)
|
96
96
|
let minNumberPrecision
|
97
97
|
let maxNumberPrecision
|