@ecoding/components.antd 0.3.25 → 0.3.27
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.js +1 -1
- package/lib/core/form.list/index.d.ts +3 -2
- package/lib/core/form.list/index.js +9 -3
- package/lib/core/inject-notification/index.js +2 -4
- package/lib/core/loading/index.d.ts +12 -0
- package/lib/core/loading/index.js +42 -29
- package/lib/core/modal/index.js +1 -1
- package/package.json +2 -2
package/lib/core/drawer/index.js
CHANGED
|
@@ -107,7 +107,7 @@ export default {
|
|
|
107
107
|
hide(props = {}) {
|
|
108
108
|
props.open = false;
|
|
109
109
|
props.footer = "";
|
|
110
|
-
props.id = props.id || "drawers";
|
|
110
|
+
props.id = props.id || props.key || "drawers";
|
|
111
111
|
setTimeout(() => {
|
|
112
112
|
InjectNotification.removeNotice(props.id);
|
|
113
113
|
}, timeout);
|
|
@@ -20,8 +20,9 @@ interface IProps {
|
|
|
20
20
|
afterAdd?: (index: any) => void;
|
|
21
21
|
operation?: {
|
|
22
22
|
width?: number;
|
|
23
|
-
|
|
24
|
-
title
|
|
23
|
+
render?: (field: FormListFieldData, index: number) => React.ReactNode;
|
|
24
|
+
title?: string;
|
|
25
|
+
hideRemove?: boolean;
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
28
|
declare const C: React.FC<IProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
-
import { Typography, Form, Button } from 'antd';
|
|
2
|
+
import { Typography, Form, Button, Space } from 'antd';
|
|
3
3
|
import { PlusCircleOutlined } from '@ant-design/icons';
|
|
4
4
|
const C = ({ columns, rules, name, hideOperation, hideBottom, operation, i18n, afterRemove, afterAdd }) => {
|
|
5
5
|
const tdStyle = {
|
|
@@ -44,7 +44,7 @@ const C = ({ columns, rules, name, hideOperation, hideBottom, operation, i18n, a
|
|
|
44
44
|
}
|
|
45
45
|
return React.createElement("th", { style: Object.assign({}, thStyle, { width: column.width || 200 }) }, column.title);
|
|
46
46
|
}),
|
|
47
|
-
hideOperation ? null : operation ? (React.createElement("th", { style: Object.assign({}, thStyle, { width: operation.width || 150, right: 0, position: "sticky" }) }, operation.title)) : (React.createElement("th", { style: Object.assign({}, thStyle, { width: 150, right: 0, position: "sticky" }) }, i18n ? i18n.$t("global.operation", "操作") : "操作")))),
|
|
47
|
+
hideOperation ? null : operation ? (React.createElement("th", { style: Object.assign({}, thStyle, { width: operation.width || 150, right: 0, position: "sticky" }) }, operation.title || "操作")) : (React.createElement("th", { style: Object.assign({}, thStyle, { width: 150, right: 0, position: "sticky" }) }, i18n ? i18n.$t("global.operation", "操作") : "操作")))),
|
|
48
48
|
React.createElement("tbody", null, fields.map((field, index) => {
|
|
49
49
|
return (React.createElement("tr", { style: trStyle },
|
|
50
50
|
React.createElement("td", { style: tdStyle }, index + 1),
|
|
@@ -52,7 +52,13 @@ const C = ({ columns, rules, name, hideOperation, hideBottom, operation, i18n, a
|
|
|
52
52
|
return (React.createElement("td", { style: tdStyle },
|
|
53
53
|
React.createElement(Form.Item, { style: { marginBottom: 0 }, tooltip: column.tooltip || undefined, name: [field.name, column.name], rules: column.rules || [] }, column.render(field, index))));
|
|
54
54
|
}),
|
|
55
|
-
hideOperation ? null : operation ? (React.createElement("td", { style: Object.assign({}, tdStyle, { right: 0, position: "sticky", backgroundColor: "#fff" }) },
|
|
55
|
+
hideOperation ? null : operation ? (React.createElement("td", { style: Object.assign({}, tdStyle, { right: 0, position: "sticky", backgroundColor: "#fff" }) },
|
|
56
|
+
React.createElement(Space, null,
|
|
57
|
+
operation.render && operation.render(field, index),
|
|
58
|
+
operation.hideRemove ? null : (React.createElement(Typography.Text, { style: { cursor: 'pointer' }, type: "danger", onClick: () => {
|
|
59
|
+
remove(field.name);
|
|
60
|
+
afterRemove && afterRemove(field.name);
|
|
61
|
+
} }, i18n ? i18n.$t("global.del", '删除') : '删除'))))) : (React.createElement("td", { style: Object.assign({}, tdStyle, { right: 0, position: "sticky", backgroundColor: "#fff" }) },
|
|
56
62
|
React.createElement(Typography.Text, { style: { cursor: 'pointer' }, type: "danger", onClick: () => {
|
|
57
63
|
remove(field.name);
|
|
58
64
|
afterRemove && afterRemove(field.name);
|
|
@@ -53,10 +53,8 @@ class InjectNotification extends React.Component {
|
|
|
53
53
|
update(props) {
|
|
54
54
|
const { notices } = this.state;
|
|
55
55
|
const key = props.id;
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
if (temp && temp.length > 0) {
|
|
59
|
-
const notice = temp[0];
|
|
56
|
+
const notice = notices.find(item => item.key === key);
|
|
57
|
+
if (notice) {
|
|
60
58
|
notice.props = Object.assign(notice.props, props);
|
|
61
59
|
InjectNotification[key].forceUpdate();
|
|
62
60
|
}
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
interface ILoadingFCProps {
|
|
2
3
|
tip?: string;
|
|
4
|
+
id?: string;
|
|
5
|
+
key?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class LoadingFC extends React.Component<ILoadingFCProps> {
|
|
8
|
+
static defaultProps: {
|
|
9
|
+
tip: string;
|
|
10
|
+
};
|
|
11
|
+
maskStyle: React.CSSProperties;
|
|
12
|
+
alertStyle: React.CSSProperties;
|
|
13
|
+
render(): JSX.Element;
|
|
3
14
|
}
|
|
4
15
|
declare const _default: {
|
|
5
16
|
show(props?: ILoadingFCProps): void;
|
|
17
|
+
update(props?: ILoadingFCProps): void;
|
|
6
18
|
hide(props?: ILoadingFCProps): void;
|
|
7
19
|
};
|
|
8
20
|
export default _default;
|
|
@@ -1,40 +1,53 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Spin } from 'antd';
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
3
|
+
import InjectNotification from "../inject-notification";
|
|
4
|
+
const timeout = 300;
|
|
5
|
+
export class LoadingFC extends React.Component {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.maskStyle = {
|
|
9
|
+
position: 'fixed',
|
|
10
|
+
top: 0,
|
|
11
|
+
right: 0,
|
|
12
|
+
bottom: 0,
|
|
13
|
+
left: 0,
|
|
14
|
+
zIndex: 9001,
|
|
15
|
+
backgroundColor: '#fff',
|
|
16
|
+
height: '100%',
|
|
17
|
+
opacity: 0.45
|
|
18
|
+
};
|
|
19
|
+
this.alertStyle = {
|
|
20
|
+
position: 'fixed',
|
|
21
|
+
top: '50%',
|
|
22
|
+
left: '50%',
|
|
23
|
+
maxWidth: 340,
|
|
24
|
+
zIndex: 9002,
|
|
25
|
+
transform: 'translate(-50%, -70%)'
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
render() {
|
|
29
|
+
return (React.createElement(React.Fragment, null,
|
|
30
|
+
React.createElement("div", { style: this.maskStyle }),
|
|
31
|
+
React.createElement("div", { style: this.alertStyle, className: 'ecoding-spin' },
|
|
32
|
+
React.createElement(Spin, { size: "large", tip: this.props.tip }, " "))));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
30
35
|
LoadingFC.defaultProps = {
|
|
31
36
|
tip: ''
|
|
32
37
|
};
|
|
33
38
|
export default {
|
|
34
39
|
show(props = {}) {
|
|
35
|
-
|
|
40
|
+
props.id = props.id || props.key || "loading";
|
|
41
|
+
InjectNotification.notice(React.createElement(LoadingFC, Object.assign({}, props, { key: props.id, ref: ref => InjectNotification[props.id] = ref })));
|
|
42
|
+
},
|
|
43
|
+
update(props = {}) {
|
|
44
|
+
props.id = props.id || props.key || "loading";
|
|
45
|
+
InjectNotification.updateNotice(props);
|
|
36
46
|
},
|
|
37
47
|
hide(props = {}) {
|
|
38
|
-
|
|
48
|
+
props.id = props.id || props.key || "loading";
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
InjectNotification.removeNotice(props.id);
|
|
51
|
+
}, timeout);
|
|
39
52
|
}
|
|
40
53
|
};
|
package/lib/core/modal/index.js
CHANGED
|
@@ -104,7 +104,7 @@ export default {
|
|
|
104
104
|
hide(props = {}) {
|
|
105
105
|
props.open = false;
|
|
106
106
|
props.footer = "";
|
|
107
|
-
props.id = props.id || "modals";
|
|
107
|
+
props.id = props.id || props.key || "modals";
|
|
108
108
|
setTimeout(() => {
|
|
109
109
|
InjectNotification.removeNotice(props.id);
|
|
110
110
|
}, timeout);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecoding/components.antd",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.27",
|
|
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": "571168c21c039e8eed8da932957c8b567fa22abb"
|
|
47
47
|
}
|