easy3wui 1.5.64-beta.1 → 1.5.64-beta.10
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/assets/editBigTable.css +31 -0
- package/assets/index.css +31 -0
- package/lib/Easy3wDownLoad/Easy3wRCView.js +12 -7
- package/lib/Easy3wEditBigTable/index.js +191 -95
- package/package.json +3 -3
package/assets/editBigTable.css
CHANGED
|
@@ -44,3 +44,34 @@
|
|
|
44
44
|
padding: 4px;
|
|
45
45
|
font-size: 14px;
|
|
46
46
|
}
|
|
47
|
+
.Easy3wEditBigTable .textEditor {
|
|
48
|
+
-webkit-appearance: none;
|
|
49
|
+
-moz-appearance: none;
|
|
50
|
+
appearance: none;
|
|
51
|
+
box-sizing: border-box;
|
|
52
|
+
inline-size: 100%;
|
|
53
|
+
block-size: 100%;
|
|
54
|
+
padding-block: 0;
|
|
55
|
+
padding-inline: 6px;
|
|
56
|
+
border: 2px solid #ccc;
|
|
57
|
+
vertical-align: top;
|
|
58
|
+
color: var(--rdg-color);
|
|
59
|
+
background-color: var(--rdg-background-color);
|
|
60
|
+
font-family: inherit;
|
|
61
|
+
font-size: var(--rdg-font-size);
|
|
62
|
+
}
|
|
63
|
+
.Easy3wEditBigTable .textEditor:focus {
|
|
64
|
+
border-color: var(--rdg-selection-color);
|
|
65
|
+
outline: none;
|
|
66
|
+
}
|
|
67
|
+
.Easy3wEditBigTable .textEditor:-ms-input-placeholder {
|
|
68
|
+
color: #999;
|
|
69
|
+
opacity: 1;
|
|
70
|
+
}
|
|
71
|
+
.Easy3wEditBigTable .textEditor::placeholder {
|
|
72
|
+
color: #999;
|
|
73
|
+
opacity: 1;
|
|
74
|
+
}
|
|
75
|
+
.Easy3wEditBigTable .rdg-row:not(.rdg-summary-row) .rdg-cell:not([aria-readonly]) {
|
|
76
|
+
background-color: #f6ffed;
|
|
77
|
+
}
|
package/assets/index.css
CHANGED
|
@@ -1528,3 +1528,34 @@ input.ant-input-number-input {
|
|
|
1528
1528
|
padding: 4px;
|
|
1529
1529
|
font-size: 14px;
|
|
1530
1530
|
}
|
|
1531
|
+
.Easy3wEditBigTable .textEditor {
|
|
1532
|
+
-webkit-appearance: none;
|
|
1533
|
+
-moz-appearance: none;
|
|
1534
|
+
appearance: none;
|
|
1535
|
+
box-sizing: border-box;
|
|
1536
|
+
inline-size: 100%;
|
|
1537
|
+
block-size: 100%;
|
|
1538
|
+
padding-block: 0;
|
|
1539
|
+
padding-inline: 6px;
|
|
1540
|
+
border: 2px solid #ccc;
|
|
1541
|
+
vertical-align: top;
|
|
1542
|
+
color: var(--rdg-color);
|
|
1543
|
+
background-color: var(--rdg-background-color);
|
|
1544
|
+
font-family: inherit;
|
|
1545
|
+
font-size: var(--rdg-font-size);
|
|
1546
|
+
}
|
|
1547
|
+
.Easy3wEditBigTable .textEditor:focus {
|
|
1548
|
+
border-color: var(--rdg-selection-color);
|
|
1549
|
+
outline: none;
|
|
1550
|
+
}
|
|
1551
|
+
.Easy3wEditBigTable .textEditor:-ms-input-placeholder {
|
|
1552
|
+
color: #999;
|
|
1553
|
+
opacity: 1;
|
|
1554
|
+
}
|
|
1555
|
+
.Easy3wEditBigTable .textEditor::placeholder {
|
|
1556
|
+
color: #999;
|
|
1557
|
+
opacity: 1;
|
|
1558
|
+
}
|
|
1559
|
+
.Easy3wEditBigTable .rdg-row:not(.rdg-summary-row) .rdg-cell:not([aria-readonly]) {
|
|
1560
|
+
background-color: #f6ffed;
|
|
1561
|
+
}
|
|
@@ -27,16 +27,20 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'd
|
|
|
27
27
|
var Easy3wRCView = function (_PureComponent) {
|
|
28
28
|
(0, _inherits3['default'])(Easy3wRCView, _PureComponent);
|
|
29
29
|
|
|
30
|
-
function Easy3wRCView() {
|
|
30
|
+
function Easy3wRCView(props) {
|
|
31
31
|
(0, _classCallCheck3['default'])(this, Easy3wRCView);
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
var _this = (0, _possibleConstructorReturn3['default'])(this, _PureComponent.call(this, props));
|
|
34
|
+
|
|
35
|
+
_this.viewerRef = _react2['default'].createRef(); // 创建 ref
|
|
36
|
+
return _this;
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
Easy3wRCView.prototype.componentDidUpdate = function componentDidUpdate() {
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
var viewer = this.viewerRef.current; // 使用 ref 的 current 属性
|
|
41
|
+
if (viewer) {
|
|
42
|
+
viewer.show();
|
|
43
|
+
}
|
|
40
44
|
};
|
|
41
45
|
|
|
42
46
|
Easy3wRCView.prototype.render = function render() {
|
|
@@ -52,7 +56,8 @@ var Easy3wRCView = function (_PureComponent) {
|
|
|
52
56
|
hide: hideModal
|
|
53
57
|
}
|
|
54
58
|
// eslint-disable-next-line react/no-string-refs
|
|
55
|
-
|
|
59
|
+
// ref="viewer"
|
|
60
|
+
, ref: this.viewerRef // 使用回调 ref 或 createRef
|
|
56
61
|
},
|
|
57
62
|
_react2['default'].createElement('img', { style: { display: 'none' }, src: imgUrl, alt: '' })
|
|
58
63
|
);
|
|
@@ -34,16 +34,12 @@ var _reactDataGrid = require('react-data-grid');
|
|
|
34
34
|
|
|
35
35
|
var _reactDataGrid2 = _interopRequireDefault(_reactDataGrid);
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
require('react-data-grid/lib/styles.css');
|
|
38
38
|
|
|
39
39
|
var _xlsx = require('xlsx');
|
|
40
40
|
|
|
41
41
|
var _xlsx2 = _interopRequireDefault(_xlsx);
|
|
42
42
|
|
|
43
|
-
var _numeral = require('numeral');
|
|
44
|
-
|
|
45
|
-
var _numeral2 = _interopRequireDefault(_numeral);
|
|
46
|
-
|
|
47
43
|
var _classnames = require('classnames');
|
|
48
44
|
|
|
49
45
|
var _classnames2 = _interopRequireDefault(_classnames);
|
|
@@ -54,9 +50,6 @@ var _Easy3wEditBigTableForm2 = _interopRequireDefault(_Easy3wEditBigTableForm);
|
|
|
54
50
|
|
|
55
51
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
56
52
|
|
|
57
|
-
/* eslint-disable no-alert */
|
|
58
|
-
var Selectors = _reactDataGridAddons.Data.Selectors;
|
|
59
|
-
|
|
60
53
|
var Easy3wEditBigTable = function (_Component) {
|
|
61
54
|
(0, _inherits3['default'])(Easy3wEditBigTable, _Component);
|
|
62
55
|
|
|
@@ -69,18 +62,48 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
69
62
|
_this[pureComponentName] = that;
|
|
70
63
|
};
|
|
71
64
|
|
|
65
|
+
_this.touchCreateColumns = function (columns) {
|
|
66
|
+
var _this$props = _this.props,
|
|
67
|
+
_this$props$autoAddNu = _this$props.autoAddNumber,
|
|
68
|
+
autoAddNumber = _this$props$autoAddNu === undefined ? true : _this$props$autoAddNu,
|
|
69
|
+
selectedFlag = _this$props.selectedFlag;
|
|
70
|
+
|
|
71
|
+
if (autoAddNumber) {
|
|
72
|
+
columns.unshift({
|
|
73
|
+
name: '序号',
|
|
74
|
+
key: 'index',
|
|
75
|
+
renderCell: function renderCell(_ref) {
|
|
76
|
+
var rowIdx = _ref.rowIdx;
|
|
77
|
+
return rowIdx + 1;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (selectedFlag) {
|
|
82
|
+
columns.unshift(_reactDataGrid.SelectColumn);
|
|
83
|
+
}
|
|
84
|
+
return columns;
|
|
85
|
+
};
|
|
86
|
+
|
|
72
87
|
_this.touchDP = function () {
|
|
73
|
-
var
|
|
88
|
+
var dataList = _this.props.dataList;
|
|
74
89
|
|
|
75
|
-
var arrOriginalRows = [].concat(
|
|
90
|
+
var arrOriginalRows = [].concat(dataList); // 原始数据
|
|
76
91
|
var _this$state = _this.state,
|
|
77
92
|
objFilters = _this$state.objFilters,
|
|
78
93
|
sortColumns = _this$state.sortColumns;
|
|
79
94
|
|
|
80
95
|
var arrRows = [].concat(arrOriginalRows);
|
|
96
|
+
var numFlag = false;
|
|
81
97
|
if (objFilters.enabled) {
|
|
82
98
|
// 启用筛选条件
|
|
83
99
|
arrRows = _this.touchFilter(objFilters, arrOriginalRows);
|
|
100
|
+
numFlag = true;
|
|
101
|
+
}
|
|
102
|
+
if (!numFlag) {
|
|
103
|
+
arrRows.map(function (item, index) {
|
|
104
|
+
item.autoAddNumber_idx_edit = index;
|
|
105
|
+
return item;
|
|
106
|
+
});
|
|
84
107
|
}
|
|
85
108
|
if (sortColumns.length > 0) {
|
|
86
109
|
// 有排序字段
|
|
@@ -93,7 +116,8 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
93
116
|
var objFiltersNew = (0, _extends5['default'])({}, objFilters);
|
|
94
117
|
delete objFiltersNew.enabled;
|
|
95
118
|
var arrFilterKeys = Object.keys(objFiltersNew);
|
|
96
|
-
return arrRows.filter(function (r) {
|
|
119
|
+
return arrRows.filter(function (r, index) {
|
|
120
|
+
r.autoAddNumber_idx_edit = index;
|
|
97
121
|
var filterFlag = true;
|
|
98
122
|
arrFilterKeys.map(function (key) {
|
|
99
123
|
filterFlag = filterFlag && (objFilters[key] || objFilters[key] === 0 ? r[key] && r[key].includes(objFilters[key]) : true);
|
|
@@ -114,7 +138,7 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
114
138
|
}
|
|
115
139
|
return true;
|
|
116
140
|
});
|
|
117
|
-
|
|
141
|
+
var arr = arrRows.sort(function (a, b) {
|
|
118
142
|
// const comparator = getComparator(objSortColumns.columnKey);
|
|
119
143
|
var compResult = 0; // 比较结果
|
|
120
144
|
switch (dataType) {
|
|
@@ -162,28 +186,40 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
162
186
|
return compResult;
|
|
163
187
|
}
|
|
164
188
|
});
|
|
189
|
+
return arr;
|
|
165
190
|
};
|
|
166
191
|
|
|
167
|
-
_this.
|
|
168
|
-
var rowsView = [].concat(_this.arrRows);
|
|
169
|
-
var objTotal = {}; // 总计对象
|
|
192
|
+
_this.touchCountTotal = function (rowsView, columns) {
|
|
170
193
|
rowsView.map(function (row, index) {
|
|
171
|
-
|
|
194
|
+
columns.map(function (item, idx) {
|
|
172
195
|
var key = item.key,
|
|
173
|
-
totalFlag = item.totalFlag
|
|
196
|
+
totalFlag = item.totalFlag,
|
|
197
|
+
children = item.children;
|
|
174
198
|
|
|
175
|
-
if (
|
|
199
|
+
if (children) {
|
|
200
|
+
_this.touchCountTotal(rowsView, children);
|
|
201
|
+
} else if (totalFlag && typeof totalFlag === 'boolean') {
|
|
176
202
|
if (index === 0) {
|
|
177
|
-
objTotal[key] = 0;
|
|
203
|
+
_this.objTotal[key] = 0;
|
|
178
204
|
}
|
|
179
205
|
var intData = Number(row[key]) || 0;
|
|
180
|
-
objTotal[key] += intData;
|
|
206
|
+
_this.objTotal[key] += intData;
|
|
181
207
|
}
|
|
182
208
|
return idx;
|
|
183
209
|
});
|
|
184
210
|
return index;
|
|
185
211
|
});
|
|
186
|
-
return objTotal;
|
|
212
|
+
return _this.objTotal;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
_this.touchSetState = function (objState, callback) {
|
|
216
|
+
// objState 要设置的state对象
|
|
217
|
+
// callback 回调函数 非必须
|
|
218
|
+
if (callback && typeof callback === 'function') {
|
|
219
|
+
_this.setState(objState, callback);
|
|
220
|
+
} else {
|
|
221
|
+
_this.setState(objState);
|
|
222
|
+
}
|
|
187
223
|
};
|
|
188
224
|
|
|
189
225
|
_this.touchFilters = function () {
|
|
@@ -193,6 +229,12 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
193
229
|
objFilters: (0, _extends5['default'])({}, objFilters, {
|
|
194
230
|
enabled: !objFilters.enabled
|
|
195
231
|
})
|
|
232
|
+
}, function () {
|
|
233
|
+
var touchFiltersChangeState = _this.props.touchFiltersChangeState;
|
|
234
|
+
|
|
235
|
+
if (touchFiltersChangeState && typeof touchFiltersChangeState === 'function') {
|
|
236
|
+
touchFiltersChangeState((0, _extends5['default'])({}, _this.state.objFilters));
|
|
237
|
+
}
|
|
196
238
|
});
|
|
197
239
|
};
|
|
198
240
|
|
|
@@ -203,6 +245,12 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
203
245
|
|
|
204
246
|
_this.setState({
|
|
205
247
|
objFilters: (0, _extends5['default'])({}, objFilters, (_extends2 = {}, _extends2[fieldId] = value, _extends2))
|
|
248
|
+
}, function () {
|
|
249
|
+
var touchFiltersChangeState = _this.props.touchFiltersChangeState;
|
|
250
|
+
|
|
251
|
+
if (touchFiltersChangeState && typeof touchFiltersChangeState === 'function') {
|
|
252
|
+
touchFiltersChangeState((0, _extends5['default'])({}, _this.state.objFilters));
|
|
253
|
+
}
|
|
206
254
|
});
|
|
207
255
|
};
|
|
208
256
|
|
|
@@ -213,6 +261,12 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
213
261
|
objFilters: {
|
|
214
262
|
enabled: objFilters.enabled
|
|
215
263
|
}
|
|
264
|
+
}, function () {
|
|
265
|
+
var touchFiltersChangeState = _this.props.touchFiltersChangeState;
|
|
266
|
+
|
|
267
|
+
if (touchFiltersChangeState && typeof touchFiltersChangeState === 'function') {
|
|
268
|
+
touchFiltersChangeState((0, _extends5['default'])({}, _this.state.objFilters));
|
|
269
|
+
}
|
|
216
270
|
});
|
|
217
271
|
};
|
|
218
272
|
|
|
@@ -306,18 +360,18 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
306
360
|
};
|
|
307
361
|
|
|
308
362
|
_this.touchAddRow = function () {
|
|
309
|
-
var
|
|
363
|
+
var _ref2;
|
|
310
364
|
|
|
311
365
|
var rowKey = _this.props.rowKey;
|
|
312
|
-
var
|
|
366
|
+
var dataList = _this.props.dataList;
|
|
313
367
|
|
|
314
|
-
_this.saveEditBigTableModelZJ('touchAddRow', [].concat(
|
|
368
|
+
_this.saveEditBigTableModelZJ('touchAddRow', [].concat(dataList, [(_ref2 = {}, _ref2[rowKey] = 'add_' + (dataList.length - 1) + '_' + new Date().getTime(), _ref2)]));
|
|
315
369
|
};
|
|
316
370
|
|
|
317
371
|
_this.touchCopyRow = function () {
|
|
318
|
-
var _this$
|
|
319
|
-
|
|
320
|
-
rowKey = _this$
|
|
372
|
+
var _this$props2 = _this.props,
|
|
373
|
+
dataList = _this$props2.dataList,
|
|
374
|
+
rowKey = _this$props2.rowKey;
|
|
321
375
|
var arrValuesInfo = _this.state.arrValuesInfo;
|
|
322
376
|
|
|
323
377
|
if (arrValuesInfo.length) {
|
|
@@ -329,7 +383,7 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
329
383
|
arrNew.push(newRow);
|
|
330
384
|
return item;
|
|
331
385
|
});
|
|
332
|
-
_this.saveEditBigTableModelZJ('touchCopyRow', [].concat(
|
|
386
|
+
_this.saveEditBigTableModelZJ('touchCopyRow', [].concat(dataList, arrNew));
|
|
333
387
|
} else {
|
|
334
388
|
_modal2['default'].error({
|
|
335
389
|
title: '错误',
|
|
@@ -339,18 +393,18 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
339
393
|
};
|
|
340
394
|
|
|
341
395
|
_this.deleteRow = function () {
|
|
342
|
-
var
|
|
396
|
+
var dataList = _this.props.dataList;
|
|
343
397
|
var _this$state2 = _this.state,
|
|
344
398
|
arrValues = _this$state2.arrValues,
|
|
345
399
|
arrValuesInfo = _this$state2.arrValuesInfo;
|
|
346
|
-
var _this$
|
|
347
|
-
objToolbarProps = _this$
|
|
348
|
-
rowKey = _this$
|
|
400
|
+
var _this$props3 = _this.props,
|
|
401
|
+
objToolbarProps = _this$props3.objToolbarProps,
|
|
402
|
+
rowKey = _this$props3.rowKey;
|
|
349
403
|
var deleteRowInterface = objToolbarProps.deleteRowInterface;
|
|
350
404
|
|
|
351
405
|
if (arrValues.length) {
|
|
352
406
|
var arrRows = []; // 删除数据后的新数组
|
|
353
|
-
|
|
407
|
+
dataList.map(function (row) {
|
|
354
408
|
var flag = true;
|
|
355
409
|
arrValues.map(function (key) {
|
|
356
410
|
if (key === row[rowKey]) {
|
|
@@ -379,12 +433,12 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
379
433
|
}
|
|
380
434
|
};
|
|
381
435
|
|
|
382
|
-
_this.
|
|
383
|
-
var _this$
|
|
384
|
-
columns = _this$
|
|
385
|
-
arrColumnsKey = _this$
|
|
386
|
-
objSheet = _this$
|
|
387
|
-
arrColInfo = _this$
|
|
436
|
+
_this.touchGetHearder = function () {
|
|
437
|
+
var _this$props4 = _this.props,
|
|
438
|
+
columns = _this$props4.columns,
|
|
439
|
+
arrColumnsKey = _this$props4.arrColumnsKey,
|
|
440
|
+
objSheet = _this$props4.objSheet,
|
|
441
|
+
arrColInfo = _this$props4.arrColInfo;
|
|
388
442
|
|
|
389
443
|
|
|
390
444
|
var arrColumnsKeyNew = ['id'];
|
|
@@ -425,17 +479,17 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
425
479
|
var file = e.target.files[0];
|
|
426
480
|
var reader = new FileReader();
|
|
427
481
|
reader.onload = function (event) {
|
|
428
|
-
var _this$
|
|
429
|
-
arrColumnsKey = _this$
|
|
482
|
+
var _this$touchGetHearder = _this.touchGetHearder(),
|
|
483
|
+
arrColumnsKey = _this$touchGetHearder.arrColumnsKey;
|
|
430
484
|
|
|
431
485
|
var data = event.target.result;
|
|
432
486
|
var workbook = _xlsx2['default'].read(data, { type: 'binary' });
|
|
433
487
|
var firstSheetName = workbook.SheetNames[0];
|
|
434
488
|
var worksheet = workbook.Sheets[firstSheetName];
|
|
435
|
-
var
|
|
436
|
-
|
|
437
|
-
// const rowsView = this.getRows(
|
|
438
|
-
_this.saveEditBigTableModelZJ('touchImport',
|
|
489
|
+
var dataList = _xlsx2['default'].utils.sheet_to_json(worksheet, { header: arrColumnsKey });
|
|
490
|
+
dataList.shift(); // 去掉表头
|
|
491
|
+
// const rowsView = this.getRows(dataList); // 表格显示数据
|
|
492
|
+
_this.saveEditBigTableModelZJ('touchImport', dataList);
|
|
439
493
|
};
|
|
440
494
|
reader.readAsBinaryString(file);
|
|
441
495
|
};
|
|
@@ -443,9 +497,9 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
443
497
|
};
|
|
444
498
|
|
|
445
499
|
_this.touchExport = function () {
|
|
446
|
-
var _this$
|
|
447
|
-
objSheet = _this$
|
|
448
|
-
arrColInfo = _this$
|
|
500
|
+
var _this$touchGetHearder2 = _this.touchGetHearder(),
|
|
501
|
+
objSheet = _this$touchGetHearder2.objSheet,
|
|
502
|
+
arrColInfo = _this$touchGetHearder2.arrColInfo;
|
|
449
503
|
|
|
450
504
|
var rowsView = [].concat(_this.arrRows);
|
|
451
505
|
// 计算 rowsView 中所有对象字段最多的长度
|
|
@@ -486,61 +540,46 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
486
540
|
};
|
|
487
541
|
|
|
488
542
|
_this.confirmCallbackBatchEditBigTable = function (objFormData, objColumn) {
|
|
489
|
-
var _this$
|
|
490
|
-
|
|
491
|
-
touchAutoCompute = _this$
|
|
492
|
-
rowKey = _this$
|
|
543
|
+
var _this$props5 = _this.props,
|
|
544
|
+
dataList = _this$props5.dataList,
|
|
545
|
+
touchAutoCompute = _this$props5.touchAutoCompute,
|
|
546
|
+
rowKey = _this$props5.rowKey;
|
|
493
547
|
|
|
494
548
|
var rowsView = [].concat(_this.arrRows);
|
|
495
|
-
rowsView.map(function (row
|
|
496
|
-
|
|
549
|
+
rowsView.map(function (row) {
|
|
550
|
+
// const rowId = row[rowKey];
|
|
551
|
+
var autoAddNumberIdxEdit = row.autoAddNumber_idx_edit;
|
|
497
552
|
// const { [rowKey]: } = row;
|
|
553
|
+
|
|
498
554
|
var updated = (0, _extends5['default'])({}, objFormData);
|
|
499
555
|
if (touchAutoCompute && typeof touchAutoCompute === 'function') {
|
|
500
556
|
// 数据变更-自动计算行数据
|
|
501
|
-
// action 改变的动作类型,'CELL_UPDATE' 单元格更新,'CELL_BATCH_CHANGE' 单元格批量更新 CELL_UPDATE, COLUMN_FILL, COPY_PASTE, CELL_DRAG
|
|
502
|
-
// cellKey 改变的单元格的key
|
|
503
|
-
// fromRow 改变的单元格的原来行序号
|
|
504
|
-
// fromRowData 改变的单元格的原来行数据
|
|
505
|
-
// fromRowId 改变的单元格的原来行id(行唯一标识)
|
|
506
|
-
// rowIds 所有被选中的行id
|
|
507
|
-
// toRow 改变的单元格的新行序号
|
|
508
|
-
// toRowId 改变的单元格的新行id
|
|
509
|
-
// updated 改变的单元格的新值
|
|
510
557
|
updated = touchAutoCompute({
|
|
511
558
|
cellKey: objColumn.key,
|
|
512
|
-
fromRow: index,
|
|
513
|
-
toRow: index,
|
|
514
|
-
fromRowId: row[rowKey],
|
|
515
|
-
toRowId: row[rowKey],
|
|
516
|
-
rowIds: [row[rowKey]],
|
|
517
559
|
updated: updated,
|
|
518
|
-
action: 'CELL_BATCH_CHANGE',
|
|
519
|
-
fromRowData: row,
|
|
520
560
|
toRowData: row
|
|
521
561
|
});
|
|
522
562
|
}
|
|
523
|
-
|
|
524
|
-
rowsView[index] = (0, _extends5['default'])({}, rowsView[index], updated);
|
|
563
|
+
dataList[autoAddNumberIdxEdit] = (0, _extends5['default'])({}, dataList[autoAddNumberIdxEdit], updated);
|
|
525
564
|
return row;
|
|
526
565
|
});
|
|
527
|
-
_this.saveEditBigTableModelZJ('confirmCallbackBatchEditBigTable',
|
|
566
|
+
_this.saveEditBigTableModelZJ('confirmCallbackBatchEditBigTable', dataList);
|
|
528
567
|
};
|
|
529
568
|
|
|
530
|
-
_this.saveEditBigTableModelZJ = function (operationType,
|
|
569
|
+
_this.saveEditBigTableModelZJ = function (operationType, dataList) {
|
|
531
570
|
var saveEditBigTableModel = _this.props.saveEditBigTableModel;
|
|
532
571
|
|
|
533
572
|
if (saveEditBigTableModel && typeof saveEditBigTableModel === 'function') {
|
|
534
573
|
// 数据变更-回调函数
|
|
535
|
-
saveEditBigTableModel(operationType,
|
|
574
|
+
saveEditBigTableModel(operationType, dataList);
|
|
536
575
|
}
|
|
537
576
|
};
|
|
538
577
|
|
|
539
578
|
_this.saveEditBigTableZJ = function () {
|
|
540
579
|
var objToolbarProps = _this.props.objToolbarProps;
|
|
541
580
|
|
|
542
|
-
var
|
|
543
|
-
saveEditBigTable =
|
|
581
|
+
var _ref3 = objToolbarProps || {},
|
|
582
|
+
saveEditBigTable = _ref3.saveEditBigTable;
|
|
544
583
|
|
|
545
584
|
if (saveEditBigTable && typeof saveEditBigTable === 'function') {
|
|
546
585
|
// 数据变更-回调函数
|
|
@@ -556,8 +595,40 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
556
595
|
});
|
|
557
596
|
};
|
|
558
597
|
|
|
598
|
+
_this.touchRowsChange = function (updatedRows, obj) {
|
|
599
|
+
var indexes = obj.indexes,
|
|
600
|
+
column = obj.column;
|
|
601
|
+
var _this$props6 = _this.props,
|
|
602
|
+
touchAutoCompute = _this$props6.touchAutoCompute,
|
|
603
|
+
dataList = _this$props6.dataList;
|
|
604
|
+
var key = column.key;
|
|
605
|
+
|
|
606
|
+
if (indexes && indexes.length) {
|
|
607
|
+
indexes.map(function (index) {
|
|
608
|
+
var updated = updatedRows[index];
|
|
609
|
+
var _updated = updated,
|
|
610
|
+
autoAddNumberIdxEdit = _updated.autoAddNumber_idx_edit;
|
|
611
|
+
|
|
612
|
+
if (touchAutoCompute && typeof touchAutoCompute === 'function') {
|
|
613
|
+
var _updated2;
|
|
614
|
+
|
|
615
|
+
updated = touchAutoCompute({
|
|
616
|
+
cellKey: key,
|
|
617
|
+
updated: (_updated2 = {}, _updated2[column.key] = updated[column.key], _updated2),
|
|
618
|
+
toRowData: _this.arrRows[index]
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
dataList[autoAddNumberIdxEdit] = (0, _extends5['default'])({}, dataList[autoAddNumberIdxEdit], updated);
|
|
622
|
+
return index;
|
|
623
|
+
});
|
|
624
|
+
_this.saveEditBigTableModelZJ('touchRowsChange', dataList);
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
|
|
559
628
|
_this.touchSelectedRowsChange = function (selectedRows) {
|
|
560
|
-
var
|
|
629
|
+
var _this$props7 = _this.props,
|
|
630
|
+
rowKey = _this$props7.rowKey,
|
|
631
|
+
touchSelectedRowsChangeCB = _this$props7.touchSelectedRowsChangeCB;
|
|
561
632
|
|
|
562
633
|
var arrValuesInfo = Array.from(selectedRows);
|
|
563
634
|
var arrValues = [];
|
|
@@ -565,6 +636,9 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
565
636
|
arrValues.push(item[rowKey]);
|
|
566
637
|
return item;
|
|
567
638
|
});
|
|
639
|
+
if (touchSelectedRowsChangeCB && typeof touchSelectedRowsChangeCB === 'function') {
|
|
640
|
+
touchSelectedRowsChangeCB(arrValues, arrValuesInfo, selectedRows);
|
|
641
|
+
}
|
|
568
642
|
_this.setState({
|
|
569
643
|
// 表格选择
|
|
570
644
|
selectedRows: selectedRows, // 选中的行
|
|
@@ -596,9 +670,9 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
596
670
|
Easy3wEditBigTable.prototype.componentWillUnmount = function componentWillUnmount() {
|
|
597
671
|
var objToolbarProps = this.props.objToolbarProps;
|
|
598
672
|
|
|
599
|
-
var
|
|
600
|
-
|
|
601
|
-
unloadSaveFlag =
|
|
673
|
+
var _ref4 = objToolbarProps || {},
|
|
674
|
+
_ref4$unloadSaveFlag = _ref4.unloadSaveFlag,
|
|
675
|
+
unloadSaveFlag = _ref4$unloadSaveFlag === undefined ? true : _ref4$unloadSaveFlag;
|
|
602
676
|
// unloadSaveFlag 是否在卸载后保存 true 需要保存 false 不需要保存
|
|
603
677
|
|
|
604
678
|
|
|
@@ -626,6 +700,9 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
626
700
|
};
|
|
627
701
|
// 绑定组件
|
|
628
702
|
|
|
703
|
+
// #region 表头列处理
|
|
704
|
+
|
|
705
|
+
// #endregion 表头列处理
|
|
629
706
|
|
|
630
707
|
// #region 数据处理
|
|
631
708
|
// 数据处理
|
|
@@ -638,6 +715,11 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
638
715
|
|
|
639
716
|
// #endregion 数据处理
|
|
640
717
|
|
|
718
|
+
// #region state变更
|
|
719
|
+
// 设置组件state
|
|
720
|
+
|
|
721
|
+
// #endregion state变更
|
|
722
|
+
|
|
641
723
|
// #region 筛选
|
|
642
724
|
// 切换筛选
|
|
643
725
|
|
|
@@ -685,6 +767,10 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
685
767
|
|
|
686
768
|
// #endregion 保存
|
|
687
769
|
|
|
770
|
+
// #region 表单数据编辑
|
|
771
|
+
|
|
772
|
+
// #endregion 表单数据编辑
|
|
773
|
+
|
|
688
774
|
// #region 行选择
|
|
689
775
|
|
|
690
776
|
|
|
@@ -702,23 +788,25 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
702
788
|
selectedRows = _state.selectedRows;
|
|
703
789
|
var _props = this.props,
|
|
704
790
|
columns = _props.columns,
|
|
705
|
-
rows = _props.rows,
|
|
706
791
|
objToolbarProps = _props.objToolbarProps,
|
|
707
792
|
rowKey = _props.rowKey,
|
|
708
793
|
topTotalFlag = _props.topTotalFlag,
|
|
709
|
-
bottomTotalFlag = _props.bottomTotalFlag
|
|
794
|
+
bottomTotalFlag = _props.bottomTotalFlag,
|
|
795
|
+
objOtherProps = _props.objOtherProps;
|
|
710
796
|
// #region 表格数据处理,排序(sort)、筛选(filter)
|
|
711
797
|
|
|
712
798
|
this.arrRows = this.touchDP();
|
|
713
799
|
var objPrps = {};
|
|
714
800
|
// #region 总计行
|
|
715
|
-
if (topTotalFlag) {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
801
|
+
if (topTotalFlag || bottomTotalFlag) {
|
|
802
|
+
this.objTotal = {}; // 总计对象
|
|
803
|
+
var arrTotalRows = [this.touchCountTotal(this.arrRows, columns)];
|
|
804
|
+
if (topTotalFlag) {
|
|
805
|
+
objPrps.topSummaryRows = arrTotalRows;
|
|
806
|
+
}
|
|
807
|
+
if (bottomTotalFlag) {
|
|
808
|
+
objPrps.bottomSummaryRows = arrTotalRows;
|
|
809
|
+
}
|
|
722
810
|
}
|
|
723
811
|
// #endregion 总计行
|
|
724
812
|
return _react2['default'].createElement(
|
|
@@ -726,8 +814,11 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
726
814
|
{ className: (0, _classnames2['default'])(['Easy3wEditBigTable']) },
|
|
727
815
|
objToolbarProps ? this.getToolbar() : '',
|
|
728
816
|
_react2['default'].createElement(_reactDataGrid2['default'], (0, _extends5['default'])({}, objPrps, {
|
|
729
|
-
columns: columns // 表头
|
|
730
|
-
,
|
|
817
|
+
columns: this.touchCreateColumns(columns) // 表头
|
|
818
|
+
, defaultColumnOptions: {
|
|
819
|
+
resizable: true // 可调整列宽
|
|
820
|
+
},
|
|
821
|
+
rows: this.arrRows // 行数据
|
|
731
822
|
, headerRowHeight: objFilters.enabled ? 70 : undefined // 表头高度
|
|
732
823
|
// 排序
|
|
733
824
|
, sortColumns: sortColumns // 排序字段
|
|
@@ -738,7 +829,10 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
738
829
|
},
|
|
739
830
|
selectedRows: selectedRows,
|
|
740
831
|
onSelectedRowsChange: this.touchSelectedRowsChange
|
|
741
|
-
|
|
832
|
+
// 表格编辑时触发
|
|
833
|
+
, onRowsChange: this.touchRowsChange
|
|
834
|
+
// 其它属性
|
|
835
|
+
}, objOtherProps)),
|
|
742
836
|
visible ? _react2['default'].createElement(_Easy3wEditBigTableForm2['default'] // 批量录入Modal
|
|
743
837
|
, { visible: visible // 是否显示
|
|
744
838
|
, objOtherParameters: {
|
|
@@ -754,10 +848,12 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
754
848
|
};
|
|
755
849
|
|
|
756
850
|
return Easy3wEditBigTable;
|
|
757
|
-
}(_react.Component);
|
|
851
|
+
}(_react.Component); /* eslint-disable no-param-reassign */
|
|
852
|
+
/* eslint-disable no-alert */
|
|
853
|
+
|
|
758
854
|
|
|
759
855
|
Easy3wEditBigTable.defaultProps = {
|
|
760
|
-
rowKey: '
|
|
856
|
+
rowKey: 'autoAddNumber_idx_edit' // 表格主键 原始数据索引
|
|
761
857
|
};
|
|
762
858
|
exports['default'] = Easy3wEditBigTable;
|
|
763
859
|
module.exports = exports['default'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easy3wui",
|
|
3
|
-
"version": "1.5.64-beta.
|
|
3
|
+
"version": "1.5.64-beta.10",
|
|
4
4
|
"description": "easy3wui components for react",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -85,10 +85,10 @@
|
|
|
85
85
|
"rc-test": "^6.0.8",
|
|
86
86
|
"rc-tools": "^7.0.2",
|
|
87
87
|
"rc-trigger": "^2.2.2",
|
|
88
|
-
"react": "18.
|
|
88
|
+
"react": "^18.1.0",
|
|
89
89
|
"react-container-query": "^0.11.0",
|
|
90
90
|
"react-document-title": "^2.0.3",
|
|
91
|
-
"react-dom": "18.
|
|
91
|
+
"react-dom": "^18.1.0",
|
|
92
92
|
"react-test-renderer": "^16.0.0",
|
|
93
93
|
"redbox-react": "^1.3.2",
|
|
94
94
|
"roadhog": "^2.5.0-beta.4",
|