1
import './VSimpleTable.sass'
2

3
import { convertToUnit } from '../../util/helpers'
4
import Themeable from '../../mixins/themeable'
5
import mixins from '../../util/mixins'
6
import { VNode } from 'vue'
7

8
export default mixins(Themeable).extend({
9
  name: 'v-simple-table',
10

11
  props: {
12
    dense: Boolean,
13
    fixedHeader: Boolean,
14
    height: [Number, String],
15
  },
16

17
  computed: {
18 1
    classes (): Record<string, boolean> {
19 1
      return {
20
        'v-data-table--dense': this.dense,
21 1
        'v-data-table--fixed-height': !!this.height && !this.fixedHeader,
22
        'v-data-table--fixed-header': this.fixedHeader,
23
        'v-data-table--has-top': !!this.$slots.top,
24
        'v-data-table--has-bottom': !!this.$slots.bottom,
25
        ...this.themeClasses,
26
      }
27
    },
28
  },
29

30
  methods: {
31 1
    genWrapper () {
32 1
      return this.$slots.wrapper || this.$createElement('div', {
33
        staticClass: 'v-data-table__wrapper',
34
        style: {
35
          height: convertToUnit(this.height),
36
        },
37
      }, [
38
        this.$createElement('table', this.$slots.default),
39
      ])
40
    },
41
  },
42

43 1
  render (h): VNode {
44 1
    return h('div', {
45
      staticClass: 'v-data-table',
46
      class: this.classes,
47
    }, [
48
      this.$slots.top,
49
      this.genWrapper(),
50
      this.$slots.bottom,
51
    ])
52
  },
53
})

Read our documentation on viewing source code .

Loading