ztxkui 3.0.13 → 3.0.16
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/dist/App.js +3 -0
- package/dist/Demo.js +6 -3
- package/dist/DemoCom/FormDemo.js +1 -1
- package/dist/DemoCom/TableDemo.js +7 -1
- package/dist/components/EnhanceSelect/index.js +2 -4
- package/dist/components/Table/table-summary.d.ts +1 -0
- package/dist/components/Table/table.js +11 -2
- package/dist/components/Table/utils/getSummaryData.d.ts +2 -0
- package/dist/components/Table/utils/getSummaryData.js +15 -1
- package/dist/components/business/SearchContainer/search-item.js +3 -3
- package/package.json +2 -1
package/dist/App.js
CHANGED
package/dist/Demo.js
CHANGED
|
@@ -16,6 +16,7 @@ function Demo() {
|
|
|
16
16
|
var _a = useState([]), list = _a[0], setList = _a[1];
|
|
17
17
|
var _b = useState([]), setDefaultList = _b[1];
|
|
18
18
|
var _c = useState(), value = _c[0], setValue = _c[1];
|
|
19
|
+
var _d = useState(0), selectVal = _d[0], setSelectVal = _d[1];
|
|
19
20
|
var params = useState({
|
|
20
21
|
tenantId: '000000',
|
|
21
22
|
isCreateUser: 0,
|
|
@@ -25,7 +26,7 @@ function Demo() {
|
|
|
25
26
|
var timeoutId = setTimeout(function () {
|
|
26
27
|
console.log('获取数据');
|
|
27
28
|
setList(new Array(10000).fill(1).map(function (item, index) { return ({
|
|
28
|
-
id: index
|
|
29
|
+
id: index,
|
|
29
30
|
name: '你好' + index,
|
|
30
31
|
test1: 'test1' + index,
|
|
31
32
|
test2: 'test2' + index,
|
|
@@ -50,12 +51,14 @@ function Demo() {
|
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
}, []);
|
|
54
|
+
console.log(list);
|
|
53
55
|
return (React.createElement("div", { style: { height: 2000 } },
|
|
54
56
|
React.createElement(Link, { to: "/test" }, "test"),
|
|
55
57
|
React.createElement("h1", null, "\u4F5C\u4E3A\u6F14\u793A\u4F7F\u7528"),
|
|
56
58
|
React.createElement("h2", null, "\u5982\u679C\u6570\u636E\u662F\u901A\u8FC7\u5916\u90E8\u83B7\u53D6\u7684\uFF0C\u53EF\u4EE5\u901A\u8FC7\u4F20\u9012list\u5C5E\u6027"),
|
|
57
|
-
React.createElement(EnhanceSelect, { style: selectStyle, list: list, showAll: true, joinKey: "test1", lineFeedKey: "test1", onChange: function (value, option, fullData) {
|
|
58
|
-
console.log(value, option, fullData);
|
|
59
|
+
React.createElement(EnhanceSelect, { style: selectStyle, list: list, showAll: true, joinKey: "test1", lineFeedKey: "test1", value: selectVal, onChange: function (value, option, fullData) {
|
|
60
|
+
console.log(typeof value, option, fullData);
|
|
61
|
+
setSelectVal(value);
|
|
59
62
|
} }),
|
|
60
63
|
React.createElement(EnhanceSelect, { style: selectStyle, list: list, joinKey: "test1", showAll: true, onChange: function (value, option, fullData) {
|
|
61
64
|
console.log(value, option, fullData);
|
package/dist/DemoCom/FormDemo.js
CHANGED
|
@@ -147,7 +147,7 @@ var FormDemo = function () {
|
|
|
147
147
|
React.createElement(Select, null)),
|
|
148
148
|
React.createElement(SearchItem, { name: "type4", width: "half", noLabel: true },
|
|
149
149
|
React.createElement(Select, null)),
|
|
150
|
-
React.createElement(SearchItem, { name: "type4", width: "
|
|
150
|
+
React.createElement(SearchItem, { name: "type4", width: "half", label: "\u4F60\u597D" },
|
|
151
151
|
React.createElement(Select, null))))),
|
|
152
152
|
React.createElement("button", { onClick: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
153
153
|
var err_1, errorFields;
|
|
@@ -33,7 +33,7 @@ function useGetTableRecords() {
|
|
|
33
33
|
var newItem = {
|
|
34
34
|
id: "" + (index + 1),
|
|
35
35
|
test1: index + 1 + "-test1",
|
|
36
|
-
test2: index
|
|
36
|
+
test2: index,
|
|
37
37
|
test3: index + 1 + "-test3",
|
|
38
38
|
materialId: 1,
|
|
39
39
|
// brand: '123',
|
|
@@ -525,6 +525,12 @@ var TableDemo = function () {
|
|
|
525
525
|
width: 120,
|
|
526
526
|
dataIndex: 'test2',
|
|
527
527
|
key: 'test2',
|
|
528
|
+
sorter: {
|
|
529
|
+
compare: function (a, b) {
|
|
530
|
+
console.log(a, b);
|
|
531
|
+
return a.test2 - b.test2;
|
|
532
|
+
},
|
|
533
|
+
},
|
|
528
534
|
},
|
|
529
535
|
{
|
|
530
536
|
title: '编辑字段1',
|
|
@@ -426,7 +426,7 @@ function EnhanceSelect(_a) {
|
|
|
426
426
|
Array.isArray(selectList) &&
|
|
427
427
|
concatData(concatData(selectList, _defaultList), multipleList).map(function (item) {
|
|
428
428
|
var key = componentKey ? item[componentKey] : item[dataKey];
|
|
429
|
-
var value = item[dataKey]
|
|
429
|
+
var value = item[dataKey];
|
|
430
430
|
var title = item[titleKey];
|
|
431
431
|
var joinTitle = [];
|
|
432
432
|
var linefeedTitle = [];
|
|
@@ -551,8 +551,6 @@ function EnhanceSelect(_a) {
|
|
|
551
551
|
};
|
|
552
552
|
return (React.createElement(Select, __assign({ defaultValue: showAll ? '' : undefined, allowClear: true, showSearch: true, filterOption: remoteSearch ? false : filterOptionHandle, onSearch: remoteSearch ? onSearchHandle : onSearch, onChange: onChangeHandle, optionLabelProp: "title", loading: loading, onFocus: onFocusHandle, onBlur: onBlurHandle, onClear: onClearHandle, onSelect: onSelectHandle, onClick: onClickHandle,
|
|
553
553
|
// getPopupContainer={(trigger) => trigger || document.body}
|
|
554
|
-
open: isOpen }, restProps, {
|
|
555
|
-
? restProps.value
|
|
556
|
-
: (restProps.value + ''), disabled: remoteSearch ? restProps.disabled : loading || restProps.disabled }), renderSelectOption()));
|
|
554
|
+
open: isOpen }, restProps, { disabled: remoteSearch ? restProps.disabled : loading || restProps.disabled }), renderSelectOption()));
|
|
557
555
|
}
|
|
558
556
|
export default memo(EnhanceSelect);
|
|
@@ -162,16 +162,25 @@ function Table(props) {
|
|
|
162
162
|
? function (pageData) {
|
|
163
163
|
var summaryData = getSummaryData(summaryConfig, pageData, newColumns, props.rowSelection ? true : false);
|
|
164
164
|
return (React.createElement(AntTable.Summary, { fixed: summaryFixed }, summaryData.map(function (summary) {
|
|
165
|
-
var title = summary.title, key = summary.key, titleIndex = summary.titleIndex, list = summary.list;
|
|
165
|
+
var title = summary.title, key = summary.key, titleIndex = summary.titleIndex, list = summary.list, columnList = summary.columnList, onClickHandle = summary.onClickHandle;
|
|
166
166
|
return (React.createElement(AntTable.Summary.Row, { key: key }, Array.isArray(list) &&
|
|
167
167
|
list.map(function (item, index) {
|
|
168
|
+
var data = {
|
|
169
|
+
index: index,
|
|
170
|
+
column: Array.isArray(columnList)
|
|
171
|
+
? columnList[index]
|
|
172
|
+
: null,
|
|
173
|
+
num: item,
|
|
174
|
+
};
|
|
168
175
|
if (titleIndex === index) {
|
|
169
|
-
return (React.createElement(AntTable.Summary.Cell, { key: index, index: index }, title));
|
|
176
|
+
return (React.createElement(AntTable.Summary.Cell, { key: index, index: index }, onClickHandle ? (React.createElement("div", { onClick: function () { return onClickHandle === null || onClickHandle === void 0 ? void 0 : onClickHandle(data); } }, title)) : (title)));
|
|
170
177
|
}
|
|
171
178
|
else {
|
|
172
179
|
return (React.createElement(AntTable.Summary.Cell, { key: index, index: index },
|
|
173
180
|
React.createElement("div", { style: {
|
|
174
181
|
color: '#ff6666',
|
|
182
|
+
}, onClick: function () {
|
|
183
|
+
return onClickHandle && (onClickHandle === null || onClickHandle === void 0 ? void 0 : onClickHandle(data));
|
|
175
184
|
} }, item)));
|
|
176
185
|
}
|
|
177
186
|
})));
|
|
@@ -17,7 +17,7 @@ function getSummaryData(summaryConfig, pageData, columns, hasRowSelection) {
|
|
|
17
17
|
var _summaryData = [];
|
|
18
18
|
if (Array.isArray(summaryConfig)) {
|
|
19
19
|
summaryConfig.forEach(function (summary) {
|
|
20
|
-
var type = summary.type, fields = summary.fields, title = summary.title;
|
|
20
|
+
var type = summary.type, fields = summary.fields, title = summary.title, onClickHandle = summary.onClickHandle;
|
|
21
21
|
switch (type) {
|
|
22
22
|
case 'subtotal': // 小计
|
|
23
23
|
// 如果没有设置 统计字段 那么直接跳出循环
|
|
@@ -35,12 +35,19 @@ function getSummaryData(summaryConfig, pageData, columns, hasRowSelection) {
|
|
|
35
35
|
? subtotalObj_1[col.key || col.dataIndex]
|
|
36
36
|
: undefined;
|
|
37
37
|
});
|
|
38
|
+
var columnResult = columns.map(function (col) { return ({
|
|
39
|
+
key: col === null || col === void 0 ? void 0 : col.key,
|
|
40
|
+
dataIndex: col === null || col === void 0 ? void 0 : col.dataIndex,
|
|
41
|
+
}); });
|
|
38
42
|
_summaryData.push({
|
|
39
43
|
title: title || '小计',
|
|
40
44
|
titleIndex: 0 + (hasRowSelection ? 1 : 0),
|
|
41
45
|
key: 'subtotal',
|
|
42
46
|
list: hasRowSelection
|
|
43
47
|
? __spreadArray([undefined], subtotalResult) : subtotalResult,
|
|
48
|
+
columnList: hasRowSelection
|
|
49
|
+
? __spreadArray([undefined], columnResult) : columnResult,
|
|
50
|
+
onClickHandle: onClickHandle,
|
|
44
51
|
});
|
|
45
52
|
break;
|
|
46
53
|
case 'total': // 总计
|
|
@@ -59,11 +66,18 @@ function getSummaryData(summaryConfig, pageData, columns, hasRowSelection) {
|
|
|
59
66
|
? totalObj_1[col.key || col.dataIndex]
|
|
60
67
|
: undefined;
|
|
61
68
|
});
|
|
69
|
+
var columnResult_1 = columns.map(function (col) { return ({
|
|
70
|
+
key: col === null || col === void 0 ? void 0 : col.key,
|
|
71
|
+
dataIndex: col === null || col === void 0 ? void 0 : col.dataIndex,
|
|
72
|
+
}); });
|
|
62
73
|
_summaryData.push({
|
|
63
74
|
title: title || '总计',
|
|
64
75
|
titleIndex: 0 + (hasRowSelection ? 1 : 0),
|
|
65
76
|
key: 'total',
|
|
66
77
|
list: hasRowSelection ? __spreadArray([undefined], totalResult) : totalResult,
|
|
78
|
+
columnList: hasRowSelection
|
|
79
|
+
? __spreadArray([undefined], columnResult_1) : columnResult_1,
|
|
80
|
+
onClickHandle: onClickHandle,
|
|
67
81
|
});
|
|
68
82
|
}
|
|
69
83
|
break;
|
|
@@ -39,15 +39,15 @@ function getWidthStr(width) {
|
|
|
39
39
|
// }
|
|
40
40
|
switch (width) {
|
|
41
41
|
case 'half':
|
|
42
|
-
return '16.
|
|
42
|
+
return '16.6%';
|
|
43
43
|
case 'all':
|
|
44
44
|
return '100%';
|
|
45
45
|
case 'double':
|
|
46
|
-
return '66.
|
|
46
|
+
return '66.6%';
|
|
47
47
|
case 'halfAll':
|
|
48
48
|
return '50%';
|
|
49
49
|
default:
|
|
50
|
-
return '33.
|
|
50
|
+
return '33.3%';
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
var SearchItem = function (_a) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ztxkui",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.16",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "React components library",
|
|
6
6
|
"author": "zt-front-end",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"@types/react": "^17.0.0",
|
|
68
68
|
"@types/react-dom": "^17.0.0",
|
|
69
69
|
"@types/react-router-dom": "^5.1.8",
|
|
70
|
+
"cross-env": "^7.0.3",
|
|
70
71
|
"eslint-config-prettier": "^8.0.0",
|
|
71
72
|
"eslint-plugin-prettier": "^3.3.1",
|
|
72
73
|
"html2canvas": "^1.4.1",
|