blob: 0834ae7cb5fb0e8dc19076ef2514310fd0fc3ae8 [file] [log] [blame]
Surya Vde23ea22024-07-11 15:19:46 +05301import i18n from '@/i18n';
SurenNewareba91c492020-10-27 14:18:54 +05302export const currentPage = 1;
3export const perPage = 20;
4export const itemsPerPageOptions = [
5 {
6 value: 10,
7 text: '10',
Yoshie Muranakaf9832b02020-05-12 12:04:46 -07008 },
SurenNewareba91c492020-10-27 14:18:54 +05309 {
10 value: 20,
11 text: '20',
12 },
13 {
14 value: 30,
15 text: '30',
16 },
17 {
18 value: 40,
19 text: '40',
20 },
21 {
22 value: 0,
Surya Vde23ea22024-07-11 15:19:46 +053023 text: i18n.global.t('global.table.viewAll'),
SurenNewareba91c492020-10-27 14:18:54 +053024 },
25];
26const BVPaginationMixin = {
jason westoverd36ac8a2025-11-03 20:58:59 -060027 watch: {
28 perPage(newPerPage) {
29 // When switching to "View all" (perPage === 0), reset to first page
30 // to avoid empty views when previously on a later page.
31 if (newPerPage === 0) {
32 this.currentPage = 1;
33 }
34 },
35 },
Yoshie Muranakaf9832b02020-05-12 12:04:46 -070036 methods: {
37 getTotalRowCount(count) {
38 return this.perPage === 0 ? 0 : count;
Derick Montague602e98a2020-10-21 16:20:00 -050039 },
40 },
Yoshie Muranakaf9832b02020-05-12 12:04:46 -070041};
42
43export default BVPaginationMixin;