56 lines
1.3 KiB
Vue
Executable File
56 lines
1.3 KiB
Vue
Executable File
<template>
|
|
<span :class="cx('current')" v-bind="ptm('current')">{{ text }}</span>
|
|
</template>
|
|
|
|
<script>
|
|
import BaseComponent from 'primevue/basecomponent';
|
|
|
|
export default {
|
|
name: 'CurrentPageReport',
|
|
extends: BaseComponent,
|
|
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);
|
|
|
|
return text;
|
|
}
|
|
}
|
|
};
|
|
</script>
|