Add content wrapper to paginator

pull/6011/head
Cagatay Civici 2024-07-02 11:19:32 +03:00
parent f81a17fedc
commit fd5e30da33
3 changed files with 90 additions and 75 deletions

View File

@ -73,6 +73,10 @@ export interface PaginatorPassThroughOptions<T = any> {
* Used to pass attributes to the root's DOM element. * Used to pass attributes to the root's DOM element.
*/ */
root?: PaginatorPassThroughOptionType<T>; root?: PaginatorPassThroughOptionType<T>;
/**
* Used to pass attributes to the content DOM element.
*/
content?: PaginatorPassThroughOptionType<T>;
/** /**
* Used to pass attributes to the content start's DOM element. * Used to pass attributes to the content start's DOM element.
*/ */

View File

@ -4,6 +4,7 @@
<div v-if="$slots.start" :class="cx('contentStart')" v-bind="ptm('contentStart')"> <div v-if="$slots.start" :class="cx('contentStart')" v-bind="ptm('contentStart')">
<slot name="start" :state="currentState"></slot> <slot name="start" :state="currentState"></slot>
</div> </div>
<div :class="cx('content')" v-bind="ptm('content')">
<template v-for="item in value" :key="item"> <template v-for="item in value" :key="item">
<FirstPageLink <FirstPageLink
v-if="item === 'FirstPageLink'" v-if="item === 'FirstPageLink'"
@ -79,6 +80,7 @@
/> />
<JumpToPageInput v-else-if="item === 'JumpToPageInput'" :page="currentPage" @page-change="changePage($event)" :disabled="empty" :unstyled="unstyled" :pt="pt" /> <JumpToPageInput v-else-if="item === 'JumpToPageInput'" :page="currentPage" @page-change="changePage($event)" :disabled="empty" :unstyled="unstyled" :pt="pt" />
</template> </template>
</div>
<div v-if="$slots.end" :class="cx('contentEnd')" v-bind="ptm('contentEnd')"> <div v-if="$slots.end" :class="cx('contentEnd')" v-bind="ptm('contentEnd')">
<slot name="end" :state="currentState"></slot> <slot name="end" :state="currentState"></slot>
</div> </div>

View File

@ -13,6 +13,14 @@ const theme = ({ dt }) => `
gap: ${dt('paginator.gap')}; gap: ${dt('paginator.gap')};
} }
.p-paginator-content {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
gap: ${dt('paginator.gap')};
}
.p-paginator-content-start { .p-paginator-content-start {
margin-right: auto; margin-right: auto;
} }
@ -92,6 +100,7 @@ const classes = {
[`p-paginator-${key}`]: instance.hasBreakpoints() [`p-paginator-${key}`]: instance.hasBreakpoints()
} }
], ],
content: 'p-paginator-content',
contentStart: 'p-paginator-content-start', contentStart: 'p-paginator-content-start',
contentEnd: 'p-paginator-content-end', contentEnd: 'p-paginator-content-end',
first: ({ instance }) => [ first: ({ instance }) => [