@ecoding/components.antd 0.3.31 → 0.3.32
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/lib/core/drawer/index.d.ts +32 -3
- package/lib/core/drawer/index.js +15 -15
- package/lib/core/inject-notification/index.js +1 -2
- package/lib/core/loading/index.d.ts +4 -1
- package/lib/core/loading/index.js +8 -4
- package/lib/core/modal/index.d.ts +27 -2
- package/lib/core/modal/index.js +12 -15
- package/package.json +2 -2
|
@@ -4,7 +4,6 @@ export interface IDrawerProps {
|
|
|
4
4
|
key?: string;
|
|
5
5
|
id?: string;
|
|
6
6
|
className?: string;
|
|
7
|
-
bodyStyle?: React.CSSProperties;
|
|
8
7
|
closable?: boolean;
|
|
9
8
|
maskClosable?: boolean;
|
|
10
9
|
open?: boolean;
|
|
@@ -33,7 +32,7 @@ export interface IDrawerProps {
|
|
|
33
32
|
disabled: boolean;
|
|
34
33
|
};
|
|
35
34
|
}
|
|
36
|
-
export declare class Drawers extends React.Component<IDrawerProps> {
|
|
35
|
+
export declare class Drawers extends React.Component<IDrawerProps, IDrawerProps> {
|
|
37
36
|
static defaultProps: {
|
|
38
37
|
className: string;
|
|
39
38
|
open: boolean;
|
|
@@ -63,9 +62,39 @@ export declare class Drawers extends React.Component<IDrawerProps> {
|
|
|
63
62
|
component: null;
|
|
64
63
|
};
|
|
65
64
|
state: {
|
|
65
|
+
key?: string | undefined;
|
|
66
|
+
id?: string | undefined;
|
|
67
|
+
className?: string | undefined;
|
|
68
|
+
closable?: boolean | undefined;
|
|
69
|
+
maskClosable?: boolean | undefined;
|
|
70
|
+
open?: boolean | undefined;
|
|
71
|
+
width?: string | number | undefined;
|
|
72
|
+
zIndex?: number | undefined;
|
|
73
|
+
height?: string | number | undefined;
|
|
74
|
+
placement?: import("rc-drawer/lib/DrawerPopup").Placement | undefined;
|
|
75
|
+
okDanger?: boolean | undefined;
|
|
76
|
+
title?: React.ReactNode;
|
|
77
|
+
okType?: "link" | "text" | "dashed" | "default" | "primary" | undefined;
|
|
78
|
+
okText?: string | undefined;
|
|
79
|
+
cancelText?: string | undefined;
|
|
80
|
+
mask?: boolean | undefined;
|
|
81
|
+
footer?: React.ReactNode;
|
|
82
|
+
extra?: React.ReactNode;
|
|
83
|
+
onOk?: (() => Promise<any>) | undefined;
|
|
84
|
+
onOkAfter?: ((args: any) => void | Promise<any>) | undefined;
|
|
85
|
+
onCancel?: (() => Promise<any>) | undefined;
|
|
86
|
+
component?: React.ReactNode;
|
|
87
|
+
addonBefore?: React.ReactNode;
|
|
88
|
+
addonAfter?: React.ReactNode;
|
|
89
|
+
okButtonProps?: {
|
|
90
|
+
disabled: boolean;
|
|
91
|
+
} | undefined;
|
|
92
|
+
cancelButtonProps?: {
|
|
93
|
+
disabled: boolean;
|
|
94
|
+
} | undefined;
|
|
66
95
|
loading: boolean;
|
|
67
|
-
open: boolean | undefined;
|
|
68
96
|
};
|
|
97
|
+
update(props: IDrawerProps): void;
|
|
69
98
|
cancel: () => void;
|
|
70
99
|
ok: () => void;
|
|
71
100
|
render(): JSX.Element;
|
package/lib/core/drawer/index.js
CHANGED
|
@@ -5,10 +5,7 @@ const timeout = 300;
|
|
|
5
5
|
export class Drawers extends React.Component {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
|
-
this.state = {
|
|
9
|
-
loading: false,
|
|
10
|
-
open: this.props.open
|
|
11
|
-
};
|
|
8
|
+
this.state = Object.assign({ loading: false }, this.props);
|
|
12
9
|
this.cancel = () => {
|
|
13
10
|
if (this.state.loading) {
|
|
14
11
|
return;
|
|
@@ -24,36 +21,39 @@ export class Drawers extends React.Component {
|
|
|
24
21
|
});
|
|
25
22
|
};
|
|
26
23
|
this.ok = () => {
|
|
27
|
-
this.setState({
|
|
24
|
+
this.setState(Object.assign({}, this.state, {
|
|
28
25
|
loading: true
|
|
29
|
-
});
|
|
26
|
+
}));
|
|
30
27
|
this.props.onOk &&
|
|
31
28
|
this.props
|
|
32
29
|
.onOk()
|
|
33
30
|
.then((res) => {
|
|
34
|
-
this.setState({
|
|
31
|
+
this.setState(Object.assign({}, this.state, {
|
|
35
32
|
loading: false,
|
|
36
33
|
open: false
|
|
37
|
-
});
|
|
34
|
+
}));
|
|
38
35
|
setTimeout(() => {
|
|
39
36
|
InjectNotification.removeNotice(this.props.id);
|
|
40
37
|
this.props.onOkAfter && this.props.onOkAfter(res);
|
|
41
38
|
}, timeout);
|
|
42
39
|
})
|
|
43
40
|
.catch(() => {
|
|
44
|
-
this.setState({
|
|
41
|
+
this.setState(Object.assign({}, this.state, {
|
|
45
42
|
loading: false
|
|
46
|
-
});
|
|
43
|
+
}));
|
|
47
44
|
});
|
|
48
45
|
};
|
|
49
46
|
}
|
|
47
|
+
update(props) {
|
|
48
|
+
this.setState(props);
|
|
49
|
+
}
|
|
50
50
|
render() {
|
|
51
51
|
// if (!this.props.visible) return null;
|
|
52
|
-
return (React.createElement(Drawer, { className: this.
|
|
53
|
-
this.
|
|
54
|
-
React.createElement(Button, Object.assign({}, this.
|
|
55
|
-
React.createElement(Button, Object.assign({}, this.
|
|
56
|
-
this.
|
|
52
|
+
return (React.createElement(Drawer, { className: this.state.className, placement: this.state.placement, height: this.state.height, open: this.state.open, destroyOnClose: true, maskClosable: this.state.maskClosable, keyboard: false, title: this.state.title, extra: this.state.extra === null ? null : this.state.extra ? (this.state.extra) : (React.createElement("div", { className: "tac" },
|
|
53
|
+
this.state.addonBefore ? this.state.addonBefore : null,
|
|
54
|
+
React.createElement(Button, Object.assign({}, this.state.cancelButtonProps, { className: "mr10", key: "back", onClick: this.cancel }), this.state.cancelText),
|
|
55
|
+
React.createElement(Button, Object.assign({}, this.state.okButtonProps, { danger: this.state.okDanger, key: "submit", type: this.state.okType, loading: this.state.loading, onClick: this.ok }), this.state.okText),
|
|
56
|
+
this.state.addonAfter ? this.state.addonAfter : null)), width: this.state.width, zIndex: this.state.zIndex, mask: this.state.mask, onClose: this.cancel, closable: this.state.closable }, this.props.component ? this.props.component : null));
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
Drawers.defaultProps = {
|
|
@@ -55,8 +55,7 @@ class InjectNotification extends React.Component {
|
|
|
55
55
|
const key = props.id;
|
|
56
56
|
const notice = notices.find(item => item.key === key);
|
|
57
57
|
if (notice) {
|
|
58
|
-
|
|
59
|
-
InjectNotification[key].forceUpdate();
|
|
58
|
+
InjectNotification[key].update(Object.assign({}, notice.props, props));
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
61
|
getNoticeList() {
|
|
@@ -3,13 +3,16 @@ interface ILoadingFCProps {
|
|
|
3
3
|
tip?: string;
|
|
4
4
|
id?: string;
|
|
5
5
|
key?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
6
7
|
}
|
|
7
|
-
export declare class LoadingFC extends React.Component<ILoadingFCProps> {
|
|
8
|
+
export declare class LoadingFC extends React.Component<ILoadingFCProps, ILoadingFCProps> {
|
|
8
9
|
static defaultProps: {
|
|
9
10
|
tip: string;
|
|
10
11
|
};
|
|
12
|
+
constructor(props: ILoadingFCProps);
|
|
11
13
|
maskStyle: React.CSSProperties;
|
|
12
14
|
alertStyle: React.CSSProperties;
|
|
15
|
+
update(props: ILoadingFCProps): void;
|
|
13
16
|
render(): JSX.Element;
|
|
14
17
|
}
|
|
15
18
|
declare const _default: {
|
|
@@ -3,8 +3,8 @@ import { Spin } from 'antd';
|
|
|
3
3
|
import InjectNotification from "../inject-notification";
|
|
4
4
|
const timeout = 300;
|
|
5
5
|
export class LoadingFC extends React.Component {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super(props);
|
|
8
8
|
this.maskStyle = {
|
|
9
9
|
position: 'fixed',
|
|
10
10
|
top: 0,
|
|
@@ -24,12 +24,16 @@ export class LoadingFC extends React.Component {
|
|
|
24
24
|
zIndex: 9002,
|
|
25
25
|
transform: 'translate(-50%, -70%)'
|
|
26
26
|
};
|
|
27
|
+
this.state = Object.assign({}, props);
|
|
28
|
+
}
|
|
29
|
+
update(props) {
|
|
30
|
+
this.setState(props);
|
|
27
31
|
}
|
|
28
32
|
render() {
|
|
29
33
|
return (React.createElement(React.Fragment, null,
|
|
30
34
|
React.createElement("div", { style: this.maskStyle }),
|
|
31
|
-
React.createElement("div", { style: this.alertStyle, className: 'ecoding-spin' },
|
|
32
|
-
React.createElement(Spin, { size: "large", tip: this.
|
|
35
|
+
React.createElement("div", { style: Object.assign({}, this.alertStyle, this.state.style), className: 'ecoding-spin' },
|
|
36
|
+
React.createElement(Spin, { size: "large", tip: this.state.tip, style: { width: 200 } }, " "))));
|
|
33
37
|
}
|
|
34
38
|
}
|
|
35
39
|
LoadingFC.defaultProps = {
|
|
@@ -4,7 +4,6 @@ export interface IModalProps {
|
|
|
4
4
|
id?: string;
|
|
5
5
|
className?: string;
|
|
6
6
|
open?: boolean;
|
|
7
|
-
bodyStyle?: React.CSSProperties;
|
|
8
7
|
width?: string | number;
|
|
9
8
|
zIndex?: number;
|
|
10
9
|
mask?: boolean;
|
|
@@ -56,8 +55,34 @@ export declare class Modals extends React.Component<IModalProps> {
|
|
|
56
55
|
component: null;
|
|
57
56
|
};
|
|
58
57
|
state: {
|
|
58
|
+
key?: string | undefined;
|
|
59
|
+
id?: string | undefined;
|
|
60
|
+
className?: string | undefined;
|
|
61
|
+
open?: boolean | undefined;
|
|
62
|
+
width?: string | number | undefined;
|
|
63
|
+
zIndex?: number | undefined;
|
|
64
|
+
mask?: boolean | undefined;
|
|
65
|
+
title?: React.ReactNode;
|
|
66
|
+
okDanger?: boolean | undefined;
|
|
67
|
+
okType?: "link" | "text" | "dashed" | "default" | "primary" | undefined;
|
|
68
|
+
okText?: string | undefined;
|
|
69
|
+
cancelText?: string | undefined;
|
|
70
|
+
closable?: boolean | undefined;
|
|
71
|
+
maskClosable?: boolean | undefined;
|
|
72
|
+
footer?: React.ReactNode;
|
|
73
|
+
onOk?: (() => Promise<any>) | undefined;
|
|
74
|
+
onOkAfter?: ((args: any) => void | Promise<any>) | undefined;
|
|
75
|
+
onCancel?: (() => Promise<any>) | undefined;
|
|
76
|
+
component?: React.ReactNode;
|
|
77
|
+
addonBefore?: React.ReactNode;
|
|
78
|
+
addonAfter?: React.ReactNode;
|
|
79
|
+
okButtonProps?: {
|
|
80
|
+
disabled: boolean;
|
|
81
|
+
} | undefined;
|
|
82
|
+
cancelButtonProps?: {
|
|
83
|
+
disabled: boolean;
|
|
84
|
+
} | undefined;
|
|
59
85
|
loading: boolean;
|
|
60
|
-
open: boolean | undefined;
|
|
61
86
|
};
|
|
62
87
|
cancel: () => void;
|
|
63
88
|
ok: () => void;
|
package/lib/core/modal/index.js
CHANGED
|
@@ -5,10 +5,7 @@ const timeout = 300;
|
|
|
5
5
|
export class Modals extends React.Component {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
|
-
this.state = {
|
|
9
|
-
loading: false,
|
|
10
|
-
open: this.props.open
|
|
11
|
-
};
|
|
8
|
+
this.state = Object.assign({ loading: false }, this.props);
|
|
12
9
|
this.cancel = () => {
|
|
13
10
|
if (this.state.loading) {
|
|
14
11
|
return;
|
|
@@ -24,36 +21,36 @@ export class Modals extends React.Component {
|
|
|
24
21
|
});
|
|
25
22
|
};
|
|
26
23
|
this.ok = () => {
|
|
27
|
-
this.setState({
|
|
24
|
+
this.setState(Object.assign({}, this.state, {
|
|
28
25
|
loading: true
|
|
29
|
-
});
|
|
26
|
+
}));
|
|
30
27
|
this.props.onOk &&
|
|
31
28
|
this.props
|
|
32
29
|
.onOk()
|
|
33
30
|
.then((res) => {
|
|
34
|
-
this.setState({
|
|
31
|
+
this.setState(Object.assign({}, this.state, {
|
|
35
32
|
loading: false,
|
|
36
33
|
open: false
|
|
37
|
-
});
|
|
34
|
+
}));
|
|
38
35
|
setTimeout(() => {
|
|
39
36
|
InjectNotification.removeNotice(this.props.id);
|
|
40
37
|
this.props.onOkAfter && this.props.onOkAfter(res);
|
|
41
38
|
}, timeout);
|
|
42
39
|
})
|
|
43
40
|
.catch(() => {
|
|
44
|
-
this.setState({
|
|
41
|
+
this.setState(Object.assign({}, this.state, {
|
|
45
42
|
loading: false
|
|
46
|
-
});
|
|
43
|
+
}));
|
|
47
44
|
});
|
|
48
45
|
};
|
|
49
46
|
}
|
|
50
47
|
render() {
|
|
51
48
|
// if (!this.props.visible) return null;
|
|
52
|
-
return (React.createElement(Modal, { className: this.
|
|
53
|
-
this.
|
|
54
|
-
React.createElement(Button, Object.assign({}, this.
|
|
55
|
-
React.createElement(Button, Object.assign({}, this.
|
|
56
|
-
this.
|
|
49
|
+
return (React.createElement(Modal, { className: this.state.className, open: this.state.open, width: this.state.width, zIndex: this.state.zIndex, mask: this.state.mask, title: typeof this.state.title === "string" ? (React.createElement("div", { style: { boxShadow: "inset 0px -1px 0px #F0F0F0", marginBottom: "20px", paddingBottom: "12px" } }, this.state.title)) : (this.state.title), closable: this.state.closable, maskClosable: this.state.maskClosable, onCancel: this.cancel, destroyOnClose: true, keyboard: false, footer: this.state.footer === null ? null : this.state.footer ? (this.state.footer) : (React.createElement(React.Fragment, null,
|
|
50
|
+
this.state.addonBefore ? this.state.addonBefore : null,
|
|
51
|
+
React.createElement(Button, Object.assign({}, this.state.cancelButtonProps, { key: "back", onClick: this.cancel }), this.state.cancelText),
|
|
52
|
+
React.createElement(Button, Object.assign({}, this.state.okButtonProps, { danger: this.state.okDanger, key: "submit", type: this.state.okType, loading: this.state.loading, onClick: this.ok }), this.state.okText),
|
|
53
|
+
this.state.addonAfter ? this.state.addonAfter : null)) }, this.props.component ? this.props.component : null));
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
56
|
Modals.defaultProps = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecoding/components.antd",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.32",
|
|
4
4
|
"author": "cxc",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"antd": "^5.8.4",
|
|
44
44
|
"axios": "^1.1.2"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "91de23836af8423f200834bdd68cf7b77a2a0424"
|
|
47
47
|
}
|