@zat-design/sisyphus-react 3.11.5-beta.1 → 3.11.5-beta.1.1
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/es/ProEditTable/components/RcTable/DraggableTable.js +6 -5
- package/es/ProEditTable/index.js +5 -4
- package/es/ProEditTable/utils/config.js +13 -9
- package/es/ProEditTable/utils/index.js +3 -3
- package/es/ProEditTable/utils/tools.js +2 -2
- package/lib/ProEditTable/components/RcTable/DraggableTable.js +6 -5
- package/lib/ProEditTable/index.js +5 -4
- package/lib/ProEditTable/utils/config.js +13 -9
- package/lib/ProEditTable/utils/index.js +3 -3
- package/lib/ProEditTable/utils/tools.js +2 -2
- package/package.json +1 -1
|
@@ -67,7 +67,7 @@ var Row = function Row(props) {
|
|
|
67
67
|
}));
|
|
68
68
|
};
|
|
69
69
|
var DndWrapper = function DndWrapper(_ref2) {
|
|
70
|
-
var _value
|
|
70
|
+
var _value$, _value$map;
|
|
71
71
|
var draggable = _ref2.draggable,
|
|
72
72
|
value = _ref2.value,
|
|
73
73
|
onChange = _ref2.onChange,
|
|
@@ -78,15 +78,16 @@ var DndWrapper = function DndWrapper(_ref2) {
|
|
|
78
78
|
var active = event.active,
|
|
79
79
|
over = event.over;
|
|
80
80
|
if (active.id !== (over === null || over === void 0 ? void 0 : over.id)) {
|
|
81
|
+
var _value$findIndex, _value$findIndex2;
|
|
81
82
|
if (onDrag) {
|
|
82
83
|
var nextList = onDrag(event, value);
|
|
83
84
|
onChange(nextList);
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
86
|
-
var activeIndex = value.findIndex(function (i) {
|
|
87
|
+
var activeIndex = value === null || value === void 0 ? void 0 : (_value$findIndex = value.findIndex) === null || _value$findIndex === void 0 ? void 0 : _value$findIndex.call(value, function (i) {
|
|
87
88
|
return i.rowKey === active.id;
|
|
88
89
|
});
|
|
89
|
-
var overIndex = value.findIndex(function (i) {
|
|
90
|
+
var overIndex = value === null || value === void 0 ? void 0 : (_value$findIndex2 = value.findIndex) === null || _value$findIndex2 === void 0 ? void 0 : _value$findIndex2.call(value, function (i) {
|
|
90
91
|
return i.rowKey === (over === null || over === void 0 ? void 0 : over.id);
|
|
91
92
|
});
|
|
92
93
|
var nextValue = arrayMove(value, activeIndex, overIndex);
|
|
@@ -96,8 +97,8 @@ var DndWrapper = function DndWrapper(_ref2) {
|
|
|
96
97
|
return draggable && !disabled ? _jsx(DndContext, {
|
|
97
98
|
onDragEnd: onDragEnd,
|
|
98
99
|
children: _jsx(SortableContext, {
|
|
99
|
-
items: (value === null || value === void 0 ? void 0 : (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.rowKey) ? value.map(function (i) {
|
|
100
|
-
return i.rowKey;
|
|
100
|
+
items: (value === null || value === void 0 ? void 0 : (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.rowKey) ? value === null || value === void 0 ? void 0 : (_value$map = value.map) === null || _value$map === void 0 ? void 0 : _value$map.call(value, function (i) {
|
|
101
|
+
return i === null || i === void 0 ? void 0 : i.rowKey;
|
|
101
102
|
}) : [],
|
|
102
103
|
strategy: verticalListSortingStrategy,
|
|
103
104
|
children: children
|
package/es/ProEditTable/index.js
CHANGED
|
@@ -122,10 +122,10 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
122
122
|
className: className
|
|
123
123
|
});
|
|
124
124
|
var getRowKey = function getRowKey(record) {
|
|
125
|
-
var key = record.rowKey || getRandom();
|
|
125
|
+
var key = (record === null || record === void 0 ? void 0 : record.rowKey) || getRandom();
|
|
126
126
|
if (rowKey) {
|
|
127
127
|
var _ref3;
|
|
128
|
-
key = (_ref3 = typeof rowKey === 'function' ? rowKey(record) : record[rowKey]) !== null && _ref3 !== void 0 ? _ref3 : key;
|
|
128
|
+
key = (_ref3 = typeof rowKey === 'function' ? rowKey(record) : record === null || record === void 0 ? void 0 : record[rowKey]) !== null && _ref3 !== void 0 ? _ref3 : key;
|
|
129
129
|
}
|
|
130
130
|
return key;
|
|
131
131
|
};
|
|
@@ -240,7 +240,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
240
240
|
}, resetProps);
|
|
241
241
|
// 编辑行设置下样式
|
|
242
242
|
var _rowClassName = function _rowClassName(record) {
|
|
243
|
-
var isEdit = !virtualKey || editingKeys.includes(record.rowKey);
|
|
243
|
+
var isEdit = !virtualKey || editingKeys.includes(record === null || record === void 0 ? void 0 : record.rowKey);
|
|
244
244
|
var className = isEdit ? 'is-editing' : '';
|
|
245
245
|
if (getIsNew(record)) {
|
|
246
246
|
return "is-new-row ".concat(className);
|
|
@@ -342,7 +342,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
342
342
|
});
|
|
343
343
|
// 初始化默认生成row-key
|
|
344
344
|
if ((value === null || value === void 0 ? void 0 : value.length) && (!isAllHasKey || isNeedCover)) {
|
|
345
|
-
var
|
|
345
|
+
var _value$map;
|
|
346
|
+
var nextValues = value === null || value === void 0 ? void 0 : (_value$map = value.map) === null || _value$map === void 0 ? void 0 : _value$map.call(value, function (item) {
|
|
346
347
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
347
348
|
rowKey: getRowKey(item)
|
|
348
349
|
});
|
|
@@ -50,7 +50,7 @@ export var actions = {
|
|
|
50
50
|
}
|
|
51
51
|
var nextEditingKeys = _toConsumableArray(editingKeys);
|
|
52
52
|
// 开启编辑状态
|
|
53
|
-
nextEditingKeys.push(record.rowKey);
|
|
53
|
+
nextEditingKeys.push(record === null || record === void 0 ? void 0 : record.rowKey);
|
|
54
54
|
// 编辑时赋值编辑状态,供validator做保存校验
|
|
55
55
|
if (nextEditingKeys === null || nextEditingKeys === void 0 ? void 0 : nextEditingKeys.length) {
|
|
56
56
|
record.isEditing = true;
|
|
@@ -65,6 +65,7 @@ export var actions = {
|
|
|
65
65
|
},
|
|
66
66
|
save: function () {
|
|
67
67
|
var _save = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
|
|
68
|
+
var _editingKeys$filter;
|
|
68
69
|
var record, editingKeys, setState, form, rowName, virtualRowName, result, updateData, nextEditingKeys, values;
|
|
69
70
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
70
71
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -75,8 +76,9 @@ export var actions = {
|
|
|
75
76
|
record = _objectSpread(_objectSpread(_objectSpread({}, record), form.getFieldValue(virtualRowName)), updateData);
|
|
76
77
|
delete record.addFlag; // 删除第一次新增的标记
|
|
77
78
|
// 关闭当前保存行的编辑状态
|
|
78
|
-
nextEditingKeys = editingKeys.filter(function (key) {
|
|
79
|
-
|
|
79
|
+
nextEditingKeys = editingKeys === null || editingKeys === void 0 ? void 0 : (_editingKeys$filter = editingKeys.filter) === null || _editingKeys$filter === void 0 ? void 0 : _editingKeys$filter.call(editingKeys, function (key) {
|
|
80
|
+
var _record;
|
|
81
|
+
return key !== ((_record = record) === null || _record === void 0 ? void 0 : _record.rowKey);
|
|
80
82
|
}); // 保存后取消编辑状态,供validator做保存校验
|
|
81
83
|
if (nextEditingKeys === null || nextEditingKeys === void 0 ? void 0 : nextEditingKeys.length) {
|
|
82
84
|
record.isEditing = true;
|
|
@@ -102,6 +104,7 @@ export var actions = {
|
|
|
102
104
|
return save;
|
|
103
105
|
}(),
|
|
104
106
|
cancel: function cancel(_ref3) {
|
|
107
|
+
var _editingKeys$filter2;
|
|
105
108
|
var name = _ref3.name,
|
|
106
109
|
record = _ref3.record,
|
|
107
110
|
editingKeys = _ref3.editingKeys,
|
|
@@ -109,8 +112,8 @@ export var actions = {
|
|
|
109
112
|
form = _ref3.form,
|
|
110
113
|
virtualRowName = _ref3.virtualRowName,
|
|
111
114
|
virtualKey = _ref3.virtualKey;
|
|
112
|
-
var nextEditingKeys = editingKeys.filter(function (key) {
|
|
113
|
-
return key !== record.rowKey;
|
|
115
|
+
var nextEditingKeys = editingKeys === null || editingKeys === void 0 ? void 0 : (_editingKeys$filter2 = editingKeys.filter) === null || _editingKeys$filter2 === void 0 ? void 0 : _editingKeys$filter2.call(editingKeys, function (key) {
|
|
116
|
+
return key !== (record === null || record === void 0 ? void 0 : record.rowKey);
|
|
114
117
|
});
|
|
115
118
|
// 保存后取消编辑状态,供validator做保存校验
|
|
116
119
|
if (nextEditingKeys === null || nextEditingKeys === void 0 ? void 0 : nextEditingKeys.length) {
|
|
@@ -127,7 +130,7 @@ export var actions = {
|
|
|
127
130
|
name: name,
|
|
128
131
|
form: form,
|
|
129
132
|
virtualKey: virtualKey,
|
|
130
|
-
selectedRowKeys: [record.rowKey]
|
|
133
|
+
selectedRowKeys: [record === null || record === void 0 ? void 0 : record.rowKey]
|
|
131
134
|
});
|
|
132
135
|
} else {
|
|
133
136
|
// 防止value引用不变, 值不更新 - (自定义组件)
|
|
@@ -154,12 +157,13 @@ export var actions = {
|
|
|
154
157
|
name: name,
|
|
155
158
|
form: form,
|
|
156
159
|
virtualKey: virtualKey,
|
|
157
|
-
selectedRowKeys: [record.rowKey]
|
|
160
|
+
selectedRowKeys: [record === null || record === void 0 ? void 0 : record.rowKey]
|
|
158
161
|
});
|
|
159
162
|
if (virtualKey) {
|
|
163
|
+
var _editingKeys$filter3;
|
|
160
164
|
// 关闭编辑状态
|
|
161
|
-
var nextEditingKeys = editingKeys.filter(function (key) {
|
|
162
|
-
return key === record.rowKey;
|
|
165
|
+
var nextEditingKeys = editingKeys === null || editingKeys === void 0 ? void 0 : (_editingKeys$filter3 = editingKeys.filter) === null || _editingKeys$filter3 === void 0 ? void 0 : _editingKeys$filter3.call(editingKeys, function (key) {
|
|
166
|
+
return key === (record === null || record === void 0 ? void 0 : record.rowKey);
|
|
163
167
|
});
|
|
164
168
|
setState({
|
|
165
169
|
editingKeys: nextEditingKeys
|
|
@@ -174,7 +174,7 @@ var getActionColumn = function getActionColumn(config) {
|
|
|
174
174
|
config: config,
|
|
175
175
|
btnConfig: btnConfig
|
|
176
176
|
}))
|
|
177
|
-
}, "".concat(record.rowKey, "-").concat(btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.type));
|
|
177
|
+
}, "".concat(record === null || record === void 0 ? void 0 : record.rowKey, "-").concat(btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.type));
|
|
178
178
|
})
|
|
179
179
|
});
|
|
180
180
|
}
|
|
@@ -277,9 +277,9 @@ export var transformColumns = function transformColumns() {
|
|
|
277
277
|
item.className = _toConsumableArray(new Set(item.className.split(' '))).join(' ');
|
|
278
278
|
}
|
|
279
279
|
var _render = function _render(text, record, index) {
|
|
280
|
-
var isEditing = !virtualKey || editingKeys.includes(record.rowKey) || record.addFlag;
|
|
280
|
+
var isEditing = !virtualKey || editingKeys.includes(record === null || record === void 0 ? void 0 : record.rowKey) || record.addFlag;
|
|
281
281
|
var namePath = isArray(name) ? name : [name];
|
|
282
|
-
if (virtualKey && editingKeys.includes(record.rowKey)) {
|
|
282
|
+
if (virtualKey && editingKeys.includes(record === null || record === void 0 ? void 0 : record.rowKey)) {
|
|
283
283
|
namePath = getNamePath(name, virtualKey);
|
|
284
284
|
}
|
|
285
285
|
var columnNamePath = isArray(columnName) ? columnName : [columnName];
|
|
@@ -65,7 +65,7 @@ export var onDelete = function onDelete(_ref) {
|
|
|
65
65
|
// 正常的form数据流处理
|
|
66
66
|
var dataSource = form.getFieldValue(name);
|
|
67
67
|
dataSource = dataSource.filter(function (row) {
|
|
68
|
-
return !selectedRowKeys.includes(row.rowKey);
|
|
68
|
+
return !selectedRowKeys.includes(row === null || row === void 0 ? void 0 : row.rowKey);
|
|
69
69
|
});
|
|
70
70
|
form.setFieldValue(name, dataSource);
|
|
71
71
|
// 单行模式数据流处理 重置中间正在编辑状态单行数据
|
|
@@ -75,7 +75,7 @@ export var onDelete = function onDelete(_ref) {
|
|
|
75
75
|
var virtualList = form.getFieldValue(namePath);
|
|
76
76
|
if ((_virtualList = virtualList) === null || _virtualList === void 0 ? void 0 : _virtualList.length) {
|
|
77
77
|
virtualList = virtualList.filter(function (row) {
|
|
78
|
-
return !selectedRowKeys.includes(row.rowKey);
|
|
78
|
+
return !selectedRowKeys.includes(row === null || row === void 0 ? void 0 : row.rowKey);
|
|
79
79
|
});
|
|
80
80
|
form.setFieldValue(namePath, virtualList);
|
|
81
81
|
}
|
|
@@ -74,7 +74,7 @@ var Row = function Row(props) {
|
|
|
74
74
|
}));
|
|
75
75
|
};
|
|
76
76
|
var DndWrapper = function DndWrapper(_ref2) {
|
|
77
|
-
var _value
|
|
77
|
+
var _value$, _value$map;
|
|
78
78
|
var draggable = _ref2.draggable,
|
|
79
79
|
value = _ref2.value,
|
|
80
80
|
onChange = _ref2.onChange,
|
|
@@ -85,15 +85,16 @@ var DndWrapper = function DndWrapper(_ref2) {
|
|
|
85
85
|
var active = event.active,
|
|
86
86
|
over = event.over;
|
|
87
87
|
if (active.id !== (over === null || over === void 0 ? void 0 : over.id)) {
|
|
88
|
+
var _value$findIndex, _value$findIndex2;
|
|
88
89
|
if (onDrag) {
|
|
89
90
|
var nextList = onDrag(event, value);
|
|
90
91
|
onChange(nextList);
|
|
91
92
|
return;
|
|
92
93
|
}
|
|
93
|
-
var activeIndex = value.findIndex(function (i) {
|
|
94
|
+
var activeIndex = value === null || value === void 0 ? void 0 : (_value$findIndex = value.findIndex) === null || _value$findIndex === void 0 ? void 0 : _value$findIndex.call(value, function (i) {
|
|
94
95
|
return i.rowKey === active.id;
|
|
95
96
|
});
|
|
96
|
-
var overIndex = value.findIndex(function (i) {
|
|
97
|
+
var overIndex = value === null || value === void 0 ? void 0 : (_value$findIndex2 = value.findIndex) === null || _value$findIndex2 === void 0 ? void 0 : _value$findIndex2.call(value, function (i) {
|
|
97
98
|
return i.rowKey === (over === null || over === void 0 ? void 0 : over.id);
|
|
98
99
|
});
|
|
99
100
|
var nextValue = (0, _sortable.arrayMove)(value, activeIndex, overIndex);
|
|
@@ -103,8 +104,8 @@ var DndWrapper = function DndWrapper(_ref2) {
|
|
|
103
104
|
return draggable && !disabled ? (0, _jsxRuntime.jsx)(_core.DndContext, {
|
|
104
105
|
onDragEnd: onDragEnd,
|
|
105
106
|
children: (0, _jsxRuntime.jsx)(_sortable.SortableContext, {
|
|
106
|
-
items: (value === null || value === void 0 ? void 0 : (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.rowKey) ? value.map(function (i) {
|
|
107
|
-
return i.rowKey;
|
|
107
|
+
items: (value === null || value === void 0 ? void 0 : (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.rowKey) ? value === null || value === void 0 ? void 0 : (_value$map = value.map) === null || _value$map === void 0 ? void 0 : _value$map.call(value, function (i) {
|
|
108
|
+
return i === null || i === void 0 ? void 0 : i.rowKey;
|
|
108
109
|
}) : [],
|
|
109
110
|
strategy: _sortable.verticalListSortingStrategy,
|
|
110
111
|
children: children
|
|
@@ -125,10 +125,10 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
125
125
|
className: className
|
|
126
126
|
});
|
|
127
127
|
var getRowKey = function getRowKey(record) {
|
|
128
|
-
var key = record.rowKey || (0, _tools.getRandom)();
|
|
128
|
+
var key = (record === null || record === void 0 ? void 0 : record.rowKey) || (0, _tools.getRandom)();
|
|
129
129
|
if (rowKey) {
|
|
130
130
|
var _ref3;
|
|
131
|
-
key = (_ref3 = typeof rowKey === 'function' ? rowKey(record) : record[rowKey]) !== null && _ref3 !== void 0 ? _ref3 : key;
|
|
131
|
+
key = (_ref3 = typeof rowKey === 'function' ? rowKey(record) : record === null || record === void 0 ? void 0 : record[rowKey]) !== null && _ref3 !== void 0 ? _ref3 : key;
|
|
132
132
|
}
|
|
133
133
|
return key;
|
|
134
134
|
};
|
|
@@ -243,7 +243,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
243
243
|
}, resetProps);
|
|
244
244
|
// 编辑行设置下样式
|
|
245
245
|
var _rowClassName = function _rowClassName(record) {
|
|
246
|
-
var isEdit = !virtualKey || editingKeys.includes(record.rowKey);
|
|
246
|
+
var isEdit = !virtualKey || editingKeys.includes(record === null || record === void 0 ? void 0 : record.rowKey);
|
|
247
247
|
var className = isEdit ? 'is-editing' : '';
|
|
248
248
|
if (getIsNew(record)) {
|
|
249
249
|
return "is-new-row ".concat(className);
|
|
@@ -345,7 +345,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
345
345
|
});
|
|
346
346
|
// 初始化默认生成row-key
|
|
347
347
|
if ((value === null || value === void 0 ? void 0 : value.length) && (!isAllHasKey || isNeedCover)) {
|
|
348
|
-
var
|
|
348
|
+
var _value$map;
|
|
349
|
+
var nextValues = value === null || value === void 0 ? void 0 : (_value$map = value.map) === null || _value$map === void 0 ? void 0 : _value$map.call(value, function (item) {
|
|
349
350
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
350
351
|
rowKey: getRowKey(item)
|
|
351
352
|
});
|
|
@@ -56,7 +56,7 @@ var actions = exports.actions = {
|
|
|
56
56
|
}
|
|
57
57
|
var nextEditingKeys = (0, _toConsumableArray2.default)(editingKeys);
|
|
58
58
|
// 开启编辑状态
|
|
59
|
-
nextEditingKeys.push(record.rowKey);
|
|
59
|
+
nextEditingKeys.push(record === null || record === void 0 ? void 0 : record.rowKey);
|
|
60
60
|
// 编辑时赋值编辑状态,供validator做保存校验
|
|
61
61
|
if (nextEditingKeys === null || nextEditingKeys === void 0 ? void 0 : nextEditingKeys.length) {
|
|
62
62
|
record.isEditing = true;
|
|
@@ -71,6 +71,7 @@ var actions = exports.actions = {
|
|
|
71
71
|
},
|
|
72
72
|
save: function () {
|
|
73
73
|
var _save = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(_ref2) {
|
|
74
|
+
var _editingKeys$filter;
|
|
74
75
|
var record, editingKeys, setState, form, rowName, virtualRowName, result, updateData, nextEditingKeys, values;
|
|
75
76
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
76
77
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -81,8 +82,9 @@ var actions = exports.actions = {
|
|
|
81
82
|
record = (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, record), form.getFieldValue(virtualRowName)), updateData);
|
|
82
83
|
delete record.addFlag; // 删除第一次新增的标记
|
|
83
84
|
// 关闭当前保存行的编辑状态
|
|
84
|
-
nextEditingKeys = editingKeys.filter(function (key) {
|
|
85
|
-
|
|
85
|
+
nextEditingKeys = editingKeys === null || editingKeys === void 0 ? void 0 : (_editingKeys$filter = editingKeys.filter) === null || _editingKeys$filter === void 0 ? void 0 : _editingKeys$filter.call(editingKeys, function (key) {
|
|
86
|
+
var _record;
|
|
87
|
+
return key !== ((_record = record) === null || _record === void 0 ? void 0 : _record.rowKey);
|
|
86
88
|
}); // 保存后取消编辑状态,供validator做保存校验
|
|
87
89
|
if (nextEditingKeys === null || nextEditingKeys === void 0 ? void 0 : nextEditingKeys.length) {
|
|
88
90
|
record.isEditing = true;
|
|
@@ -108,6 +110,7 @@ var actions = exports.actions = {
|
|
|
108
110
|
return save;
|
|
109
111
|
}(),
|
|
110
112
|
cancel: function cancel(_ref3) {
|
|
113
|
+
var _editingKeys$filter2;
|
|
111
114
|
var name = _ref3.name,
|
|
112
115
|
record = _ref3.record,
|
|
113
116
|
editingKeys = _ref3.editingKeys,
|
|
@@ -115,8 +118,8 @@ var actions = exports.actions = {
|
|
|
115
118
|
form = _ref3.form,
|
|
116
119
|
virtualRowName = _ref3.virtualRowName,
|
|
117
120
|
virtualKey = _ref3.virtualKey;
|
|
118
|
-
var nextEditingKeys = editingKeys.filter(function (key) {
|
|
119
|
-
return key !== record.rowKey;
|
|
121
|
+
var nextEditingKeys = editingKeys === null || editingKeys === void 0 ? void 0 : (_editingKeys$filter2 = editingKeys.filter) === null || _editingKeys$filter2 === void 0 ? void 0 : _editingKeys$filter2.call(editingKeys, function (key) {
|
|
122
|
+
return key !== (record === null || record === void 0 ? void 0 : record.rowKey);
|
|
120
123
|
});
|
|
121
124
|
// 保存后取消编辑状态,供validator做保存校验
|
|
122
125
|
if (nextEditingKeys === null || nextEditingKeys === void 0 ? void 0 : nextEditingKeys.length) {
|
|
@@ -133,7 +136,7 @@ var actions = exports.actions = {
|
|
|
133
136
|
name: name,
|
|
134
137
|
form: form,
|
|
135
138
|
virtualKey: virtualKey,
|
|
136
|
-
selectedRowKeys: [record.rowKey]
|
|
139
|
+
selectedRowKeys: [record === null || record === void 0 ? void 0 : record.rowKey]
|
|
137
140
|
});
|
|
138
141
|
} else {
|
|
139
142
|
// 防止value引用不变, 值不更新 - (自定义组件)
|
|
@@ -160,12 +163,13 @@ var actions = exports.actions = {
|
|
|
160
163
|
name: name,
|
|
161
164
|
form: form,
|
|
162
165
|
virtualKey: virtualKey,
|
|
163
|
-
selectedRowKeys: [record.rowKey]
|
|
166
|
+
selectedRowKeys: [record === null || record === void 0 ? void 0 : record.rowKey]
|
|
164
167
|
});
|
|
165
168
|
if (virtualKey) {
|
|
169
|
+
var _editingKeys$filter3;
|
|
166
170
|
// 关闭编辑状态
|
|
167
|
-
var nextEditingKeys = editingKeys.filter(function (key) {
|
|
168
|
-
return key === record.rowKey;
|
|
171
|
+
var nextEditingKeys = editingKeys === null || editingKeys === void 0 ? void 0 : (_editingKeys$filter3 = editingKeys.filter) === null || _editingKeys$filter3 === void 0 ? void 0 : _editingKeys$filter3.call(editingKeys, function (key) {
|
|
172
|
+
return key === (record === null || record === void 0 ? void 0 : record.rowKey);
|
|
169
173
|
});
|
|
170
174
|
setState({
|
|
171
175
|
editingKeys: nextEditingKeys
|
|
@@ -178,7 +178,7 @@ var getActionColumn = function getActionColumn(config) {
|
|
|
178
178
|
config: config,
|
|
179
179
|
btnConfig: btnConfig
|
|
180
180
|
}))
|
|
181
|
-
}, "".concat(record.rowKey, "-").concat(btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.type));
|
|
181
|
+
}, "".concat(record === null || record === void 0 ? void 0 : record.rowKey, "-").concat(btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.type));
|
|
182
182
|
})
|
|
183
183
|
});
|
|
184
184
|
}
|
|
@@ -281,9 +281,9 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
|
281
281
|
item.className = (0, _toConsumableArray2.default)(new Set(item.className.split(' '))).join(' ');
|
|
282
282
|
}
|
|
283
283
|
var _render = function _render(text, record, index) {
|
|
284
|
-
var isEditing = !virtualKey || editingKeys.includes(record.rowKey) || record.addFlag;
|
|
284
|
+
var isEditing = !virtualKey || editingKeys.includes(record === null || record === void 0 ? void 0 : record.rowKey) || record.addFlag;
|
|
285
285
|
var namePath = (0, _lodash.isArray)(name) ? name : [name];
|
|
286
|
-
if (virtualKey && editingKeys.includes(record.rowKey)) {
|
|
286
|
+
if (virtualKey && editingKeys.includes(record === null || record === void 0 ? void 0 : record.rowKey)) {
|
|
287
287
|
namePath = (0, _tools.getNamePath)(name, virtualKey);
|
|
288
288
|
}
|
|
289
289
|
var columnNamePath = (0, _lodash.isArray)(columnName) ? columnName : [columnName];
|
|
@@ -74,7 +74,7 @@ var onDelete = exports.onDelete = function onDelete(_ref) {
|
|
|
74
74
|
// 正常的form数据流处理
|
|
75
75
|
var dataSource = form.getFieldValue(name);
|
|
76
76
|
dataSource = dataSource.filter(function (row) {
|
|
77
|
-
return !selectedRowKeys.includes(row.rowKey);
|
|
77
|
+
return !selectedRowKeys.includes(row === null || row === void 0 ? void 0 : row.rowKey);
|
|
78
78
|
});
|
|
79
79
|
form.setFieldValue(name, dataSource);
|
|
80
80
|
// 单行模式数据流处理 重置中间正在编辑状态单行数据
|
|
@@ -84,7 +84,7 @@ var onDelete = exports.onDelete = function onDelete(_ref) {
|
|
|
84
84
|
var virtualList = form.getFieldValue(namePath);
|
|
85
85
|
if ((_virtualList = virtualList) === null || _virtualList === void 0 ? void 0 : _virtualList.length) {
|
|
86
86
|
virtualList = virtualList.filter(function (row) {
|
|
87
|
-
return !selectedRowKeys.includes(row.rowKey);
|
|
87
|
+
return !selectedRowKeys.includes(row === null || row === void 0 ? void 0 : row.rowKey);
|
|
88
88
|
});
|
|
89
89
|
form.setFieldValue(namePath, virtualList);
|
|
90
90
|
}
|