quasar-ui-danx 0.0.30 → 0.0.31
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
<template>
|
2
2
|
<PopoverMenu
|
3
3
|
class="px-4 h-full flex"
|
4
|
-
:items="
|
4
|
+
:items="activeItems"
|
5
5
|
@action-item="onAction"
|
6
6
|
/>
|
7
7
|
</template>
|
8
8
|
<script setup>
|
9
|
+
import { computed } from 'vue';
|
9
10
|
import { performAction } from '../../helpers';
|
10
11
|
import { PopoverMenu } from '../Utility';
|
11
12
|
|
@@ -15,15 +16,19 @@ const props = defineProps({
|
|
15
16
|
type: Array,
|
16
17
|
required: true
|
17
18
|
},
|
18
|
-
|
19
|
+
targets: {
|
19
20
|
type: Array,
|
20
21
|
required: true
|
21
22
|
}
|
22
23
|
});
|
23
24
|
|
25
|
+
const activeItems = computed(() => props.items.filter(item => {
|
26
|
+
if (item.enabled === undefined) return true;
|
27
|
+
return typeof item.enabled === 'function' ? !!item.enabled(props.targets) : !!item.enabled;
|
28
|
+
}));
|
24
29
|
|
25
30
|
function onAction(item) {
|
26
31
|
emit('action', item);
|
27
|
-
performAction(item, props.
|
32
|
+
performAction(item, props.targets);
|
28
33
|
}
|
29
34
|
</script>
|
@@ -52,6 +52,7 @@
|
|
52
52
|
<component
|
53
53
|
:is="rowProps.col.onClick ? 'a' : 'div'"
|
54
54
|
class="flex items-center flex-nowrap"
|
55
|
+
:class="{'justify-end': rowProps.col.align === 'right', 'justify-center': rowProps.col.align === 'center', 'justify-start': rowProps.col.align === 'left'}"
|
55
56
|
@click="() => rowProps.col.onClick && rowProps.col.onClick(rowProps.row)"
|
56
57
|
>
|
57
58
|
<RenderComponent
|
@@ -72,7 +73,7 @@
|
|
72
73
|
<ActionMenu
|
73
74
|
v-if="rowProps.col.actions" class="ml-2"
|
74
75
|
:items="rowProps.col.actions"
|
75
|
-
:
|
76
|
+
:targets="[rowProps.row]"
|
76
77
|
@action="(action) => $emit('action', {action: action, row: rowProps.row})"
|
77
78
|
/>
|
78
79
|
</component>
|