ronds-metadata 1.1.0 → 1.1.3
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.
@@ -10,7 +10,7 @@ import _Input from "antd/es/input";
|
|
10
10
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
11
11
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
12
12
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
13
|
-
var _excluded = ["title", "dataIndex", "isAddColumn", "children", "className"];
|
13
|
+
var _excluded = ["title", "dataIndex", "isAddColumn", "children", "className", "style"];
|
14
14
|
import { PlusSquareOutlined, DeleteOutlined } from '@ant-design/icons';
|
15
15
|
import React from 'react';
|
16
16
|
import { EditableContext } from '../interface';
|
@@ -24,6 +24,7 @@ var EditableHeardCell = function EditableHeardCell(props) {
|
|
24
24
|
isAddColumn = props.isAddColumn,
|
25
25
|
children = props.children,
|
26
26
|
className = props.className,
|
27
|
+
style = props.style,
|
27
28
|
restProps = _objectWithoutProperties(props, _excluded);
|
28
29
|
|
29
30
|
var _ref = React.useContext(EditableContext) || undefined,
|
@@ -46,6 +47,27 @@ var EditableHeardCell = function EditableHeardCell(props) {
|
|
46
47
|
visible = _React$useState4[0],
|
47
48
|
setVisible = _React$useState4[1];
|
48
49
|
|
50
|
+
var myStyle = React.useMemo(function () {
|
51
|
+
var res = {};
|
52
|
+
|
53
|
+
if (style) {
|
54
|
+
res = _objectSpread(_objectSpread({}, style), {}, {
|
55
|
+
right: style.right - 6
|
56
|
+
});
|
57
|
+
}
|
58
|
+
|
59
|
+
return res;
|
60
|
+
}, [style]);
|
61
|
+
var myClassName = React.useMemo(function () {
|
62
|
+
var _cls = className;
|
63
|
+
|
64
|
+
if (_cls && _cls.indexOf('ant-table-cell-scrollbar')) {
|
65
|
+
_cls = _cls.replace('ant-table-cell-scrollbar', '');
|
66
|
+
}
|
67
|
+
|
68
|
+
return _cls;
|
69
|
+
}, [className]);
|
70
|
+
|
49
71
|
var onMouseOver = function onMouseOver() {
|
50
72
|
editableStream.next({
|
51
73
|
type: 'editHeardCellKey',
|
@@ -112,8 +134,10 @@ var EditableHeardCell = function EditableHeardCell(props) {
|
|
112
134
|
setVisible(b);
|
113
135
|
};
|
114
136
|
|
115
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("th", _extends({
|
116
|
-
className: "".concat(
|
137
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("th", _extends({
|
138
|
+
className: "".concat(myClassName, " ant-table-th font-bold ").concat(isAddColumn && editConfig.editHeardCellKey === dataIndex ? 'border-right ' : '', " ")
|
139
|
+
}, restProps, {
|
140
|
+
style: _objectSpread({}, myStyle)
|
117
141
|
}), isAddColumn && /*#__PURE__*/React.createElement(_Popover, {
|
118
142
|
placement: "rightTop",
|
119
143
|
content: content,
|
@@ -2,8 +2,17 @@
|
|
2
2
|
width: 100%;
|
3
3
|
height: 100%;
|
4
4
|
}
|
5
|
-
.ronds-edit-table table {
|
6
|
-
|
5
|
+
.ronds-edit-table .ant-table-body {
|
6
|
+
overflow: auto !important;
|
7
|
+
}
|
8
|
+
.ronds-edit-table .ant-table-fixed-left .ant-table-body-outer,
|
9
|
+
.ronds-edit-table .ant-table-fixed-right .ant-table-body-outer {
|
10
|
+
margin-bottom: 0 !important;
|
11
|
+
}
|
12
|
+
.ronds-edit-table .ant-table-fixed-left .ant-table-cell-scrollbar,
|
13
|
+
.ronds-edit-table .ant-table-fixed-right .ant-table-cell-scrollbar {
|
14
|
+
margin: 0 !important;
|
15
|
+
padding: 0 !important;
|
7
16
|
}
|
8
17
|
.ronds-edit-table .ant-spin-nested-loading,
|
9
18
|
.ronds-edit-table .ant-spin-container,
|
@@ -18,10 +27,6 @@
|
|
18
27
|
height: 30px;
|
19
28
|
padding: 0px 8px !important;
|
20
29
|
}
|
21
|
-
.ronds-edit-table .ant-table-cell-fix-right {
|
22
|
-
position: sticky !important;
|
23
|
-
right: 0 !important;
|
24
|
-
}
|
25
30
|
.ronds-edit-table .ant-table-body {
|
26
31
|
height: 100%;
|
27
32
|
overflow-y: auto !important;
|
@@ -32,7 +32,6 @@ var Editable = function Editable(props) {
|
|
32
32
|
addPosition = _props$addPosition === void 0 ? 'bottom' : _props$addPosition,
|
33
33
|
_props$isAddColumn = props.isAddColumn,
|
34
34
|
isAddColumn = _props$isAddColumn === void 0 ? false : _props$isAddColumn,
|
35
|
-
whiteColumn = props.whiteColumn,
|
36
35
|
tableProps = props.tableProps,
|
37
36
|
onRowConfirm = props.onRowConfirm,
|
38
37
|
onRowDelete = props.onRowDelete,
|
@@ -67,16 +66,9 @@ var Editable = function Editable(props) {
|
|
67
66
|
var _React$useState9 = React.useState(),
|
68
67
|
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
69
68
|
editHeardCellKey = _React$useState10[0],
|
70
|
-
setEditHeardCellkey = _React$useState10[1]; //
|
69
|
+
setEditHeardCellkey = _React$useState10[1]; // 记录上一次发生改变的行值
|
71
70
|
|
72
71
|
|
73
|
-
var _React$useState11 = React.useState([]),
|
74
|
-
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
75
|
-
addColumns = _React$useState12[0],
|
76
|
-
setAddColumns = _React$useState12[1];
|
77
|
-
|
78
|
-
var addColumnsRef = React.useRef([]); // 记录上一次发生改变的行值
|
79
|
-
|
80
72
|
var lastValueRef = React.useRef(); // 记录上一次的datasource
|
81
73
|
|
82
74
|
var lastDataSourceRef = React.useRef();
|
@@ -127,12 +119,6 @@ var Editable = function Editable(props) {
|
|
127
119
|
case 'editHeardCellKey':
|
128
120
|
setEditHeardCellkey(data.payload);
|
129
121
|
break;
|
130
|
-
// case 'onAddColumn':
|
131
|
-
// processAddColumnsData(data.payload);
|
132
|
-
// break;
|
133
|
-
// case 'onDeleteColumn':
|
134
|
-
// processDeleteColumnsData(data.payload);
|
135
|
-
// break;
|
136
122
|
|
137
123
|
case 'onSingleSave':
|
138
124
|
if (lastValueRef.current && lastValueRef.current.rowIdx === data.payload._rowKey_) {
|
@@ -200,36 +186,7 @@ var Editable = function Editable(props) {
|
|
200
186
|
}
|
201
187
|
}, [type]); // 集中处理数据流
|
202
188
|
|
203
|
-
useObservable(processStreamFactory, [editableStream]); //
|
204
|
-
// const _columns = addColumnsRef.current.length > 0 ? addColumnsRef.current : columns;
|
205
|
-
// // 判断key是否重复
|
206
|
-
// if (_columns.findIndex((v) => v.key === data.key) > -1) {
|
207
|
-
// // message.warning('表格的key不可以重复');
|
208
|
-
// return;
|
209
|
-
// }
|
210
|
-
// const idx = _columns.findIndex((v: any) => v.dataIndex === data.dataIndex);
|
211
|
-
// const obj = {
|
212
|
-
// title: data.title,
|
213
|
-
// key: data.key,
|
214
|
-
// dataIndex: data.key,
|
215
|
-
// };
|
216
|
-
// _columns.splice(idx + 1, 0, { ..._columns[0], ...obj });
|
217
|
-
// setAddColumns([..._columns]);
|
218
|
-
// addColumnsRef.current = _columns;
|
219
|
-
// // editableStream.next({ type: 'editHeardCellKey', payload: undefined });
|
220
|
-
// };
|
221
|
-
// const processDeleteColumnsData = (data: any) => {
|
222
|
-
// let _columns = addColumnsRef.current.length > 0 ? addColumnsRef.current : columns;
|
223
|
-
// if (whiteColumn.findIndex((v) => v === data.dataIndex) > -1) {
|
224
|
-
// // message.warning(`${data.dataIndex}无法删除`);
|
225
|
-
// return;
|
226
|
-
// }
|
227
|
-
// _columns = _columns.filter((v: any) => v.dataIndex != data.dataIndex);
|
228
|
-
// setAddColumns([..._columns]);
|
229
|
-
// addColumnsRef.current = _columns;
|
230
|
-
// // editableStream.next({ type: 'editHeardCellKey', payload: undefined });
|
231
|
-
// };
|
232
|
-
// 返回stream的实例
|
189
|
+
useObservable(processStreamFactory, [editableStream]); // 返回stream的实例
|
233
190
|
|
234
191
|
React.useEffect(function () {
|
235
192
|
if (firstLoadRef && editableStream) {
|
@@ -272,7 +229,7 @@ var Editable = function Editable(props) {
|
|
272
229
|
}, [readonly, type]); // 处理一下编辑表格的数据
|
273
230
|
|
274
231
|
var _columns = React.useMemo(function () {
|
275
|
-
var __columns__ =
|
232
|
+
var __columns__ = columns;
|
276
233
|
|
277
234
|
var res = __columns__.map(getEditColumn);
|
278
235
|
|
@@ -299,7 +256,7 @@ var Editable = function Editable(props) {
|
|
299
256
|
}
|
300
257
|
|
301
258
|
return res;
|
302
|
-
}, [columns, readonly, type
|
259
|
+
}, [columns, readonly, type]); // 主要是自己加一层rowkey
|
303
260
|
|
304
261
|
|
305
262
|
var _dataSource = React.useMemo(function () {
|
@@ -362,6 +319,7 @@ var Editable = function Editable(props) {
|
|
362
319
|
}
|
363
320
|
}
|
364
321
|
}, /*#__PURE__*/React.createElement(_Table, _extends({
|
322
|
+
key: _columns.length,
|
365
323
|
className: "ronds-edit-table",
|
366
324
|
bordered: true,
|
367
325
|
scroll: {
|
package/es/theme.css
CHANGED
@@ -1,6 +1,50 @@
|
|
1
1
|
.ronds-metadata-dark {
|
2
2
|
--ronds-metadata-color-border-1: #314162;
|
3
3
|
}
|
4
|
+
.ronds-metadata-dark ::-webkit-scrollbar {
|
5
|
+
width: 6px;
|
6
|
+
height: 6px;
|
7
|
+
overflow: auto;
|
8
|
+
}
|
9
|
+
.ronds-metadata-dark ::-webkit-scrollbar-corner {
|
10
|
+
background-color: transparent;
|
11
|
+
color: transparent;
|
12
|
+
}
|
13
|
+
.ronds-metadata-dark ::-webkit-scrollbar-thumb {
|
14
|
+
box-shadow: inset 0 0 5px var(--scrollbar-bg-color);
|
15
|
+
background: var(--scrollbar-color);
|
16
|
+
min-height: 25px;
|
17
|
+
min-width: 25px;
|
18
|
+
border-radius: 3px;
|
19
|
+
}
|
20
|
+
.ronds-metadata-dark ::-webkit-scrollbar-thumb:hover {
|
21
|
+
border-radius: 2px;
|
22
|
+
background: var(--scrollbar-color-hover);
|
23
|
+
}
|
24
|
+
.ronds-metadata-dark ::-webkit-scrollbar-thumb:active {
|
25
|
+
background: var(--scrollbar-color-hover);
|
26
|
+
}
|
4
27
|
.ronds-metadata-normal {
|
5
28
|
--ronds-metadata-color-border-1: #d9d9d9;
|
6
29
|
}
|
30
|
+
.ronds-metadata-normal ::-webkit-scrollbar {
|
31
|
+
width: 6px;
|
32
|
+
height: 6px;
|
33
|
+
overflow: auto;
|
34
|
+
}
|
35
|
+
.ronds-metadata-normal ::-webkit-scrollbar-thumb {
|
36
|
+
background-color: var(--scrollbar-color);
|
37
|
+
min-height: 25px;
|
38
|
+
min-width: 25px;
|
39
|
+
border-radius: 3px;
|
40
|
+
/* border: 1px solid #e0e0e0; */
|
41
|
+
}
|
42
|
+
.ronds-metadata-normal ::-webkit-scrollbar-thumb:hover {
|
43
|
+
background-color: #a8a8a8;
|
44
|
+
}
|
45
|
+
.ronds-metadata-normal ::-webkit-scrollbar-thumb:active {
|
46
|
+
background-color: #787878;
|
47
|
+
}
|
48
|
+
.ronds-metadata-normal ::-webkit-scrollbar-track {
|
49
|
+
background-color: #f7f7f7;
|
50
|
+
}
|