@eturnity/eturnity_reusable_components 1.1.15 → 1.1.16

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.1.15",
3
+ "version": "1.1.16",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -1,11 +1,17 @@
1
1
  <template>
2
2
  <page-container @click="toggleButton()">
3
- <button-container>
3
+ <button-container ref="dropdownItem">
4
4
  <dot-item />
5
5
  <dot-item />
6
6
  <dot-item />
7
7
  </button-container>
8
- <dropdown-container v-if="isOpen" @click.stop>
8
+ <dropdown-container
9
+ v-if="isOpen"
10
+ @click.stop
11
+ :top="getItemLocation('top')"
12
+ :right="getItemLocation('right')"
13
+ :containerWidth="childOpen ? 420 : 220"
14
+ >
9
15
  <loading-container v-if="isLoading">
10
16
  <spinner />
11
17
  </loading-container>
@@ -148,12 +154,13 @@ const DotItem = styled.div`
148
154
  border-radius: 50%;
149
155
  `
150
156
 
151
- const DropdownContainer = styled.div`
157
+ const dropdownAttrs = { top: Number, right: Number, containerWidth: Number }
158
+ const DropdownContainer = styled("div", dropdownAttrs)`
152
159
  z-index: 99;
153
160
  height: 200px;
154
- margin-top: 50px;
161
+ top: ${(props) => props.top + "px"};
162
+ left: ${(props) => props.right - props.containerWidth + "px"};
155
163
  position: absolute;
156
- right: 20px;
157
164
  display: grid;
158
165
  grid-template-columns: auto auto;
159
166
  `
@@ -283,6 +290,14 @@ export default {
283
290
  document.removeEventListener("click", this.clickOutside)
284
291
  }
285
292
  },
293
+ getItemLocation(value) {
294
+ let ref = this.$refs.dropdownItem
295
+ let location = ref.$el.getBoundingClientRect()[value]
296
+ if (value === "top") {
297
+ location = location + window.scrollY
298
+ }
299
+ return location
300
+ },
286
301
  hasChildren(item) {
287
302
  return !!item.children && !!item.children.length
288
303
  },