1
- import { CloseOutlined } from "@ant-design/icons" ;
1
+ import { CloseOutlined , PropertySafetyFilled } from "@ant-design/icons" ;
2
2
import { default as Button } from "antd/es/button" ;
3
3
import { ContainerCompBuilder } from "comps/comps/containerBase/containerCompBuilder" ;
4
4
import { gridItemCompToGridItems , InnerGrid } from "comps/comps/containerComp/containerView" ;
5
5
import { AutoHeightControl } from "comps/controls/autoHeightControl" ;
6
6
import { BoolControl } from "comps/controls/boolControl" ;
7
7
import { StringControl } from "comps/controls/codeControl" ;
8
8
import { booleanExposingStateControl } from "comps/controls/codeStateControl" ;
9
- import { PositionControl } from "comps/controls/dropdownControl" ;
9
+ import { PositionControl , LeftRightControl } from "comps/controls/dropdownControl" ;
10
10
import { closeEvent , eventHandlerControl } from "comps/controls/eventHandlerControl" ;
11
11
import { styleControl } from "comps/controls/styleControl" ;
12
12
import { DrawerStyle } from "comps/controls/styleControlConstants" ;
@@ -35,40 +35,22 @@ const DrawerWrapper = styled.div`
35
35
pointer-events: auto;
36
36
` ;
37
37
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
-
67
38
// If it is a number, use the px unit by default
68
39
function transToPxSize ( size : string | number ) {
69
40
return isNumeric ( size ) ? size + "px" : ( size as string ) ;
70
41
}
71
42
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
+
72
54
const PlacementOptions = [
73
55
{
74
56
label : trans ( "drawer.top" ) ,
@@ -88,6 +70,7 @@ const PlacementOptions = [
88
70
} ,
89
71
] as const ;
90
72
73
+
91
74
let TmpDrawerComp = ( function ( ) {
92
75
return new ContainerCompBuilder (
93
76
{
@@ -98,6 +81,7 @@ let TmpDrawerComp = (function () {
98
81
autoHeight : AutoHeightControl ,
99
82
style : styleControl ( DrawerStyle ) ,
100
83
placement : PositionControl ,
84
+ closePosition : withDefault ( LeftRightControl , "left" ) ,
101
85
maskClosable : withDefault ( BoolControl , true ) ,
102
86
showMask : withDefault ( BoolControl , true ) ,
103
87
} ,
@@ -119,6 +103,34 @@ let TmpDrawerComp = (function () {
119
103
} ,
120
104
[ dispatch , isTopBom ]
121
105
) ;
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
+ ` ;
122
134
return (
123
135
< BackgroundColorContext . Provider value = { props . style . background } >
124
136
< DrawerWrapper >
@@ -181,6 +193,7 @@ let TmpDrawerComp = (function () {
181
193
. setPropertyViewFn ( ( children ) => (
182
194
< >
183
195
< Section name = { sectionNames . basic } >
196
+ { children . closePosition . propertyView ( { label : trans ( "drawer.closePosition" ) , radioButton : true } ) }
184
197
{ children . placement . propertyView ( { label : trans ( "drawer.placement" ) , radioButton : true } ) }
185
198
{ [ "top" , "bottom" ] . includes ( children . placement . getView ( ) )
186
199
? children . autoHeight . getPropertyView ( )
0 commit comments