1 1
import './VPicker.sass'
2 1
import '../VCard/VCard.sass'
3

4
// Mixins
5 1
import Colorable from '../../mixins/colorable'
6 1
import Elevatable from '../../mixins/elevatable'
7 1
import Themeable from '../../mixins/themeable'
8

9
// Helpers
10 1
import { convertToUnit } from '../../util/helpers'
11

12
// Types
13
import { VNode } from 'vue/types'
14 1
import mixins from '../../util/mixins'
15

16
/* @vue/component */
17 1
export default mixins(
18
  Colorable,
19
  Elevatable,
20
  Themeable
21
).extend({
22
  name: 'v-picker',
23

24
  props: {
25
    flat: Boolean,
26
    fullWidth: Boolean,
27
    landscape: Boolean,
28
    noTitle: Boolean,
29
    transition: {
30
      type: String,
31
      default: 'fade-transition',
32
    },
33
    width: {
34
      type: [Number, String],
35
      default: 290,
36
    },
37
  },
38

39
  computed: {
40 1
    computedTitleColor (): string | false {
41 1
      const defaultTitleColor = this.isDark ? false : (this.color || 'primary')
42 1
      return this.color || defaultTitleColor
43
    },
44
  },
45

46
  methods: {
47 1
    genTitle () {
48 1
      return this.$createElement('div', this.setBackgroundColor(this.computedTitleColor, {
49
        staticClass: 'v-picker__title',
50
        class: {
51
          'v-picker__title--landscape': this.landscape,
52
        },
53
      }), this.$slots.title)
54
    },
55 1
    genBodyTransition () {
56 1
      return this.$createElement('transition', {
57
        props: {
58
          name: this.transition,
59
        },
60
      }, this.$slots.default)
61
    },
62 1
    genBody () {
63 1
      return this.$createElement('div', {
64
        staticClass: 'v-picker__body',
65
        class: {
66
          'v-picker__body--no-title': this.noTitle,
67
          ...this.themeClasses,
68
        },
69 1
        style: this.fullWidth ? undefined : {
70
          width: convertToUnit(this.width),
71
        },
72
      }, [
73
        this.genBodyTransition(),
74
      ])
75
    },
76 1
    genActions () {
77 1
      return this.$createElement('div', {
78
        staticClass: 'v-picker__actions v-card__actions',
79
        class: {
80
          'v-picker__actions--no-title': this.noTitle,
81
        },
82
      }, this.$slots.actions)
83
    },
84
  },
85

86 1
  render (h): VNode {
87 1
    return h('div', {
88
      staticClass: 'v-picker v-card',
89
      class: {
90
        'v-picker--flat': this.flat,
91
        'v-picker--landscape': this.landscape,
92
        'v-picker--full-width': this.fullWidth,
93
        ...this.themeClasses,
94
        ...this.elevationClasses,
95
      },
96
    }, [
97 1
      this.$slots.title ? this.genTitle() : null,
98
      this.genBody(),
99 1
      this.$slots.actions ? this.genActions() : null,
100
    ])
101
  },
102
})

Read our documentation on viewing source code .

Loading