@eturnity/eturnity_reusable_components 6.37.0-EPDM-8148.6 → 6.37.0-EPDM-8148.7
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
@@ -408,7 +408,7 @@ export default {
|
|
408
408
|
isActive: false,
|
409
409
|
textSearch: '',
|
410
410
|
hoveredIndex: 0,
|
411
|
-
hoveredValue:null,
|
411
|
+
hoveredValue: null,
|
412
412
|
isClickOutsideActive: false
|
413
413
|
}
|
414
414
|
},
|
@@ -447,7 +447,7 @@ export default {
|
|
447
447
|
this.$emit('input-change', e)
|
448
448
|
},
|
449
449
|
optionHovered(e) {
|
450
|
-
this.hoveredValue=e
|
450
|
+
this.hoveredValue = e
|
451
451
|
},
|
452
452
|
mouseEnterHandler() {
|
453
453
|
if (this.hoverDropdown) {
|
@@ -477,10 +477,14 @@ export default {
|
|
477
477
|
this.toggleDropdown()
|
478
478
|
},
|
479
479
|
clickOutside(event) {
|
480
|
+
const dropdownRef = this.$refs.dropdown
|
481
|
+
// we need to prevent closing on selecting an option, because in the case of
|
482
|
+
// a disabled option, we don't want to close the dropdown
|
480
483
|
if (!this.isClickOutsideActive) return
|
481
484
|
if (
|
482
485
|
this.$refs.select.$el == event.target ||
|
483
|
-
this.$refs.select.$el.contains(event.target)
|
486
|
+
this.$refs.select.$el.contains(event.target) ||
|
487
|
+
event.target.parentNode === dropdownRef.$el
|
484
488
|
) {
|
485
489
|
return
|
486
490
|
} else {
|
@@ -502,14 +506,16 @@ export default {
|
|
502
506
|
},
|
503
507
|
onArrowPress(dir) {
|
504
508
|
let newHoveredElem
|
505
|
-
const currentHoveredElem=this.$refs.dropdown.$el.querySelector(
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
newHoveredElem=currentHoveredElem.
|
509
|
+
const currentHoveredElem = this.$refs.dropdown.$el.querySelector(
|
510
|
+
`[data-value="${this.hoveredValue}"]`
|
511
|
+
)
|
512
|
+
if (currentHoveredElem) {
|
513
|
+
if (dir > 0) {
|
514
|
+
newHoveredElem = currentHoveredElem.nextElementSibling
|
515
|
+
} else {
|
516
|
+
newHoveredElem = currentHoveredElem.previousElementSibling
|
511
517
|
}
|
512
|
-
if(newHoveredElem){
|
518
|
+
if (newHoveredElem) {
|
513
519
|
this.hoveredValue = newHoveredElem.getAttribute('data-value')
|
514
520
|
const topPos = newHoveredElem.offsetTop
|
515
521
|
this.$refs.dropdown.$el.scrollTop = topPos
|
@@ -77,6 +77,10 @@ export default {
|
|
77
77
|
},
|
78
78
|
hoverText: {
|
79
79
|
required: false
|
80
|
+
},
|
81
|
+
isDisabled: {
|
82
|
+
required: false,
|
83
|
+
default: false
|
80
84
|
}
|
81
85
|
},
|
82
86
|
|
@@ -87,7 +91,12 @@ export default {
|
|
87
91
|
},
|
88
92
|
methods: {
|
89
93
|
clickHandler() {
|
90
|
-
|
94
|
+
if (this.isDisabled) {
|
95
|
+
// prevent emitter if the option is disabled
|
96
|
+
return
|
97
|
+
} else {
|
98
|
+
this.$parent.$emit('option-selected', this.value)
|
99
|
+
}
|
91
100
|
},
|
92
101
|
hoverHandler() {
|
93
102
|
this.$parent.$emit('option-hovered', this.value)
|