Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1324e37

Browse files
liammannmcosta74
authored andcommitted
fix(pagination) Keep start page number (#286)
* fix(pagination) Keep start page number* Update pageCount inside collectionSize* Move pageSize above collectionSize setter* remove trailing whitespace
1 parent1cebf2a commit1324e37

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

‎src/collections/pagination/components/pagination.spec.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,14 @@ describe("Pagination", () => {
196196
expect(pagination.pages.length).toBe(5);
197197
expect(pagination.hasNavigationLinks).toBe(true);
198198
});
199+
it("should keep the start page number",()=>{
200+
comp.collectionSize=100;
201+
comp.pageSize=10;
202+
comp.maxSize=5;
203+
comp.currentPage=5;
204+
205+
fixture.detectChanges();
206+
expect(comp.currentPage).toBe(5);
207+
expect(pagination.page).toBe(5);
208+
});
199209
});

‎src/collections/pagination/components/pagination.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,19 @@ export class SuiPagination implements OnChanges {
6666
this._maxSize=(value!=undefined) ?Math.max(value,1) :undefined;
6767
}
6868

69+
@Input()
70+
publicpageSize:number;
71+
6972
@Input()
7073
publicgetcollectionSize():number{
7174
returnthis._collectionSize;
7275
}
7376

7477
publicsetcollectionSize(value:number){
7578
this._collectionSize=Math.max(value,0);
79+
this.pageCount=Math.max(1,Math.ceil(this._collectionSize/this.pageSize));
7680
}
7781

78-
@Input()
79-
publicpageSize:number;
80-
8182
@Input()
8283
publicgethasNavigationLinks():boolean{
8384
constmaxSize=this._maxSize||this.pageCount;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp