@@ -54,22 +54,6 @@ export function HidableView(props: {
54
54
}
55
55
}
56
56
57
- export function ExtendedComponentView ( props : {
58
- children : JSX . Element | React . ReactNode ;
59
- className : string ;
60
- dataTestId : string ;
61
- } ) {
62
- if ( ! props . className && ! props . dataTestId ) {
63
- return < > { props . children } </ > ;
64
- }
65
-
66
- return (
67
- < div className = { props . className } data-testid = { props . dataTestId } style = { { width : "100%" , height : "100%" , margin : "0px" , padding : "0px" } } >
68
- { props . children }
69
- </ div >
70
- ) ;
71
- }
72
-
73
57
export function ExtendedPropertyView <
74
58
ChildrenCompMap extends Record < string , Comp < unknown > > ,
75
59
> ( props : {
@@ -196,7 +180,13 @@ export class UICompBuilder<
196
180
}
197
181
198
182
override getView ( ) : ViewReturn {
199
- return ( < div ref = { this . ref } style = { { height :"100%" , width :"100%" , margin :0 , padding :0 } } > < UIView comp = { this } viewFn = { builder . viewFn } /> </ div > ) ;
183
+ return (
184
+ < UIView
185
+ innerRef = { this . ref }
186
+ comp = { this }
187
+ viewFn = { builder . viewFn }
188
+ />
189
+ ) ;
200
190
}
201
191
202
192
override getPropertyView ( ) : ReactNode {
@@ -223,7 +213,11 @@ export const DisabledContext = React.createContext<boolean>(false);
223
213
/**
224
214
* Guaranteed to be in a react component, so that react hooks can be used internally
225
215
*/
226
- function UIView ( props : { comp : any ; viewFn : any } ) {
216
+ function UIView ( props : {
217
+ innerRef : React . RefObject < HTMLDivElement > ;
218
+ comp : any ;
219
+ viewFn : any ;
220
+ } ) {
227
221
const comp = props . comp ;
228
222
229
223
const childrenProps = childrenToProps ( comp . children ) ;
@@ -243,13 +237,22 @@ function UIView(props: { comp: any; viewFn: any }) {
243
237
//END ADD BY FRED
244
238
245
239
return (
246
- < ExtendedComponentView
240
+ < div
241
+ ref = { props . innerRef }
247
242
className = { childrenProps . className as string }
248
- dataTestId = { childrenProps . dataTestId as string }
249
- >
243
+ data-testid = { childrenProps . dataTestId as string }
244
+ style = { {
245
+ width : "100%" ,
246
+ height : "100%" ,
247
+ margin : "0px" ,
248
+ padding : "0px" ,
249
+ } } >
250
250
< HidableView hidden = { childrenProps . hidden as boolean } >
251
- { props . viewFn ( childrenProps , comp . dispatch ) }
251
+ { props . viewFn (
252
+ childrenProps ,
253
+ comp . dispatch
254
+ ) }
252
255
</ HidableView >
253
- </ ExtendedComponentView >
256
+ </ div >
254
257
) ;
255
258
}
0 commit comments