1- import { CloseOutlined } from "@ant-design/icons" ;
1+ import { CloseOutlined , PropertySafetyFilled } from "@ant-design/icons" ;
22import { default as Button } from "antd/es/button" ;
33import { ContainerCompBuilder } from "comps/comps/containerBase/containerCompBuilder" ;
44import { gridItemCompToGridItems , InnerGrid } from "comps/comps/containerComp/containerView" ;
55import { AutoHeightControl } from "comps/controls/autoHeightControl" ;
66import { BoolControl } from "comps/controls/boolControl" ;
77import { StringControl } from "comps/controls/codeControl" ;
88import { booleanExposingStateControl } from "comps/controls/codeStateControl" ;
9- import { PositionControl } from "comps/controls/dropdownControl" ;
9+ import { PositionControl , LeftRightControl } from "comps/controls/dropdownControl" ;
1010import { closeEvent , eventHandlerControl } from "comps/controls/eventHandlerControl" ;
1111import { styleControl } from "comps/controls/styleControl" ;
1212import { DrawerStyle } from "comps/controls/styleControlConstants" ;
@@ -35,40 +35,22 @@ const DrawerWrapper = styled.div`
3535 pointer-events: auto;
3636` ;
3737
38- const ButtonStyle = styled ( Button ) `
39- position: absolute;
40- left: 0;
41- top: 0;
42- z-index: 10;
43- font-weight: 700;
44- box-shadow: none;
45- color: rgba(0, 0, 0, 0.45);
46- height: 54px;
47- width: 54px;
48-
49- svg {
50- width: 16px;
51- height: 16px;
52- }
53-
54- &,
55- :hover,
56- :focus {
57- background-color: transparent;
58- border: none;
59- }
60-
61- :hover,
62- :focus {
63- color: rgba(0, 0, 0, 0.75);
64- }
65- ` ;
66-
6738// If it is a number, use the px unit by default
6839function transToPxSize ( size : string | number ) {
6940 return isNumeric ( size ) ? size + "px" : ( size as string ) ;
7041}
7142
43+ const ClosePlacementOptions = [
44+ {
45+ label : trans ( "drawer.left" ) ,
46+ value : "left" ,
47+ } ,
48+ {
49+ label : trans ( "drawer.right" ) ,
50+ value : "right" ,
51+ } ,
52+ ] as const ;
53+
7254const PlacementOptions = [
7355 {
7456 label : trans ( "drawer.top" ) ,
@@ -88,6 +70,7 @@ const PlacementOptions = [
8870 } ,
8971] as const ;
9072
73+
9174let TmpDrawerComp = ( function ( ) {
9275 return new ContainerCompBuilder (
9376 {
@@ -98,6 +81,7 @@ let TmpDrawerComp = (function () {
9881 autoHeight : AutoHeightControl ,
9982 style : styleControl ( DrawerStyle ) ,
10083 placement : PositionControl ,
84+ closePosition : withDefault ( LeftRightControl , "left" ) ,
10185 maskClosable : withDefault ( BoolControl , true ) ,
10286 showMask : withDefault ( BoolControl , true ) ,
10387 } ,
@@ -119,6 +103,34 @@ let TmpDrawerComp = (function () {
119103 } ,
120104 [ dispatch , isTopBom ]
121105 ) ;
106+ const ButtonStyle = styled ( Button ) `
107+ position: absolute;
108+ ${ props . closePosition === "right" ? "right: 0;" : "left: 0;" }
109+ top: 0;
110+ z-index: 10;
111+ font-weight: 700;
112+ box-shadow: none;
113+ color: rgba(0, 0, 0, 0.45);
114+ height: 54px;
115+ width: 54px;
116+
117+ svg {
118+ width: 16px;
119+ height: 16px;
120+ }
121+
122+ &,
123+ :hover,
124+ :focus {
125+ background-color: transparent;
126+ border: none;
127+ }
128+
129+ :hover,
130+ :focus {
131+ color: rgba(0, 0, 0, 0.75);
132+ }
133+ ` ;
122134 return (
123135 < BackgroundColorContext . Provider value = { props . style . background } >
124136 < DrawerWrapper >
@@ -181,6 +193,7 @@ let TmpDrawerComp = (function () {
181193 . setPropertyViewFn ( ( children ) => (
182194 < >
183195 < Section name = { sectionNames . basic } >
196+ { children . closePosition . propertyView ( { label : trans ( "drawer.closePosition" ) , radioButton : true } ) }
184197 { children . placement . propertyView ( { label : trans ( "drawer.placement" ) , radioButton : true } ) }
185198 { [ "top" , "bottom" ] . includes ( children . placement . getView ( ) )
186199 ? children . autoHeight . getPropertyView ( )
0 commit comments