@eturnity/eturnity_reusable_components 1.2.45 → 1.2.46
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
@@ -44,7 +44,7 @@
|
|
44
44
|
<div v-else>
|
45
45
|
<slot name="selector" :selectedValue="selectedValue"></slot>
|
46
46
|
</div>
|
47
|
-
<Caret :isUp="isDropdownOpen" >
|
47
|
+
<Caret :isUp="isDropdownOpen" @click.stop="toggleCaretDropdown" >
|
48
48
|
<icon name="arrow_up" size="12px" :color="caretColor || colorMode=='dark'?'white':'transparentBlack1'"/>
|
49
49
|
</Caret>
|
50
50
|
</selectButton>
|
@@ -274,10 +274,12 @@ const InputWrapper = styled('div', inputAttrs)`
|
|
274
274
|
isActive:false,
|
275
275
|
textSearch:"",
|
276
276
|
hoveredIndex:0,
|
277
|
+
isClickOutsideActive:false,
|
277
278
|
}
|
278
279
|
},
|
279
280
|
mounted(){
|
280
281
|
this.selectedValue=this.value
|
282
|
+
document.addEventListener('click', this.clickOutside)
|
281
283
|
},
|
282
284
|
beforeDestroy(){
|
283
285
|
document.removeEventListener('click', this.clickOutside)
|
@@ -291,23 +293,18 @@ const InputWrapper = styled('div', inputAttrs)`
|
|
291
293
|
},
|
292
294
|
toggleDropdown(){
|
293
295
|
if(this.isSearchBarVisible){return}
|
294
|
-
this.isDropdownOpen=!this.isDropdownOpen
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
document.removeEventListener('click', this.clickOutside)
|
299
|
-
}
|
300
|
-
|
296
|
+
this.isDropdownOpen=!this.isDropdownOpen
|
297
|
+
},
|
298
|
+
toggleCaretDropdown(){
|
299
|
+
this.isDropdownOpen=!this.isDropdownOpen
|
301
300
|
},
|
302
301
|
openDropdown(){
|
303
302
|
this.focus()
|
304
303
|
this.isDropdownOpen=true
|
305
|
-
document.addEventListener('click', this.clickOutside)
|
306
304
|
},
|
307
305
|
closeDropdown(){
|
308
306
|
this.blur()
|
309
307
|
this.isDropdownOpen=false
|
310
|
-
document.removeEventListener('click', this.clickOutside)
|
311
308
|
},
|
312
309
|
optionSelected(e){
|
313
310
|
this.selectedValue=e
|
@@ -339,11 +336,16 @@ const InputWrapper = styled('div', inputAttrs)`
|
|
339
336
|
if(!el.textContent.toLowerCase().includes(value.toLowerCase())){el.style.display='none'}else{el.style.display='inherit'}
|
340
337
|
}))
|
341
338
|
},
|
339
|
+
onSelectSlotClick(){
|
340
|
+
this.toggleDropdown()
|
341
|
+
},
|
342
342
|
clickOutside(event) {
|
343
|
+
if(!this.isClickOutsideActive) return
|
343
344
|
if (this.$el==event.target || this.$el.contains(event.target)) {
|
344
345
|
return
|
345
|
-
}
|
346
|
+
}else{
|
346
347
|
this.closeDropdown()
|
348
|
+
}
|
347
349
|
},
|
348
350
|
onKeyDown(e){
|
349
351
|
if(e.key=='ArrowDown'){
|
@@ -380,6 +382,15 @@ const InputWrapper = styled('div', inputAttrs)`
|
|
380
382
|
this.selectedValue=val
|
381
383
|
},
|
382
384
|
isDropdownOpen(val){
|
385
|
+
if(val){
|
386
|
+
setTimeout(()=>{
|
387
|
+
this.isClickOutsideActive=true
|
388
|
+
},10)
|
389
|
+
}else{
|
390
|
+
setTimeout(()=>{
|
391
|
+
this.isClickOutsideActive=false
|
392
|
+
},10)
|
393
|
+
}
|
383
394
|
if(val && this.isSearchable){
|
384
395
|
this.$nextTick(()=>{if(this.$refs.searchInput){this.$refs.searchInput.$el.querySelector('input').focus()}})
|
385
396
|
}
|