@eturnity/eturnity_reusable_components 7.18.0-EPDM-10335.1 → 7.18.0-EPDM-10335.2

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": "7.18.0-EPDM-10335.1",
3
+ "version": "7.18.0-EPDM-10335.2",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -1,11 +1,7 @@
1
1
  <template>
2
- <wrapper
3
- @mouseover="isHovered = true"
4
- @mouseleave="isHovered = false"
5
- :isDisabled="isDisabled"
6
- >
7
- <delete-icon-red v-if="isHovered && !isDisabled" :hoverBg="hoverBg" />
8
- <delete-icon-gray v-else />
2
+ <wrapper :isDisabled="isDisabled">
3
+ <delete-icon-red class="icon-red" :hoverBg="hoverBg" />
4
+ <delete-icon-gray class="icon-gray" />
9
5
  </wrapper>
10
6
  </template>
11
7
 
@@ -21,6 +17,28 @@ const Wrapper = styled('div', wrapperAttrs)`
21
17
  width: 30px;
22
18
  height: 30px;
23
19
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
20
+
21
+ .icon-red {
22
+ display: none;
23
+ }
24
+
25
+ .icon-gray {
26
+ display: inline;
27
+ }
28
+
29
+ ${(props) =>
30
+ !props.isDisabled &&
31
+ `
32
+ &:hover {
33
+ .icon-red {
34
+ display: inline;
35
+ }
36
+
37
+ .icon-gray {
38
+ display: none;
39
+ }
40
+ }
41
+ `}
24
42
  `
25
43
 
26
44
  const IconImageAttrs = { hoverBg: String }
@@ -55,11 +73,6 @@ export default {
55
73
  required: false,
56
74
  default: ''
57
75
  }
58
- },
59
- data() {
60
- return {
61
- isHovered: false
62
- }
63
76
  }
64
77
  }
65
78
  </script>
@@ -627,9 +627,9 @@ export default {
627
627
  }
628
628
  await this.$nextTick()
629
629
  const isDisplayedAtBottom = await this.generateDropdownPosition()
630
- await this.$nextTick()
631
630
  // If the dropdown menu is going to be displayed at the bottom,
632
631
  // we need reverify its position after a dom update (nextTick)
632
+ await this.$nextTick()
633
633
  if (isDisplayedAtBottom) this.generateDropdownPosition()
634
634
  },
635
635
  async generateDropdownPosition() {
@@ -666,6 +666,8 @@ export default {
666
666
  const windowHeight =
667
667
  window.innerHeight || document.documentElement.clientHeight
668
668
 
669
+ if (windowHeight <= 650) return true
670
+
669
671
  // using Math.floor because the offsets may contain decimals we are not going to consider here
670
672
  return Math.floor(rect.top) + Math.floor(rect.height) <= windowHeight
671
673
  },
@@ -720,7 +722,9 @@ export default {
720
722
  computed: {
721
723
  optionLength() {
722
724
  if (this.isDropdownOpen) {
723
- return this.$refs.dropdown.$el.childElementCount
725
+ return this.$refs.dropdown.$el.childElementCount > 1
726
+ ? this.$refs.dropdown.$el.childElementCount
727
+ : this.$refs.dropdown.$el.children[0].childElementCount
724
728
  }
725
729
 
726
730
  return 0
@@ -739,6 +743,20 @@ export default {
739
743
  this.dropdownPosition.left !== null &&
740
744
  (!this.isSearchable || this.isSearchable)
741
745
  )
746
+ },
747
+ isMobileDevice() {
748
+ const userAgent = navigator.userAgent || navigator.vendor || window.opera
749
+ const touchCapable =
750
+ 'ontouchstart' in window ||
751
+ navigator.maxTouchPoints > 0 ||
752
+ navigator.msMaxTouchPoints > 0
753
+
754
+ return (
755
+ /Android/i.test(userAgent) ||
756
+ /iPad|iPhone|iPod/.test(userAgent) ||
757
+ (/Macintosh/.test(userAgent) && touchCapable) ||
758
+ /windows phone/i.test(userAgent)
759
+ )
742
760
  }
743
761
  },
744
762
  watch: {
@@ -760,7 +778,7 @@ export default {
760
778
  }
761
779
  if (val && this.isSearchable) {
762
780
  this.$nextTick(() => {
763
- if (this.$refs.searchInput) {
781
+ if (this.$refs.searchInput && !this.isMobileDevice) {
764
782
  this.$refs.searchInput.$el.querySelector('input').focus()
765
783
  }
766
784
  })
@@ -75,7 +75,7 @@ import icon from '../icon'
75
75
  import theme from '@/assets/theme.js'
76
76
 
77
77
  const paginationWrapper = styled.nav`
78
- color: ${(props) => props.theme.brightBlue};
78
+ color: ${(props) => props.theme.colors.brightBlue};
79
79
  font-size: 13px;
80
80
  display: flex;
81
81
  flex-wrap: wrap;
@@ -95,7 +95,7 @@ const paginationLink = styled.div`
95
95
 
96
96
  &.active {
97
97
  color: #fff;
98
- background-color: ${(props) => props.theme.brightBlue};
98
+ background-color: ${(props) => props.theme.colors.brightBlue};
99
99
  padding: 7px 12px;
100
100
  border-radius: 4px;
101
101
  }
@@ -40,12 +40,7 @@
40
40
  "
41
41
  @click.stop="onSelectedTemplateClick(item.row)"
42
42
  >
43
- <img
44
- :src="require('../../assets/icons/file_icon.png')"
45
- alt="icon"
46
- width="12"
47
- height="16"
48
- />
43
+ <img :src="fileIcon" alt="icon" width="12" height="16" />
49
44
  <div>{{ item.value }}</div>
50
45
  </template-link>
51
46
  <no-template v-if="item.type && item.type === 'no-template'">
@@ -182,6 +177,7 @@ import SearchInput from '../inputs/searchInput'
182
177
  import InputText from '../inputs/inputText'
183
178
  import CollapseArrowIcon from '../../assets/icons/collapse_arrow_icon.svg'
184
179
  import SubpositionMarkerIcon from '../../assets/icons/subposition_marker.svg'
180
+ import fileIconPng from '../../assets/icons/file_icon.png'
185
181
 
186
182
  const rowAttrs = { disabled: Boolean, isOpen: Boolean }
187
183
  const DropdownRow = styled('div', rowAttrs)`
@@ -494,7 +490,8 @@ export default {
494
490
  inputText: '',
495
491
  wasClicked: false, // prevents custom-name from being triggered on the <input-text />
496
492
  dynamicWidth: [], // for numbers
497
- dynamicGridWidth: [] // for grid values
493
+ dynamicGridWidth: [], // for grid values
494
+ fileIcon: fileIconPng
498
495
  }
499
496
  },
500
497
  methods: {
@@ -516,7 +513,7 @@ export default {
516
513
  })
517
514
  this.$emit('toggle-dropdown-open', { close: false })
518
515
  this.$nextTick(() => {
519
- this.$refs.searchInput.$el.children[0].children[0].focus()
516
+ this.$refs.searchInput.$el.children[0].children[1].focus()
520
517
  })
521
518
  } else {
522
519
  document.removeEventListener('click', this.clickOutside)