2023-11-10 20:34:36 +08:00
|
|
|
<template>
|
2023-11-28 16:41:10 +08:00
|
|
|
<div class="items-center -ml-1.5 my-2">
|
2023-11-10 20:34:36 +08:00
|
|
|
<MenuDropdown
|
|
|
|
:listItems="this.formattedList"
|
2023-11-28 16:41:10 +08:00
|
|
|
btnClasses="bg-transparent w-6 h-6 border-0 p-0 flex"
|
2023-11-10 20:34:36 +08:00
|
|
|
:position="'right'"
|
|
|
|
:alwaysShow="true"
|
|
|
|
:btnIcon="'sn-icon sn-icon-more-hori'"
|
|
|
|
@open="loadActions"
|
|
|
|
></MenuDropdown>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import MenuDropdown from '../menu_dropdown.vue'
|
|
|
|
import axios from '../../../packs/custom_axios.js';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'RowMenuRenderer',
|
|
|
|
props: {
|
|
|
|
params: {
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
actionsMenu: []
|
|
|
|
}
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
MenuDropdown
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
formattedList() {
|
|
|
|
return this.actionsMenu.map((item) => {
|
|
|
|
let newItem = { text: item.label }
|
|
|
|
if (item.type == 'emit') {
|
|
|
|
newItem.emit = item.name
|
|
|
|
}
|
|
|
|
if (item.type == 'link') {
|
|
|
|
newItem.url = item.path
|
|
|
|
}
|
|
|
|
|
|
|
|
return newItem
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
loadActions() {
|
|
|
|
if (this.actionsMenu.length > 0) return
|
|
|
|
|
|
|
|
axios.get(this.params.data.urls.actions)
|
|
|
|
.then((response) => {
|
|
|
|
this.actionsMenu = response.data.actions
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
console.log(error)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|