forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtable-top.js
More file actions
50 lines (44 loc) · 1.22 KB
/
table-top.js
File metadata and controls
50 lines (44 loc) · 1.22 KB
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
export default {
methods: {
getTop (h) {
if (this.noTop) {
return
}
const
top = this.$scopedSlots.top,
topLeft = this.$scopedSlots['top-left'],
topRight = this.$scopedSlots['top-right'],
topSelection = this.$scopedSlots['top-selection'],
hasSelection = this.selection && topSelection && this.rowsSelectedNumber > 0,
cls = 'q-table-top relative-position row no-wrap items-center',
child = [],
props = {
hasSelection
}
if (top) {
return h('div', { staticClass: cls }, [ top(props) ])
}
if (hasSelection) {
child.push(topSelection(props))
}
else {
if (topLeft) {
child.push(topLeft(props))
}
else if (this.title) {
child.push(h('div', { staticClass: 'q-table-title' }, this.title))
}
}
if (topRight) {
child.push(h('div', { staticClass: 'q-table-separator col' }))
child.push(topRight(props))
}
if (child.length === 0) {
return
}
return h('div', {
staticClass: `${cls}${hasSelection ? ` text-${this.color} q-table-top-selection` : ''}`
}, child)
}
}
}