ronds-metadata 1.0.56 → 1.0.57
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.
@@ -5,8 +5,11 @@ import _Button from "antd/es/button";
|
|
5
5
|
import { EditOutlined, CloseOutlined, CheckOutlined, DeleteOutlined } from '@ant-design/icons';
|
6
6
|
import React from 'react';
|
7
7
|
import { EditableContext } from '../interface';
|
8
|
+
import { isFreeEditRow } from '../utils';
|
8
9
|
|
9
10
|
var EditableAction = function EditableAction(props) {
|
11
|
+
var _editConfig$editCellK;
|
12
|
+
|
10
13
|
var type = props.type,
|
11
14
|
record = props.record;
|
12
15
|
|
@@ -69,7 +72,15 @@ var EditableAction = function EditableAction(props) {
|
|
69
72
|
title: '取消'
|
70
73
|
}), /*#__PURE__*/React.createElement(_Divider, {
|
71
74
|
type: "vertical"
|
72
|
-
})))), /*#__PURE__*/React.createElement(_Button, {
|
75
|
+
})))), type === 'freedom' && /*#__PURE__*/React.createElement(React.Fragment, null, (record._rowKey_ === (editConfig === null || editConfig === void 0 ? void 0 : (_editConfig$editCellK = editConfig.editCellKey) === null || _editConfig$editCellK === void 0 ? void 0 : _editConfig$editCellK.rowIndex) || isFreeEditRow(editConfig.curRow, record._rowKey_)) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Button, {
|
76
|
+
type: "link",
|
77
|
+
size: "small",
|
78
|
+
icon: /*#__PURE__*/React.createElement(CheckOutlined, null),
|
79
|
+
onClick: onSave,
|
80
|
+
title: '确定'
|
81
|
+
}), /*#__PURE__*/React.createElement(_Divider, {
|
82
|
+
type: "vertical"
|
83
|
+
}))), /*#__PURE__*/React.createElement(_Button, {
|
73
84
|
type: "link",
|
74
85
|
size: "small",
|
75
86
|
icon: /*#__PURE__*/React.createElement(DeleteOutlined, null),
|
@@ -24,6 +24,8 @@ var EditableCell = function EditableCell(props) {
|
|
24
24
|
|
25
25
|
|
26
26
|
var onCellDoubleClick = function onCellDoubleClick() {
|
27
|
+
var _editConfig$editCellK, _editConfig$editCellK2;
|
28
|
+
|
27
29
|
if ((editConfig === null || editConfig === void 0 ? void 0 : editConfig.curRow) && (editConfig === null || editConfig === void 0 ? void 0 : editConfig.curRow) !== 'undefined') {
|
28
30
|
if (isFreeEditRow(editConfig.curRow, rowIndex)) return;
|
29
31
|
|
@@ -32,6 +34,12 @@ var EditableCell = function EditableCell(props) {
|
|
32
34
|
return;
|
33
35
|
}
|
34
36
|
|
37
|
+
if (((editConfig === null || editConfig === void 0 ? void 0 : (_editConfig$editCellK = editConfig.editCellKey) === null || _editConfig$editCellK === void 0 ? void 0 : _editConfig$editCellK.rowIndex) || (editConfig === null || editConfig === void 0 ? void 0 : (_editConfig$editCellK2 = editConfig.editCellKey) === null || _editConfig$editCellK2 === void 0 ? void 0 : _editConfig$editCellK2.rowIndex) === 0) && rowIndex !== editConfig.editCellKey.rowIndex) {
|
38
|
+
_message.warning('请先保存正在编辑的行');
|
39
|
+
|
40
|
+
return;
|
41
|
+
}
|
42
|
+
|
35
43
|
editableStream.next({
|
36
44
|
type: 'editCellKey',
|
37
45
|
payload: {
|
@@ -42,16 +50,9 @@ var EditableCell = function EditableCell(props) {
|
|
42
50
|
};
|
43
51
|
|
44
52
|
var onCellClick = function onCellClick() {
|
45
|
-
if (!isFreeEditCell(editConfig.editCellKey, dataIndex, rowIndex)) {
|
46
|
-
|
47
|
-
|
48
|
-
payload: {
|
49
|
-
dataIndex: undefined,
|
50
|
-
rowIndex: undefined
|
51
|
-
}
|
52
|
-
});
|
53
|
-
}
|
54
|
-
|
53
|
+
// if (!isFreeEditCell(editConfig.editCellKey, dataIndex, rowIndex)) {
|
54
|
+
// editableStream.next({ type: 'editCellKey', payload: { dataIndex: undefined, rowIndex: undefined } });
|
55
|
+
// }
|
55
56
|
if (isAddColumn) {
|
56
57
|
editableStream.next({
|
57
58
|
type: 'editHeardCellKey',
|
@@ -17,13 +17,7 @@ var EditableRow = function EditableRow(props) {
|
|
17
17
|
React.useEffect(function () {
|
18
18
|
if (!form) return;
|
19
19
|
form.setFieldsValue(record);
|
20
|
-
}, [record]);
|
21
|
-
// React.useEffect(() => {
|
22
|
-
// const subscription = editableStream.pipe(filter((p: any) => p?.type === 'editRowKey')).subscribe((p: IEditableStream) => {
|
23
|
-
// form.setFieldsValue(p.payload);
|
24
|
-
// });
|
25
|
-
// return () => subscription.unsubscribe();
|
26
|
-
// }, [editableStream]);
|
20
|
+
}, [record]);
|
27
21
|
|
28
22
|
var onValuesChange = function onValuesChange(values, allValues) {
|
29
23
|
if (editableStream) {
|
@@ -270,10 +270,10 @@ var Editable = function Editable(props) {
|
|
270
270
|
var _aciton_ = {
|
271
271
|
dataKey: '_aciton_',
|
272
272
|
title: '操作',
|
273
|
-
width:
|
274
|
-
maxWidth:
|
273
|
+
width: 50,
|
274
|
+
maxWidth: 50,
|
275
275
|
export: false,
|
276
|
-
minWidth:
|
276
|
+
minWidth: 50,
|
277
277
|
frozen: 'right',
|
278
278
|
render: function render(val, record) {
|
279
279
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EditableAction, {
|