1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
<script>
import { GlDisclosureDropdown } from '@gitlab/ui';
import { __ } from '~/locale';
import { BASE_ACTIONS } from './constants';
export default {
name: 'ListActions',
i18n: {
actions: __('Actions'),
},
components: {
GlDisclosureDropdown,
},
props: {
// Can extend `BASE_ACTIONS` and/or add new actions.
// Expected format: https://gitlab-org.gitlab.io/gitlab-ui/?path=/docs/base-new-dropdowns-disclosure--docs#setting-disclosure-dropdown-items
actions: {
type: Object,
required: true,
},
availableActions: {
type: Array,
required: true,
},
},
computed: {
items() {
return this.availableActions.reduce((accumulator, action) => {
return [
...accumulator,
{
...BASE_ACTIONS[action],
...this.actions[action],
},
];
}, []);
},
},
};
</script>
<template>
<gl-disclosure-dropdown
:items="items"
icon="ellipsis_v"
no-caret
:toggle-text="$options.i18n.actions"
text-sr-only
placement="right"
category="tertiary"
/>
</template>
|