all files / src/datePicker/ calendarToolbar.vue

0% Statements 0/2
100% Branches 0/0
100% Functions 0/0
0% Lines 0/2
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                                                                                                                                                                                           
<template>
<div class="mu-calendar-toolbar">
  <icon-button :disabled="!prevMonth" @click.stop="prev">
    <svg viewBox="0 0 24 24" class="mu-calendar-svg-icon">
      <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/>
    </svg>
  </icon-button>
  <div class="mu-calendar-toolbar-title-wrapper">
    <transition :name="'mu-calendar-slide-' + slideType"  v-for="displayDate, index in displayDates" :key="index">
      <div class="mu-calendar-toolbar-title" :key="displayDate.getTime()">
        {{dateTimeFormat.formatMonth(displayDate)}}
      </div>
    </transition>
  </div>
  <icon-button :disabled="!nextMonth" @click.stop="next">
    <svg viewBox="0 0 24 24" class="mu-calendar-svg-icon">
      <path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/>
    </svg>
  </icon-button>
</div>
</template>
 
<script>
import iconButton from '../iconButton'
export default {
  props: {
    dateTimeFormat: {
      type: Object
    },
    displayDates: {
      type: Array
    },
    nextMonth: {
      type: Boolean,
      default: true
    },
    prevMonth: {
      type: Boolean,
      default: true
    },
    slideType: {
      type: String
    }
  },
  methods: {
    prev () {
      this.$emit('monthChange', -1)
    },
    next () {
      this.$emit('monthChange', 1)
    }
  },
  components: {
    'icon-button': iconButton
  }
}
</script>
 
<style lang="less">
@import "../styles/import.less";
.mu-calendar-toolbar {
  display: flex;
  justify-content: space-between;
  height: 48px;
}
 
.mu-calendar-toolbar-title-wrapper {
  position: relative;
  overflow: hidden;
  height: 100%;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  width: 100%;
}
 
.mu-calendar-toolbar-title {
  position: absolute;
  height: 100%;
  width: 100%;
  top: 0px;
  left: 0px;
  line-height: 48px;
}
 
.mu-calendar-svg-icon {
  display: block;
  fill: currentColor;
  height: 24px;
  width: 24px;
  user-select: none;
}
</style>