fix: added more context for custom bulk actions
This commit is contained in:
parent
3f9c23bd4a
commit
f66e6b960a
@ -134,9 +134,12 @@ import {
|
|||||||
ListSelectBanner,
|
ListSelectBanner,
|
||||||
ListFooter,
|
ListFooter,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
|
call,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
import { setupBulkActions } from '@/utils'
|
import { setupBulkActions, createToast } from '@/utils'
|
||||||
|
import { globalStore } from '@/stores/global'
|
||||||
import { onMounted, ref, watch } from 'vue'
|
import { onMounted, ref, watch } from 'vue'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
rows: {
|
rows: {
|
||||||
@ -162,6 +165,10 @@ const emit = defineEmits(['loadMore', 'updatePageCount'])
|
|||||||
const pageLengthCount = defineModel()
|
const pageLengthCount = defineModel()
|
||||||
const list = defineModel('list')
|
const list = defineModel('list')
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
const { $dialog } = globalStore()
|
||||||
|
|
||||||
watch(pageLengthCount, (val, old_value) => {
|
watch(pageLengthCount, (val, old_value) => {
|
||||||
if (val === old_value) return
|
if (val === old_value) return
|
||||||
emit('updatePageCount', val)
|
emit('updatePageCount', val)
|
||||||
@ -189,7 +196,16 @@ function bulkActions(selections, unselectAll) {
|
|||||||
customBulkActions.value.forEach((action) => {
|
customBulkActions.value.forEach((action) => {
|
||||||
actions.push({
|
actions.push({
|
||||||
label: action.label,
|
label: action.label,
|
||||||
onClick: () => action.onClick(selections, unselectAll, list.value),
|
onClick: () =>
|
||||||
|
action.onClick({
|
||||||
|
list: list.value,
|
||||||
|
selections,
|
||||||
|
unselectAll,
|
||||||
|
call,
|
||||||
|
createToast,
|
||||||
|
$dialog,
|
||||||
|
router,
|
||||||
|
}),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
return actions
|
return actions
|
||||||
|
|||||||
@ -143,9 +143,12 @@ import {
|
|||||||
ListRowItem,
|
ListRowItem,
|
||||||
ListFooter,
|
ListFooter,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
|
call,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
import { setupBulkActions } from '@/utils'
|
import { setupBulkActions, createToast } from '@/utils'
|
||||||
|
import { globalStore } from '@/stores/global'
|
||||||
import { onMounted, ref, watch } from 'vue'
|
import { onMounted, ref, watch } from 'vue'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
rows: {
|
rows: {
|
||||||
@ -171,6 +174,10 @@ const emit = defineEmits(['loadMore', 'updatePageCount'])
|
|||||||
const pageLengthCount = defineModel()
|
const pageLengthCount = defineModel()
|
||||||
const list = defineModel('list')
|
const list = defineModel('list')
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
const { $dialog } = globalStore()
|
||||||
|
|
||||||
watch(pageLengthCount, (val, old_value) => {
|
watch(pageLengthCount, (val, old_value) => {
|
||||||
if (val === old_value) return
|
if (val === old_value) return
|
||||||
emit('updatePageCount', val)
|
emit('updatePageCount', val)
|
||||||
@ -198,7 +205,16 @@ function bulkActions(selections, unselectAll) {
|
|||||||
customBulkActions.value.forEach((action) => {
|
customBulkActions.value.forEach((action) => {
|
||||||
actions.push({
|
actions.push({
|
||||||
label: action.label,
|
label: action.label,
|
||||||
onClick: () => action.onClick(selections, unselectAll, list.value),
|
onClick: () =>
|
||||||
|
action.onClick({
|
||||||
|
list: list.value,
|
||||||
|
selections,
|
||||||
|
unselectAll,
|
||||||
|
call,
|
||||||
|
createToast,
|
||||||
|
$dialog,
|
||||||
|
router,
|
||||||
|
}),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
return actions
|
return actions
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user