All files / src/components/organisms/common AppModal.vue

100% Statements 42/42
66.66% Branches 2/3
50% Functions 2/4
100% Lines 42/42

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157  1x 1x 1x 1x   1x 1x 1x 1x   1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x   1x 1x 1x 1x   1x 1x 1x 1x 1x 1x         1x 1x 1x                                     1x               1x                       1x                               1x 1x 1x 1x                                                                                           1x                    
<template>
  <v-dialog
    v-model="isOpen"
    :persistent="persistent"
    :max-width="maxWidth"
  >
    <v-card>
      <!-- title -->
      <v-card-title class="d-flex align-center justify-space-between">
        <slot name="title"></slot>
 
        <!-- ×ボタンは persistent 中は出さない(または disabled) -->
        <IconButton
          role="close"
          v-if="showClose && !persistent"
          icon="mdi-close"
          color="secondary"
          variant="text"
          size="small"
          rounded="pill"
          @click="close"
          :aria-label="t('ui.verb.close')"
        />
      </v-card-title>
 
      <!-- body -->
      <v-card-text>
        <slot></slot>
      </v-card-text>
 
      <!-- actions(必要なときだけ) -->
      <v-card-actions v-if="$slots.actions">
        <slot name="actions"></slot>
      </v-card-actions>
    </v-card>
  </v-dialog>
</template>
 
<script setup lang="ts">
// region import
import { computed } from 'vue'
import IconButton from "@/components/atoms/IconButton.vue";
import { useI18n } from 'vue-i18n'
// endregion import
 
// region Component
// endregion Component
 
// region types
type Props = {
  modelValue: boolean
  maxWidth?: number | string
  persistent?: boolean
  showClose?: boolean
}
// endregion types
 
// region interface
// endregion interface
 
// region props
const props = withDefaults(defineProps<Props>(), {
  maxWidth: 800,
  persistent: false,
  showClose: true,
})
// endregion props
 
// region emits
const emit = defineEmits<{
  (e: 'update:modelValue', v: boolean): void
}>()
// endregion emits
 
// region expose
// endregion expose
 
// region slots
// endregion slots
 
// region i18n
const { t } = useI18n()
// endregion i18n
 
// region router
// endregion router
 
// region store
// endregion store
 
// region consts
// endregion consts
 
// region state
// endregion state
 
// region computed
const isOpen = computed({
  get: () => props.modelValue,
  set: (v: boolean) => emit('update:modelValue', v),
})
// endregion computed
 
// region validation
// endregion validation
 
// region watchers
// endregion watchers
 
// region effects
// endregion effects
 
// region permissions
// endregion permissions
 
// region api
// endregion api
 
// region handlers
// endregion handlers
 
// region lifecycle
// endregion lifecycle
 
// region provide
// endregion provide
 
// region inject
// endregion inject
 
// region expose-public
// endregion expose-public
 
// region devtools
// endregion devtools
 
// region test-ids
// endregion test-ids
 
// region variable
// endregion variable
 
// region properties
// endregion properties
 
// region methods
const close = () => emit('update:modelValue', false)
// endregion methods
 
// region export
// endregion export
</script>
 
<style scoped>
 
</style>