fix position style to contextual menu in data table. (#331)

pull/3759/head
Edwin Betancourt 2020-02-13 16:49:53 -04:00 committed by GitHub
parent be0e3d8eec
commit db731fcf97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 10 deletions

View File

@ -122,8 +122,8 @@
<el-main style="padding: 0px !important; overflow: hidden;"> <el-main style="padding: 0px !important; overflow: hidden;">
<table-context-menu <table-context-menu
v-show="isParent ? getShowContextMenuTable : getShowContextMenuTabChildren" v-show="isParent ? getShowContextMenuTable : getShowContextMenuTabChildren"
:style="{ left: left + 'px', top: top + 'px' }" :style="{ left: leftContextualMenu + 'px', top: topContextualMenu + 'px' }"
class="contextmenu" class="contextual-menu"
:container-uuid="containerUuid" :container-uuid="containerUuid"
:parent-uuid="parentUuid" :parent-uuid="parentUuid"
:panel-type="panelType" :panel-type="panelType"
@ -309,8 +309,8 @@ export default {
activeName.push('1') activeName.push('1')
} }
return { return {
top: 0, topContextualMenu: 0,
left: 0, leftContextualMenu: 0,
currentRowMenu: {}, currentRowMenu: {},
currentRow: null, currentRow: null,
currentTable: 0, currentTable: 0,
@ -575,18 +575,22 @@ export default {
const maxLeft = offsetWidth - menuMinWidth // left boundary const maxLeft = offsetWidth - menuMinWidth // left boundary
const left = event.clientX - offsetLeft + 15 // 15: margin right const left = event.clientX - offsetLeft + 15 // 15: margin right
this.left = left this.leftContextualMenu = left
if (left > maxLeft) { if (left > maxLeft) {
this.left = maxLeft this.leftContextualMenu = maxLeft
} }
this.top = event.clientY - event.screenY const offsetTop = this.$el.getBoundingClientRect().top
if (this.isParent) { let top = event.clientY - offsetTop
this.top = event.clientY - 100 if (this.panelType === 'browser' && this.getterPanel.isShowedCriteria) {
top = event.clientY - 200
} }
this.topContextualMenu = top
this.currentRowMenu = row this.currentRowMenu = row
this.visible = true this.visible = true
// TODO: Verify use
this.$store.dispatch('showMenuTable', { this.$store.dispatch('showMenuTable', {
isShowedTable: this.isParent isShowedTable: this.isParent
}) })
@ -1007,7 +1011,7 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.contextmenu { .contextual-menu {
margin: 0; margin: 0;
background: #fff; background: #fff;
z-index: 3000; z-index: 3000;