@@ -28,6 +28,8 @@ interface IAnchoredProps {
2828}
2929
3030interface IResizableProps {
31+ handleSize ?: number ,
32+ overlayHandle ?: boolean ,
3133 minimumSize ?: number ,
3234 maximumSize ?: number
3335}
@@ -223,43 +225,12 @@ class Space extends React.Component<AllProps, IState> {
223225 }
224226 }
225227
226- const { id, className } = this . props ;
227-
228228 const currentContext = this . getContext ( parentContext ) ;
229+ const handleSize = this . props . handleSize || 5 ;
230+ const overlayHandle = this . props . overlayHandle !== undefined ? this . props . overlayHandle : true ;
231+ let children = this . props . children ;
229232
230- let spaceRender = this . props . children ;
231- let resizeRender = null ;
232-
233- if ( parentContext && this . props . anchor && this . props . resizable ) {
234- let resizeType : ResizeType = ResizeType . Left ;
235-
236- switch ( this . props . anchor ) {
237- case AnchorType . Left :
238- resizeType = ResizeType . Right ;
239- break ;
240- case AnchorType . Right :
241- resizeType = ResizeType . Left ;
242- break ;
243- case AnchorType . Top :
244- resizeType = ResizeType . Bottom ;
245- break ;
246- case AnchorType . Bottom :
247- resizeType = ResizeType . Top ;
248- break ;
249- }
250-
251- resizeRender =
252- < Resizable
253- type = { resizeType }
254- minimumAdjust = { - ( this . state . parsedSize || 0 ) + ( this . props . minimumSize || 20 ) }
255- maximumAdjust = { this . props . maximumSize ? ( this . props . maximumSize - ( this . state . parsedSize || 0 ) ) : undefined }
256- onResize = { ( adjustedSize ) => {
257- this . setState (
258- { adjustedSize : adjustedSize } ,
259- ( ) => {
260- parentContext . updateSpaceTakerAdjustedSize ( this . state . id , adjustedSize ) ;
261- } ) ;
262- } } /> ;
233+ const [ resizeRender , resizeType ] = this . applyResize ( parentContext , handleSize ) ;
263234
264235 if ( this . props . centerContent === CenterType . Vertical ) {
265236 children = < CenteredVertically > { children } </ CenteredVertically > ;
@@ -353,6 +324,52 @@ class Space extends React.Component<AllProps, IState> {
353324 }
354325 }
355326
327+ private applyResize = ( parentContext : ISpaceContext | null , handleSize : number ) => {
328+ let resizeType : ResizeType = ResizeType . Left ;
329+ let resizeHandleWidth : number | undefined ;
330+ let resizeHandleHeight : number | undefined ;
331+
332+ if ( parentContext && this . props . anchor && this . props . resizable ) {
333+ switch ( this . props . anchor ) {
334+ case AnchorType . Left :
335+ resizeType = ResizeType . Right ;
336+ resizeHandleWidth = handleSize ;
337+ break ;
338+ case AnchorType . Right :
339+ resizeType = ResizeType . Left ;
340+ resizeHandleWidth = this . props . handleSize || 5 ;
341+ break ;
342+ case AnchorType . Top :
343+ resizeType = ResizeType . Bottom ;
344+ resizeHandleHeight = this . props . handleSize || 5 ;
345+ break ;
346+ case AnchorType . Bottom :
347+ resizeType = ResizeType . Top ;
348+ resizeHandleHeight = this . props . handleSize || 5 ;
349+ break ;
350+ }
351+
352+ return [
353+ < Resizable
354+ type = { resizeType }
355+ width = { resizeHandleWidth }
356+ height = { resizeHandleHeight }
357+ minimumAdjust = { - ( this . state . parsedSize || 0 ) + ( this . props . minimumSize || 20 ) }
358+ maximumAdjust = { this . props . maximumSize ? ( this . props . maximumSize - ( this . state . parsedSize || 0 ) ) : undefined }
359+ onResize = { ( adjustedSize ) => {
360+ this . setState (
361+ { adjustedSize : adjustedSize } ,
362+ ( ) => {
363+ parentContext . updateSpaceTakerAdjustedSize ( this . state . id , adjustedSize ) ;
364+ } ) ;
365+ } } /> ,
366+ resizeType
367+ ]
368+ }
369+
370+ return [ null , null ] ;
371+ }
372+
356373 private spaceResized : ResizeSensorCallback = ( size ) => {
357374 this . setState ( {
358375 currentWidth : size . width ,
0 commit comments