File tree Expand file tree Collapse file tree 9 files changed +25
-29
lines changed Expand file tree Collapse file tree 9 files changed +25
-29
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export const defaultContentProps: ContentProps = {
9
9
header : null ,
10
10
footer : null ,
11
11
close : '' ,
12
- footerDirection : '' ,
12
+ footerDirection : 'horizontal ' ,
13
13
onClick : ( ) => { } ,
14
14
}
15
15
@@ -39,7 +39,7 @@ export const Content: FunctionComponent<
39
39
footer && (
40
40
< View
41
41
className = { classNames ( `${ classPrefix } -footer` , {
42
- [ footerDirection as any ] : footerDirection ,
42
+ [ footerDirection ] : footerDirection ,
43
43
} ) }
44
44
>
45
45
{ footer }
@@ -65,9 +65,7 @@ export const Content: FunctionComponent<
65
65
style = { { display : visible ? 'flex' : 'none' } }
66
66
>
67
67
{ renderHeader ( ) }
68
- < View className = { `${ classPrefix } -content` } >
69
- < > { children } </ >
70
- </ View >
68
+ < View className = { `${ classPrefix } -content` } > { children } </ View >
71
69
{ renderFooter ( ) }
72
70
</ View >
73
71
</ View >
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ export const defaultContentProps: ContentProps = {
8
8
header : '' ,
9
9
footer : '' ,
10
10
close : '' ,
11
- footerDirection : '' ,
11
+ footerDirection : 'horizontal ' ,
12
12
onClick : ( ) => { } ,
13
13
}
14
14
@@ -23,24 +23,24 @@ export const Content: FunctionComponent<
23
23
footer,
24
24
close,
25
25
footerDirection,
26
- onClick,
27
26
children,
28
27
style,
29
28
className,
29
+ onClick,
30
30
} = { ...defaultContentProps , ...props }
31
31
32
32
const classPrefix = 'nut-dialog'
33
33
34
34
const renderHeader = ( ) => {
35
- return title ? < div className = { `${ classPrefix } -header` } > { title } </ div > : null
35
+ return title && < div className = { `${ classPrefix } -header` } > { title } </ div >
36
36
}
37
37
38
38
const renderFooter = ( ) => {
39
39
return (
40
40
footer && (
41
41
< div
42
42
className = { classNames ( `${ classPrefix } -footer` , {
43
- [ footerDirection as any ] : footerDirection ,
43
+ [ footerDirection ] : footerDirection ,
44
44
} ) }
45
45
>
46
46
{ footer }
@@ -66,9 +66,7 @@ export const Content: FunctionComponent<
66
66
style = { { display : visible ? 'flex' : 'none' } }
67
67
>
68
68
{ renderHeader ( ) }
69
- < div className = { `${ classPrefix } -content` } >
70
- < > { children } </ >
71
- </ div >
69
+ < div className = { `${ classPrefix } -content` } > { children } </ div >
72
70
{ renderFooter ( ) }
73
71
</ div >
74
72
</ div >
Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ export const BaseDialog: FunctionComponent<Partial<DialogBasicProps>> & {
182
182
)
183
183
}
184
184
185
- const onHandleClickOverlay = ( e : any ) => {
185
+ const onHandleClickOverlay = ( e : React . MouseEvent < HTMLElement > ) => {
186
186
if ( closeOnOverlayClick && visible && e . target === e . currentTarget ) {
187
187
const closed = onOverlayClick && onOverlayClick ( e )
188
188
closed && onClose && onClose ( )
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export const DialogWrap: FunctionComponent<
34
34
...restProps
35
35
} = { ...defaultDialogWrapProps , ...props }
36
36
37
- const onHandleClickOverlay = ( e : any ) => {
37
+ const onHandleClickOverlay = ( e : React . MouseEvent < HTMLElement > ) => {
38
38
if ( closeOnOverlayClick && visible && e . target === e . currentTarget ) {
39
39
const closed = onOverlayClick && onOverlayClick ( e )
40
40
closed && onClose ?.( )
Original file line number Diff line number Diff line change @@ -9,15 +9,15 @@ export type DialogConfigType = {
9
9
}
10
10
11
11
export type DialogCloseIconPosition = 'top-right' | 'top-left' | 'bottom'
12
-
12
+ export type DialogFooterDirection = 'horizontal' | 'vertical'
13
13
export interface ContentProps extends BasicComponent {
14
14
visible : boolean
15
15
title : ReactNode
16
16
header : ReactNode
17
17
footer : ReactNode
18
18
close : ReactNode
19
- footerDirection : string
20
- onClick : ( event : any ) => void
19
+ footerDirection : DialogFooterDirection
20
+ onClick : ( event : MouseEvent < HTMLElement > ) => void
21
21
}
22
22
export type DialogWrapProps = OverlayProps &
23
23
ContentProps & {
@@ -27,7 +27,7 @@ export type DialogWrapProps = OverlayProps &
27
27
overlayClassName : string
28
28
onCancel : ( ) => void
29
29
onClose : ( ) => void
30
- onOverlayClick : ( e : MouseEvent ) => boolean | void
30
+ onOverlayClick : ( e : MouseEvent < HTMLElement > ) => boolean | void
31
31
}
32
32
33
33
export type DialogBasicProps = DialogWrapProps &
Original file line number Diff line number Diff line change 1
1
import React , { useState } from 'react'
2
- import { FixedNav } from '@nutui/nutui-react-taro'
2
+ import { FixedNav , FixedNavItem } from '@nutui/nutui-react-taro'
3
3
4
4
const Demo1 = ( ) => {
5
5
const list = [
@@ -29,7 +29,10 @@ const Demo1 = () => {
29
29
const change = ( value : boolean ) => {
30
30
setVisible ( value )
31
31
}
32
- const selected = ( item : any , event : any ) => {
32
+ const selected = (
33
+ item : FixedNavItem ,
34
+ event : React . MouseEvent < HTMLDivElement , MouseEvent >
35
+ ) => {
33
36
console . log ( item , event )
34
37
}
35
38
return (
Original file line number Diff line number Diff line change @@ -19,10 +19,7 @@ export const defaultOverlayProps: OverlayProps = {
19
19
afterClose : ( ) => { } ,
20
20
}
21
21
export const Overlay : FunctionComponent <
22
- Partial < OverlayProps > &
23
- Omit < React . HTMLAttributes < HTMLDivElement > , 'onClick' > & {
24
- onClick : ( event : React . MouseEvent | ITouchEvent ) => void
25
- }
22
+ Partial < OverlayProps > & Omit < React . HTMLAttributes < HTMLDivElement > , 'onClick' >
26
23
> = ( props ) => {
27
24
const {
28
25
children,
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ export interface OverlayProps extends BasicComponent {
6
6
closeOnOverlayClick : boolean
7
7
visible : boolean
8
8
lockScroll : boolean
9
- onClick : ( event : React . MouseEvent ) => void
9
+ onClick : ( event : React . MouseEvent < HTMLDivElement , MouseEvent > ) => void
10
10
afterShow : ( ) => void
11
11
afterClose : ( ) => void
12
12
}
Original file line number Diff line number Diff line change @@ -16,13 +16,13 @@ const Demo4 = () => {
16
16
duration ?: number ,
17
17
title ?: string
18
18
) => {
19
- const changeState = Object . assign ( state , {
19
+ setState ( {
20
+ ...state ,
20
21
icon,
21
22
content,
22
- duration,
23
- title,
23
+ duration : duration || 0 ,
24
+ title : title || '' ,
24
25
} )
25
- setState ( changeState )
26
26
}
27
27
return (
28
28
< >
You can’t perform that action at this time.
0 commit comments