@@ -5,13 +5,14 @@ import { manualOptionsControl } from "comps/controls/optionsControl";
55import { BoolCodeControl , StringControl , jsonControl , NumberControl } from "comps/controls/codeControl" ;
66import { IconControl } from "comps/controls/iconControl" ;
77import styled from "styled-components" ;
8- import React , { Suspense , useContext , useEffect , useMemo , useState } from "react" ;
8+ import React , { Suspense , useContext , useEffect , useMemo , useState , useCallback } from "react" ;
99import { registerLayoutMap } from "comps/comps/uiComp" ;
1010import { AppSelectComp } from "comps/comps/layout/appSelectComp" ;
1111import { NameAndExposingInfo } from "comps/utils/exposingTypes" ;
1212import { ConstructorToComp , ConstructorToDataType } from "lowcoder-core" ;
1313import { CanvasContainer } from "comps/comps/gridLayoutComp/canvasView" ;
1414import { CanvasContainerID } from "constants/domLocators" ;
15+ import { PreviewContainerID } from "constants/domLocators" ;
1516import { EditorContainer , EmptyContent } from "pages/common/styledComponent" ;
1617import { Layers } from "constants/Layers" ;
1718import { ExternalEditorContext } from "util/context/ExternalEditorContext" ;
@@ -30,6 +31,7 @@ import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext";
3031import { AlignCenter } from "lowcoder-design" ;
3132import { AlignLeft } from "lowcoder-design" ;
3233import { AlignRight } from "lowcoder-design" ;
34+ import { Drawer } from "lowcoder-design" ;
3335import { LayoutActionComp } from "./layoutActionComp" ;
3436import { defaultTheme } from "@lowcoder-ee/constants/themeConstants" ;
3537import { clickEvent , eventHandlerControl } from "@lowcoder-ee/comps/controls/eventHandlerControl" ;
@@ -43,7 +45,6 @@ const TabBarItem = React.lazy(() =>
4345 default : module . TabBarItem ,
4446 } ) )
4547) ;
46- const Popup = React . lazy ( ( ) => import ( "antd-mobile/es/components/popup" ) ) ;
4748const EventOptions = [ clickEvent ] as const ;
4849
4950const AppViewContainer = styled . div `
@@ -620,6 +621,13 @@ MobileTabLayoutTmp = withViewFn(MobileTabLayoutTmp, (comp) => {
620621 const bgColor = ( useContext ( ThemeContext ) ?. theme || defaultTheme ) . canvas ;
621622 const onEvent = comp . children . onEvent . getView ( ) ;
622623
624+ const getContainer = useCallback ( ( ) =>
625+ document . querySelector ( `#${ PreviewContainerID } ` ) ||
626+ document . querySelector ( `#${ CanvasContainerID } ` ) ||
627+ document . body ,
628+ [ ]
629+ ) ;
630+
623631 useEffect ( ( ) => {
624632 comp . children . jsonTabs . dispatchChangeValueAction ( {
625633 manual : jsonItems as unknown as Array < ConstructorToDataType < typeof TabOptionComp > >
@@ -749,22 +757,27 @@ MobileTabLayoutTmp = withViewFn(MobileTabLayoutTmp, (comp) => {
749757 </ HamburgerButton >
750758 ) ;
751759
752- const drawerBodyStyle = useMemo ( ( ) => {
753- if ( drawerPlacement === 'left' || drawerPlacement === 'right' ) {
754- return { width : drawerWidth } as React . CSSProperties ;
755- }
756- return { height : drawerHeight } as React . CSSProperties ;
757- } , [ drawerPlacement , drawerHeight , drawerWidth ] ) ;
758-
759760 const drawerView = (
760761 < Suspense fallback = { < Skeleton /> } >
761- < Popup
762- visible = { drawerVisible }
763- onMaskClick = { ( ) => setDrawerVisible ( false ) }
762+ < Drawer
763+ open = { drawerVisible }
764764 onClose = { ( ) => setDrawerVisible ( false ) }
765- position = { drawerPlacement as any }
765+ placement = { drawerPlacement as any }
766766 mask = { shadowOverlay }
767- bodyStyle = { drawerBodyStyle }
767+ maskClosable = { true }
768+ closable = { false }
769+ styles = { { body : { padding : 0 } } as any }
770+ getContainer = { getContainer }
771+ width = {
772+ ( drawerPlacement === 'left' || drawerPlacement === 'right' )
773+ ? ( drawerWidth as any )
774+ : undefined
775+ }
776+ height = {
777+ ( drawerPlacement === 'top' || drawerPlacement === 'bottom' )
778+ ? ( drawerHeight as any )
779+ : undefined
780+ }
768781 >
769782 < DrawerContent
770783 $background = { drawerContainerStyle ?. background || '#FFFFFF' }
@@ -808,7 +821,7 @@ MobileTabLayoutTmp = withViewFn(MobileTabLayoutTmp, (comp) => {
808821 ) ) }
809822 </ DrawerList >
810823 </ DrawerContent >
811- </ Popup >
824+ </ Drawer >
812825 </ Suspense >
813826 ) ;
814827
0 commit comments