-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(comp:pagination): remove itemRender and totalRender (#695)
BREAKING CHANGE: itemRender and totalRender have been removed re #658
- Loading branch information
Showing
31 changed files
with
403 additions
and
441 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 50 additions & 10 deletions
60
packages/components/pagination/__tests__/__snapshots__/pagination.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,56 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Pagination render work 1`] = ` | ||
"<ul class=\\"ix-pagination ix-pagination-medium\\"> | ||
"<ul class=\\"ix-pagination ix-pagination-md\\"> | ||
<li class=\\"ix-pagination-total\\">共 50 条</li> | ||
<li class=\\"ix-pagination-item\\" title=\\"上一页\\"><button class=\\"ix-button ix-button-disabled ix-button-icon-only ix-button-text ix-button-small ix-button-circle\\" disabled=\\"\\" type=\\"button\\"><i class=\\"ix-icon ix-icon-left\\" role=\\"img\\" aria-label=\\"left\\"></i></button></li> | ||
<li class=\\"ix-pagination-item ix-pagination-item-active\\" title=\\"1\\"><button class=\\"ix-button ix-button-text ix-button-small ix-button-circle\\" type=\\"button\\"><span>1</span></button></li> | ||
<li class=\\"ix-pagination-item\\" title=\\"2\\"><button class=\\"ix-button ix-button-text ix-button-small ix-button-circle\\" type=\\"button\\"><span>2</span></button></li> | ||
<li class=\\"ix-pagination-item\\" title=\\"3\\"><button class=\\"ix-button ix-button-text ix-button-small ix-button-circle\\" type=\\"button\\"><span>3</span></button></li> | ||
<li class=\\"ix-pagination-item\\" title=\\"4\\"><button class=\\"ix-button ix-button-text ix-button-small ix-button-circle\\" type=\\"button\\"><span>4</span></button></li> | ||
<li class=\\"ix-pagination-item\\" title=\\"5\\"><button class=\\"ix-button ix-button-text ix-button-small ix-button-circle\\" type=\\"button\\"><span>5</span></button></li> | ||
<li class=\\"ix-pagination-item\\" title=\\"下一页\\"><button class=\\"ix-button ix-button-icon-only ix-button-text ix-button-small ix-button-circle\\" type=\\"button\\"><i class=\\"ix-icon ix-icon-right\\" role=\\"img\\" aria-label=\\"right\\"></i></button></li> | ||
<!----> | ||
<!----> | ||
<li class=\\"ix-pagination-item\\" title=\\"上一页\\"><button class=\\"ix-button ix-button-disabled ix-button-icon-only ix-button-text ix-button-circle ix-button-sm\\" disabled=\\"\\" type=\\"button\\"><i class=\\"ix-icon ix-icon-left\\" role=\\"img\\" aria-label=\\"left\\"></i></button></li> | ||
<li class=\\"ix-pagination-item ix-pagination-item-active\\" title=\\"1\\"><button class=\\"ix-button ix-button-text ix-button-circle ix-button-sm\\" type=\\"button\\"><span>1</span></button></li> | ||
<li class=\\"ix-pagination-item\\" title=\\"2\\"><button class=\\"ix-button ix-button-text ix-button-circle ix-button-sm\\" type=\\"button\\"><span>2</span></button></li> | ||
<li class=\\"ix-pagination-item\\" title=\\"3\\"><button class=\\"ix-button ix-button-text ix-button-circle ix-button-sm\\" type=\\"button\\"><span>3</span></button></li> | ||
<li class=\\"ix-pagination-item\\" title=\\"4\\"><button class=\\"ix-button ix-button-text ix-button-circle ix-button-sm\\" type=\\"button\\"><span>4</span></button></li> | ||
<li class=\\"ix-pagination-item\\" title=\\"5\\"><button class=\\"ix-button ix-button-text ix-button-circle ix-button-sm\\" type=\\"button\\"><span>5</span></button></li> | ||
<li class=\\"ix-pagination-item\\" title=\\"下一页\\"><button class=\\"ix-button ix-button-icon-only ix-button-text ix-button-circle ix-button-sm\\" type=\\"button\\"><i class=\\"ix-icon ix-icon-right\\" role=\\"img\\" aria-label=\\"right\\"></i></button></li> | ||
</ul>" | ||
`; | ||
exports[`Pagination render work 2`] = ` | ||
"<ul class=\\"ix-pagination ix-pagination-simple ix-pagination-md\\"> | ||
<li class=\\"ix-pagination-total\\">共 50 条</li> | ||
<li class=\\"ix-pagination-item\\" title=\\"上一页\\"><button class=\\"ix-button ix-button-disabled ix-button-icon-only ix-button-text ix-button-circle ix-button-sm\\" disabled=\\"\\" type=\\"button\\"><i class=\\"ix-icon ix-icon-left\\" role=\\"img\\" aria-label=\\"left\\"></i></button></li> | ||
<li class=\\"ix-pagination-item\\"><input class=\\"ix-input ix-input-md\\"><span class=\\"ix-pagination-item-slash\\">/</span><span>5</span></li> | ||
<li class=\\"ix-pagination-item\\" title=\\"下一页\\"><button class=\\"ix-button ix-button-disabled ix-button-icon-only ix-button-text ix-button-circle ix-button-sm\\" disabled=\\"\\" type=\\"button\\"><i class=\\"ix-icon ix-icon-right\\" role=\\"img\\" aria-label=\\"right\\"></i></button></li> | ||
</ul>" | ||
`; | ||
exports[`Pagination render work 3`] = ` | ||
"<ul class=\\"ix-pagination ix-pagination-md\\"> | ||
<li class=\\"ix-pagination-total\\">共 500 条</li> | ||
<li class=\\"ix-pagination-item\\" title=\\"上一页\\"><button class=\\"ix-button ix-button-disabled ix-button-icon-only ix-button-text ix-button-circle ix-button-sm\\" disabled=\\"\\" type=\\"button\\"><i class=\\"ix-icon ix-icon-left\\" role=\\"img\\" aria-label=\\"left\\"></i></button></li> | ||
<li class=\\"ix-pagination-item ix-pagination-item-active\\" title=\\"1\\"><button class=\\"ix-button ix-button-text ix-button-circle ix-button-sm\\" type=\\"button\\"><span>1</span></button></li> | ||
<li class=\\"ix-pagination-item\\" title=\\"2\\"><button class=\\"ix-button ix-button-text ix-button-circle ix-button-sm\\" type=\\"button\\"><span>2</span></button></li> | ||
<li class=\\"ix-pagination-item\\" title=\\"3\\"><button class=\\"ix-button ix-button-text ix-button-circle ix-button-sm\\" type=\\"button\\"><span>3</span></button></li> | ||
<li class=\\"ix-pagination-item\\" title=\\"4\\"><button class=\\"ix-button ix-button-text ix-button-circle ix-button-sm\\" type=\\"button\\"><span>4</span></button></li> | ||
<li class=\\"ix-pagination-item\\" title=\\"5\\"><button class=\\"ix-button ix-button-text ix-button-circle ix-button-sm\\" type=\\"button\\"><span>5</span></button></li> | ||
<li class=\\"ix-pagination-item\\" title=\\"向后 5 页\\"><span class=\\"ix-pagination-item-jumper\\"><button class=\\"ix-button ix-button-icon-only ix-button-text ix-button-circle ix-button-sm\\" type=\\"button\\"><i class=\\"ix-icon ix-icon-double-right\\" role=\\"img\\" aria-label=\\"double-right\\"></i></button><button class=\\"ix-button ix-button-icon-only ix-button-text ix-button-circle ix-button-sm ix-pagination-item-ellipsis\\" type=\\"button\\"><i class=\\"ix-icon ix-icon-ellipsis\\" role=\\"img\\" aria-label=\\"ellipsis\\"></i></button></span></li> | ||
<li class=\\"ix-pagination-item\\" title=\\"50\\"><button class=\\"ix-button ix-button-text ix-button-circle ix-button-sm\\" type=\\"button\\"><span>50</span></button></li> | ||
<li class=\\"ix-pagination-item\\" title=\\"下一页\\"><button class=\\"ix-button ix-button-icon-only ix-button-text ix-button-circle ix-button-sm\\" type=\\"button\\"><i class=\\"ix-icon ix-icon-right\\" role=\\"img\\" aria-label=\\"right\\"></i></button></li> | ||
<li class=\\"ix-pagination-sizes\\"> | ||
<div class=\\"ix-select ix-select-single ix-select-with-suffix ix-select-md\\"> | ||
<!----> | ||
<div class=\\"ix-select-selector\\"> | ||
<div class=\\"ix-select-selector-item\\"><span class=\\"ix-select-selector-item-label\\">10 条/页</span> | ||
<!----> | ||
</div> | ||
<div class=\\"ix-select-selector-input\\"><input class=\\"ix-select-selector-input-inner\\" style=\\"opacity: 0;\\" autocomplete=\\"off\\"> | ||
<!----> | ||
</div> | ||
<!----> | ||
<div class=\\"ix-select-selector-suffix\\"><i class=\\"ix-icon ix-icon-down\\" role=\\"img\\" aria-label=\\"down\\"></i></div> | ||
<!----> | ||
</div> | ||
</div> | ||
<!----> | ||
</li> | ||
<li class=\\"ix-pagination-jumper\\">前往<input class=\\"ix-input ix-input-md\\">页</li> | ||
</ul>" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
<template> | ||
<IxPagination :pageIndex="1" :total="50" /> | ||
<IxPagination :total="50" /> | ||
<br /> | ||
<IxPagination disabled :pageIndex="1" :total="50" /> | ||
<IxPagination :pageIndex="pageIndex" disabled :total="500" /> | ||
<br /> | ||
<IxPagination :pageIndex="6" :total="500" /> | ||
<IxPagination v-model:pageIndex="pageIndex" :total="500" /> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
const pageIndex = ref(6) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: | ||
zh: 受控的分页器 | ||
en: Controlled pagination | ||
order: 7 | ||
--- | ||
|
||
## zh | ||
|
||
通过 `:pageIndex`, `:pageSize` 搭配 `onChange`, 让分页器变得受控。 | ||
|
||
## en | ||
|
||
Make the pager controlled by `:pageIndex`, `:pageSize` and `onChange`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<IxPagination | ||
:pageIndex="pageIndex" | ||
:pageSize="pageSize" | ||
:pageSizes="[10, 20, 40, 80, 160]" | ||
showSizeChanger | ||
:total="500" | ||
@change="onChange" | ||
/> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
const pageIndex = ref(1) | ||
const pageSize = ref(20) | ||
const onChange = (index: number, size: number) => { | ||
pageIndex.value = index + 1 | ||
pageSize.value = size * 2 | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<template> | ||
<IxPagination :pageIndex="1" :total="500" showQuickJumper /> | ||
<IxPagination :total="500" showQuickJumper /> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<template> | ||
<IxPagination :pageIndex="1" :total="500" simple /> | ||
<IxPagination :total="500" simple /> | ||
<br /> | ||
<IxPagination :pageIndex="1" :total="500" simple disabled /> | ||
<IxPagination :total="500" simple disabled /> | ||
</template> |
Oops, something went wrong.