Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking β€œSign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Table): add pagination feature #2654

Draft
wants to merge 5 commits into
base: v3
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(Table): improve html and styling of pagination
blouflashdb committed Nov 15, 2024
commit 019005249751928538cad635f9afab554e8671ab
10 changes: 3 additions & 7 deletions src/runtime/components/Table.vue
Original file line number Diff line number Diff line change
@@ -277,13 +277,9 @@ defineExpose({
</td>
</tr>
</tbody>
<tfoot v-if="tableApi.getPageCount() > 1">
<tr>
<td :colspan="columns?.length">
<UPagination v-model:page="page" :items-per-page="1" :total="tableApi.getPageCount()" />
</td>
</tr>
</tfoot>
</table>
<div :class="ui.pagination({ class: [props.ui?.pagination] })">
<UPagination v-if="tableApi.getPageCount() > 1" v-model:page="page" :items-per-page="1" :total="tableApi.getPageCount()" />
</div>
</div>
</template>
3 changes: 2 additions & 1 deletion src/theme/table.ts
Original file line number Diff line number Diff line change
@@ -10,7 +10,8 @@ export default (options: Required<ModuleOptions>) => ({
tr: 'data-[selected=true]:bg-[var(--ui-bg-elevated)]/50',
th: 'px-4 py-3.5 text-sm text-[var(--ui-text-highlighted)] text-left rtl:text-right font-semibold [&:has([role=checkbox])]:pe-0',
td: 'p-4 text-sm text-[var(--ui-text-muted)] whitespace-nowrap [&:has([role=checkbox])]:pe-0',
empty: 'py-6 text-center text-sm text-[var(--ui-text-muted)]'
empty: 'py-6 text-center text-sm text-[var(--ui-text-muted)]',
pagination: 'flex justify-center items-center py-4'
},
variants: {
pinned: {