File tree 3 files changed +13
-4
lines changed
pluggableWidgets/gallery-web/src
shared/widget-plugin-sorting/src/controllers
3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 1
1
import { createElement , ReactElement } from "react" ;
2
+ import { useGalleryRootScope } from "../helpers/root-context" ;
3
+ import { getGlobalSortContext } from "@mendix/widget-plugin-sorting/context" ;
2
4
3
5
type GalleryHeaderProps = Omit < JSX . IntrinsicElements [ "div" ] , "ref" > ;
4
6
7
+ const SortAPI = getGlobalSortContext ( ) ;
8
+
5
9
export function GalleryHeader ( props : GalleryHeaderProps ) : ReactElement | null {
6
10
const { children } = props ;
11
+ const scope = useGalleryRootScope ( ) ;
7
12
8
13
if ( ! children ) {
9
14
return null ;
10
15
}
11
16
12
- return < section { ...props } className = "widget-gallery-header widget-gallery-filter" /> ;
17
+ return (
18
+ < SortAPI . Provider value = { scope . rootStore . sortAPI } >
19
+ < section { ...props } className = "widget-gallery-header widget-gallery-filter" />
20
+ </ SortAPI . Provider >
21
+ ) ;
13
22
}
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { CustomFilterHost } from "@mendix/widget-plugin-filtering/stores/generic
3
3
import { DatasourceController } from "@mendix/widget-plugin-grid/query/DatasourceController" ;
4
4
import { disposeBatch } from "@mendix/widget-plugin-mobx-kit/disposeBatch" ;
5
5
import { ReactiveController , ReactiveControllerHost } from "@mendix/widget-plugin-mobx-kit/reactive-controller" ;
6
- import { ObservableSortStoreHost } from "@mendix/widget-plugin-sorting/observable-sort-host " ;
6
+ import { ObservableSortStoreHost } from "@mendix/widget-plugin-sorting/ObservableSortStoreHost " ;
7
7
import { ListValue } from "mendix" ;
8
8
import { FilterCondition } from "mendix/filters" ;
9
9
import { makeAutoObservable , reaction } from "mobx" ;
Original file line number Diff line number Diff line change @@ -37,8 +37,8 @@ export class SortStoreProvider implements ISetupable {
37
37
setup ( ) : ( ) => void {
38
38
const [ add , disposeAll ] = disposeBatch ( ) ;
39
39
40
- this . _host . observe ( this . _key , this . _store ) ;
41
- add ( ( ) => this . _host . unobserve ( this . _key ) ) ;
40
+ this . _host . observe ( this . _store , this . _key ) ;
41
+ add ( ( ) => this . _host . unobserve ( this . _store ) ) ;
42
42
add ( this . _store . setup ?.( ) ) ;
43
43
return disposeAll ;
44
44
}
You can’t perform that action at this time.
0 commit comments