1
0
forked from test/crm

fix: allow hiding some bulk actions

This commit is contained in:
Shariq Ansari 2024-05-20 22:14:25 +05:30
parent d518a4709f
commit 8f1637ffa1

View File

@ -29,6 +29,14 @@ const props = defineProps({
type: String,
default: '',
},
options: {
type: Object,
default: () => ({
hideEdit: false,
hideDelete: false,
hideAssign: false,
}),
},
})
const list = defineModel()
@ -126,24 +134,33 @@ const customBulkActions = ref([])
const customListActions = ref([])
function bulkActions(selections, unselectAll) {
let actions = [
{
let actions = []
debugger
if (!props.options.hideEdit) {
actions.push({
label: __('Edit'),
onClick: () => editValues(selections, unselectAll),
},
{
})
}
if (!props.options.hideDelete) {
actions.push({
label: __('Delete'),
onClick: () => deleteValues(selections, unselectAll),
},
{
})
}
if (!props.options.hideAssign) {
actions.push({
label: __('Assign To'),
onClick: () => assignValues(selections, unselectAll),
},
{
})
actions.push({
label: __('Clear Assignment'),
onClick: () => clearAssignemnts(selections, unselectAll),
},
]
})
}
customBulkActions.value.forEach((action) => {
actions.push({
label: __(action.label),