File tree 6 files changed +125
-26
lines changed
tests/alipay/Modal/__tests__
6 files changed +125
-26
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,14 @@ export interface IModalProps extends IBaseProps {
37
37
* @description 过渡动画时长,单位毫秒
38
38
*/
39
39
duration : number ;
40
+ /**
41
+ * @description 是否开启过渡动画
42
+ */
43
+ animation : boolean ;
44
+ /**
45
+ * @description 弹窗层级
46
+ */
47
+ zIndex : number ;
40
48
/**
41
49
* @description 标题
42
50
*/
@@ -103,6 +111,8 @@ export const ModalDefaultProps: Partial<IModalProps> = {
103
111
closable : true ,
104
112
type : 'default' ,
105
113
duration : 200 ,
114
+ animation : true ,
115
+ zIndex : 998 ,
106
116
} ;
107
117
108
118
export const ModalFunctionalProps : Partial < IModalProps > = {
@@ -114,6 +124,8 @@ export const ModalFunctionalProps: Partial<IModalProps> = {
114
124
type : 'default' ,
115
125
closable : true ,
116
126
duration : 200 ,
127
+ animation : true ,
128
+ zIndex : 998 ,
117
129
title : '' ,
118
130
content : '' ,
119
131
visible : false ,
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ export var ModalDefaultProps = {
4
4
closable : true ,
5
5
type : 'default' ,
6
6
duration : 200 ,
7
+ animation : true ,
8
+ zIndex : 998 ,
7
9
} ;
8
10
export var ModalFunctionalProps = {
9
11
bodyClassName : '' ,
@@ -14,6 +16,8 @@ export var ModalFunctionalProps = {
14
16
type : 'default' ,
15
17
closable : true ,
16
18
duration : 200 ,
19
+ animation : true ,
20
+ zIndex : 998 ,
17
21
title : '' ,
18
22
content : '' ,
19
23
visible : false ,
Original file line number Diff line number Diff line change @@ -3,34 +3,32 @@ import AntPopup from '../Popup/index.axml';
3
3
import AntButton from '../Button/index.axml' ;
4
4
import AntIcon from '../Icon/index.axml' ;
5
5
import { IModalProps } from './props' ;
6
- import { TSXMLProps , InternalData } from 'tsxml' ;
6
+ import { TSXMLProps } from 'tsxml' ;
7
7
import utils from './index.sjs' ;
8
8
9
- export default (
10
- {
11
- className,
12
- style,
13
- maskClassName,
14
- maskStyle,
15
- visible,
16
- duration,
17
- destroyOnClose,
18
- bodyClassName,
19
- bodyStyle,
20
- title,
21
- content,
22
- type,
23
- primaryButtonText,
24
- primaryButtonStyle,
25
- secondaryButtonText,
26
- secondaryButtonStyle,
27
- cancelButtonText,
28
- cancelButtonStyle,
29
- closable,
30
- } : TSXMLProps < IModalProps > ,
31
-
32
- { animation, zIndex } : InternalData
33
- ) => (
9
+ export default ( {
10
+ className,
11
+ style,
12
+ maskClassName,
13
+ maskStyle,
14
+ visible,
15
+ duration,
16
+ destroyOnClose,
17
+ bodyClassName,
18
+ bodyStyle,
19
+ title,
20
+ content,
21
+ type,
22
+ primaryButtonText,
23
+ primaryButtonStyle,
24
+ secondaryButtonText,
25
+ secondaryButtonStyle,
26
+ cancelButtonText,
27
+ cancelButtonStyle,
28
+ closable,
29
+ animation,
30
+ zIndex,
31
+ } : TSXMLProps < IModalProps > ) => (
34
32
< Component >
35
33
< AntPopup
36
34
className = { `ant-modal ${ className || '' } ` }
Original file line number Diff line number Diff line change @@ -37,6 +37,14 @@ export interface IModalProps extends IBaseProps {
37
37
* @description 过渡动画时长,单位毫秒
38
38
*/
39
39
duration : number ;
40
+ /**
41
+ * @description 是否开启过渡动画
42
+ */
43
+ animation : boolean ;
44
+ /**
45
+ * @description 弹窗层级
46
+ */
47
+ zIndex : number ;
40
48
/**
41
49
* @description 标题
42
50
*/
@@ -103,6 +111,8 @@ export const ModalDefaultProps: Partial<IModalProps> = {
103
111
closable : true ,
104
112
type : 'default' ,
105
113
duration : 200 ,
114
+ animation : true ,
115
+ zIndex : 998 ,
106
116
} ;
107
117
108
118
export const ModalFunctionalProps : Partial < IModalProps > = {
@@ -114,6 +124,8 @@ export const ModalFunctionalProps: Partial<IModalProps> = {
114
124
type : 'default' ,
115
125
closable : true ,
116
126
duration : 200 ,
127
+ animation : true ,
128
+ zIndex : 998 ,
117
129
title : '' ,
118
130
content : '' ,
119
131
visible : false ,
Original file line number Diff line number Diff line change 1
1
import { getInstance } from 'tests/utils' ;
2
2
import { describe , it , expect , vi } from 'vitest' ;
3
3
4
+ describe ( 'init' , ( ) => {
5
+ it ( '测试默认值' , ( ) => {
6
+ const instance = getInstance ( 'Modal' , { } ) ;
7
+
8
+ const {
9
+ bodyClassName,
10
+ bodyStyle,
11
+ maskClassName,
12
+ maskStyle,
13
+ maskClosable,
14
+ type,
15
+ closable,
16
+ duration,
17
+ animation,
18
+ zIndex,
19
+ title,
20
+ content,
21
+ visible,
22
+ destroyOnClose,
23
+ primaryButtonText,
24
+ secondaryButtonText,
25
+ cancelButtonText,
26
+ primaryButtonStyle,
27
+ secondaryButtonStyle,
28
+ cancelButtonStyle,
29
+ } = instance . getConfig ( ) . props ;
30
+ expect ( {
31
+ bodyClassName,
32
+ bodyStyle,
33
+ maskClassName,
34
+ maskStyle,
35
+ maskClosable,
36
+ type,
37
+ closable,
38
+ duration,
39
+ animation,
40
+ zIndex,
41
+ title,
42
+ content,
43
+ visible,
44
+ destroyOnClose,
45
+ primaryButtonText,
46
+ secondaryButtonText,
47
+ cancelButtonText,
48
+ primaryButtonStyle,
49
+ secondaryButtonStyle,
50
+ cancelButtonStyle,
51
+ } ) . toMatchFileSnapshot ( 'snapshot/alipay_config_props.txt' ) ;
52
+ } ) ;
53
+ } ) ;
54
+
4
55
describe ( 'modal onClose' , ( ) => {
5
56
it ( 'modal onClose' , ( ) => {
6
57
const onClose = vi . fn ( ) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "animation": true,
3
+ "bodyClassName": "",
4
+ "bodyStyle": "",
5
+ "cancelButtonStyle": "",
6
+ "cancelButtonText": "",
7
+ "closable": true,
8
+ "content": "",
9
+ "destroyOnClose": false,
10
+ "duration": 200,
11
+ "maskClassName": "",
12
+ "maskClosable": true,
13
+ "maskStyle": "",
14
+ "primaryButtonStyle": "",
15
+ "primaryButtonText": "",
16
+ "secondaryButtonStyle": "",
17
+ "secondaryButtonText": "",
18
+ "title": "",
19
+ "type": "default",
20
+ "visible": false,
21
+ "zIndex": 998,
22
+ }
You can’t perform that action at this time.
0 commit comments