@@ -3,7 +3,8 @@ import '../assets/index.less';
33import * as React from 'react' ;
44import Dialog from '../src/DialogWrap' ;
55
6- const clearPath = 'M793 242H366v-74c0-6.7-7.7-10.4-12.9' +
6+ const clearPath =
7+ 'M793 242H366v-74c0-6.7-7.7-10.4-12.9' +
78 '-6.3l-142 112c-4.1 3.2-4.1 9.4 0 12.6l142 112c' +
89 '5.2 4.1 12.9 0.4 12.9-6.3v-74h415v470H175c-4.4' +
910 ' 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h618c35.3 0 64-' +
@@ -19,22 +20,22 @@ const getSvg = (path: string, props = {}, align = false) => {
1920 fill = "currentColor"
2021 style = { align ? { verticalAlign : '-.125em ' } : { } }
2122 >
22- < path d = { path } p-id = "5827" > </ path >
23+ < path d = { path } p-id = "5827" / >
2324 </ svg >
2425 </ i >
2526 ) ;
2627} ;
2728
2829const MyControl = ( ) => {
29- const [ visible1 , setVisible1 ] = React . useState ( false ) ;
30+ const [ visible1 , setVisible1 ] = React . useState ( true ) ;
3031 const [ visible2 , setVisible2 ] = React . useState ( false ) ;
31- const [ visible3 , setVisible3 ] = React . useState ( true ) ;
32+ const [ visible3 , setVisible3 ] = React . useState ( false ) ;
3233 const [ width , setWidth ] = React . useState ( 600 ) ;
3334 const [ destroyOnClose , setDestroyOnClose ] = React . useState ( false ) ;
3435 const [ center , setCenter ] = React . useState ( false ) ;
3536 const [ mousePosition , setMousePosition ] = React . useState ( {
3637 x : null ,
37- y : null
38+ y : null ,
3839 } ) ;
3940 const [ useIcon , setUseIcon ] = React . useState ( false ) ;
4041 const [ forceRender , setForceRender ] = React . useState ( false ) ;
@@ -45,45 +46,45 @@ const MyControl = () => {
4546 y : e . pageY ,
4647 } ) ;
4748 setVisible1 ( true ) ;
48- }
49+ } ;
4950
5051 const onClose = ( ) => {
5152 setVisible1 ( false ) ;
52- }
53+ } ;
5354
5455 const onClose2 = ( ) => {
5556 setVisible2 ( false ) ;
56- }
57+ } ;
5758
5859 const onClose3 = ( ) => {
5960 setVisible3 ( false ) ;
60- }
61+ } ;
6162
6263 const closeAll = ( ) => {
6364 setVisible1 ( false ) ;
6465 setVisible2 ( false ) ;
6566 setVisible3 ( false ) ;
66- }
67+ } ;
6768
6869 const onDestroyOnCloseChange = ( e : React . ChangeEvent < HTMLInputElement > ) => {
6970 setDestroyOnClose ( e . target . checked ) ;
70- }
71+ } ;
7172
7273 const onForceRenderChange = ( e : React . ChangeEvent < HTMLInputElement > ) => {
7374 setForceRender ( e . target . checked ) ;
74- }
75+ } ;
7576
7677 const changeWidth = ( ) => {
7778 setWidth ( width === 600 ? 800 : 600 ) ;
78- }
79+ } ;
7980
8081 const centerEvent = ( e : React . ChangeEvent < HTMLInputElement > ) => {
8182 setCenter ( e . target . checked ) ;
82- }
83+ } ;
8384
8485 const toggleCloseIcon = ( ) => {
8586 setUseIcon ( ! useIcon ) ;
86- }
87+ } ;
8788
8889 const style = { width } ;
8990
@@ -109,66 +110,92 @@ const MyControl = () => {
109110 >
110111 < input autoFocus />
111112 < p > basic modal</ p >
112- < button type = "button" onClick = { ( ) => {
113- setVisible1 ( false ) ;
114- setVisible2 ( true ) ;
115- } } > 打开第二个并关闭当前的</ button >
116- < button type = "button" onClick = { ( ) => {
117- setVisible2 ( true ) ;
118- } } > 打开第二个</ button >
119- < button type = "button" onClick = { changeWidth } > change width</ button >
113+ < button
114+ type = "button"
115+ onClick = { ( ) => {
116+ setVisible1 ( false ) ;
117+ setVisible2 ( true ) ;
118+ } }
119+ >
120+ 打开第二个并关闭当前的
121+ </ button >
122+ < button
123+ type = "button"
124+ onClick = { ( ) => {
125+ setVisible2 ( true ) ;
126+ } }
127+ >
128+ 打开第二个
129+ </ button >
130+ < button type = "button" onClick = { changeWidth } >
131+ change width
132+ </ button >
120133 < button type = "button" onClick = { toggleCloseIcon } >
121- use custom icon, is using icon: { useIcon && 'true' || 'false' } .
134+ use custom icon, is using icon: { ( useIcon && 'true' ) || 'false' } .
122135 </ button >
123136 < div style = { { height : 200 } } />
124137 </ Dialog >
125138 ) ;
126139
127140 const dialog2 = (
128- < Dialog
129- visible = { visible2 }
130- title = "dialog2"
131- onClose = { onClose2 }
132- >
141+ < Dialog visible = { visible2 } title = "dialog2" onClose = { onClose2 } >
133142 < input autoFocus />
134143 < p > basic modal</ p >
135- < button type = "button" onClick = { ( ) => {
136- setVisible3 ( true ) ;
137- } } > 打开第三个</ button >
138- < button type = "button" onClick = { ( ) => {
139- setVisible2 ( false ) ;
140- } } > 关闭当前</ button >
141- < button type = "button" onClick = { closeAll } > 关闭所有</ button >
142- < button type = "button" onClick = { changeWidth } > change width</ button >
144+ < button
145+ type = "button"
146+ onClick = { ( ) => {
147+ setVisible3 ( true ) ;
148+ } }
149+ >
150+ 打开第三个
151+ </ button >
152+ < button
153+ type = "button"
154+ onClick = { ( ) => {
155+ setVisible2 ( false ) ;
156+ } }
157+ >
158+ 关闭当前
159+ </ button >
160+ < button type = "button" onClick = { closeAll } >
161+ 关闭所有
162+ </ button >
163+ < button type = "button" onClick = { changeWidth } >
164+ change width
165+ </ button >
143166 < button type = "button" onClick = { toggleCloseIcon } >
144- use custom icon, is using icon: { useIcon && 'true' || 'false' } .
167+ use custom icon, is using icon: { ( useIcon && 'true' ) || 'false' } .
145168 </ button >
146169 < div style = { { height : 200 } } />
147170 </ Dialog >
148171 ) ;
149172
150173 const dialog3 = (
151- < Dialog
152- forceRender
153- title = "dialog3"
154- visible = { visible3 }
155- onClose = { onClose3 }
156- >
174+ < Dialog forceRender title = "dialog3" visible = { visible3 } onClose = { onClose3 } >
157175 < p > initialized with forceRender and visbile true</ p >
158- < button type = "button" onClick = { ( ) => {
159- setVisible3 ( false ) ;
160- } } > 关闭当前</ button >
161- < button type = "button" onClick = { closeAll } > 关闭所有</ button >
162- < button type = "button" onClick = { changeWidth } > change width</ button >
176+ < button
177+ type = "button"
178+ onClick = { ( ) => {
179+ setVisible3 ( false ) ;
180+ } }
181+ >
182+ 关闭当前
183+ </ button >
184+ < button type = "button" onClick = { closeAll } >
185+ 关闭所有
186+ </ button >
187+ < button type = "button" onClick = { changeWidth } >
188+ change width
189+ </ button >
163190 < button type = "button" onClick = { toggleCloseIcon } >
164- use custom icon, is using icon: { useIcon && 'true' || 'false' } .
191+ use custom icon, is using icon: { ( useIcon && 'true' ) || 'false' } .
165192 </ button >
166193 < div style = { { height : 200 } } />
167194 </ Dialog >
168195 ) ;
169196
170197 return (
171- < div style = { { width : '90%' , margin : '0 auto' } } >
198+ < div style = { { width : '90%' , margin : '0 auto' , height : '150vh' } } >
172199 < style >
173200 { `
174201 .center {
@@ -185,30 +212,19 @@ const MyControl = () => {
185212
186213 < label >
187214 destroy on close:
188- < input
189- type = "checkbox"
190- checked = { destroyOnClose }
191- onChange = { onDestroyOnCloseChange }
192- />
215+ < input type = "checkbox" checked = { destroyOnClose } onChange = { onDestroyOnCloseChange } />
193216 </ label >
194217
195218 < label >
196219 center
197- < input
198- type = "checkbox"
199- checked = { center }
200- onChange = { centerEvent }
201- />
220+ < input type = "checkbox" checked = { center } onChange = { centerEvent } />
202221 </ label >
203222
204223 < label >
205224 force render
206- < input
207- type = "checkbox"
208- checked = { forceRender }
209- onChange = { onForceRenderChange }
210- />
225+ < input type = "checkbox" checked = { forceRender } onChange = { onForceRenderChange } />
211226 </ label >
227+ < input placeholder = "Useless Input" onClick = { onClick } />
212228 </ p >
213229 { dialog }
214230 { dialog2 }
0 commit comments