ronds-metadata 1.0.56 → 1.0.59
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/comps/Editable/comps/EditableAction.js +31 -2
- package/es/comps/Editable/comps/EditableCell.js +11 -10
- package/es/comps/Editable/comps/EditableHeardCell.js +22 -1
- package/es/comps/Editable/comps/EditableRow.js +1 -7
- package/es/comps/Editable/comps/index.css +1 -1
- package/es/comps/Editable/index.js +9 -3
- package/package.json +1 -1
@@ -1,3 +1,5 @@
|
|
1
|
+
import "antd/es/popconfirm/style";
|
2
|
+
import _Popconfirm from "antd/es/popconfirm";
|
1
3
|
import "antd/es/divider/style";
|
2
4
|
import _Divider from "antd/es/divider";
|
3
5
|
import "antd/es/button/style";
|
@@ -5,8 +7,11 @@ import _Button from "antd/es/button";
|
|
5
7
|
import { EditOutlined, CloseOutlined, CheckOutlined, DeleteOutlined } from '@ant-design/icons';
|
6
8
|
import React from 'react';
|
7
9
|
import { EditableContext } from '../interface';
|
10
|
+
import { isFreeEditRow } from '../utils';
|
8
11
|
|
9
12
|
var EditableAction = function EditableAction(props) {
|
13
|
+
var _editConfig$editCellK;
|
14
|
+
|
10
15
|
var type = props.type,
|
11
16
|
record = props.record;
|
12
17
|
|
@@ -35,6 +40,13 @@ var EditableAction = function EditableAction(props) {
|
|
35
40
|
type: 'onSingleSave',
|
36
41
|
payload: record
|
37
42
|
});
|
43
|
+
editableStream.next({
|
44
|
+
type: 'editCellKey',
|
45
|
+
payload: {
|
46
|
+
dataIndex: undefined,
|
47
|
+
rowIndex: undefined
|
48
|
+
}
|
49
|
+
});
|
38
50
|
};
|
39
51
|
|
40
52
|
var onDelete = function onDelete() {
|
@@ -69,13 +81,30 @@ var EditableAction = function EditableAction(props) {
|
|
69
81
|
title: '取消'
|
70
82
|
}), /*#__PURE__*/React.createElement(_Divider, {
|
71
83
|
type: "vertical"
|
72
|
-
})))), /*#__PURE__*/React.createElement(_Button, {
|
84
|
+
})))), 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, {
|
85
|
+
type: "link",
|
86
|
+
size: "small",
|
87
|
+
icon: /*#__PURE__*/React.createElement(CheckOutlined, null),
|
88
|
+
onClick: onSave,
|
89
|
+
title: '确定'
|
90
|
+
}), /*#__PURE__*/React.createElement(_Divider, {
|
91
|
+
type: "vertical"
|
92
|
+
}))), /*#__PURE__*/React.createElement(_Popconfirm, {
|
93
|
+
placement: 'left',
|
94
|
+
title: "\u786E\u8BA4\u5220\u9664\u8BE5\u6761\u6570\u636E\uFF1F",
|
95
|
+
onConfirm: onDelete,
|
96
|
+
onCancel: function onCancel(e) {
|
97
|
+
e.stopPropagation();
|
98
|
+
},
|
99
|
+
okText: "\u786E\u5B9A",
|
100
|
+
cancelText: "\u53D6\u6D88"
|
101
|
+
}, /*#__PURE__*/React.createElement(_Button, {
|
73
102
|
type: "link",
|
74
103
|
size: "small",
|
75
104
|
icon: /*#__PURE__*/React.createElement(DeleteOutlined, null),
|
76
105
|
onClick: onDelete,
|
77
106
|
title: '删除'
|
78
|
-
}));
|
107
|
+
})));
|
79
108
|
};
|
80
109
|
|
81
110
|
export default EditableAction;
|
@@ -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',
|
@@ -1,4 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
+
import "antd/es/popconfirm/style";
|
3
|
+
import _Popconfirm from "antd/es/popconfirm";
|
2
4
|
import "antd/es/popover/style";
|
3
5
|
import _Popover from "antd/es/popover";
|
4
6
|
import "antd/es/button/style";
|
@@ -70,6 +72,16 @@ var EditableHeardCell = function EditableHeardCell(props) {
|
|
70
72
|
};
|
71
73
|
};
|
72
74
|
|
75
|
+
var onDeleteColumn = function onDeleteColumn() {
|
76
|
+
setVisible(false);
|
77
|
+
editableStream.next({
|
78
|
+
type: 'onDeleteColumn',
|
79
|
+
payload: {
|
80
|
+
dataIndex: dataIndex
|
81
|
+
}
|
82
|
+
});
|
83
|
+
};
|
84
|
+
|
73
85
|
var content = /*#__PURE__*/React.createElement("div", {
|
74
86
|
style: {
|
75
87
|
width: '100px'
|
@@ -129,10 +141,19 @@ var EditableHeardCell = function EditableHeardCell(props) {
|
|
129
141
|
icon: /*#__PURE__*/React.createElement(PlusSquareOutlined, null)
|
130
142
|
}))), isAddColumn && /*#__PURE__*/React.createElement("div", {
|
131
143
|
className: "".concat(editConfig.editHeardCellKey === dataIndex ? 'editable-th-hover-delete' : 'display-none')
|
144
|
+
}, /*#__PURE__*/React.createElement(_Popconfirm, {
|
145
|
+
placement: 'left',
|
146
|
+
title: "\u786E\u8BA4\u5220\u9664\u8BE5\u6761\u5217\uFF1F",
|
147
|
+
onConfirm: onDeleteColumn,
|
148
|
+
onCancel: function onCancel(e) {
|
149
|
+
e.stopPropagation();
|
150
|
+
},
|
151
|
+
okText: "\u786E\u5B9A",
|
152
|
+
cancelText: "\u53D6\u6D88"
|
132
153
|
}, /*#__PURE__*/React.createElement(_Button, {
|
133
154
|
type: "link",
|
134
155
|
icon: /*#__PURE__*/React.createElement(DeleteOutlined, null)
|
135
|
-
})), /*#__PURE__*/React.createElement("div", {
|
156
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
136
157
|
onMouseOver: onMouseOver,
|
137
158
|
onMouseLeave: onMouseLeave
|
138
159
|
}, children)));
|
@@ -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, {
|
@@ -311,6 +311,12 @@ var Editable = function Editable(props) {
|
|
311
311
|
|
312
312
|
var onAddRow = function onAddRow() {
|
313
313
|
if (defaultValue) {
|
314
|
+
if (type === 'freedom' && editRowKey) {
|
315
|
+
_message.warn('请先保存正在编辑的行');
|
316
|
+
|
317
|
+
return;
|
318
|
+
}
|
319
|
+
|
314
320
|
var _records = recordsRef.current;
|
315
321
|
|
316
322
|
if (addPosition === 'top') {
|