File tree Expand file tree Collapse file tree 3 files changed +15
-22
lines changed
packages/pluggableWidgets/gallery-web/src Expand file tree Collapse file tree 3 files changed +15
-22
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ const Container = observer(function GalleryContainer(props: GalleryContainerProp
91
91
focusController = { focusController }
92
92
getPosition = { getPositionCallback }
93
93
loadMoreButtonCaption = { props . loadMoreButtonCaption ?. value }
94
+ showRefreshIndicator = { rootStore . loaderCtrl . showRefreshIndicator }
94
95
/>
95
96
) ;
96
97
} ) ;
Original file line number Diff line number Diff line change 1
- type DerivedLoaderControllerSpec = {
2
- refreshIndicator : boolean ;
3
- query : {
4
- isRefreshing : boolean ;
5
- isSilentRefresh : boolean ;
6
- } ;
7
- } ;
1
+ import { DatasourceController } from "@mendix/widget-plugin-grid/query/DatasourceController" ;
2
+ import { makeObservable , computed } from "mobx" ;
8
3
9
4
export class DerivedLoaderController {
10
- constructor ( private spec : DerivedLoaderControllerSpec ) { }
5
+ constructor (
6
+ private datasourceController : DatasourceController ,
7
+ private refreshIndicator : boolean
8
+ ) {
9
+ makeObservable ( this , {
10
+ isRefreshing : computed ,
11
+ showRefreshIndicator : computed
12
+ } ) ;
13
+ }
11
14
12
15
get isRefreshing ( ) : boolean {
13
- const { isSilentRefresh, isRefreshing } = this . spec . query ;
14
-
16
+ const { isSilentRefresh, isRefreshing } = this . datasourceController ;
15
17
return ! isSilentRefresh && isRefreshing ;
16
18
}
17
19
18
20
get showRefreshIndicator ( ) : boolean {
19
- if ( ! this . spec . refreshIndicator ) {
20
- return false ;
21
- }
22
-
23
- return this . isRefreshing ;
21
+ return this . refreshIndicator && this . isRefreshing ;
24
22
}
25
23
}
Original file line number Diff line number Diff line change @@ -87,13 +87,7 @@ export class GalleryStore extends BaseControllerHost {
87
87
host : this . _sortHost
88
88
} ;
89
89
90
- this . loaderCtrl = new DerivedLoaderController ( {
91
- refreshIndicator : spec . refreshIndicator ,
92
- query : {
93
- isRefreshing : this . _query . isRefreshing ,
94
- isSilentRefresh : this . _query . isSilentRefresh
95
- }
96
- } ) ;
90
+ this . loaderCtrl = new DerivedLoaderController ( this . _query , spec . refreshIndicator ) ;
97
91
98
92
new RefreshController ( this , {
99
93
delay : 0 ,
You can’t perform that action at this time.
0 commit comments