ronds-metadata 1.2.55 → 1.2.57
Sign up to get free protection for your applications and to get access to all the features.
- package/es/comps/Editable/comps/EditableCell.js +3 -3
- package/es/comps/Editable/comps/EditableRow.js +8 -6
- package/es/comps/Editable/index.js +2 -2
- package/es/comps/Editable/interface.d.ts +1 -0
- package/es/comps/Editable/interface.js +1 -1
- package/es/comps/Editable/utils.d.ts +1 -0
- package/es/comps/Editable/utils.js +25 -1
- package/es/comps/MetadataForm/DataCell/Select.js +2 -2
- package/package.json +1 -1
@@ -6,11 +6,11 @@ var _excluded = ["title", "isAddColumn", "editable", "record", "editableType", "
|
|
6
6
|
/*
|
7
7
|
* @Author: wangxian
|
8
8
|
* @Date: 2022-03-04 10:01:10
|
9
|
-
* @LastEditTime: 2023-
|
9
|
+
* @LastEditTime: 2023-05-23 10:17:15
|
10
10
|
*/
|
11
11
|
import React from 'react';
|
12
12
|
import { EditableContext } from '../interface';
|
13
|
-
import { getDataCell, isFreeEditCell, isFreeEditRow } from '../utils';
|
13
|
+
import { getDataCell, isCellDisabled, isFreeEditCell, isFreeEditRow } from '../utils';
|
14
14
|
import './index.less';
|
15
15
|
import Texty from './Texty';
|
16
16
|
import { tr } from '../../../framework/locale';
|
@@ -88,7 +88,7 @@ var EditableCell = function EditableCell(props) {
|
|
88
88
|
}
|
89
89
|
return /*#__PURE__*/React.createElement("td", _extends({}, restProps, {
|
90
90
|
className: "".concat(className, " ").concat(isAddColumn && editConfig.editHeardCellKey === dataIndex ? 'border-right' : '', " ")
|
91
|
-
}), editable ? getDataCell(props) : /*#__PURE__*/React.createElement(Texty, {
|
91
|
+
}), editable && isCellDisabled(record, restProps === null || restProps === void 0 ? void 0 : restProps.cellDisabled) ? getDataCell(props) : /*#__PURE__*/React.createElement(Texty, {
|
92
92
|
tooltipStyle: {
|
93
93
|
wordWrap: 'break-word'
|
94
94
|
},
|
@@ -2,10 +2,12 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import "antd/es/form/style";
|
3
3
|
import _Form from "antd/es/form";
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
5
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
6
|
+
var _excluded = ["record", "index", "className"];
|
5
7
|
/*
|
6
8
|
* @Author: wangxian
|
7
9
|
* @Date: 2022-03-04 10:01:10
|
8
|
-
* @LastEditTime: 2023-
|
10
|
+
* @LastEditTime: 2023-05-24 09:07:32
|
9
11
|
*/
|
10
12
|
import React from 'react';
|
11
13
|
import { useDrag, useDrop } from 'react-dnd';
|
@@ -14,7 +16,7 @@ var EditableRow = function EditableRow(props) {
|
|
14
16
|
var record = props.record,
|
15
17
|
index = props.index,
|
16
18
|
className = props.className,
|
17
|
-
|
19
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
18
20
|
var _Form$useForm = _Form.useForm(),
|
19
21
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
20
22
|
form = _Form$useForm2[0];
|
@@ -30,7 +32,7 @@ var EditableRow = function EditableRow(props) {
|
|
30
32
|
collect: function collect(monitor) {
|
31
33
|
var _ref2 = monitor.getItem() || {},
|
32
34
|
dragIndex = _ref2.index;
|
33
|
-
if (dragIndex === index || !onMove) {
|
35
|
+
if (dragIndex === index || !(restProps === null || restProps === void 0 ? void 0 : restProps.onMove)) {
|
34
36
|
return {};
|
35
37
|
}
|
36
38
|
return {
|
@@ -39,10 +41,10 @@ var EditableRow = function EditableRow(props) {
|
|
39
41
|
};
|
40
42
|
},
|
41
43
|
drop: function drop(item, monitor) {
|
42
|
-
onMove && onMove({
|
44
|
+
(restProps === null || restProps === void 0 ? void 0 : restProps.onMove) && (restProps === null || restProps === void 0 ? void 0 : restProps.onMove({
|
43
45
|
dragIndex: item.index,
|
44
46
|
hoverIndex: index
|
45
|
-
});
|
47
|
+
}));
|
46
48
|
}
|
47
49
|
}),
|
48
50
|
_useDrop2 = _slicedToArray(_useDrop, 2),
|
@@ -67,7 +69,7 @@ var EditableRow = function EditableRow(props) {
|
|
67
69
|
}),
|
68
70
|
_useDrag2 = _slicedToArray(_useDrag, 2),
|
69
71
|
drag = _useDrag2[1];
|
70
|
-
onMove && drop(drag(ref));
|
72
|
+
(restProps === null || restProps === void 0 ? void 0 : restProps.onMove) && drop(drag(ref));
|
71
73
|
var onValuesChange = function onValuesChange(values, allValues) {
|
72
74
|
if (editableStream) {
|
73
75
|
editableStream.next({
|
@@ -11,7 +11,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
11
11
|
/*
|
12
12
|
* @Author: wangxain
|
13
13
|
* @Date: 2022-03-04 08:53:04
|
14
|
-
* @LastEditTime: 2023-
|
14
|
+
* @LastEditTime: 2023-05-23 09:20:36
|
15
15
|
*/
|
16
16
|
import React from 'react';
|
17
17
|
import { pick, isArray } from 'lodash';
|
@@ -205,7 +205,7 @@ var Editable = function Editable(props) {
|
|
205
205
|
record: record,
|
206
206
|
editableType: type,
|
207
207
|
isAddColumn: isAddColumn
|
208
|
-
}, pick(column, ['editable', 'title', 'dataIndex', 'type', 'enum', 'mode', 'disabled'])), {}, {
|
208
|
+
}, pick(column, ['editable', 'title', 'dataIndex', 'type', 'enum', 'mode', 'disabled', 'cellDisabled'])), {}, {
|
209
209
|
rowIndex: rowIndex
|
210
210
|
});
|
211
211
|
};
|
@@ -2,4 +2,5 @@ import { EditableCellProps } from './interface';
|
|
2
2
|
export declare function getDataCell(item: EditableCellProps): JSX.Element;
|
3
3
|
export declare function isFreeEditRow(curRow: any, rowIndex: number): boolean;
|
4
4
|
export declare function isFreeEditCell(editCellKey: any, dataIndex: string, rowIndex: number): boolean;
|
5
|
+
export declare function isCellDisabled(record: any, cellDisabled?: string): boolean;
|
5
6
|
export declare function removeCurKeyFromEditRow(editRowKey: any, curKey: number): string;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
* @Author: wangxian
|
3
3
|
* @Date: 2022-03-04 14:59:04
|
4
|
-
* @LastEditTime:
|
4
|
+
* @LastEditTime: 2023-05-23 10:33:54
|
5
5
|
*/
|
6
6
|
import React from 'react';
|
7
7
|
import Input from './DataCell/Input';
|
@@ -31,6 +31,30 @@ export function isFreeEditRow(curRow, rowIndex) {
|
|
31
31
|
export function isFreeEditCell(editCellKey, dataIndex, rowIndex) {
|
32
32
|
return (editCellKey === null || editCellKey === void 0 ? void 0 : editCellKey.dataIndex) === dataIndex && (editCellKey === null || editCellKey === void 0 ? void 0 : editCellKey.rowIndex) === rowIndex;
|
33
33
|
}
|
34
|
+
export function isCellDisabled(record, cellDisabled) {
|
35
|
+
if (cellDisabled) {
|
36
|
+
var regex = /\w+(\.\w+)?[=<>!]{1}|\w+(\.\w+)?(\.indexOf\('.+'\)[=<>!]{1})/g;
|
37
|
+
var keys = cellDisabled.trim().match(regex);
|
38
|
+
if (!keys) {
|
39
|
+
return true;
|
40
|
+
}
|
41
|
+
var expression = cellDisabled;
|
42
|
+
for (var i = 0; i < keys.length; i++) {
|
43
|
+
var key = keys[i].substring(0, keys[i].length - 1);
|
44
|
+
// 处理.length 之类的状况
|
45
|
+
var _key = key.split('.');
|
46
|
+
var _changeData = record[_key[0]];
|
47
|
+
if (_changeData || _changeData === 0) {
|
48
|
+
var r = key === _key[0] ? "'".concat(_changeData, "'") : eval("_changeData.".concat(_key[1]));
|
49
|
+
expression = expression.replace(key, r);
|
50
|
+
} else {
|
51
|
+
expression = expression.replace(key, undefined);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
return !eval(expression);
|
55
|
+
}
|
56
|
+
return true;
|
57
|
+
}
|
34
58
|
export function removeCurKeyFromEditRow(editRowKey, curKey) {
|
35
59
|
var keys = editRowKey.toString().split(',');
|
36
60
|
var res = [];
|
@@ -37,7 +37,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
37
37
|
/*
|
38
38
|
* @Author:wangxian
|
39
39
|
* @Date: 2021-09-18 14:15:04
|
40
|
-
* @LastEditTime: 2023-05-
|
40
|
+
* @LastEditTime: 2023-05-24 09:08:30
|
41
41
|
*/
|
42
42
|
import React from 'react';
|
43
43
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
@@ -91,7 +91,7 @@ function Index(props) {
|
|
91
91
|
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
92
92
|
expandedKeys = _React$useState12[0],
|
93
93
|
setExpandedKeys = _React$useState12[1];
|
94
|
-
var firstLoadTreeSelectRef = React.useRef(
|
94
|
+
var firstLoadTreeSelectRef = React.useRef(true);
|
95
95
|
var pageRef = React.useRef(1);
|
96
96
|
var totalRef = React.useRef();
|
97
97
|
var onSelect = function onSelect(value) {
|