@@ -387,106 +387,100 @@ const Preview: React.FC<PreviewProps> = props => {
387387 if ( mousePosition ) {
388388 bodyStyle . transformOrigin = `${ mousePosition . x } px ${ mousePosition . y } px` ;
389389 }
390-
391390 return (
392- < Portal open = { portalRender && open } getContainer = { getContainer } autoLock = { lockScroll } >
393- < CSSMotion
394- motionName = { motionName }
395- visible = { portalRender && open }
396- motionAppear
397- motionEnter
398- motionLeave
399- onVisibleChanged = { onVisibleChanged }
400- >
401- { ( { className : motionClassName , style : motionStyle } ) => {
402- const mergedStyle = {
403- ...styles . root ,
404- ...motionStyle ,
405- } ;
406-
407- if ( zIndex ) {
408- mergedStyle . zIndex = zIndex ;
409- }
410-
411- return (
412- < div
413- className = { clsx ( prefixCls , rootClassName , classNames . root , motionClassName , {
414- [ `${ prefixCls } -moving` ] : isMoving ,
415- } ) }
416- style = { mergedStyle }
417- >
418- { /* Mask */ }
391+ < Portal open = { portalRender } getContainer = { getContainer } autoLock = { lockScroll } >
392+ < div
393+ className = { clsx ( prefixCls , rootClassName , classNames . root , { [ `${ prefixCls } -moving` ] : isMoving } ) }
394+ style = { { ...styles . root , ...( zIndex ? { zIndex } : { } ) } } >
395+ { /* Mask */ }
396+ { open && ( < div
397+ className = { clsx ( `${ prefixCls } -mask` , classNames . mask ) }
398+ style = { styles . mask }
399+ onClick = { onClose }
400+ />
401+ ) }
402+ < CSSMotion
403+ motionName = { motionName }
404+ visible = { portalRender && open }
405+ motionAppear
406+ motionEnter
407+ motionLeave
408+ onVisibleChanged = { onVisibleChanged }
409+ >
410+ { ( { className : motionClassName , style : motionStyle } ) => {
411+ return (
419412 < div
420- className = { clsx ( `${ prefixCls } -mask` , classNames . mask ) }
421- style = { styles . mask }
422- onClick = { onClose }
423- />
424-
425- { /* Body */ }
426- < div className = { clsx ( `${ prefixCls } -body` , classNames . body ) } style = { bodyStyle } >
427- { /* Preview Image */ }
428- { imageRender
429- ? imageRender ( imgNode , { transform, image, ...( groupContext ? { current } : { } ) } )
430- : imgNode }
431- </ div >
432-
433- { /* Close Button */ }
434- { closeIcon !== false && closeIcon !== null && (
435- < CloseBtn
436- prefixCls = { prefixCls }
437- icon = { closeIcon === true ? icons . close : closeIcon || icons . close }
438- onClick = { onClose }
439- />
440- ) }
441-
442- { /* Switch prev or next */ }
443- { showLeftOrRightSwitches && (
444- < PrevNext
413+ className = { clsx ( motionClassName ) }
414+ style = { { ...motionStyle } }
415+ >
416+
417+ { /* Body */ }
418+ < div className = { clsx ( `${ prefixCls } -body` , classNames . body ) } style = { bodyStyle } >
419+ { /* Preview Image */ }
420+ { imageRender
421+ ? imageRender ( imgNode , { transform, image, ...( groupContext ? { current } : { } ) } )
422+ : imgNode }
423+ </ div >
424+
425+ { /* Close Button */ }
426+ { closeIcon !== false && closeIcon !== null && (
427+ < CloseBtn
428+ prefixCls = { prefixCls }
429+ icon = { closeIcon === true ? icons . close : closeIcon || icons . close }
430+ onClick = { onClose }
431+ />
432+ ) }
433+
434+ { /* Switch prev or next */ }
435+ { showLeftOrRightSwitches && (
436+ < PrevNext
437+ prefixCls = { prefixCls }
438+ current = { current }
439+ count = { count }
440+ icons = { icons }
441+ onActive = { onActive }
442+ />
443+ ) }
444+
445+ { /* Footer */ }
446+ < Footer
445447 prefixCls = { prefixCls }
448+ showProgress = { showOperationsProgress }
446449 current = { current }
447450 count = { count }
451+ showSwitch = { showLeftOrRightSwitches }
452+ // Style
453+ classNames = { classNames }
454+ styles = { styles }
455+ // Render
456+ image = { image }
457+ transform = { transform }
448458 icons = { icons }
459+ countRender = { countRender }
460+ actionsRender = { actionsRender }
461+ // Scale
462+ scale = { scale }
463+ minScale = { minScale }
464+ maxScale = { maxScale }
465+ // Actions
449466 onActive = { onActive }
467+ onFlipY = { onFlipY }
468+ onFlipX = { onFlipX }
469+ onRotateLeft = { onRotateLeft }
470+ onRotateRight = { onRotateRight }
471+ onZoomOut = { onZoomOut }
472+ onZoomIn = { onZoomIn }
473+ onClose = { onClose }
474+ onReset = { onReset }
450475 />
451- ) }
452-
453- { /* Footer */ }
454- < Footer
455- prefixCls = { prefixCls }
456- showProgress = { showOperationsProgress }
457- current = { current }
458- count = { count }
459- showSwitch = { showLeftOrRightSwitches }
460- // Style
461- classNames = { classNames }
462- styles = { styles }
463- // Render
464- image = { image }
465- transform = { transform }
466- icons = { icons }
467- countRender = { countRender }
468- actionsRender = { actionsRender }
469- // Scale
470- scale = { scale }
471- minScale = { minScale }
472- maxScale = { maxScale }
473- // Actions
474- onActive = { onActive }
475- onFlipY = { onFlipY }
476- onFlipX = { onFlipX }
477- onRotateLeft = { onRotateLeft }
478- onRotateRight = { onRotateRight }
479- onZoomOut = { onZoomOut }
480- onZoomIn = { onZoomIn }
481- onClose = { onClose }
482- onReset = { onReset }
483- />
484- </ div >
485- ) ;
486- } }
487- </ CSSMotion >
476+ </ div >
477+ ) ;
478+ } }
479+ </ CSSMotion >
480+ </ div >
488481 </ Portal >
489- ) ;
482+ )
483+ ;
490484} ;
491485
492486export default Preview ;
0 commit comments