forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtable-bottom.js
More file actions
110 lines (104 loc) · 3.54 KB
/
table-bottom.js
File metadata and controls
110 lines (104 loc) · 3.54 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import { QSelect } from '../select'
import { QBtn } from '../btn'
import { QIcon } from '../icon'
export default {
computed: {
navIcon () {
const ico = [ this.$q.icon.table.prevPage, this.$q.icon.table.nextPage ]
return this.$q.i18n.rtl ? ico.reverse() : ico
}
},
methods: {
getBottom (h) {
if (this.hideBottom) {
return
}
if (this.nothingToDisplay) {
const message = this.filter
? this.noResultsLabel || this.$q.i18n.table.noResults
: (this.loading ? this.loadingLabel || this.$q.i18n.table.loading : this.noDataLabel || this.$q.i18n.table.noData)
return h('div', { staticClass: 'q-table-bottom row items-center q-table-nodata' }, [
h(QIcon, {props: { name: this.$q.icon.table.warning }}),
message
])
}
const bottom = this.$scopedSlots.bottom
return h('div', {
staticClass: 'q-table-bottom row items-center',
'class': bottom ? null : 'justify-end'
}, bottom ? [ bottom(this.marginalsProps) ] : this.getPaginationRow(h))
},
getPaginationRow (h) {
const
{ rowsPerPage } = this.computedPagination,
paginationLabel = this.paginationLabel || this.$q.i18n.table.pagination,
paginationSlot = this.$scopedSlots.pagination
return [
h('div', { staticClass: 'q-table-control' }, [
h('div', [
this.hasSelectionMode && this.rowsSelectedNumber > 0
? (this.selectedRowsLabel || this.$q.i18n.table.selectedRows)(this.rowsSelectedNumber)
: ''
])
]),
h('div', { staticClass: 'q-table-separator col' }),
h('div', { staticClass: 'q-table-control' }, [
h('span', { staticClass: 'q-table-bottom-item' }, [
this.rowsPerPageLabel || this.$q.i18n.table.rowsPerPage
]),
h(QSelect, {
staticClass: 'inline q-table-bottom-item',
props: {
color: this.color,
value: rowsPerPage,
options: this.computedRowsPerPageOptions,
dark: this.dark,
hideUnderline: true
},
on: {
input: rowsPerPage => {
this.setPagination({
page: 1,
rowsPerPage
})
}
}
})
]),
h('div', { staticClass: 'q-table-control' }, [
paginationSlot
? paginationSlot(this.marginalsProps)
: [
h('span', { staticClass: 'q-table-bottom-item' }, [
rowsPerPage
? paginationLabel(this.firstRowIndex + 1, Math.min(this.lastRowIndex, this.computedRowsNumber), this.computedRowsNumber)
: paginationLabel(1, this.computedRowsNumber, this.computedRowsNumber)
]),
h(QBtn, {
props: {
color: this.color,
round: true,
icon: this.navIcon[0],
dense: true,
flat: true,
disable: this.isFirstPage
},
on: { click: this.prevPage }
}),
h(QBtn, {
props: {
color: this.color,
round: true,
icon: this.navIcon[1],
dense: true,
flat: true,
disable: this.isLastPage
},
on: { click: this.nextPage }
})
]
])
]
}
}
}