@ecoding/components.antd 0.3.47 → 0.3.48
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.
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
1
|
+
import React, { useMemo, useRef } from 'react';
|
|
2
2
|
import { Typography, Form, Button, Space, Tooltip } from 'antd';
|
|
3
3
|
import { PlusCircleOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
|
4
|
-
const C = ({ columns, rules, name, hideOperation, hideHeader, hideBottom, operation, i18n, afterRemove, afterAdd }) => {
|
|
4
|
+
const C = ({ columns, rules, tStyle, name, hideOperation, hideHeader, hideBottom, operation, i18n, afterRemove, afterAdd }) => {
|
|
5
|
+
const tbodyRef = useRef(null);
|
|
5
6
|
const tdStyle = {
|
|
6
7
|
verticalAlign: 'top',
|
|
7
8
|
lineHeight: '32px',
|
|
@@ -10,7 +11,10 @@ const C = ({ columns, rules, name, hideOperation, hideHeader, hideBottom, operat
|
|
|
10
11
|
const thStyle = {
|
|
11
12
|
textAlign: 'left',
|
|
12
13
|
backgroundColor: '#fafafa',
|
|
13
|
-
padding: '8px'
|
|
14
|
+
padding: '8px',
|
|
15
|
+
position: "sticky",
|
|
16
|
+
top: 0,
|
|
17
|
+
zIndex: 1
|
|
14
18
|
};
|
|
15
19
|
const trStyle = {
|
|
16
20
|
borderBottom: '1px solid #eee'
|
|
@@ -29,25 +33,31 @@ const C = ({ columns, rules, name, hideOperation, hideHeader, hideBottom, operat
|
|
|
29
33
|
return w;
|
|
30
34
|
}, []);
|
|
31
35
|
return (React.createElement(Form.List, { name: name, rules: rules || [] }, (fields, { add, remove }, { errors }) => {
|
|
32
|
-
return (React.createElement(
|
|
33
|
-
React.createElement("div", { className: "m-form-list", style: {
|
|
36
|
+
return (React.createElement("div", { className: 'm-form-list' },
|
|
37
|
+
React.createElement("div", { ref: tbodyRef, className: "m-form-list-table", style: Object.assign({}, { marginBottom: '4px', paddingBottom: '12px', overflow: "auto", position: 'relative' }, tStyle) },
|
|
34
38
|
React.createElement("table", { style: { width: widths } },
|
|
39
|
+
React.createElement("colgroup", null,
|
|
40
|
+
React.createElement("col", { style: Object.assign({}, { width: 60 }) }),
|
|
41
|
+
columns.map((column) => {
|
|
42
|
+
return (React.createElement("col", { style: Object.assign({}, { width: column.width || 200 }) }));
|
|
43
|
+
}),
|
|
44
|
+
hideOperation ? null : (React.createElement("col", { style: Object.assign({}, { width: (operation === null || operation === void 0 ? void 0 : operation.width) || 150 }) }))),
|
|
35
45
|
React.createElement("thead", null, hideHeader ? null : (React.createElement("tr", null,
|
|
36
|
-
React.createElement("th", { style:
|
|
46
|
+
React.createElement("th", { style: thStyle }, i18n ? i18n.$t("global.num", "序号") : "序号"),
|
|
37
47
|
columns.map((column, i) => {
|
|
38
48
|
if (column.require) {
|
|
39
|
-
return (React.createElement("th", { style:
|
|
49
|
+
return (React.createElement("th", { style: thStyle },
|
|
40
50
|
React.createElement("span", { style: { color: '#ff4d4f' } }, "*"),
|
|
41
51
|
column.title,
|
|
42
52
|
column.tooltip ? (React.createElement(Tooltip, { placement: "top", title: column.tooltip || undefined },
|
|
43
53
|
React.createElement(QuestionCircleOutlined, { style: { paddingLeft: 4, color: "rgba(0, 0, 0, 0.45)" } }))) : null));
|
|
44
54
|
}
|
|
45
|
-
return (React.createElement("th", { style:
|
|
55
|
+
return (React.createElement("th", { style: thStyle },
|
|
46
56
|
column.title,
|
|
47
57
|
column.tooltip ? (React.createElement(Tooltip, { placement: "top", title: column.tooltip || undefined },
|
|
48
58
|
React.createElement(QuestionCircleOutlined, { style: { paddingLeft: 4, color: "rgba(0, 0, 0, 0.45)" } }))) : null));
|
|
49
59
|
}),
|
|
50
|
-
hideOperation ? null : operation ? (React.createElement("th", { style: Object.assign({}, thStyle, {
|
|
60
|
+
hideOperation ? null : operation ? (React.createElement("th", { style: Object.assign({}, thStyle, { right: 0 }) }, operation.title || "操作")) : (React.createElement("th", { style: Object.assign({}, thStyle, { right: 0 }) }, i18n ? i18n.$t("global.operation", "操作") : "操作"))))),
|
|
51
61
|
React.createElement("tbody", null, fields.map((field, index) => {
|
|
52
62
|
return (React.createElement("tr", { style: trStyle },
|
|
53
63
|
React.createElement("td", { style: tdStyle }, index + 1),
|
|
@@ -70,6 +80,9 @@ const C = ({ columns, rules, name, hideOperation, hideHeader, hideBottom, operat
|
|
|
70
80
|
hideBottom ? null : (React.createElement("div", null,
|
|
71
81
|
React.createElement(Button, { icon: React.createElement(PlusCircleOutlined, null), type: "dashed", onClick: () => {
|
|
72
82
|
add();
|
|
83
|
+
setTimeout(() => {
|
|
84
|
+
tbodyRef.current.scrollTop = tbodyRef.current.scrollHeight;
|
|
85
|
+
}, 10);
|
|
73
86
|
afterAdd && afterAdd(fields.length);
|
|
74
87
|
} }, i18n ? i18n.$t("global.add", "添加") : "添加")))));
|
|
75
88
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecoding/components.antd",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.48",
|
|
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": "8cba1e5d0bc72933d15c1f9b53343fbdbbb234b8"
|
|
47
47
|
}
|