1
- import { RefSelectController } from "@mendix/widget-plugin-dropdown-filter /controllers/RefSelectController" ;
2
- import { RefComboboxController } from "@mendix/widget-plugin-dropdown-filter /controllers/RefComboboxController" ;
3
- import { RefTagPickerController } from "@mendix/widget-plugin-dropdown-filter /controllers/RefTagPickerController" ;
4
- import { Select } from "@mendix/widget-plugin-filtering /controls/select/Select" ;
5
- import { Combobox } from "@mendix/widget-plugin-filtering /controls/combobox/Combobox" ;
6
- import { TagPicker } from "@mendix/widget-plugin-filtering /controls/tag-picker/TagPicker" ;
7
- import { usePickerJSActions } from "@mendix/widget-plugin-filtering /helpers/usePickerJSActions" ;
8
- import { RefFilterStore } from "@mendix/widget-plugin-filtering/ stores/picker /RefFilterStore" ;
1
+ import { RefSelectController } from ".. /controllers/RefSelectController" ;
2
+ import { RefComboboxController } from ".. /controllers/RefComboboxController" ;
3
+ import { RefTagPickerController } from ".. /controllers/RefTagPickerController" ;
4
+ import { Select } from ".. /controls/select/Select" ;
5
+ import { Combobox } from ".. /controls/combobox/Combobox" ;
6
+ import { TagPicker } from ".. /controls/tag-picker/TagPicker" ;
7
+ import { usePickerJSActions } from ".. /helpers/usePickerJSActions" ;
8
+ import { RefFilterStore } from "../ stores/RefFilterStore" ;
9
9
import { ActionValue , EditableValue } from "mendix" ;
10
10
import { observer } from "mobx-react-lite" ;
11
- import { createElement , CSSProperties } from "react" ;
12
- import { useSetupUpdate } from "@mendix/widget-plugin-filtering/helpers/useSetupUpdate" ;
13
- import { useFrontendType } from "../hooks/useFrontendType" ;
14
- import { SelectedItemsStyleEnum , SelectionMethodEnum } from "../../typings/DatagridDropdownFilterProps" ;
11
+ import { createElement , CSSProperties , useEffect } from "react" ;
12
+
13
+ import { useFrontendType } from "../helpers/useFrontendType" ;
15
14
import { useOnScrollBottom } from "@mendix/widget-plugin-hooks/useOnScrollBottom" ;
15
+ import { SelectedItemsStyleEnum , SelectionMethodEnum } from "../typings/widget" ;
16
+ import { useConst } from "@mendix/widget-plugin-mobx-kit/react/useConst" ;
17
+ import { GateProvider } from "@mendix/widget-plugin-mobx-kit/GateProvider" ;
18
+ import { DerivedPropsGate } from "@mendix/widget-plugin-mobx-kit/props-gate" ;
16
19
17
20
export interface RefFilterContainerProps {
18
21
ariaLabel ?: string ;
@@ -48,7 +51,8 @@ function Container(props: RefFilterContainerProps): React.ReactElement {
48
51
}
49
52
50
53
const SelectWidget = observer ( function SelectWidget ( props : RefFilterContainerProps ) : React . ReactElement {
51
- const ctrl1 = useSetupUpdate ( ( ) => new RefSelectController ( props ) , props ) ;
54
+ const gate = useGate ( props ) ;
55
+ const ctrl1 = useConst ( ( ) => new RefSelectController ( { gate } ) ) ;
52
56
const handleMenuScroll = useOnScrollBottom ( ctrl1 . handleMenuScrollEnd , { triggerZoneHeight : 100 } ) ;
53
57
54
58
usePickerJSActions ( ctrl1 , props ) ;
@@ -71,7 +75,8 @@ const SelectWidget = observer(function SelectWidget(props: RefFilterContainerPro
71
75
} ) ;
72
76
73
77
const ComboboxWidget = observer ( function ComboboxWidget ( props : RefFilterContainerProps ) : React . ReactElement {
74
- const ctrl2 = useSetupUpdate ( ( ) => new RefComboboxController ( props ) , props ) ;
78
+ const gate = useGate ( props ) ;
79
+ const ctrl2 = useConst ( ( ) => new RefComboboxController ( { gate } ) ) ;
75
80
const handleMenuScroll = useOnScrollBottom ( ctrl2 . handleMenuScrollEnd , { triggerZoneHeight : 100 } ) ;
76
81
77
82
usePickerJSActions ( ctrl2 , props ) ;
@@ -93,7 +98,8 @@ const ComboboxWidget = observer(function ComboboxWidget(props: RefFilterContaine
93
98
} ) ;
94
99
95
100
const TagPickerWidget = observer ( function TagPickerWidget ( props : RefFilterContainerProps ) : React . ReactElement {
96
- const ctrl3 = useSetupUpdate ( ( ) => new RefTagPickerController ( props ) , props ) ;
101
+ const gate = useGate ( props ) ;
102
+ const ctrl3 = useConst ( ( ) => new RefTagPickerController ( { gate } ) ) ;
97
103
const handleMenuScroll = useOnScrollBottom ( ctrl3 . handleMenuScrollEnd , { triggerZoneHeight : 100 } ) ;
98
104
99
105
usePickerJSActions ( ctrl3 , props ) ;
@@ -119,3 +125,9 @@ const TagPickerWidget = observer(function TagPickerWidget(props: RefFilterContai
119
125
} ) ;
120
126
121
127
export const RefFilterContainer = Container ;
128
+
129
+ function useGate ( props : RefFilterContainerProps ) : DerivedPropsGate < RefFilterContainerProps > {
130
+ const gp = useConst ( ( ) => new GateProvider ( props ) ) ;
131
+ useEffect ( ( ) => gp . setProps ( props ) ) ;
132
+ return gp . gate ;
133
+ }
0 commit comments