forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQTh.js
More file actions
51 lines (45 loc) · 1005 Bytes
/
QTh.js
File metadata and controls
51 lines (45 loc) · 1005 Bytes
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
import QIcon from '../icon/QIcon.js'
export default {
name: 'QTh',
props: {
props: Object,
autoWidth: Boolean
},
render (h) {
if (!this.props) {
return h('td', {
'class': { 'q-table-col-auto-width': this.autoWidth }
}, this.$slots.default)
}
let col
const
name = this.$vnode.key,
child = [].concat(this.$slots.default)
if (name) {
col = this.props.colsMap[name]
if (!col) { return }
}
else {
col = this.props.col
}
if (col.sortable) {
const action = col.align === 'right'
? 'unshift'
: 'push'
child[action](
h(QIcon, {
props: { name: this.$q.icon.table.arrowUp },
staticClass: col.__iconClass
})
)
}
return h('th', {
'class': [col.__thClass, {
'q-table-col-auto-width': this.autoWidth
}],
on: col.sortable
? { click: () => { this.props.sort(col) } }
: null
}, child)
}
}