@@ -8,20 +8,31 @@ import CSSTransition, { CSSTransitionProps } from "react-transition-group/CSSTra
88export const version = "%VERSION%" ;
99
1010export interface PopupProps extends React . HTMLAttributes < any > {
11+ /** 样式前缀 */
1112 prefixCls ?: string ;
13+ /** popup元素样式 */
1214 style ?: React . CSSProperties ;
15+ /** popupCSS样式名 */
1316 className ?: string ;
17+ /** popup根节点CSS样式名 */
1418 rootClassName ?: string ;
19+ /** popup根节点样式 */
1520 rootStyle ?: React . CSSProperties ;
21+ /** popup元素属性 */
1622 rootProps ?: React . HTMLAttributes < any > ;
17-
23+ /** 否显示popup(受控) */
1824 visible ?: boolean ;
25+ /** 使用fixed定位popup */
1926 fixed ?: boolean ;
27+ /** 初始不显示的情况下不渲染组件 */
2028 lazy ?: boolean ;
29+ /** 当destroyOnClose=false时,组件刷新时强制更新 */
2130 forceRender ?: boolean ;
22-
31+ /** CSSTransition参数,参考:react-transition-group */
2332 transition ?: Partial < CSSTransitionProps > ;
33+ /** 隐藏销毁弹组件 */
2434 destroyOnClose ?: boolean ;
35+ /** popup显示用于获取元素显示位置信息,大部分情况下建议直接用style */
2536 getPosition ?: (
2637 dom : HTMLElement
2738 ) => {
@@ -30,18 +41,25 @@ export interface PopupProps extends React.HTMLAttributes<any> {
3041 right ?: number | string ;
3142 bottom ?: number | string ;
3243 } ;
33-
44+ /** 禁用mask */
3445 disableMask ?: boolean ;
46+ /** 是否开启遮罩层 */
3547 mask ?: boolean ;
48+ /** 遮罩层样式 */
3649 maskStyle ?: React . CSSProperties ;
50+ /** 遮罩层组件属性 */
3751 maskProps ?: React . HTMLAttributes < any > ;
52+ /** 遮罩层样式名称 */
3853 maskClassName ?: string ;
54+ /** CSSTransition参数,参考:react-transition-group */
3955 maskTransition ?: Partial < CSSTransitionProps > ;
40-
56+ /** 内部使用 */
4157 component ?: React . ElementType ;
58+ /** 内部使用 */
4259 maskComponent ?: React . ElementType ;
60+ /** 内部使用 */
4361 rootComponent ?: React . ElementType ;
44-
62+ /** 内部使用 */
4563 wrapContent ?: ( node : React . ReactNode ) => React . ReactNode ;
4664}
4765
@@ -147,13 +165,13 @@ export class Popup extends React.Component<PopupProps, {}> {
147165 }
148166 }
149167
150- onEnter (
168+ protected onEnter (
151169 { onEnter } : CSSTransitionProps ,
152170 isMask : boolean ,
153171 node : HTMLElement ,
154172 appearing : boolean
155173 ) {
156- const { destroyOnClose , getPosition } = this . props ;
174+ const { getPosition } = this . props ;
157175 const rootElement = findDOMNode ( this . rootInstance ) as HTMLElement ;
158176 const popupElement = findDOMNode ( this . popupInstance ) as HTMLElement ;
159177 const maskElement = findDOMNode ( this . maskInstance ) as HTMLElement ;
@@ -210,7 +228,7 @@ export class Popup extends React.Component<PopupProps, {}> {
210228 }
211229 }
212230
213- onEntered ( { onEntered } , isMask : boolean , node : HTMLElement , appearing : boolean ) {
231+ protected onEntered ( { onEntered } , isMask : boolean , node : HTMLElement , appearing : boolean ) {
214232 if ( isMask ) {
215233 this . inMaskTransition = false ;
216234 } else {
@@ -222,7 +240,7 @@ export class Popup extends React.Component<PopupProps, {}> {
222240 }
223241 }
224242
225- onExit ( { onExit } : CSSTransitionProps , isMask : boolean , node : HTMLElement ) {
243+ protected onExit ( { onExit } : CSSTransitionProps , isMask : boolean , node : HTMLElement ) {
226244 if ( isMask ) {
227245 this . inMaskTransition = true ;
228246 } else {
@@ -234,7 +252,7 @@ export class Popup extends React.Component<PopupProps, {}> {
234252 }
235253 }
236254
237- onExited ( { onExited } : CSSTransitionProps , isMask : boolean , node : HTMLElement ) {
255+ protected onExited ( { onExited } : CSSTransitionProps , isMask : boolean , node : HTMLElement ) {
238256 const { destroyOnClose, visible } = this . props ;
239257 const rootElement = findDOMNode ( this . rootInstance ) as HTMLElement ;
240258 const popupElement = findDOMNode ( this . popupInstance ) as HTMLElement ;
@@ -269,7 +287,7 @@ export class Popup extends React.Component<PopupProps, {}> {
269287 }
270288 }
271289
272- renderPopupMask ( ) {
290+ protected renderPopupMask ( ) {
273291 const {
274292 prefixCls,
275293 visible,
0 commit comments