@rc-component/dialog 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/es/DialogWrap.js +6 -0
- package/es/IDialogPropTypes.d.ts +6 -4
- package/lib/DialogWrap.js +6 -0
- package/lib/IDialogPropTypes.d.ts +6 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ ReactDOM.render(
|
|
|
64
64
|
| maskTransitionName | String | | mask animation css class name | |
|
|
65
65
|
| title | String\|React.Element | | Title of the dialog | |
|
|
66
66
|
| footer | React.Element | | footer of the dialog | |
|
|
67
|
-
| closable | Boolean \| ({ closeIcon?: React.ReactNode; disabled?: boolean } & React.AriaAttributes | true | whether show close button | |
|
|
67
|
+
| closable | Boolean \| ({ closeIcon?: React.ReactNode; disabled?: boolean, afterClose:function } & React.AriaAttributes) | true | whether show close button | |
|
|
68
68
|
| mask | Boolean | true | whether show mask | |
|
|
69
69
|
| maskClosable | Boolean | true | whether click mask to close | |
|
|
70
70
|
| keyboard | Boolean | true | whether support press esc to close | |
|
package/es/DialogWrap.js
CHANGED
|
@@ -19,6 +19,7 @@ const DialogWrap = props => {
|
|
|
19
19
|
forceRender,
|
|
20
20
|
destroyOnHidden = false,
|
|
21
21
|
afterClose,
|
|
22
|
+
closable,
|
|
22
23
|
panelRef
|
|
23
24
|
} = props;
|
|
24
25
|
const [animatedVisible, setAnimatedVisible] = React.useState(visible);
|
|
@@ -45,6 +46,11 @@ const DialogWrap = props => {
|
|
|
45
46
|
}, /*#__PURE__*/React.createElement(Dialog, _extends({}, props, {
|
|
46
47
|
destroyOnHidden: destroyOnHidden,
|
|
47
48
|
afterClose: () => {
|
|
49
|
+
const closableObj = closable && typeof closable === 'object' ? closable : {};
|
|
50
|
+
const {
|
|
51
|
+
afterClose: closableAfterClose
|
|
52
|
+
} = closableObj || {};
|
|
53
|
+
closableAfterClose?.();
|
|
48
54
|
afterClose?.();
|
|
49
55
|
setAnimatedVisible(false);
|
|
50
56
|
}
|
package/es/IDialogPropTypes.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ import type { CSSProperties, ReactNode, SyntheticEvent } from 'react';
|
|
|
3
3
|
export type SemanticName = 'header' | 'body' | 'footer' | 'container' | 'title' | 'wrapper' | 'mask';
|
|
4
4
|
export type ModalClassNames = Partial<Record<SemanticName, string>>;
|
|
5
5
|
export type ModalStyles = Partial<Record<SemanticName, CSSProperties>>;
|
|
6
|
+
export type ClosableType = {
|
|
7
|
+
closeIcon?: React.ReactNode;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
afterClose?: () => any;
|
|
10
|
+
};
|
|
6
11
|
export type IDialogPropTypes = {
|
|
7
12
|
className?: string;
|
|
8
13
|
keyboard?: boolean;
|
|
@@ -13,10 +18,7 @@ export type IDialogPropTypes = {
|
|
|
13
18
|
afterClose?: () => any;
|
|
14
19
|
afterOpenChange?: (open: boolean) => void;
|
|
15
20
|
onClose?: (e: SyntheticEvent) => any;
|
|
16
|
-
closable?: boolean | (
|
|
17
|
-
closeIcon?: React.ReactNode;
|
|
18
|
-
disabled?: boolean;
|
|
19
|
-
} & React.AriaAttributes);
|
|
21
|
+
closable?: boolean | (ClosableType & React.AriaAttributes);
|
|
20
22
|
maskClosable?: boolean;
|
|
21
23
|
visible?: boolean;
|
|
22
24
|
destroyOnHidden?: boolean;
|
package/lib/DialogWrap.js
CHANGED
|
@@ -28,6 +28,7 @@ const DialogWrap = props => {
|
|
|
28
28
|
forceRender,
|
|
29
29
|
destroyOnHidden = false,
|
|
30
30
|
afterClose,
|
|
31
|
+
closable,
|
|
31
32
|
panelRef
|
|
32
33
|
} = props;
|
|
33
34
|
const [animatedVisible, setAnimatedVisible] = React.useState(visible);
|
|
@@ -54,6 +55,11 @@ const DialogWrap = props => {
|
|
|
54
55
|
}, /*#__PURE__*/React.createElement(_Dialog.default, _extends({}, props, {
|
|
55
56
|
destroyOnHidden: destroyOnHidden,
|
|
56
57
|
afterClose: () => {
|
|
58
|
+
const closableObj = closable && typeof closable === 'object' ? closable : {};
|
|
59
|
+
const {
|
|
60
|
+
afterClose: closableAfterClose
|
|
61
|
+
} = closableObj || {};
|
|
62
|
+
closableAfterClose?.();
|
|
57
63
|
afterClose?.();
|
|
58
64
|
setAnimatedVisible(false);
|
|
59
65
|
}
|
|
@@ -3,6 +3,11 @@ import type { CSSProperties, ReactNode, SyntheticEvent } from 'react';
|
|
|
3
3
|
export type SemanticName = 'header' | 'body' | 'footer' | 'container' | 'title' | 'wrapper' | 'mask';
|
|
4
4
|
export type ModalClassNames = Partial<Record<SemanticName, string>>;
|
|
5
5
|
export type ModalStyles = Partial<Record<SemanticName, CSSProperties>>;
|
|
6
|
+
export type ClosableType = {
|
|
7
|
+
closeIcon?: React.ReactNode;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
afterClose?: () => any;
|
|
10
|
+
};
|
|
6
11
|
export type IDialogPropTypes = {
|
|
7
12
|
className?: string;
|
|
8
13
|
keyboard?: boolean;
|
|
@@ -13,10 +18,7 @@ export type IDialogPropTypes = {
|
|
|
13
18
|
afterClose?: () => any;
|
|
14
19
|
afterOpenChange?: (open: boolean) => void;
|
|
15
20
|
onClose?: (e: SyntheticEvent) => any;
|
|
16
|
-
closable?: boolean | (
|
|
17
|
-
closeIcon?: React.ReactNode;
|
|
18
|
-
disabled?: boolean;
|
|
19
|
-
} & React.AriaAttributes);
|
|
21
|
+
closable?: boolean | (ClosableType & React.AriaAttributes);
|
|
20
22
|
maskClosable?: boolean;
|
|
21
23
|
visible?: boolean;
|
|
22
24
|
destroyOnHidden?: boolean;
|