Welcome to mirror list, hosted at ThFree Co, Russian Federation.

actions_button.vue « components « vue_shared « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1d6dbef799a59b2193d86c8a34912afd1558e81c (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<script>
import {
  GlDisclosureDropdown,
  GlDisclosureDropdownGroup,
  GlDisclosureDropdownItem,
} from '@gitlab/ui';

export default {
  components: {
    GlDisclosureDropdown,
    GlDisclosureDropdownGroup,
    GlDisclosureDropdownItem,
  },
  props: {
    toggleText: {
      type: String,
      required: true,
    },
    actions: {
      type: Array,
      required: true,
    },
    category: {
      type: String,
      required: false,
      default: 'secondary',
    },
    variant: {
      type: String,
      required: false,
      default: 'default',
    },
  },
  methods: {
    handleItemClick(action) {
      return action.handle?.();
    },
  },
};
</script>

<template>
  <gl-disclosure-dropdown
    :variant="variant"
    :category="category"
    :toggle-text="toggleText"
    data-qa-selector="action_dropdown"
    fluid-width
    block
    @shown="$emit('shown')"
    @hidden="$emit('hidden')"
  >
    <gl-disclosure-dropdown-group class="edit-dropdown-group-width">
      <gl-disclosure-dropdown-item
        v-for="action in actions"
        :key="action.key"
        v-bind="action.attrs"
        :item="action"
        :data-qa-selector="`${action.key}_menu_item`"
        @action="handleItemClick(action)"
      >
        <template #list-item>
          <div class="gl-display-flex gl-flex-direction-column">
            <span class="gl-font-weight-bold gl-mb-2">{{ action.text }}</span>
            <span class="gl-text-gray-700">
              {{ action.secondaryText }}
            </span>
          </div>
        </template>
      </gl-disclosure-dropdown-item>
    </gl-disclosure-dropdown-group>
    <slot></slot>
  </gl-disclosure-dropdown>
</template>