@ecoding/components.antd 0.3.24 → 0.3.26
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
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);
|
|
@@ -16,10 +16,13 @@ interface IProps {
|
|
|
16
16
|
i18n?: any;
|
|
17
17
|
hideOperation?: boolean;
|
|
18
18
|
hideBottom?: boolean;
|
|
19
|
+
afterRemove?: (index: any) => void;
|
|
20
|
+
afterAdd?: (index: any) => void;
|
|
19
21
|
operation?: {
|
|
20
22
|
width?: number;
|
|
21
|
-
|
|
22
|
-
title
|
|
23
|
+
render?: (field: FormListFieldData, index: number) => React.ReactNode;
|
|
24
|
+
title?: string;
|
|
25
|
+
hideRemove?: boolean;
|
|
23
26
|
};
|
|
24
27
|
}
|
|
25
28
|
declare const C: React.FC<IProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
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
|
-
const C = ({ columns, rules, name, hideOperation, hideBottom, operation, i18n }) => {
|
|
4
|
+
const C = ({ columns, rules, name, hideOperation, hideBottom, operation, i18n, afterRemove, afterAdd }) => {
|
|
5
5
|
const tdStyle = {
|
|
6
6
|
verticalAlign: 'top',
|
|
7
7
|
lineHeight: '32px',
|
|
@@ -28,33 +28,47 @@ const C = ({ columns, rules, name, hideOperation, hideBottom, operation, i18n })
|
|
|
28
28
|
}
|
|
29
29
|
return w;
|
|
30
30
|
}, []);
|
|
31
|
-
return (React.createElement(Form.List, { name: name, rules: rules || [] }, (fields, { add, remove }, { errors }) =>
|
|
32
|
-
React.createElement(
|
|
33
|
-
React.createElement("
|
|
34
|
-
React.createElement("
|
|
35
|
-
React.createElement("
|
|
36
|
-
React.createElement("
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
React.createElement("
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
React.createElement("
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
React.createElement(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
React.createElement(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
31
|
+
return (React.createElement(Form.List, { name: name, rules: rules || [] }, (fields, { add, remove }, { errors }) => {
|
|
32
|
+
return (React.createElement(React.Fragment, null,
|
|
33
|
+
React.createElement("div", { className: "m-form-list", style: { overflowX: 'auto', marginBottom: '4px', paddingBottom: '12px', position: 'relative' } },
|
|
34
|
+
React.createElement("table", { style: { width: widths } },
|
|
35
|
+
React.createElement("thead", null,
|
|
36
|
+
React.createElement("tr", null,
|
|
37
|
+
React.createElement("th", { style: Object.assign({}, thStyle, { width: '60px' }) }, i18n ? i18n.$t("global.num", "序号") : "序号"),
|
|
38
|
+
columns.map((column, i) => {
|
|
39
|
+
if (column.require) {
|
|
40
|
+
return (React.createElement("th", { style: Object.assign({}, thStyle, { width: column.width || 200 }) },
|
|
41
|
+
React.createElement("span", { style: { color: '#ff4d4f' } }, "*"),
|
|
42
|
+
" ",
|
|
43
|
+
column.title));
|
|
44
|
+
}
|
|
45
|
+
return React.createElement("th", { style: Object.assign({}, thStyle, { width: column.width || 200 }) }, column.title);
|
|
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", "操作") : "操作")))),
|
|
48
|
+
React.createElement("tbody", null, fields.map((field, index) => {
|
|
49
|
+
return (React.createElement("tr", { style: trStyle },
|
|
50
|
+
React.createElement("td", { style: tdStyle }, index + 1),
|
|
51
|
+
columns.map((column, i) => {
|
|
52
|
+
return (React.createElement("td", { style: tdStyle },
|
|
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
|
+
}),
|
|
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" }) },
|
|
62
|
+
React.createElement(Typography.Text, { style: { cursor: 'pointer' }, type: "danger", onClick: () => {
|
|
63
|
+
remove(field.name);
|
|
64
|
+
afterRemove && afterRemove(field.name);
|
|
65
|
+
} }, i18n ? i18n.$t("global.del", '删除') : '删除')))));
|
|
66
|
+
})))),
|
|
67
|
+
hideBottom ? null : (React.createElement("div", null,
|
|
68
|
+
React.createElement(Button, { icon: React.createElement(PlusCircleOutlined, null), type: "dashed", onClick: () => {
|
|
69
|
+
add();
|
|
70
|
+
afterAdd && afterAdd(fields.length);
|
|
71
|
+
} }, i18n ? i18n.$t("global.add", "添加") : "添加")))));
|
|
72
|
+
}));
|
|
59
73
|
};
|
|
60
74
|
export default C;
|
|
@@ -24,17 +24,19 @@ const LoadingFC = (props) => {
|
|
|
24
24
|
};
|
|
25
25
|
return (React.createElement(React.Fragment, null,
|
|
26
26
|
React.createElement("div", { style: maskStyle }),
|
|
27
|
-
React.createElement("div", { style: alertStyle },
|
|
28
|
-
React.createElement(Spin, { size: "large", tip: props.tip }))));
|
|
27
|
+
React.createElement("div", { style: alertStyle, className: 'ecoding-spin' },
|
|
28
|
+
React.createElement(Spin, { size: "large", tip: props.tip }, " "))));
|
|
29
29
|
};
|
|
30
30
|
LoadingFC.defaultProps = {
|
|
31
31
|
tip: ''
|
|
32
32
|
};
|
|
33
33
|
export default {
|
|
34
34
|
show(props = {}) {
|
|
35
|
-
|
|
35
|
+
props.id = props.id || props.key || "loading";
|
|
36
|
+
notification.notice(React.createElement(LoadingFC, Object.assign({}, props, { key: props.id })));
|
|
36
37
|
},
|
|
37
38
|
hide(props = {}) {
|
|
38
|
-
|
|
39
|
+
props.id = props.id || props.key || "loading";
|
|
40
|
+
notification.removeNotice(props.id);
|
|
39
41
|
}
|
|
40
42
|
};
|
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.26",
|
|
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": "44a35846bf5d22c709e5eba2784d27ba081be374"
|
|
47
47
|
}
|