@everchron/ec-shards 4.4.1 → 4.4.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": "@everchron/ec-shards",
3
- "version": "4.4.1",
3
+ "version": "4.4.2",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -48,6 +48,16 @@ export default {
48
48
  /** If passed, an icon will appear. The list of available icon names can be found [here](https://github.com/everchron/ec-shards/tree/main/src/assets/icons). */
49
49
  icon: {
50
50
  type: String
51
+ },
52
+ /** Use the offset of the context menu appears in a scrollable container which does not start at the very top of the browser window. For example, pass the pixel height value of the everchron navigation bar and toolbar. */
53
+ offsetTop: {
54
+ type: Number,
55
+ default: 0
56
+ },
57
+ /** Use the offset of the context menu appears in a scrollable container which does not start at the very left of the browser window. For example, pass the pixel width value of a left hand sidebar. */
58
+ offsetLeft: {
59
+ type: Number,
60
+ default: 0
51
61
  }
52
62
  },
53
63
 
@@ -86,17 +96,16 @@ export default {
86
96
  }
87
97
 
88
98
  if (this.menuWidth + event.pageX >= window.innerWidth) {
89
- this.left = event.pageX - this.menuWidth + 2
99
+ this.left = event.pageX - this.menuWidth + 2 - this.offsetLeft
90
100
  } else {
91
- this.left = event.pageX - 2
101
+ this.left = event.pageX - 2 - this.offsetLeft
92
102
  }
93
103
 
94
104
  if (this.menuHeight + event.pageY >= window.innerHeight) {
95
- this.top = event.pageY - this.menuHeight + 2
105
+ this.top = event.pageY - this.menuHeight + 2 - this.offsetTop
96
106
  } else {
97
- this.top = event.pageY - 2
107
+ this.top = event.pageY - 2 - this.offsetTop
98
108
  }
99
-
100
109
  this.opened = true
101
110
  },
102
111
 
@@ -21,7 +21,7 @@ export const contextMenu = () => ({
21
21
  <ecs-data-grid-head-cell name="Fourth" :width="200" />
22
22
  </template>
23
23
 
24
- <ecs-data-grid-row v-for="index in 6" :key="index" mouse-event="contextmenu" @click="(e) => handleClick(e, index)">
24
+ <ecs-data-grid-row v-for="index in 60" :key="index" mouse-event="contextmenu" @click="(e) => handleClick(e, index)">
25
25
  <ecs-data-grid-cell column="first" :width="200">Right click me</ecs-data-grid-cell>
26
26
  <ecs-data-grid-cell column="second" :width="200">Right click me</ecs-data-grid-cell>
27
27
  <ecs-data-grid-cell column="third" :width="200">Right click me</ecs-data-grid-cell>
@@ -63,6 +63,7 @@ export const contextMenu = () => ({
63
63
  },
64
64
  methods: {
65
65
  handleClick(event, item) {
66
+ console.log(this.$refs)
66
67
  this.$refs.contextMenu.showMenu(event, item)
67
68
  }
68
69
  },