@redseed/redseed-ui-vue3 2.18.1 → 2.18.3

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": "@redseed/redseed-ui-vue3",
3
- "version": "2.18.1",
3
+ "version": "2.18.3",
4
4
  "description": "RedSeed UI Vue 3 components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
- import { ref, computed, onMounted, onUnmounted, watchEffect } from 'vue'
3
- import { onClickOutside, useResizeObserver, useElementBounding } from '@vueuse/core'
2
+ import { ref, onMounted, onUnmounted } from 'vue'
3
+ import { onClickOutside, useElementBounding } from '@vueuse/core'
4
4
  import FormFieldSlot from './FormFieldSlot.vue'
5
5
  import { ChevronDownIcon, CheckIcon } from '@heroicons/vue/24/outline'
6
6
 
@@ -44,18 +44,8 @@ const formFieldSelectElement = ref(null)
44
44
  const selectElement = ref(null)
45
45
  const dropdownElement = ref(null)
46
46
 
47
-
48
-
49
47
  onClickOutside(formFieldSelectElement, () => close())
50
48
 
51
- // useResizeObserver(formFieldSelectElement, (entries) => {
52
- // const entry = entries[0]
53
- // const { width } = entry.contentRect
54
- // dropdownWidth.value = width
55
- // })
56
-
57
- // watchEffect(() => calculateDropdownPosition())
58
-
59
49
  const selectElementBounding = useElementBounding(selectElement)
60
50
 
61
51
  function calculateDropdownPosition() {
@@ -65,44 +55,46 @@ function calculateDropdownPosition() {
65
55
  * Get the viewport height
66
56
  */
67
57
  const viewportHeight = window.innerHeight
68
- console.log('viewportHeight', viewportHeight)
58
+ // console.log('viewportHeight', viewportHeight)
69
59
 
70
60
  /**
71
61
  * Get the dropdown element height
72
62
  */
73
63
  const dropdownElementHeight = dropdownElement.value.offsetHeight
74
- console.log('dropdownElementHeight', dropdownElementHeight)
64
+ // console.log('dropdownElementHeight', dropdownElementHeight)
75
65
 
76
66
  /**
77
67
  * Get space above the select element
78
68
  */
79
69
  const spaceAboveSelectElement = selectElementBounding.top.value
80
- console.log('spaceAboveSelectElement', spaceAboveSelectElement)
70
+ // console.log('spaceAboveSelectElement', spaceAboveSelectElement)
81
71
 
82
72
  /**
83
73
  * Get space below the select element
84
74
  */
85
75
  const spaceBelowSelectElement = viewportHeight - selectElementBounding.bottom.value
86
- console.log('spaceBelowSelectElement', spaceBelowSelectElement)
76
+ // console.log('spaceBelowSelectElement', spaceBelowSelectElement)
87
77
 
88
78
  dropdownElement.value.style.width = `${selectElementBounding.width.value}px`
89
79
 
80
+ dropdownElement.value.style.left = `${selectElementBounding.left.value}px`
81
+
90
82
  if (spaceAboveSelectElement <= dropdownElementHeight
91
83
  && spaceBelowSelectElement <= dropdownElementHeight) {
92
84
  dropdownElement.value.style.top = '0'
93
85
  dropdownElement.value.style.bottom = 'auto'
94
86
  return
95
87
  } else if (spaceBelowSelectElement > dropdownElementHeight) {
96
- console.log('space below >= dropdown height')
88
+ // console.log('space below >= dropdown height')
97
89
  dropdownElement.value.style.top = `${selectElementBounding.bottom.value}px`
98
- console.log('dropdownElement.value.style.top', dropdownElement.value.style.top)
90
+ // console.log('dropdownElement.value.style.top', dropdownElement.value.style.top)
99
91
  dropdownElement.value.style.bottom = 'auto'
100
92
  return
101
93
  } else if (spaceAboveSelectElement > dropdownElementHeight) {
102
- console.log('space above > dropdown height')
94
+ // console.log('space above > dropdown height')
103
95
  dropdownElement.value.style.top = 'auto'
104
96
  dropdownElement.value.style.bottom = `${spaceBelowSelectElement + selectElementBounding.height.value + 8}px`
105
- console.log('dropdownElement.value.style.bottom', dropdownElement.value.style.bottom)
97
+ // console.log('dropdownElement.value.style.bottom', dropdownElement.value.style.bottom)
106
98
  return
107
99
  }
108
100
  }