fix: show grouped with label actions as grouped action in mobile view
This commit is contained in:
parent
02ea301d5d
commit
d92a29ce7c
@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<Button
|
<Button
|
||||||
|
v-if="normalActions.length && !isMobileView"
|
||||||
v-for="action in normalActions"
|
v-for="action in normalActions"
|
||||||
:label="action.label"
|
:label="action.label"
|
||||||
@click="action.onClick()"
|
@click="action.onClick()"
|
||||||
@ -12,7 +13,7 @@
|
|||||||
<Button icon="more-horizontal" />
|
<Button icon="more-horizontal" />
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
<div
|
<div
|
||||||
v-if="groupedWithLabelActions.length"
|
v-if="groupedWithLabelActions.length && !isMobileView"
|
||||||
v-for="g in groupedWithLabelActions"
|
v-for="g in groupedWithLabelActions"
|
||||||
:key="g.label"
|
:key="g.label"
|
||||||
>
|
>
|
||||||
@ -41,24 +42,8 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const groupedActions = computed(() => {
|
const normalActions = computed(() => {
|
||||||
let _actions = []
|
return props.actions.filter((action) => !action.group)
|
||||||
let _normalActions = props.actions.filter((action) => !action.group)
|
|
||||||
if (isMobileView.value && _normalActions.length) {
|
|
||||||
_actions.push({
|
|
||||||
group: __('Actions'),
|
|
||||||
hideLabel: true,
|
|
||||||
items: _normalActions.map((action) => ({
|
|
||||||
label: action.label,
|
|
||||||
onClick: action.onClick,
|
|
||||||
icon: action.icon,
|
|
||||||
})),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
_actions = _actions.concat(
|
|
||||||
props.actions.filter((action) => action.group && !action.buttonLabel)
|
|
||||||
)
|
|
||||||
return _actions
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const groupedWithLabelActions = computed(() => {
|
const groupedWithLabelActions = computed(() => {
|
||||||
@ -80,11 +65,28 @@ const groupedWithLabelActions = computed(() => {
|
|||||||
return _actions
|
return _actions
|
||||||
})
|
})
|
||||||
|
|
||||||
const normalActions = computed(() => {
|
const groupedActions = computed(() => {
|
||||||
let _actions = props.actions.filter((action) => !action.group)
|
let _actions = []
|
||||||
if (isMobileView.value && _actions.length) {
|
let _normalActions = normalActions.value
|
||||||
return []
|
if (isMobileView.value && _normalActions.length) {
|
||||||
|
_actions.push({
|
||||||
|
group: __('Actions'),
|
||||||
|
hideLabel: true,
|
||||||
|
items: _normalActions.map((action) => ({
|
||||||
|
label: action.label,
|
||||||
|
onClick: action.onClick,
|
||||||
|
icon: action.icon,
|
||||||
|
})),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
if (isMobileView.value && groupedWithLabelActions.value.length) {
|
||||||
|
groupedWithLabelActions.value.map((group) => {
|
||||||
|
group.action.forEach((action) => _actions.push(action))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
_actions = _actions.concat(
|
||||||
|
props.actions.filter((action) => action.group && !action.buttonLabel)
|
||||||
|
)
|
||||||
return _actions
|
return _actions
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user