@@ -8,20 +8,31 @@ import CSSTransition, { CSSTransitionProps } from "react-transition-group/CSSTra
8
8
export const version = "%VERSION%" ;
9
9
10
10
export interface PopupProps extends React . HTMLAttributes < any > {
11
+ /** 样式前缀 */
11
12
prefixCls ?: string ;
13
+ /** popup元素样式 */
12
14
style ?: React . CSSProperties ;
15
+ /** popupCSS样式名 */
13
16
className ?: string ;
17
+ /** popup根节点CSS样式名 */
14
18
rootClassName ?: string ;
19
+ /** popup根节点样式 */
15
20
rootStyle ?: React . CSSProperties ;
21
+ /** popup元素属性 */
16
22
rootProps ?: React . HTMLAttributes < any > ;
17
-
23
+ /** 否显示popup(受控) */
18
24
visible ?: boolean ;
25
+ /** 使用fixed定位popup */
19
26
fixed ?: boolean ;
27
+ /** 初始不显示的情况下不渲染组件 */
20
28
lazy ?: boolean ;
29
+ /** 当destroyOnClose=false时,组件刷新时强制更新 */
21
30
forceRender ?: boolean ;
22
-
31
+ /** CSSTransition参数,参考:react-transition-group */
23
32
transition ?: Partial < CSSTransitionProps > ;
33
+ /** 隐藏销毁弹组件 */
24
34
destroyOnClose ?: boolean ;
35
+ /** popup显示用于获取元素显示位置信息,大部分情况下建议直接用style */
25
36
getPosition ?: (
26
37
dom : HTMLElement
27
38
) => {
@@ -30,18 +41,25 @@ export interface PopupProps extends React.HTMLAttributes<any> {
30
41
right ?: number | string ;
31
42
bottom ?: number | string ;
32
43
} ;
33
-
44
+ /** 禁用mask */
34
45
disableMask ?: boolean ;
46
+ /** 是否开启遮罩层 */
35
47
mask ?: boolean ;
48
+ /** 遮罩层样式 */
36
49
maskStyle ?: React . CSSProperties ;
50
+ /** 遮罩层组件属性 */
37
51
maskProps ?: React . HTMLAttributes < any > ;
52
+ /** 遮罩层样式名称 */
38
53
maskClassName ?: string ;
54
+ /** CSSTransition参数,参考:react-transition-group */
39
55
maskTransition ?: Partial < CSSTransitionProps > ;
40
-
56
+ /** 内部使用 */
41
57
component ?: React . ElementType ;
58
+ /** 内部使用 */
42
59
maskComponent ?: React . ElementType ;
60
+ /** 内部使用 */
43
61
rootComponent ?: React . ElementType ;
44
-
62
+ /** 内部使用 */
45
63
wrapContent ?: ( node : React . ReactNode ) => React . ReactNode ;
46
64
}
47
65
@@ -147,13 +165,13 @@ export class Popup extends React.Component<PopupProps, {}> {
147
165
}
148
166
}
149
167
150
- onEnter (
168
+ protected onEnter (
151
169
{ onEnter } : CSSTransitionProps ,
152
170
isMask : boolean ,
153
171
node : HTMLElement ,
154
172
appearing : boolean
155
173
) {
156
- const { destroyOnClose , getPosition } = this . props ;
174
+ const { getPosition } = this . props ;
157
175
const rootElement = findDOMNode ( this . rootInstance ) as HTMLElement ;
158
176
const popupElement = findDOMNode ( this . popupInstance ) as HTMLElement ;
159
177
const maskElement = findDOMNode ( this . maskInstance ) as HTMLElement ;
@@ -210,7 +228,7 @@ export class Popup extends React.Component<PopupProps, {}> {
210
228
}
211
229
}
212
230
213
- onEntered ( { onEntered } , isMask : boolean , node : HTMLElement , appearing : boolean ) {
231
+ protected onEntered ( { onEntered } , isMask : boolean , node : HTMLElement , appearing : boolean ) {
214
232
if ( isMask ) {
215
233
this . inMaskTransition = false ;
216
234
} else {
@@ -222,7 +240,7 @@ export class Popup extends React.Component<PopupProps, {}> {
222
240
}
223
241
}
224
242
225
- onExit ( { onExit } : CSSTransitionProps , isMask : boolean , node : HTMLElement ) {
243
+ protected onExit ( { onExit } : CSSTransitionProps , isMask : boolean , node : HTMLElement ) {
226
244
if ( isMask ) {
227
245
this . inMaskTransition = true ;
228
246
} else {
@@ -234,7 +252,7 @@ export class Popup extends React.Component<PopupProps, {}> {
234
252
}
235
253
}
236
254
237
- onExited ( { onExited } : CSSTransitionProps , isMask : boolean , node : HTMLElement ) {
255
+ protected onExited ( { onExited } : CSSTransitionProps , isMask : boolean , node : HTMLElement ) {
238
256
const { destroyOnClose, visible } = this . props ;
239
257
const rootElement = findDOMNode ( this . rootInstance ) as HTMLElement ;
240
258
const popupElement = findDOMNode ( this . popupInstance ) as HTMLElement ;
@@ -269,7 +287,7 @@ export class Popup extends React.Component<PopupProps, {}> {
269
287
}
270
288
}
271
289
272
- renderPopupMask ( ) {
290
+ protected renderPopupMask ( ) {
273
291
const {
274
292
prefixCls,
275
293
visible,
0 commit comments