fix: allow hiding some bulk actions
This commit is contained in:
parent
d518a4709f
commit
8f1637ffa1
@ -29,6 +29,14 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
options: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({
|
||||||
|
hideEdit: false,
|
||||||
|
hideDelete: false,
|
||||||
|
hideAssign: false,
|
||||||
|
}),
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const list = defineModel()
|
const list = defineModel()
|
||||||
@ -126,24 +134,33 @@ const customBulkActions = ref([])
|
|||||||
const customListActions = ref([])
|
const customListActions = ref([])
|
||||||
|
|
||||||
function bulkActions(selections, unselectAll) {
|
function bulkActions(selections, unselectAll) {
|
||||||
let actions = [
|
let actions = []
|
||||||
{
|
debugger
|
||||||
|
if (!props.options.hideEdit) {
|
||||||
|
actions.push({
|
||||||
label: __('Edit'),
|
label: __('Edit'),
|
||||||
onClick: () => editValues(selections, unselectAll),
|
onClick: () => editValues(selections, unselectAll),
|
||||||
},
|
})
|
||||||
{
|
}
|
||||||
|
|
||||||
|
if (!props.options.hideDelete) {
|
||||||
|
actions.push({
|
||||||
label: __('Delete'),
|
label: __('Delete'),
|
||||||
onClick: () => deleteValues(selections, unselectAll),
|
onClick: () => deleteValues(selections, unselectAll),
|
||||||
},
|
})
|
||||||
{
|
}
|
||||||
|
|
||||||
|
if (!props.options.hideAssign) {
|
||||||
|
actions.push({
|
||||||
label: __('Assign To'),
|
label: __('Assign To'),
|
||||||
onClick: () => assignValues(selections, unselectAll),
|
onClick: () => assignValues(selections, unselectAll),
|
||||||
},
|
})
|
||||||
{
|
actions.push({
|
||||||
label: __('Clear Assignment'),
|
label: __('Clear Assignment'),
|
||||||
onClick: () => clearAssignemnts(selections, unselectAll),
|
onClick: () => clearAssignemnts(selections, unselectAll),
|
||||||
},
|
})
|
||||||
]
|
}
|
||||||
|
|
||||||
customBulkActions.value.forEach((action) => {
|
customBulkActions.value.forEach((action) => {
|
||||||
actions.push({
|
actions.push({
|
||||||
label: __(action.label),
|
label: __(action.label),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user