Fixed #6679 - Paginator: Headless mode
parent
31e834447c
commit
bf5aa0872f
|
@ -416,6 +416,60 @@ export interface PaginatorSlots {
|
|||
*/
|
||||
class: string;
|
||||
}): VNode[];
|
||||
/**
|
||||
* Custom container slot.
|
||||
* @param {Object} scope - container slot's params.
|
||||
*/
|
||||
container(scope: {
|
||||
/**
|
||||
* Index of first record
|
||||
*/
|
||||
first: number;
|
||||
/**
|
||||
* Index of last record
|
||||
*/
|
||||
last: number;
|
||||
/**
|
||||
* Number of rows to display in new page
|
||||
*/
|
||||
rows: number;
|
||||
/**
|
||||
* New page number
|
||||
*/
|
||||
page: number;
|
||||
/**
|
||||
* Total number of pages
|
||||
*/
|
||||
pageCount?: number;
|
||||
/**
|
||||
* Total records
|
||||
*/
|
||||
totalRecords?: number;
|
||||
/**
|
||||
* First page function.
|
||||
* @param {Event} event - Browser event
|
||||
*/
|
||||
firstPageCallback: (event: Event) => void;
|
||||
/**
|
||||
* Last page function.
|
||||
* @param {Event} event - Browser event
|
||||
*/
|
||||
lastPageCallback: (event: Event) => void;
|
||||
/**
|
||||
* Previous page function.
|
||||
* @param {Event} event - Browser event
|
||||
*/
|
||||
prevCallback: (event: Event) => void;
|
||||
/**
|
||||
* Next page function.
|
||||
* @param {Event} event - Browser event
|
||||
*/
|
||||
nextCallback: (event: Event) => void;
|
||||
/**
|
||||
* Row change function.
|
||||
*/
|
||||
rowChangeCallback: (value: number) => void;
|
||||
}): VNode[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,22 @@
|
|||
<template>
|
||||
<nav v-if="alwaysShow ? true : pageLinks && pageLinks.length > 1" v-bind="ptmi('paginatorContainer')">
|
||||
<div v-for="(value, key) in templateItems" :key="key" ref="paginator" :class="cx('paginator', { key })" v-bind="ptm('root')">
|
||||
<slot
|
||||
v-if="$slots.container"
|
||||
name="container"
|
||||
:first="d_first + 1"
|
||||
:last="last"
|
||||
:rows="d_rows"
|
||||
:page="page"
|
||||
:pageCount="pageCount"
|
||||
:totalRecords="totalRecords"
|
||||
:firstPageCallback="changePageToFirst"
|
||||
:lastPageCallback="changePageToLast"
|
||||
:prevCallback="changePageToPrev"
|
||||
:nextCallback="changePageToNext"
|
||||
:rowChangeCallback="onRowChange"
|
||||
/>
|
||||
<template v-else>
|
||||
<div v-if="$slots.start" :class="cx('contentStart')" v-bind="ptm('contentStart')">
|
||||
<slot name="start" :state="currentState"></slot>
|
||||
</div>
|
||||
|
@ -84,6 +100,7 @@
|
|||
<div v-if="$slots.end" :class="cx('contentEnd')" v-bind="ptm('contentEnd')">
|
||||
<slot name="end" :state="currentState"></slot>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</nav>
|
||||
</template>
|
||||
|
@ -317,6 +334,9 @@ export default {
|
|||
},
|
||||
currentPage() {
|
||||
return this.pageCount > 0 ? this.page + 1 : 0;
|
||||
},
|
||||
last() {
|
||||
return Math.min(this.d_first + this.rows, this.totalRecords);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
|
Loading…
Reference in New Issue