@ecoding/components.antd 0.3.23 → 0.3.25
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,7 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { Typography, Form, Button } 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,41 @@ 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" }) }, operation.component)) : (React.createElement("td", { style: Object.assign({}, tdStyle, { right: 0, position: "sticky", backgroundColor: "#fff" }) },
|
|
56
|
+
React.createElement(Typography.Text, { style: { cursor: 'pointer' }, type: "danger", onClick: () => {
|
|
57
|
+
remove(field.name);
|
|
58
|
+
afterRemove && afterRemove(field.name);
|
|
59
|
+
} }, i18n ? i18n.$t("global.del", '删除') : '删除')))));
|
|
60
|
+
})))),
|
|
61
|
+
hideBottom ? null : (React.createElement("div", null,
|
|
62
|
+
React.createElement(Button, { icon: React.createElement(PlusCircleOutlined, null), type: "dashed", onClick: () => {
|
|
63
|
+
add();
|
|
64
|
+
afterAdd && afterAdd(fields.length);
|
|
65
|
+
} }, i18n ? i18n.$t("global.add", "添加") : "添加")))));
|
|
66
|
+
}));
|
|
59
67
|
};
|
|
60
68
|
export default C;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { FilterValue, SorterResult, TableCurrentDataSource, TablePaginationConfig } from 'antd/lib/table/interface';
|
|
2
3
|
interface IProps {
|
|
3
4
|
className?: string;
|
|
4
5
|
header?: React.ReactNode;
|
|
@@ -13,6 +14,7 @@ interface IProps {
|
|
|
13
14
|
operationColumn?: any[];
|
|
14
15
|
pagination?: any;
|
|
15
16
|
offsetY?: number;
|
|
17
|
+
onChange?: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<any> | SorterResult<any>[], extra: TableCurrentDataSource<any>) => void;
|
|
16
18
|
filterTitle?: string;
|
|
17
19
|
columnsTitle?: string;
|
|
18
20
|
selectType?: "checkbox" | "radio";
|
|
@@ -2,7 +2,7 @@ import React, { memo, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
2
2
|
import { Popover, Button, Typography, Table } from 'antd';
|
|
3
3
|
import { FilterOutlined, MenuOutlined } from '@ant-design/icons';
|
|
4
4
|
import TableProColumns from "./columns";
|
|
5
|
-
const TablePro = memo(({ className, header, buttonArea, filterArea, searchInputArea, loading, rowKey, dataSource, pagination, offsetY, columns, operationColumn, bordered, selectChangeHandler, selectType, columnsTitle, filterTitle }) => {
|
|
5
|
+
const TablePro = memo(({ className, header, buttonArea, filterArea, searchInputArea, loading, rowKey, dataSource, pagination, offsetY, columns, operationColumn, bordered, selectChangeHandler, selectType, onChange, columnsTitle, filterTitle }) => {
|
|
6
6
|
const ref = useRef(null);
|
|
7
7
|
const disColumnRef = useRef([]);
|
|
8
8
|
const [y, setY] = useState('100%');
|
|
@@ -85,7 +85,7 @@ const TablePro = memo(({ className, header, buttonArea, filterArea, searchInputA
|
|
|
85
85
|
} },
|
|
86
86
|
React.createElement(Button, { type: "text", icon: React.createElement(MenuOutlined, null) }, columnsTitle))) : null)),
|
|
87
87
|
dataSource ? (React.createElement("div", { style: { height: '100%', overflow: 'hidden' }, ref: ref },
|
|
88
|
-
React.createElement(Table, { rowSelection: selectType ? rowSelection : undefined, bordered: bordered, rowKey: rowKey, columns: showColumns, dataSource: dataSource, scroll: { y }, loading: loading, pagination: pagination || false }))) : null));
|
|
88
|
+
React.createElement(Table, { rowSelection: selectType ? rowSelection : undefined, bordered: bordered, rowKey: rowKey, columns: showColumns, dataSource: dataSource, scroll: { y }, loading: loading, pagination: pagination || false, onChange: onChange || undefined }))) : null));
|
|
89
89
|
});
|
|
90
90
|
TablePro.defaultProps = {
|
|
91
91
|
filterTitle: "筛选",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecoding/components.antd",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.25",
|
|
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": "098eed4b9537a6bec1dde382cb25cac39f299356"
|
|
47
47
|
}
|
package/LICENSE.md
DELETED
|
File without changes
|