File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
frontend/src/components/ui Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -147,15 +147,14 @@ export class Pagination extends LitElement {
147
147
this . onPageChange ( page , 0 ) ;
148
148
} ) ;
149
149
150
- @state ( )
150
+ // @property ({ type: Number })
151
+ // public set page(page: number) {
152
+ // this.onPageChange(page);
153
+ // }
154
+
151
155
public get page ( ) {
152
- return Math . min (
153
- 1 ,
154
- Math . max (
155
- this . totalCount ,
156
- parsePage ( this . searchParams . searchParams . get ( this . name ) ) ,
157
- ) ,
158
- ) ;
156
+ const page = parsePage ( this . searchParams . searchParams . get ( this . name ) ) ;
157
+ return Math . max ( 1 , Math . min ( this . pages , page ) ) ;
159
158
}
160
159
161
160
@property ( { type : String } )
@@ -186,6 +185,14 @@ export class Pagination extends LitElement {
186
185
this . calculatePages ( ) ;
187
186
}
188
187
188
+ const parsedPage = parseFloat (
189
+ this . searchParams . searchParams . get ( this . name ) ?? "1" ,
190
+ ) ;
191
+ if ( parsedPage > this . pages || parsedPage < 1 || parsedPage % 1 !== 0 ) {
192
+ this . onPageChange ( this . page , parsedPage ) ;
193
+ this . requestUpdate ( "page" , parsedPage ) ;
194
+ }
195
+
189
196
if ( changedProperties . get ( "page" ) && this . page ) {
190
197
this . inputValue = `${ this . page } ` ;
191
198
}
You can’t perform that action at this time.
0 commit comments