32
32
:page-text =" pageText"
33
33
:info-fn =" infoFn"
34
34
:mode =" mode" />
35
+ <button
36
+ v-if =" jumpFirstOrLast"
37
+ type =" button"
38
+ aria-controls =" vgt-table"
39
+ class =" footer__navigation__page-btn"
40
+ :class =" { disabled: !firstIsPossible }"
41
+ @click.prevent.stop =" firstPage"
42
+ >
43
+ <span
44
+ aria-hidden =" true"
45
+ class =" chevron start"
46
+ ></span >
47
+ <span >{{ firstText }}</span >
48
+ </button >
49
+
35
50
<button
36
51
type =" button"
37
52
aria-controls =" vgt-table"
38
53
class =" footer__navigation__page-btn"
39
54
:class =" { disabled: !prevIsPossible }"
40
55
@click.prevent.stop =" previousPage" >
41
- <span aria-hidden =" true" class =" chevron" v-bind:class = " { 'left': !rtl, 'right': rtl } " ></span >
56
+ <span aria-hidden =" true" class =" chevron start " ></span >
42
57
<span >{{prevText}}</span >
43
58
</button >
44
59
49
64
:class =" { disabled: !nextIsPossible }"
50
65
@click.prevent.stop =" nextPage" >
51
66
<span >{{nextText}}</span >
52
- <span aria-hidden =" true" class =" chevron" v-bind:class =" { 'right': !rtl, 'left': rtl }" ></span >
67
+ <span aria-hidden =" true" class =" chevron end" ></span >
68
+ </button >
69
+
70
+ <button
71
+ v-if =" jumpFirstOrLast"
72
+ type =" button"
73
+ aria-controls =" vgt-table"
74
+ class =" footer__navigation__page-btn"
75
+ :class =" { disabled: !lastIsPossible }"
76
+ @click.prevent.stop =" lastPage"
77
+ >
78
+ <span >{{ lastText }}</span >
79
+ <span
80
+ aria-hidden =" true"
81
+ class =" chevron end"
82
+ ></span >
53
83
</button >
54
84
</div >
55
85
</div >
@@ -73,8 +103,11 @@ export default {
73
103
customRowsPerPageDropdown: { default () { return []; } },
74
104
paginateDropdownAllowAll: { default: true },
75
105
mode: { default: PAGINATION_MODES .Records },
106
+ jumpFirstOrLast: { default: false },
76
107
77
108
// text options
109
+ firstText: { default: " First" },
110
+ lastText: { default: " Last" },
78
111
nextText: { default: ' Next' },
79
112
prevText: { default: ' Prev' },
80
113
rowsPerPageText: { default: ' Rows per page:' },
@@ -104,8 +137,8 @@ export default {
104
137
105
138
customRowsPerPageDropdown: {
106
139
handler () {
107
- this .handlePerPage ();
108
- },
140
+ this .handlePerPage ();
141
+ },
109
142
deep: true ,
110
143
},
111
144
@@ -121,12 +154,26 @@ export default {
121
154
computed: {
122
155
// Number of pages
123
156
pagesCount () {
157
+ // if the setting is set to 'all'
158
+ if (this .currentPerPage === - 1 ) {
159
+ return 1 ;
160
+ }
124
161
const quotient = Math .floor (this .total / this .currentPerPage );
125
162
const remainder = this .total % this .currentPerPage ;
126
163
127
164
return remainder === 0 ? quotient : quotient + 1 ;
128
165
},
129
166
167
+ // Can go to first page
168
+ firstIsPossible () {
169
+ return this .currentPage > 1 ;
170
+ },
171
+
172
+ // Can go to last page
173
+ lastIsPossible () {
174
+ return this .currentPage < Math .ceil (this .total / this .currentPerPage );
175
+ },
176
+
130
177
// Can go to next page
131
178
nextIsPossible () {
132
179
return this .currentPage < this .pagesCount ;
@@ -151,6 +198,24 @@ export default {
151
198
}
152
199
},
153
200
201
+ // Go to first page
202
+ firstPage () {
203
+ if (this .firstIsPossible ) {
204
+ this .currentPage = 1 ;
205
+ this .prevPage = 0 ;
206
+ this .pageChanged ();
207
+ }
208
+ },
209
+
210
+ // Go to last page
211
+ lastPage () {
212
+ if (this .lastIsPossible ) {
213
+ this .currentPage = this .pagesCount ;
214
+ this .prev = this .currentPage - 1 ;
215
+ this .pageChanged ();
216
+ }
217
+ },
218
+
154
219
// Go to next page
155
220
nextPage () {
156
221
if (this .nextIsPossible ) {
0 commit comments