primevue-mirror/components/lib/paginator/CurrentPageReport.vue

56 lines
1.3 KiB
Vue
Raw Normal View History

2022-09-06 12:03:37 +00:00
<template>
2023-05-08 09:35:25 +00:00
<span class="p-paginator-current" v-bind="ptm('current')">{{ text }}</span>
2022-09-06 12:03:37 +00:00
</template>
2023-05-08 09:35:25 +00:00
2022-09-06 12:03:37 +00:00
<script>
2023-05-08 09:35:25 +00:00
import BaseComponent from 'primevue/basecomponent';
2022-09-14 11:26:01 +00:00
export default {
name: 'CurrentPageReport',
2023-05-08 09:35:25 +00:00
extends: BaseComponent,
2022-09-14 11:26:01 +00:00
props: {
pageCount: {
type: Number,
default: 0
},
currentPage: {
type: Number,
default: 0
},
page: {
type: Number,
default: 0
},
first: {
type: Number,
default: 0
},
rows: {
type: Number,
default: 0
},
totalRecords: {
type: Number,
default: 0
},
template: {
type: String,
default: '({currentPage} of {totalPages})'
}
},
computed: {
text() {
let text = this.template
.replace('{currentPage}', this.currentPage)
.replace('{totalPages}', this.pageCount)
.replace('{first}', this.pageCount > 0 ? this.first + 1 : 0)
.replace('{last}', Math.min(this.first + this.rows, this.totalRecords))
.replace('{rows}', this.rows)
.replace('{totalRecords}', this.totalRecords);
2022-09-06 12:03:37 +00:00
2022-09-14 11:26:01 +00:00
return text;
}
}
};
2022-09-06 12:03:37 +00:00
</script>