@eturnity/eturnity_reusable_components 1.2.45-3d-master.0 → 1.2.45-3d-master.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "1.2.45-3d-master.0",
3
+ "version": "1.2.45-3d-master.1",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -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)
@@ -290,25 +292,19 @@ const InputWrapper = styled('div', inputAttrs)`
290
292
  this.isActive=false
291
293
  },
292
294
  toggleDropdown(){
293
- console.log('toggleDropdown')
294
295
  if(this.isSearchBarVisible){return}
295
- this.isDropdownOpen=!this.isDropdownOpen
296
- if (this.isDropdownOpen) {
297
- document.addEventListener('click', this.clickOutside)
298
- } else {
299
- document.removeEventListener('click', this.clickOutside)
300
- }
301
-
296
+ this.isDropdownOpen=!this.isDropdownOpen
297
+ },
298
+ toggleCaretDropdown(){
299
+ this.isDropdownOpen=!this.isDropdownOpen
302
300
  },
303
301
  openDropdown(){
304
302
  this.focus()
305
303
  this.isDropdownOpen=true
306
- document.addEventListener('click', this.clickOutside)
307
304
  },
308
305
  closeDropdown(){
309
306
  this.blur()
310
307
  this.isDropdownOpen=false
311
- document.removeEventListener('click', this.clickOutside)
312
308
  },
313
309
  optionSelected(e){
314
310
  this.selectedValue=e
@@ -340,12 +336,16 @@ const InputWrapper = styled('div', inputAttrs)`
340
336
  if(!el.textContent.toLowerCase().includes(value.toLowerCase())){el.style.display='none'}else{el.style.display='inherit'}
341
337
  }))
342
338
  },
339
+ onSelectSlotClick(){
340
+ this.toggleDropdown()
341
+ },
343
342
  clickOutside(event) {
344
- console.log("click outside",event)
343
+ if(!this.isClickOutsideActive) return
345
344
  if (this.$el==event.target || this.$el.contains(event.target)) {
346
345
  return
347
- }
346
+ }else{
348
347
  this.closeDropdown()
348
+ }
349
349
  },
350
350
  onKeyDown(e){
351
351
  if(e.key=='ArrowDown'){
@@ -382,6 +382,15 @@ const InputWrapper = styled('div', inputAttrs)`
382
382
  this.selectedValue=val
383
383
  },
384
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
+ }
385
394
  if(val && this.isSearchable){
386
395
  this.$nextTick(()=>{if(this.$refs.searchInput){this.$refs.searchInput.$el.querySelector('input').focus()}})
387
396
  }