ztxkui 4.3.0 → 4.3.2
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 +10 -4
- package/dist/Demo.js +2 -2
- package/dist/TableDemo/EditableTable.js +114 -103
- package/dist/TableDemo/ModalTable.js +2 -2
- package/dist/TableDemo/data.d.ts +20 -0
- package/dist/TableDemo/data.js +23 -0
- package/dist/components/DatePicker/data-picker.d.ts +43 -6
- package/dist/components/EnhanceSelect/index.js +28 -25
- package/dist/components/InputNumber/input-number.d.ts +3 -2
- package/dist/components/InputNumber/input-number.js +1 -1
- package/dist/components/Table/hooks/useColumns.d.ts +1 -2
- package/dist/components/Table/hooks/useColumns.js +25 -67
- package/dist/components/Table/hooks/useInnerPagination.js +1 -0
- package/dist/components/Table/table-enhance-cell.d.ts +2 -2
- package/dist/components/Table/table-enhance-cell.js +99 -98
- package/dist/components/Table/table-enhance-row.d.ts +2 -4
- package/dist/components/Table/table-enhance-row.js +4 -10
- package/dist/components/Table/table-resizable-title.js +29 -4
- package/dist/components/Table/table.js +33 -40
- package/dist/components/Table/utils/shallowEqual.d.ts +2 -0
- package/dist/components/Table/utils/shallowEqual.js +34 -0
- package/dist/components/Tabs/tabs.d.ts +2 -2
- package/dist/components/business/SearchContainer/hooks/useDynamic.js +2 -2
- package/dist/components/business/SearchContainer/search-item.d.ts +1 -0
- package/dist/components/business/SearchContainer/search-item.js +4 -1
- package/dist/index.css +8 -0
- package/dist/index.css.map +1 -1
- package/package.json +4 -3
package/dist/App.js
CHANGED
|
@@ -1209,7 +1209,7 @@ function App() {
|
|
|
1209
1209
|
React.createElement(DetailList, { records: inspectionDetail, labelWidth: 10, labelAlign: "center", apiBaseUrl: "http://192.168.0.83:8888", fileBaseUrl: "http://192.168.0.83:88", previewBtnDisable: true, hasManOrDate: true, hasSignArea: true }),
|
|
1210
1210
|
React.createElement(DetailList, { records: inspectionDetail, labelWidth: 10, labelAlign: "right", apiBaseUrl: "http://192.168.0.83:8888", fileBaseUrl: "http://192.168.0.83:88", previewBtnDisable: true, hasManOrDate: true, hasSignArea: true }),
|
|
1211
1211
|
React.createElement(DetailList, { apiBaseUrl: "http://192.168.0.83:8888", fileBaseUrl: "http://192.168.0.83:88", hasSignArea: true, isDark: true, labelWidth: 10 }),
|
|
1212
|
-
inspectionData.map(function (item) {
|
|
1212
|
+
inspectionData.map(function (item, index) {
|
|
1213
1213
|
var inspectionDesc = [
|
|
1214
1214
|
{ title: '巡检人', content: item.inspectionMan },
|
|
1215
1215
|
{ title: '上传时间', content: item.inspectionTime },
|
|
@@ -1228,7 +1228,7 @@ function App() {
|
|
|
1228
1228
|
return itemObj;
|
|
1229
1229
|
});
|
|
1230
1230
|
}
|
|
1231
|
-
return (React.createElement(DetailCard, { title: item.inspectionName, desc: inspectionDesc, records: records }));
|
|
1231
|
+
return (React.createElement(DetailCard, { title: item.inspectionName, desc: inspectionDesc, records: records, key: index }));
|
|
1232
1232
|
}),
|
|
1233
1233
|
React.createElement(Upload, { method: "post", headers: {
|
|
1234
1234
|
'Zmdms-Auth': 'bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJtZW1iZXJfdHlwZSI6MSwiaGFuZGxlX2hyX3Bob25lIjpudWxsLCJpbmR1Y3Rpb25fc291cmNlX3R5cGUiOm51bGwsInJlc3VtZV9kYXRlIjpudWxsLCJ1c2VyX25hbWUiOiJZRzIxMDE0IiwiaW10X2lkIjpudWxsLCJyZWFsX25hbWUiOiLpmYjkuprpm4QiLCJjbGllbnRfdHlwZSI6IndlYiIsImRhdGFfcm9sZV9pZCI6IjEzNDM0OTA2ODYyNjAyMjgwOTcsMTM0NTk3ODUwNTMwMjA1Njk2MiIsImNsaWVudF9pZCI6InN3b3JkIiwiZW1wbG95bWVudF9mb3JtX3R5cGUiOm51bGwsInVzZXJfdHlwZSI6IndlYiIsInJvbGVfaWQiOiIxMTIzNTk4ODE2NzM4Njc1MjAxLDEzNDM0OTA0MjUwMDEyMjYyNDIiLCJwb3N0X25hbWUiOm51bGwsInNjb3BlIjpbImFsbCJdLCJpbnRlcnZpZXdfaWQiOm51bGwsImV4cCI6MTYzMjQ2NzEyNSwianRpIjoiZmNiZTYwYWEtOTJjOC00ODhjLTgxYTUtOTQ2ZDJiYzJiNDM4IiwibWVtYmVyX2lkIjoxMzQ1OTkyODc4MTYyNjQ5MDkwLCJjb21wYW55X2lkIjoxMjk1OTA4NjI3OTg0NjcwNzIyLCJzeXN0ZW1faWQiOiIyIiwiZGVwdF9uYW1lIjoi5rWL6K-V6YOo6ZeoMjIxMjEyMTIiLCJhdmF0YXIiOiIiLCJkYXRhX3JvbGVfbmFtZSI6Im51bGwsbnVsbCIsImF1dGhvcml0aWVzIjpbIuWGheWLpCIsImFkbWluaXN0cmF0b3IiXSwicm9sZV9uYW1lIjoiYWRtaW5pc3RyYXRvcizlhoXli6QiLCJsaWNlbnNlIjoicG93ZXJlZCBieSB6bWRtcyIsInBvc3RfaWQiOiIiLCJ1c2VyX2lkIjoiMTM0NTk5OTc3MDM4NTU4MDAzNCIsIm5pY2tfbmFtZSI6IumZiOS6mumbhCIsImNvbXBhbnlfbmFtZSI6Iua1meWVhuS4reaLk-mbhuWbou-8iOmHjeW6hu-8ieaciemZkOWFrOWPuGxjeSIsImRlcHRfaWQiOiIxMjk1OTA5NDg4MDAxNTQwMDk3IiwiaGFuZGxlX2hyX25hbWUiOm51bGwsImFjY291bnQiOiJZRzIxMDE0IiwicmVzdW1lX2lkIjpudWxsfQ.uWW6lWQyAPWeQmTNw9w4PMYPNWHPGvhCxquaA958J5o',
|
|
@@ -1298,11 +1298,17 @@ function App() {
|
|
|
1298
1298
|
React.createElement(Checkbox, { value: "2" }, "\u5426"))),
|
|
1299
1299
|
React.createElement(SearchItem, { name: "sss", label: "", noLabelShowBg: true },
|
|
1300
1300
|
React.createElement(Checkbox, { value: "1" }, "\u662F")),
|
|
1301
|
-
React.createElement(SearchItem, { name: "
|
|
1301
|
+
React.createElement(SearchItem, { name: "sss2d1", label: "", hiddenLabelName: "\u52A8\u6001\u8868\u5355\u914D\u7F6Esssd1sss2d1", noLabelShowBg: true, dynamicdisabled: "1" },
|
|
1302
|
+
React.createElement(Checkbox, { value: "1" }, "\u662Fsa")),
|
|
1303
|
+
React.createElement(SearchItem, { name: "sssd1", label: "", hiddenLabelName: "\u52A8\u6001\u8868\u5355\u914D\u7F6Esssd1", noLabelShowBg: true, dynamicdisabled: "1" },
|
|
1304
|
+
React.createElement(Checkbox, { value: "1" }, "\u662Fa")),
|
|
1305
|
+
React.createElement(SearchItem, { name: "sss1", label: "", hiddenLabelName: "\u52A8\u6001\u8868\u5355\u914D\u7F6E", noLabelShowBg: true, dynamicdisabled: "1" },
|
|
1302
1306
|
React.createElement(Checkbox, { value: "1" }, "\u662F")),
|
|
1303
|
-
React.createElement(SearchItem, { name: "
|
|
1307
|
+
React.createElement(SearchItem, { name: "ssss1", label: "", hiddenLabelName: "\u52A8\u6001\u8868\u5355\u914D\u7F6Es1", noLabelShowBg: true, dynamicdisabled: "1" },
|
|
1304
1308
|
React.createElement(Checkbox, { value: "1" }, "\u662F")),
|
|
1305
1309
|
React.createElement(SearchItem, { name: "sss2", label: "", hiddenLabelName: "\u52A8\u6001\u8868\u5355\u914D\u7F6E", noLabelShowBg: true },
|
|
1310
|
+
React.createElement(Checkbox, { value: "1" }, "\u662F")),
|
|
1311
|
+
React.createElement(SearchItem, { name: "sss3", label: "", hiddenLabelName: "\u52A8\u6001\u8868\u5355\u914D\u7F6E", noLabelShowBg: true },
|
|
1306
1312
|
React.createElement(Radio, { value: "1" }, "\u662F")),
|
|
1307
1313
|
React.createElement(SearchItem, { name: "test2", label: "\u90E8\u95E8\u540D\u79F0", rules: [{ required: true, message: '请选择仓库名称' }] },
|
|
1308
1314
|
React.createElement(Radio.Group, null,
|
package/dist/Demo.js
CHANGED
|
@@ -121,8 +121,8 @@ function Demo() {
|
|
|
121
121
|
// defaultList={defaultList}
|
|
122
122
|
isClickRequest: true }),
|
|
123
123
|
React.createElement("p", null, "\u4E00\u6B21\u6027\u52A0\u8F7D\u6570\u636E"),
|
|
124
|
-
React.createElement(EnhanceSelect, { style: selectStyle, placeholder: "\u4E00\u6B21\u6027\u52A0\u8F7D\u6570\u636E", url: "http://192.168.0.83:8000/api/zmdms-system/company/list", request: request, dataKey: "id", titleKey: "name", isClickRequest: true, isPaste: true, mode: "multiple", value: value3, onChange: function (value, option, fullData) {
|
|
125
|
-
console.log(value);
|
|
124
|
+
React.createElement(EnhanceSelect, { style: selectStyle, placeholder: "\u4E00\u6B21\u6027\u52A0\u8F7D\u6570\u636E", url: "http://192.168.0.83:8000/api/zmdms-system/company/list", request: request, dataKey: "id", titleKey: "name", isClickRequest: true, isPaste: true, mode: "multiple", isHandAddItem: true, value: value3, onChange: function (value, option, fullData) {
|
|
125
|
+
console.log(value, fullData);
|
|
126
126
|
setValue3(value);
|
|
127
127
|
} }),
|
|
128
128
|
React.createElement("p", null, "\u5F02\u6B65\u83B7\u53D6\u6570\u636E"),
|
|
@@ -50,6 +50,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
50
50
|
* @description 可编辑表格
|
|
51
51
|
*/
|
|
52
52
|
import React, { useState, useCallback, useRef, useEffect } from 'react';
|
|
53
|
+
import { unstable_batchedUpdates } from 'react-dom';
|
|
53
54
|
// redux
|
|
54
55
|
// ztxkui公共组件
|
|
55
56
|
import { Table, EnhanceSelect, Button, message } from '../index';
|
|
@@ -64,24 +65,39 @@ exactRound, toThousand,
|
|
|
64
65
|
// minus,
|
|
65
66
|
divide, } from 'ztxkutils/dist/tools';
|
|
66
67
|
import update from 'immutability-helper';
|
|
67
|
-
import { dataSource, list1 } from './data';
|
|
68
|
+
import { dataSource, dataSource1, list1 } from './data';
|
|
68
69
|
var EditableTable = function () {
|
|
69
70
|
console.log('父组件 rerender');
|
|
70
71
|
var _a = useState(dataSource), records = _a[0], setRecords = _a[1];
|
|
71
72
|
var recordsRef = useRef([]);
|
|
72
|
-
|
|
73
|
-
//
|
|
74
|
-
|
|
75
|
-
var
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
var _b = useState(0), num = _b[0], setNum = _b[1];
|
|
74
|
+
// SCU刷新逻辑
|
|
75
|
+
var timeOutRef = useRef(null);
|
|
76
|
+
var tableSCURefreshRef = useRef();
|
|
77
|
+
var refreshScuCell = useCallback(function () {
|
|
78
|
+
tableSCURefreshRef.current = true;
|
|
79
|
+
}, []);
|
|
80
|
+
var getRefreshScuCell = useCallback(function () {
|
|
81
|
+
if (tableSCURefreshRef.current) {
|
|
82
|
+
if (timeOutRef.current) {
|
|
83
|
+
clearTimeout(timeOutRef.current);
|
|
84
|
+
timeOutRef.current = null;
|
|
85
|
+
}
|
|
86
|
+
timeOutRef.current = setTimeout(function () {
|
|
87
|
+
console.log('设置');
|
|
88
|
+
tableSCURefreshRef.current = false;
|
|
89
|
+
});
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
}, []);
|
|
78
94
|
// 表格
|
|
79
95
|
var tableHandleRef = useRef({});
|
|
80
96
|
// 表格配置
|
|
81
|
-
var
|
|
97
|
+
var tableConfig = useState({
|
|
82
98
|
test1: { isChangeable: 1, isDisplay: 1, isRequired: 1 },
|
|
83
99
|
test2: { isChangeable: 1, isDisplay: 1, isRequired: 1 },
|
|
84
|
-
})
|
|
100
|
+
})[0];
|
|
85
101
|
useEffect(function () {
|
|
86
102
|
// setTimeout(() => {
|
|
87
103
|
// setTableConfig({
|
|
@@ -95,6 +111,18 @@ var EditableTable = function () {
|
|
|
95
111
|
// setRecords(dataSource);
|
|
96
112
|
// }, 1000);
|
|
97
113
|
}, []);
|
|
114
|
+
// 表格数据改变相关
|
|
115
|
+
var onEditableSaveHandle = useCallback(function (record, index, _dataIndex) {
|
|
116
|
+
var _a;
|
|
117
|
+
if (_dataIndex === void 0) { _dataIndex = ''; }
|
|
118
|
+
if (typeof index === 'number') {
|
|
119
|
+
var newRecords = recordsRef.current.slice();
|
|
120
|
+
var item = newRecords[index];
|
|
121
|
+
newRecords.splice(index, 1, _dataIndex
|
|
122
|
+
? __assign(__assign(__assign({}, record), item), (_a = {}, _a[_dataIndex] = record[_dataIndex], _a)) : __assign(__assign({}, item), record));
|
|
123
|
+
setRecords(newRecords);
|
|
124
|
+
}
|
|
125
|
+
}, [setRecords]);
|
|
98
126
|
var columns = [
|
|
99
127
|
{
|
|
100
128
|
title: '序号',
|
|
@@ -103,25 +131,61 @@ var EditableTable = function () {
|
|
|
103
131
|
key: 'index',
|
|
104
132
|
render: function (_text, _record, index) { return "" + (index + 1); },
|
|
105
133
|
},
|
|
134
|
+
{
|
|
135
|
+
title: '测试1231212',
|
|
136
|
+
width: 100,
|
|
137
|
+
dataIndex: 'test1231212',
|
|
138
|
+
key: 'test1231212',
|
|
139
|
+
editable: true,
|
|
140
|
+
showCopy: true,
|
|
141
|
+
validate: {},
|
|
142
|
+
shouldCellUpdate: function (record, preRecord) {
|
|
143
|
+
if (getRefreshScuCell()) {
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
return record.test1231212 !== preRecord.test1231212;
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
title: '测试1212',
|
|
151
|
+
width: 100,
|
|
152
|
+
dataIndex: 'test1212',
|
|
153
|
+
key: 'test1212',
|
|
154
|
+
editable: true,
|
|
155
|
+
showCopy: true,
|
|
156
|
+
validate: {},
|
|
157
|
+
shouldCellUpdate: function (record, preRecord) {
|
|
158
|
+
if (getRefreshScuCell()) {
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
return record.test1212 !== preRecord.test1212;
|
|
162
|
+
},
|
|
163
|
+
},
|
|
106
164
|
{
|
|
107
165
|
title: '测试1',
|
|
108
166
|
width: 100,
|
|
109
|
-
dataIndex: '
|
|
110
|
-
key: '
|
|
167
|
+
dataIndex: 'test1122',
|
|
168
|
+
key: 'test1122',
|
|
111
169
|
editable: true,
|
|
112
170
|
showCopy: true,
|
|
113
171
|
validate: {},
|
|
114
172
|
shouldCellUpdate: function (record, preRecord) {
|
|
115
|
-
|
|
116
|
-
// setFirstRender(false);
|
|
117
|
-
// return true;
|
|
118
|
-
// }
|
|
119
|
-
if (lengthChange) {
|
|
120
|
-
setLengthChange(false);
|
|
173
|
+
if (getRefreshScuCell()) {
|
|
121
174
|
return true;
|
|
122
175
|
}
|
|
123
|
-
|
|
124
|
-
|
|
176
|
+
return record.test1122 !== preRecord.test1122;
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
title: '测试1',
|
|
181
|
+
width: 100,
|
|
182
|
+
dataIndex: 'test1',
|
|
183
|
+
key: 'test1',
|
|
184
|
+
editable: true,
|
|
185
|
+
showCopy: true,
|
|
186
|
+
validate: {},
|
|
187
|
+
shouldCellUpdate: function (record, preRecord) {
|
|
188
|
+
if (getRefreshScuCell()) {
|
|
125
189
|
return true;
|
|
126
190
|
}
|
|
127
191
|
return record.test1 !== preRecord.test1;
|
|
@@ -142,16 +206,7 @@ var EditableTable = function () {
|
|
|
142
206
|
},
|
|
143
207
|
validate: {},
|
|
144
208
|
shouldCellUpdate: function (record, preRecord) {
|
|
145
|
-
|
|
146
|
-
// setFirstRender(false);
|
|
147
|
-
// return true;
|
|
148
|
-
// }
|
|
149
|
-
if (lengthChange) {
|
|
150
|
-
setLengthChange(false);
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
153
|
-
if (moveChange) {
|
|
154
|
-
setMoveChange(false);
|
|
209
|
+
if (getRefreshScuCell()) {
|
|
155
210
|
return true;
|
|
156
211
|
}
|
|
157
212
|
return record.test111 !== preRecord.test111;
|
|
@@ -191,16 +246,7 @@ var EditableTable = function () {
|
|
|
191
246
|
},
|
|
192
247
|
},
|
|
193
248
|
shouldCellUpdate: function (record, preRecord) {
|
|
194
|
-
|
|
195
|
-
// setFirstRender(false);
|
|
196
|
-
// return true;
|
|
197
|
-
// }
|
|
198
|
-
if (lengthChange) {
|
|
199
|
-
setLengthChange(false);
|
|
200
|
-
return true;
|
|
201
|
-
}
|
|
202
|
-
if (moveChange) {
|
|
203
|
-
setMoveChange(false);
|
|
249
|
+
if (getRefreshScuCell()) {
|
|
204
250
|
return true;
|
|
205
251
|
}
|
|
206
252
|
return (record.test2 !== preRecord.test2 || record.test3 !== preRecord.test3);
|
|
@@ -214,12 +260,7 @@ var EditableTable = function () {
|
|
|
214
260
|
align: 'center',
|
|
215
261
|
editable: false,
|
|
216
262
|
shouldCellUpdate: function (record, preRecord) {
|
|
217
|
-
if (
|
|
218
|
-
setLengthChange(false);
|
|
219
|
-
return true;
|
|
220
|
-
}
|
|
221
|
-
if (moveChange) {
|
|
222
|
-
setMoveChange(false);
|
|
263
|
+
if (getRefreshScuCell()) {
|
|
223
264
|
return true;
|
|
224
265
|
}
|
|
225
266
|
return (record.test111 !== preRecord.test111 ||
|
|
@@ -240,12 +281,7 @@ var EditableTable = function () {
|
|
|
240
281
|
dataIndex: 'test3',
|
|
241
282
|
key: 'test3',
|
|
242
283
|
shouldCellUpdate: function (record, preRecord) {
|
|
243
|
-
if (
|
|
244
|
-
setLengthChange(false);
|
|
245
|
-
return true;
|
|
246
|
-
}
|
|
247
|
-
if (moveChange) {
|
|
248
|
-
setMoveChange(false);
|
|
284
|
+
if (getRefreshScuCell()) {
|
|
249
285
|
return true;
|
|
250
286
|
}
|
|
251
287
|
return record.test3 !== preRecord.test3;
|
|
@@ -292,12 +328,7 @@ var EditableTable = function () {
|
|
|
292
328
|
dataIndex: 'test31',
|
|
293
329
|
key: 'test31',
|
|
294
330
|
shouldCellUpdate: function (record, preRecord) {
|
|
295
|
-
if (
|
|
296
|
-
setLengthChange(false);
|
|
297
|
-
return true;
|
|
298
|
-
}
|
|
299
|
-
if (moveChange) {
|
|
300
|
-
setMoveChange(false);
|
|
331
|
+
if (getRefreshScuCell()) {
|
|
301
332
|
return true;
|
|
302
333
|
}
|
|
303
334
|
return record.test31 !== preRecord.test31;
|
|
@@ -322,12 +353,7 @@ var EditableTable = function () {
|
|
|
322
353
|
dataIndex: 'test32',
|
|
323
354
|
key: 'test32',
|
|
324
355
|
shouldCellUpdate: function (record, preRecord) {
|
|
325
|
-
if (
|
|
326
|
-
setLengthChange(false);
|
|
327
|
-
return true;
|
|
328
|
-
}
|
|
329
|
-
if (moveChange) {
|
|
330
|
-
setMoveChange(false);
|
|
356
|
+
if (getRefreshScuCell()) {
|
|
331
357
|
return true;
|
|
332
358
|
}
|
|
333
359
|
return record.test32 !== preRecord.test32;
|
|
@@ -352,12 +378,7 @@ var EditableTable = function () {
|
|
|
352
378
|
dataIndex: 'test33',
|
|
353
379
|
key: 'test33',
|
|
354
380
|
shouldCellUpdate: function (record, preRecord) {
|
|
355
|
-
if (
|
|
356
|
-
setLengthChange(false);
|
|
357
|
-
return true;
|
|
358
|
-
}
|
|
359
|
-
if (moveChange) {
|
|
360
|
-
setMoveChange(false);
|
|
381
|
+
if (getRefreshScuCell()) {
|
|
361
382
|
return true;
|
|
362
383
|
}
|
|
363
384
|
return record.test33 !== preRecord.test33;
|
|
@@ -382,12 +403,7 @@ var EditableTable = function () {
|
|
|
382
403
|
dataIndex: 'test34',
|
|
383
404
|
key: 'test34',
|
|
384
405
|
shouldCellUpdate: function (record, preRecord) {
|
|
385
|
-
if (
|
|
386
|
-
setLengthChange(false);
|
|
387
|
-
return true;
|
|
388
|
-
}
|
|
389
|
-
if (moveChange) {
|
|
390
|
-
setMoveChange(false);
|
|
406
|
+
if (getRefreshScuCell()) {
|
|
391
407
|
return true;
|
|
392
408
|
}
|
|
393
409
|
return record.test34 !== preRecord.test34;
|
|
@@ -463,34 +479,20 @@ var EditableTable = function () {
|
|
|
463
479
|
key: 'test10',
|
|
464
480
|
},
|
|
465
481
|
];
|
|
466
|
-
// 初始化渲染,针对配置了editable、editableConfig的列配置
|
|
467
|
-
// useEffect(() => {
|
|
468
|
-
// setFirstRender(true);
|
|
469
|
-
// }, []);
|
|
470
482
|
// 将表格最新数据赋值给ref引用
|
|
471
483
|
useEffect(function () {
|
|
472
484
|
recordsRef.current = records;
|
|
473
485
|
}, [records]);
|
|
474
|
-
// 表格数据改变相关
|
|
475
|
-
var onEditableSaveHandle = useCallback(function (record, index, _dataIndex) {
|
|
476
|
-
var _a;
|
|
477
|
-
if (_dataIndex === void 0) { _dataIndex = ''; }
|
|
478
|
-
if (typeof index === 'number') {
|
|
479
|
-
var newRecords = recordsRef.current.slice();
|
|
480
|
-
var item = newRecords[index];
|
|
481
|
-
newRecords.splice(index, 1, _dataIndex
|
|
482
|
-
? __assign(__assign(__assign({}, record), item), (_a = {}, _a[_dataIndex] = record[_dataIndex], _a)) : __assign(__assign({}, item), record));
|
|
483
|
-
setRecords(newRecords);
|
|
484
|
-
}
|
|
485
|
-
}, [setRecords]);
|
|
486
486
|
// 新增删除行
|
|
487
487
|
var onAddAndDelHandle = useCallback(function (type, index) {
|
|
488
488
|
var newRecords = recordsRef.current.slice();
|
|
489
489
|
if (type === 'add') {
|
|
490
490
|
var newItem = __assign(__assign({}, newRecords[index]), { _isNewData: true, id: Date.now() + "-" + index });
|
|
491
491
|
newRecords.splice(index + 1, 0, newItem);
|
|
492
|
-
|
|
493
|
-
|
|
492
|
+
refreshScuCell();
|
|
493
|
+
unstable_batchedUpdates(function () {
|
|
494
|
+
setRecords(newRecords);
|
|
495
|
+
});
|
|
494
496
|
}
|
|
495
497
|
else if (type === 'del') {
|
|
496
498
|
if (newRecords.length === 1) {
|
|
@@ -502,10 +504,12 @@ var EditableTable = function () {
|
|
|
502
504
|
else {
|
|
503
505
|
newRecords.splice(index, 1);
|
|
504
506
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
+
refreshScuCell();
|
|
508
|
+
unstable_batchedUpdates(function () {
|
|
509
|
+
setRecords(newRecords);
|
|
510
|
+
});
|
|
507
511
|
}
|
|
508
|
-
}, [setRecords]);
|
|
512
|
+
}, [setRecords, refreshScuCell]);
|
|
509
513
|
// 表格拖拽排序功能函数
|
|
510
514
|
var onMoveRowHandle = useCallback(function (dragIndex, hoverIndex) {
|
|
511
515
|
console.log(dragIndex, hoverIndex);
|
|
@@ -517,9 +521,11 @@ var EditableTable = function () {
|
|
|
517
521
|
[hoverIndex, 0, dragRow],
|
|
518
522
|
],
|
|
519
523
|
});
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
524
|
+
refreshScuCell();
|
|
525
|
+
unstable_batchedUpdates(function () {
|
|
526
|
+
setRecords(newDataSource);
|
|
527
|
+
});
|
|
528
|
+
}, [setRecords, refreshScuCell]);
|
|
523
529
|
// 表格改变
|
|
524
530
|
var onTableChange = useCallback(function (changeRecords, startIndex) {
|
|
525
531
|
console.log(changeRecords);
|
|
@@ -596,6 +602,13 @@ var EditableTable = function () {
|
|
|
596
602
|
console.log(records);
|
|
597
603
|
// console.log(tableHandleRef.current.getColumns());
|
|
598
604
|
} }, "\u83B7\u53D6\u6570\u636E"),
|
|
605
|
+
React.createElement(Button, { onClick: function () {
|
|
606
|
+
setNum(num + 1);
|
|
607
|
+
setRecords(dataSource1);
|
|
608
|
+
// console.log(tableHandleRef.current.getColumns());
|
|
609
|
+
} },
|
|
610
|
+
"\u8BBE\u7F6E\u6570\u636E",
|
|
611
|
+
num),
|
|
599
612
|
React.createElement(Table, { dataSource: records, columns: columns, rowKey: "id",
|
|
600
613
|
// 表格项可输入
|
|
601
614
|
onEditableSave: onEditableSaveHandle,
|
|
@@ -606,12 +619,10 @@ var EditableTable = function () {
|
|
|
606
619
|
// tableValidate
|
|
607
620
|
tableHandleRef: tableHandleRef, tableName: "\u6211\u662F\u4E00\u4E2A\u8868\u683C",
|
|
608
621
|
// 显隐配置
|
|
609
|
-
configInfo: tableConfig, showColumnDynamic: true, showColumnDynamicKey: "test-o-0011", onTableChange: onTableChange, showInnerPagination: true,
|
|
610
|
-
// defaultInnerPageSize={10}
|
|
611
|
-
expandable: {
|
|
622
|
+
configInfo: tableConfig, showColumnDynamic: true, showColumnDynamicKey: "test-o-0011", onTableChange: onTableChange, showInnerPagination: true, defaultInnerPageSize: 10, expandable: {
|
|
612
623
|
expandedRowRender: function (record) { return React.createElement("p", { style: { margin: 0 } }, "111"); },
|
|
613
624
|
rowExpandable: function (record) { return true; },
|
|
614
|
-
}, scroll: { x: 1000, y:
|
|
625
|
+
}, scroll: { x: 1000, y: 600 }, showDelAllBtn: true, delAllChange: onDelAllChange, rowSelection: {
|
|
615
626
|
type: 'checkbox',
|
|
616
627
|
}, summaryConfig: [
|
|
617
628
|
{
|
|
@@ -335,7 +335,7 @@ var ModalTable = function () {
|
|
|
335
335
|
setLoading(false);
|
|
336
336
|
}, 5000);
|
|
337
337
|
} }, "\u6253\u5F00\u6A21\u6001\u6846"),
|
|
338
|
-
React.createElement(Modal, { title: "\u6D4B\u8BD5", loading: loading, visible: visible, onCancel: function () { return setVisible(false); } },
|
|
338
|
+
React.createElement(Modal, { title: "\u6D4B\u8BD5", loading: loading, visible: visible, width: "80%", style: { height: '80%' }, onCancel: function () { return setVisible(false); } },
|
|
339
339
|
React.createElement(Table, { dataSource: records, columns: columns, rowKey: "id",
|
|
340
340
|
// 表格项可输入
|
|
341
341
|
onEditableSave: onEditableSaveHandle,
|
|
@@ -346,6 +346,6 @@ var ModalTable = function () {
|
|
|
346
346
|
// tableValidate
|
|
347
347
|
tableHandleRef: tableHandleRef, tableName: "\u6211\u662F\u4E00\u4E2A\u8868\u683C",
|
|
348
348
|
// 显隐配置
|
|
349
|
-
configInfo: tableConfig, showColumnDynamic: true, showColumnDynamicKey: "test-o-0011" }))));
|
|
349
|
+
configInfo: tableConfig, showColumnDynamic: true, showColumnDynamicKey: "test-o-0011", scroll: { x: 1000, y: 600 } }))));
|
|
350
350
|
};
|
|
351
351
|
export default ModalTable;
|
package/dist/TableDemo/data.d.ts
CHANGED
|
@@ -18,6 +18,26 @@ export declare const dataSource: {
|
|
|
18
18
|
test9: string;
|
|
19
19
|
test10: string;
|
|
20
20
|
}[];
|
|
21
|
+
export declare const dataSource1: {
|
|
22
|
+
id: string;
|
|
23
|
+
test1: string;
|
|
24
|
+
test2: number;
|
|
25
|
+
test111: number;
|
|
26
|
+
test3: string;
|
|
27
|
+
test31: string;
|
|
28
|
+
test32: string;
|
|
29
|
+
test33: string;
|
|
30
|
+
test34: string;
|
|
31
|
+
test4: string;
|
|
32
|
+
test5: string;
|
|
33
|
+
'test5-001': number;
|
|
34
|
+
'test5-002': number;
|
|
35
|
+
test6: string;
|
|
36
|
+
test7: string;
|
|
37
|
+
test8: string;
|
|
38
|
+
test9: string;
|
|
39
|
+
test10: string;
|
|
40
|
+
}[];
|
|
21
41
|
export declare const list1: {
|
|
22
42
|
name: string;
|
|
23
43
|
id: string;
|
package/dist/TableDemo/data.js
CHANGED
|
@@ -20,6 +20,29 @@ export var dataSource = new Array(50).fill(1).map(function (item, index) {
|
|
|
20
20
|
test10: "test10-" + index,
|
|
21
21
|
};
|
|
22
22
|
});
|
|
23
|
+
export var dataSource1 = new Array(50).fill(1).map(function (item, newIndex) {
|
|
24
|
+
var index = newIndex + 1;
|
|
25
|
+
return {
|
|
26
|
+
id: "test1-" + index,
|
|
27
|
+
test1: "test11-" + index,
|
|
28
|
+
test2: index + 100,
|
|
29
|
+
test111: index + 1,
|
|
30
|
+
test3: "test3-" + index,
|
|
31
|
+
test31: "test31-" + index,
|
|
32
|
+
test32: "test32-" + index,
|
|
33
|
+
test33: "test33-" + index,
|
|
34
|
+
test34: "test34-" + index,
|
|
35
|
+
test4: "test4-" + index,
|
|
36
|
+
test5: "test5-" + index,
|
|
37
|
+
'test5-001': index + 10,
|
|
38
|
+
'test5-002': index + 20,
|
|
39
|
+
test6: "test6-" + index,
|
|
40
|
+
test7: "test7-" + index,
|
|
41
|
+
test8: "test8-" + index,
|
|
42
|
+
test9: "test9-" + index,
|
|
43
|
+
test10: "test10-" + index,
|
|
44
|
+
};
|
|
45
|
+
});
|
|
23
46
|
export var list1 = [
|
|
24
47
|
{
|
|
25
48
|
name: '张三',
|
|
@@ -2,12 +2,49 @@ import { Dayjs } from 'dayjs';
|
|
|
2
2
|
import 'antd/es/date-picker/style/index';
|
|
3
3
|
declare const DatePicker: import("antd/es/date-picker/generatePicker/interface").PickerComponentClass<import("antd/es/date-picker/generatePicker").PickerProps<Dayjs> & {
|
|
4
4
|
status?: "" | "error" | "warning";
|
|
5
|
+
dropdownClassName?: string;
|
|
6
|
+
popupClassName?: string;
|
|
5
7
|
}, unknown> & {
|
|
6
|
-
WeekPicker: import("antd/es/date-picker/generatePicker/interface").PickerComponentClass<Omit<import("antd/es/date-picker/generatePicker").
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
WeekPicker: import("antd/es/date-picker/generatePicker/interface").PickerComponentClass<Omit<import("antd/es/date-picker/generatePicker").PickerProps<Dayjs> & {
|
|
9
|
+
status?: "" | "error" | "warning";
|
|
10
|
+
dropdownClassName?: string;
|
|
11
|
+
popupClassName?: string;
|
|
12
|
+
}, "picker">, unknown>;
|
|
13
|
+
MonthPicker: import("antd/es/date-picker/generatePicker/interface").PickerComponentClass<Omit<import("antd/es/date-picker/generatePicker").PickerProps<Dayjs> & {
|
|
14
|
+
status?: "" | "error" | "warning";
|
|
15
|
+
dropdownClassName?: string;
|
|
16
|
+
popupClassName?: string;
|
|
17
|
+
}, "picker">, unknown>;
|
|
18
|
+
YearPicker: import("antd/es/date-picker/generatePicker/interface").PickerComponentClass<Omit<import("antd/es/date-picker/generatePicker").PickerProps<Dayjs> & {
|
|
19
|
+
status?: "" | "error" | "warning";
|
|
20
|
+
dropdownClassName?: string;
|
|
21
|
+
popupClassName?: string;
|
|
22
|
+
}, "picker">, unknown>;
|
|
23
|
+
RangePicker: import("antd/es/date-picker/generatePicker/interface").PickerComponentClass<import("antd/es/date-picker/generatePicker").RangePickerProps<Dayjs> & {
|
|
24
|
+
dropdownClassName?: string;
|
|
25
|
+
popupClassName?: string;
|
|
26
|
+
}, unknown>;
|
|
27
|
+
TimePicker: import("antd/es/date-picker/generatePicker/interface").PickerComponentClass<Omit<Omit<import("rc-picker/lib/Picker").PickerTimeProps<Dayjs>, "hideHeader" | "locale" | "generateConfig" | "components"> & {
|
|
28
|
+
locale?: import("antd/es/date-picker/generatePicker").PickerLocale;
|
|
29
|
+
size?: import("antd/es/button").ButtonSize;
|
|
30
|
+
placement?: "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
|
|
31
|
+
bordered?: boolean;
|
|
32
|
+
status?: "" | "error" | "warning";
|
|
33
|
+
} & {
|
|
34
|
+
status?: "" | "error" | "warning";
|
|
35
|
+
dropdownClassName?: string;
|
|
36
|
+
popupClassName?: string;
|
|
37
|
+
}, "picker">, unknown>;
|
|
38
|
+
QuarterPicker: import("antd/es/date-picker/generatePicker/interface").PickerComponentClass<Omit<Omit<import("rc-picker/lib/Picker").PickerTimeProps<Dayjs>, "hideHeader" | "locale" | "generateConfig" | "components"> & {
|
|
39
|
+
locale?: import("antd/es/date-picker/generatePicker").PickerLocale;
|
|
40
|
+
size?: import("antd/es/button").ButtonSize;
|
|
41
|
+
placement?: "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
|
|
42
|
+
bordered?: boolean;
|
|
43
|
+
status?: "" | "error" | "warning";
|
|
44
|
+
} & {
|
|
45
|
+
status?: "" | "error" | "warning";
|
|
46
|
+
dropdownClassName?: string;
|
|
47
|
+
popupClassName?: string;
|
|
48
|
+
}, "picker">, unknown>;
|
|
12
49
|
};
|
|
13
50
|
export default DatePicker;
|
|
@@ -167,31 +167,33 @@ function concatData(originalData, newData, otherParams) {
|
|
|
167
167
|
if (item.__is_hand_add) {
|
|
168
168
|
resultData.push(item);
|
|
169
169
|
}
|
|
170
|
-
// 如果源数组中找到了该条数据,那么不添加
|
|
171
|
-
// 否则添加
|
|
172
|
-
// if (
|
|
173
|
-
// !resultData.find(
|
|
174
|
-
// (resultItem) =>
|
|
175
|
-
// resultItem && item && resultItem[dataKey] === item[dataKey]
|
|
176
|
-
// )
|
|
177
|
-
// ) {
|
|
178
|
-
// resultData.push(item);
|
|
179
|
-
// }
|
|
180
|
-
// 2022-03-01修改此处逻辑,外部参数可能会传递一些不同的逻辑,可能需要禁用此项
|
|
181
|
-
var index = resultData.findIndex(function (resultItem) {
|
|
182
|
-
return resultItem && item && resultItem[dataKey] === item[dataKey];
|
|
183
|
-
});
|
|
184
|
-
if (index === -1) {
|
|
185
|
-
// 没有找到直接添加
|
|
186
|
-
resultData.push(item);
|
|
187
|
-
}
|
|
188
170
|
else {
|
|
189
|
-
//
|
|
190
|
-
|
|
191
|
-
if (
|
|
192
|
-
|
|
171
|
+
// 如果源数组中找到了该条数据,那么不添加
|
|
172
|
+
// 否则添加
|
|
173
|
+
// if (
|
|
174
|
+
// !resultData.find(
|
|
175
|
+
// (resultItem) =>
|
|
176
|
+
// resultItem && item && resultItem[dataKey] === item[dataKey]
|
|
177
|
+
// )
|
|
178
|
+
// ) {
|
|
179
|
+
// resultData.push(item);
|
|
180
|
+
// }
|
|
181
|
+
// 2022-03-01修改此处逻辑,外部参数可能会传递一些不同的逻辑,可能需要禁用此项
|
|
182
|
+
var index = resultData.findIndex(function (resultItem) {
|
|
183
|
+
return resultItem && item && resultItem[dataKey] === item[dataKey];
|
|
184
|
+
});
|
|
185
|
+
if (index === -1) {
|
|
186
|
+
// 没有找到直接添加
|
|
187
|
+
resultData.push(item);
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
// 找到了,需要替换
|
|
191
|
+
var newItem = __assign({}, item);
|
|
192
|
+
if (!newItem[titleKey]) {
|
|
193
|
+
Reflect.deleteProperty(newItem, titleKey);
|
|
194
|
+
}
|
|
195
|
+
resultData.splice(index, 1, __assign(__assign({}, resultData[index]), newItem));
|
|
193
196
|
}
|
|
194
|
-
resultData.splice(index, 1, __assign(__assign({}, resultData[index]), newItem));
|
|
195
197
|
}
|
|
196
198
|
});
|
|
197
199
|
}
|
|
@@ -458,7 +460,7 @@ function EnhanceSelect(_a) {
|
|
|
458
460
|
}
|
|
459
461
|
// const _defaultList = Array.isArray(defaultList) ? defaultList : [];
|
|
460
462
|
var _defaultList = clearNullData(Array.isArray(defaultList) ? defaultList : [], dataKey, titleKey);
|
|
461
|
-
var currentList = concatData(concatData(concatData(selectList || [], _defaultList, { dataKey: dataKey, titleKey: titleKey }), multipleList || [], { dataKey: dataKey, titleKey: titleKey }), autoPasteListRef.current, { dataKey: dataKey, titleKey: titleKey });
|
|
463
|
+
var currentList = concatData(concatData(concatData(concatData(selectList || [], _defaultList, { dataKey: dataKey, titleKey: titleKey }), multipleList || [], { dataKey: dataKey, titleKey: titleKey }), handleAddItems, { dataKey: dataKey, titleKey: titleKey }), autoPasteListRef.current, { dataKey: dataKey, titleKey: titleKey });
|
|
462
464
|
if (currentList && Array.isArray(currentList)) {
|
|
463
465
|
var key_1 = dataKey;
|
|
464
466
|
// 支持多选模式
|
|
@@ -480,7 +482,7 @@ function EnhanceSelect(_a) {
|
|
|
480
482
|
});
|
|
481
483
|
currentData = currentData === null || currentData === void 0 ? void 0 : currentData.filter(function (item) { return item; });
|
|
482
484
|
if (remoteSearch) {
|
|
483
|
-
setMultipleList(currentData);
|
|
485
|
+
setMultipleList(currentData === null || currentData === void 0 ? void 0 : currentData.filter(function (item) { return !item.__is_hand_add; }));
|
|
484
486
|
}
|
|
485
487
|
}
|
|
486
488
|
else {
|
|
@@ -547,6 +549,7 @@ function EnhanceSelect(_a) {
|
|
|
547
549
|
setMultipleList,
|
|
548
550
|
showAll,
|
|
549
551
|
titleKey,
|
|
552
|
+
handleAddItems,
|
|
550
553
|
]);
|
|
551
554
|
// 分词粘贴
|
|
552
555
|
var pasteHandle = useCallback(function (value) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { InputNumberProps } from 'antd/lib/input-number';
|
|
3
3
|
import { IFormatterType, ICurrencySymbol } from '../../hooks/useFormatter';
|
|
4
4
|
interface IProps extends InputNumberProps {
|
|
@@ -27,4 +27,5 @@ interface IProps extends InputNumberProps {
|
|
|
27
27
|
onOverRange?: (type: 'maxType' | 'minType') => void;
|
|
28
28
|
}
|
|
29
29
|
declare function InputNumber(props: IProps): JSX.Element;
|
|
30
|
-
|
|
30
|
+
declare const _default: React.MemoExoticComponent<typeof InputNumber>;
|
|
31
|
+
export default _default;
|
|
@@ -67,4 +67,4 @@ function InputNumber(props) {
|
|
|
67
67
|
};
|
|
68
68
|
return (React.createElement(AntInputNumber, __assign({ formatter: formatter || _formatter, parser: parser || _parser, precision: precision !== null && precision !== void 0 ? precision : _precision, onChange: onChangeHandle, onBlur: onBlurHandle, onPressEnter: onPressEnterHandle, onFocus: onFocusHandle }, restProps)));
|
|
69
69
|
}
|
|
70
|
-
export default InputNumber;
|
|
70
|
+
export default React.memo(InputNumber);
|