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
68 lines (62 loc) · 1.75 KB
/
table-top.js
File metadata and controls
68 lines (62 loc) · 1.75 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
export default {
computed: {
marginalsProps () {
return {
pagination: this.computedPagination,
pagesNumber: this.pagesNumber,
isFirstPage: this.isFirstPage,
isLastPage: this.isLastPage,
prevPage: this.prevPage,
nextPage: this.nextPage,
inFullscreen: this.inFullscreen,
toggleFullscreen: this.toggleFullscreen
}
}
},
methods: {
getTop (h) {
const
top = this.$scopedSlots.top,
topLeft = this.$scopedSlots['top-left'],
topRight = this.$scopedSlots['top-right'],
topSelection = this.$scopedSlots['top-selection'],
hasSelection = this.hasSelectionMode && topSelection && this.rowsSelectedNumber > 0,
staticClass = 'q-table-top relative-position row items-center',
child = []
if (top) {
return h('div', { staticClass }, [ top(this.marginalsProps) ])
}
if (hasSelection) {
child.push(topSelection(this.marginalsProps))
}
else {
if (topLeft) {
child.push(
h('div', { staticClass: 'q-table-control' }, [
topLeft(this.marginalsProps)
])
)
}
else if (this.title) {
child.push(
h('div', { staticClass: 'q-table-control' }, [
h('div', { staticClass: 'q-table-title' }, this.title)
])
)
}
}
if (topRight) {
child.push(h('div', { staticClass: 'q-table-separator col' }))
child.push(
h('div', { staticClass: 'q-table-control' }, [
topRight(this.marginalsProps)
])
)
}
if (child.length === 0) {
return
}
return h('div', { staticClass }, child)
}
}
}