11import { useStylesheet , useI18nBundle } from '@ui5/webcomponents-react-base' ;
22import type { MutableRefObject } from 'react' ;
33import { useCallback , useEffect , useRef , useState } from 'react' ;
4+ import { createPortal } from 'react-dom' ;
45import { DRAG_TO_RESIZE } from '../../i18n/i18n-defaults.js' ;
56import { classNames , styleData } from './VerticalResizer.module.css.js' ;
67
@@ -136,6 +137,14 @@ export const VerticalResizer = (props: VerticalResizerProps) => {
136137 isInitial . current = false ;
137138 } , [ rowsLength , visibleRows ] ) ;
138139
140+ const [ allowed , setAllowed ] = useState ( false ) ;
141+ useEffect ( ( ) => {
142+ setAllowed ( true ) ;
143+ } , [ ] ) ;
144+ if ( ! allowed ) {
145+ return null ;
146+ }
147+
139148 return (
140149 < div
141150 className = { classNames . container }
@@ -145,12 +154,15 @@ export const VerticalResizer = (props: VerticalResizerProps) => {
145154 role = "separator"
146155 title = { i18nBundle . getText ( DRAG_TO_RESIZE ) }
147156 >
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+ ) }
154166 </ div >
155167 ) ;
156168} ;
0 commit comments