1
1
import { useStylesheet , useI18nBundle } from '@ui5/webcomponents-react-base' ;
2
2
import type { MutableRefObject } from 'react' ;
3
3
import { useCallback , useEffect , useRef , useState } from 'react' ;
4
+ import { createPortal } from 'react-dom' ;
4
5
import { DRAG_TO_RESIZE } from '../../i18n/i18n-defaults.js' ;
5
6
import { classNames , styleData } from './VerticalResizer.module.css.js' ;
6
7
@@ -136,6 +137,14 @@ export const VerticalResizer = (props: VerticalResizerProps) => {
136
137
isInitial . current = false ;
137
138
} , [ rowsLength , visibleRows ] ) ;
138
139
140
+ const [ allowed , setAllowed ] = useState ( false ) ;
141
+ useEffect ( ( ) => {
142
+ setAllowed ( true ) ;
143
+ } , [ ] ) ;
144
+ if ( ! allowed ) {
145
+ return null ;
146
+ }
147
+
139
148
return (
140
149
< div
141
150
className = { classNames . container }
@@ -145,12 +154,15 @@ export const VerticalResizer = (props: VerticalResizerProps) => {
145
154
role = "separator"
146
155
title = { i18nBundle . getText ( DRAG_TO_RESIZE ) }
147
156
>
148
- { resizerPosition && isDragging && (
149
- < div
150
- className = { classNames . resizer }
151
- style = { { top : resizerPosition . top , left : resizerPosition . left , width : resizerPosition . width } }
152
- />
153
- ) }
157
+ { resizerPosition &&
158
+ isDragging &&
159
+ createPortal (
160
+ < div
161
+ className = { classNames . resizer }
162
+ style = { { top : resizerPosition . top , left : resizerPosition . left , width : resizerPosition . width } }
163
+ /> ,
164
+ document . body
165
+ ) }
154
166
</ div >
155
167
) ;
156
168
} ;
0 commit comments