11import { action , computed , makeAutoObservable , observable } from "mobx" ;
22import { createRef } from "react" ;
3- import { ComputedAtom } from "@mendix/widget-plugin-mobx-kit/src/interfaces/ComputedAtom " ;
4- import { SetPageAction } from "@mendix/widget-plugin-grid/src/pagination/pagination.model.ts " ;
3+ import { SetPageAction } from "@mendix/widget-plugin-grid/main " ;
4+ import { ComputedAtom } from "@mendix/widget-plugin-mobx-kit/main " ;
55import { PaginationConfig } from "../../features/pagination/pagination.config" ;
66
77export const VIRTUAL_SCROLLING_OFFSET = 30 ;
@@ -16,19 +16,11 @@ export class GridSizeStore {
1616 gridBodyHeight ?: number ;
1717 columnSizes ?: number [ ] ;
1818
19- hasMoreItemsAtom : ComputedAtom < boolean | undefined > ;
20- paginationConfig : PaginationConfig ;
21- setPageAction : SetPageAction ;
22-
2319 constructor (
24- hasMoreItemsAtom : ComputedAtom < boolean | undefined > ,
25- paginationConfig : PaginationConfig ,
26- setPageAction : SetPageAction
20+ private readonly hasMoreItemsAtom : ComputedAtom < boolean | undefined > ,
21+ private readonly paginationConfig : PaginationConfig ,
22+ private readonly setPageAction : SetPageAction
2723 ) {
28- this . hasMoreItemsAtom = hasMoreItemsAtom ;
29- this . paginationConfig = paginationConfig ;
30- this . setPageAction = setPageAction ;
31-
3224 makeAutoObservable ( this , {
3325 gridContainerRef : false ,
3426 gridBodyRef : false ,
@@ -69,7 +61,7 @@ export class GridSizeStore {
6961 }
7062
7163 bumpPage ( ) : void {
72- if ( this . hasMoreItemsAtom . get ( ) ) {
64+ if ( this . hasMoreItems ) {
7365 return this . setPageAction ( page => page + 1 ) ;
7466 }
7567 }
@@ -87,7 +79,7 @@ export class GridSizeStore {
8779 }
8880
8981 lockGridBodyHeight ( ) : void {
90- if ( ! this . hasVirtualScrolling || ! this . paging . hasMoreItems ) {
82+ if ( ! this . hasVirtualScrolling || ! this . hasMoreItems ) {
9183 return ;
9284 }
9385 const gridBody = this . gridBodyRef . current ;
0 commit comments