ronds-metadata 1.2.37 → 1.2.39
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/api/index.js +83 -131
- package/es/comps/DynamicPorts/comps/ContextMenu.js +3 -11
- package/es/comps/DynamicPorts/comps/DragNode.js +3 -8
- package/es/comps/DynamicPorts/comps/GraphHandler/index.js +4 -5
- package/es/comps/DynamicPorts/comps/NodeElement.js +1 -4
- package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +3 -6
- package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +3 -7
- package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +18 -21
- package/es/comps/DynamicPorts/comps/shape/edge.js +5 -18
- package/es/comps/DynamicPorts/comps/shape/node.js +4 -17
- package/es/comps/DynamicPorts/constant/index.js +2 -5
- package/es/comps/DynamicPorts/graph.d.ts +2 -2
- package/es/comps/DynamicPorts/graph.js +228 -312
- package/es/comps/DynamicPorts/index.js +39 -58
- package/es/comps/DynamicPorts/utils.js +21 -25
- package/es/comps/Editable/DataCell/ButtonCell.js +4 -10
- package/es/comps/Editable/DataCell/ColorPicker.js +2 -7
- package/es/comps/Editable/DataCell/Input.js +5 -14
- package/es/comps/Editable/DataCell/Number.js +3 -10
- package/es/comps/Editable/DataCell/Select.js +7 -14
- package/es/comps/Editable/DataCell/Switch.js +2 -7
- package/es/comps/Editable/comps/EditableAction.js +8 -12
- package/es/comps/Editable/comps/EditableCell.js +16 -26
- package/es/comps/Editable/comps/EditableHeardCell.js +21 -34
- package/es/comps/Editable/comps/EditableRow.js +49 -59
- package/es/comps/Editable/comps/Texty.js +40 -73
- package/es/comps/Editable/index.js +67 -112
- package/es/comps/Editable/interface.d.ts +1 -1
- package/es/comps/Editable/utils.js +0 -1
- package/es/comps/FileView/index.js +65 -101
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +8 -13
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +8 -4
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +6 -2
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.js +8 -4
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.js +6 -11
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +6 -10
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +6 -2
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +6 -11
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +8 -4
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +8 -13
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +6 -10
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +6 -2
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.js +6 -11
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +6 -3
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +2 -5
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +86 -109
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +3 -7
- package/es/comps/FormGenerator/comps/Canvas/core/index.js +54 -91
- package/es/comps/FormGenerator/comps/Canvas/index.js +8 -15
- package/es/comps/FormGenerator/comps/Settings/index.js +16 -30
- package/es/comps/FormGenerator/comps/Sidebar/Elements.js +23 -22
- package/es/comps/FormGenerator/comps/Sidebar/index.js +6 -2
- package/es/comps/FormGenerator/index.js +3 -9
- package/es/comps/FormGenerator/interface.d.ts +1 -1
- package/es/comps/FormGenerator/settings/index.js +12 -11
- package/es/comps/FormGenerator/settings/ruleConfig.js +0 -1
- package/es/comps/FormGenerator/transformer.js +40 -105
- package/es/comps/Icons/index.js +4 -7
- package/es/comps/JsonEdit/index.js +25 -50
- package/es/comps/JsonView/index.js +7 -21
- package/es/comps/MdEdit/index.js +7 -10
- package/es/comps/MdEditPro/index.d.ts +10 -0
- package/es/comps/MdEditPro/index.js +22 -0
- package/es/comps/MdEditPro/index.less +74 -0
- package/es/comps/MdNavbar/index.js +17 -40
- package/es/comps/MdNavbar/utils.js +0 -4
- package/es/comps/MdView/index.js +7 -11
- package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +129 -183
- package/es/comps/MetadataEdit/components/MetaPropsEdit.js +11 -27
- package/es/comps/MetadataEdit/hooks/index.js +3 -11
- package/es/comps/MetadataEdit/index.js +25 -58
- package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +17 -33
- package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +15 -29
- package/es/comps/MetadataEditV2/hooks/index.js +5 -12
- package/es/comps/MetadataEditV2/index.js +30 -65
- package/es/comps/MetadataForm/DataCell/Array.js +12 -23
- package/es/comps/MetadataForm/DataCell/Input.js +23 -39
- package/es/comps/MetadataForm/DataCell/Number.js +10 -21
- package/es/comps/MetadataForm/DataCell/Ref.js +87 -121
- package/es/comps/MetadataForm/DataCell/Select.js +131 -226
- package/es/comps/MetadataForm/DataCell/Switch.js +7 -14
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +98 -169
- package/es/comps/MetadataForm/HOC/index.js +20 -37
- package/es/comps/MetadataForm/hooks/index.js +12 -38
- package/es/comps/MetadataForm/index.js +37 -72
- package/es/comps/MetadataForm/interface.d.ts +3 -3
- package/es/comps/MetadataForm/utils.d.ts +1 -0
- package/es/comps/MetadataForm/utils.js +12 -14
- package/es/comps/Split/index.js +40 -38
- package/es/config.js +0 -4
- package/es/framework/RxStore/demo/index.js +9 -10
- package/es/framework/RxStore/hooks.d.ts +9 -9
- package/es/framework/RxStore/hooks.js +10 -35
- package/es/framework/RxStore/store.d.ts +4 -4
- package/es/framework/RxStore/store.js +0 -10
- package/es/framework/fg/index.js +18 -80
- package/es/framework/fg/interface.d.ts +2 -2
- package/es/framework/fg/utils.js +0 -10
- package/es/framework/graph/index.d.ts +2 -2
- package/es/framework/graph/index.js +55 -110
- package/es/framework/hooks/use-async-memo.js +3 -7
- package/es/framework/hooks/use-sync-scroll.js +2 -15
- package/es/framework/http/cache.js +25 -32
- package/es/framework/http/cancel.js +1 -7
- package/es/framework/http/index.js +22 -82
- package/es/framework/http/msgpack.js +0 -4
- package/es/framework/http/msgpack5/index.js +2 -12
- package/es/framework/http/msgpack5/lib/codecs/DateCodec.js +1 -13
- package/es/framework/http/msgpack5/lib/decoder.js +10 -68
- package/es/framework/http/msgpack5/lib/encoder.js +8 -36
- package/es/framework/http/msgpack5/lib/helpers.js +3 -2
- package/es/framework/http/msgpack5/lib/streams.js +0 -18
- package/es/framework/libs/jquery.min.js +1009 -1696
- package/es/framework/locale/dil8/di18n.js +4 -15
- package/es/framework/locale/dil8/translate.js +0 -14
- package/es/framework/locale/dil8/util.js +0 -3
- package/es/framework/locale/index.js +2 -3
- package/es/framework/metadata/MetadataService.js +39 -78
- package/es/framework/metadata/index.js +4 -70
- package/es/framework/rxjs-hooks/useMemoSubject.js +0 -2
- package/es/framework/rxjs-hooks/useObservable.js +2 -4
- package/es/framework/rxjs-hooks/useObservableState.js +8 -14
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/utils.js +58 -97
- package/package.json +4 -2
- package/es/comps/MdEdit/plugin/EditContent.d.ts +0 -5
- package/es/comps/MdEdit/plugin/EditContent.js +0 -34
- package/es/comps/MdEdit/plugin/Mark.d.ts +0 -7
- package/es/comps/MdEdit/plugin/Mark.js +0 -60
- package/es/framework/libs/iconfont/iconfont.json +0 -401
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
|
|
4
3
|
/*
|
|
5
4
|
* @Author: wangxian
|
|
6
5
|
* @Date: 2022-05-16 18:53:31
|
|
@@ -17,33 +16,27 @@ import { DRAGGABLE_COMPONENT, DRAGGABLE_MODEL } from './constant';
|
|
|
17
16
|
import { guid } from '../../utils';
|
|
18
17
|
import ContextMenu from './comps/ContextMenu';
|
|
19
18
|
import { GraphHandler } from './comps/GraphHandler';
|
|
20
|
-
|
|
21
19
|
var DynamicPorts = function DynamicPorts(props) {
|
|
22
20
|
var defaultValue = props.defaultValue,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
onChange = props.onChange,
|
|
22
|
+
onNodeSelect = props.onNodeSelect,
|
|
23
|
+
getDPGraphInstance = props.getDPGraphInstance;
|
|
26
24
|
var divRef = React.useRef(null);
|
|
27
25
|
var containerRef = React.useRef(null);
|
|
28
|
-
|
|
29
26
|
var _React$useState = React.useState(),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
28
|
+
dpGraph = _React$useState2[0],
|
|
29
|
+
setGraph = _React$useState2[1];
|
|
34
30
|
var dpGraphRef = React.useRef();
|
|
35
|
-
var firstLoadRef = React.useRef(true);
|
|
36
|
-
|
|
31
|
+
var firstLoadRef = React.useRef(true);
|
|
32
|
+
// 处理画布卸载
|
|
37
33
|
useUnmountDPGraph();
|
|
38
34
|
var resizeSensorRef = React.useRef(null);
|
|
39
|
-
|
|
40
35
|
var onResizeStrategy = function onResizeStrategy() {
|
|
41
36
|
var _dpGraphRef$current, _dpGraphRef$current2;
|
|
42
|
-
|
|
43
37
|
(_dpGraphRef$current = dpGraphRef.current) === null || _dpGraphRef$current === void 0 ? void 0 : _dpGraphRef$current.resizeGraph();
|
|
44
38
|
(_dpGraphRef$current2 = dpGraphRef.current) === null || _dpGraphRef$current2 === void 0 ? void 0 : _dpGraphRef$current2.zoomGraphRealSize();
|
|
45
39
|
};
|
|
46
|
-
|
|
47
40
|
React.useEffect(function () {
|
|
48
41
|
if (dpGraphRef.current) {
|
|
49
42
|
try {
|
|
@@ -52,61 +45,54 @@ var DynamicPorts = function DynamicPorts(props) {
|
|
|
52
45
|
console.error(ex);
|
|
53
46
|
}
|
|
54
47
|
}
|
|
55
|
-
}, []);
|
|
56
|
-
|
|
48
|
+
}, []);
|
|
49
|
+
// 渲染画布
|
|
57
50
|
React.useEffect(function () {
|
|
58
51
|
if (firstLoadRef.current) {
|
|
59
52
|
var _dpGraph = useDPGraph(defaultValue);
|
|
60
|
-
|
|
61
53
|
dpGraphRef.current = _dpGraph;
|
|
62
54
|
setGraph(_dpGraph);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
_dpGraph.renderGraph(containerRef.current, divRef.current);
|
|
56
|
+
// 获取图信息的订阅
|
|
67
57
|
_dpGraph.factory$.dpGraph.pipe(filter(function (x) {
|
|
68
58
|
return !!x;
|
|
69
59
|
})).subscribe(function (v) {
|
|
70
60
|
onChange && onChange(v);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
|
|
61
|
+
});
|
|
62
|
+
// 获取选中节点的订阅
|
|
74
63
|
_dpGraph.factory$.selectedNodes.subscribe(function (v) {
|
|
75
64
|
onNodeSelect && onNodeSelect(v[0]);
|
|
76
65
|
});
|
|
77
|
-
|
|
78
66
|
getDPGraphInstance && getDPGraphInstance(_dpGraph);
|
|
79
67
|
firstLoadRef.current = false;
|
|
80
68
|
}
|
|
81
|
-
}, [defaultValue]);
|
|
82
|
-
|
|
69
|
+
}, [defaultValue]);
|
|
70
|
+
// 处理组件拖拽落下事件
|
|
83
71
|
var _useDrop = useDrop({
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
72
|
+
accept: [DRAGGABLE_COMPONENT, DRAGGABLE_MODEL],
|
|
73
|
+
drop: function drop(item, monitor) {
|
|
74
|
+
var currentMouseOffset = monitor.getClientOffset();
|
|
75
|
+
var sourceMouseOffset = monitor.getInitialClientOffset();
|
|
76
|
+
var sourceElementOffset = monitor.getInitialSourceClientOffset();
|
|
77
|
+
var diffX = sourceMouseOffset.x - sourceElementOffset.x;
|
|
78
|
+
var diffY = sourceMouseOffset.y - sourceElementOffset.y;
|
|
79
|
+
var x = currentMouseOffset.x - diffX;
|
|
80
|
+
var y = currentMouseOffset.y - diffY;
|
|
81
|
+
if (dpGraphRef.current.isGraphReady()) {
|
|
82
|
+
dpGraphRef.current.addDragNode(_objectSpread(_objectSpread({}, item.comp), {}, {
|
|
83
|
+
libId: item.comp.id,
|
|
84
|
+
id: guid(),
|
|
85
|
+
x: x,
|
|
86
|
+
y: y
|
|
87
|
+
}));
|
|
88
|
+
} else {
|
|
89
|
+
console.warn('请稍后再尝试添加节点');
|
|
90
|
+
}
|
|
103
91
|
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
92
|
+
}),
|
|
93
|
+
_useDrop2 = _slicedToArray(_useDrop, 2),
|
|
94
|
+
dropRef = _useDrop2[1];
|
|
95
|
+
// 画布侧边 toolbar handler
|
|
110
96
|
var onHandleSideToolbar = React.useCallback(function (action) {
|
|
111
97
|
return function () {
|
|
112
98
|
// 确保画布已渲染
|
|
@@ -115,19 +101,15 @@ var DynamicPorts = function DynamicPorts(props) {
|
|
|
115
101
|
case 'in':
|
|
116
102
|
dpGraphRef.current.zoomGraph(0.1);
|
|
117
103
|
break;
|
|
118
|
-
|
|
119
104
|
case 'out':
|
|
120
105
|
dpGraphRef.current.zoomGraph(-0.1);
|
|
121
106
|
break;
|
|
122
|
-
|
|
123
107
|
case 'fit':
|
|
124
108
|
dpGraphRef.current.zoomGraphToFit();
|
|
125
109
|
break;
|
|
126
|
-
|
|
127
110
|
case 'real':
|
|
128
111
|
dpGraphRef.current.zoomGraphRealSize();
|
|
129
112
|
break;
|
|
130
|
-
|
|
131
113
|
default:
|
|
132
114
|
}
|
|
133
115
|
}
|
|
@@ -158,5 +140,4 @@ var DynamicPorts = function DynamicPorts(props) {
|
|
|
158
140
|
ref: divRef
|
|
159
141
|
})));
|
|
160
142
|
};
|
|
161
|
-
|
|
162
143
|
export default DynamicPorts;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
-
|
|
4
3
|
/*
|
|
5
4
|
* @Author: wangxian
|
|
6
5
|
* @Date: 2022-05-24 16:40:49
|
|
7
6
|
* @LastEditTime: 2022-05-27 16:02:48
|
|
8
7
|
*/
|
|
9
8
|
import { sortBy } from 'lodash-es';
|
|
10
|
-
import { NODE_HEIGHT, NODE_WIDTH } from './constant';
|
|
11
|
-
|
|
9
|
+
import { NODE_HEIGHT, NODE_WIDTH } from './constant';
|
|
10
|
+
// 将画布上的点转换成相对于 offset parent 的点
|
|
12
11
|
export function graphPointToOffsetPoint(graph, graphPoint, containerElem) {
|
|
13
12
|
if (graph) {
|
|
14
13
|
var point = graph.localToPage({
|
|
@@ -17,30 +16,28 @@ export function graphPointToOffsetPoint(graph, graphPoint, containerElem) {
|
|
|
17
16
|
});
|
|
18
17
|
var clientRect = containerElem === null || containerElem === void 0 ? void 0 : containerElem.getBoundingClientRect();
|
|
19
18
|
var y = point.y - ((clientRect === null || clientRect === void 0 ? void 0 : clientRect.y) || 0); // ! offset parent 不能是画布容器,否则会影响内部布局,所以 offset parent 在外部,算上上方 toolbar 的高度
|
|
20
|
-
|
|
21
19
|
var x = point.x - ((clientRect === null || clientRect === void 0 ? void 0 : clientRect.x) || 0);
|
|
22
20
|
return {
|
|
23
21
|
x: x,
|
|
24
22
|
y: y
|
|
25
23
|
};
|
|
26
24
|
}
|
|
27
|
-
|
|
28
25
|
return {
|
|
29
26
|
x: 0,
|
|
30
27
|
y: 0
|
|
31
28
|
};
|
|
32
|
-
}
|
|
33
|
-
|
|
29
|
+
}
|
|
30
|
+
// 格式化单个节点,新增节点时复用
|
|
34
31
|
export function formatNodeInfoToNodeMeta(nodeData) {
|
|
35
32
|
var inputPortConnectedMap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
36
33
|
var portItems = [];
|
|
37
34
|
var id = nodeData.id,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
_nodeData$x = nodeData.x,
|
|
36
|
+
x = _nodeData$x === void 0 ? 0 : _nodeData$x,
|
|
37
|
+
_nodeData$y = nodeData.y,
|
|
38
|
+
y = _nodeData$y === void 0 ? 0 : _nodeData$y,
|
|
39
|
+
inPorts = nodeData.inPorts,
|
|
40
|
+
outPorts = nodeData.outPorts;
|
|
44
41
|
sortBy(inPorts, 'seq').forEach(function (inPort) {
|
|
45
42
|
portItems.push(_objectSpread(_objectSpread({}, inPort), {}, {
|
|
46
43
|
group: 'in',
|
|
@@ -78,18 +75,17 @@ export function formatNodeInfoToNodeMeta(nodeData) {
|
|
|
78
75
|
* 将暴露给接口的图信息转换可渲染的结图结构信息
|
|
79
76
|
* @returns
|
|
80
77
|
*/
|
|
81
|
-
|
|
82
78
|
export function formatGraphData(graphData) {
|
|
83
79
|
var _graphData$nodes = graphData.nodes,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
80
|
+
nodes = _graphData$nodes === void 0 ? [] : _graphData$nodes,
|
|
81
|
+
_graphData$edges = graphData.edges,
|
|
82
|
+
edges = _graphData$edges === void 0 ? [] : _graphData$edges;
|
|
83
|
+
// 格式化边
|
|
88
84
|
var formattedEdges = edges.map(function (edges) {
|
|
89
85
|
var source = edges.source,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
outPortId = edges.outPortId,
|
|
87
|
+
target = edges.target,
|
|
88
|
+
inPortId = edges.inPortId;
|
|
93
89
|
return _objectSpread(_objectSpread({}, edges), {}, {
|
|
94
90
|
data: _objectSpread({}, edges),
|
|
95
91
|
sourceAnchor: 'bottom',
|
|
@@ -110,13 +106,13 @@ export function formatGraphData(graphData) {
|
|
|
110
106
|
label: '',
|
|
111
107
|
zIndex: 1
|
|
112
108
|
});
|
|
113
|
-
});
|
|
114
|
-
|
|
109
|
+
});
|
|
110
|
+
// 记录所有已连线的输入桩
|
|
115
111
|
var inputPortConnectedMap = formattedEdges.reduce(function (acc, edge) {
|
|
116
112
|
acc[edge.inPortId] = true;
|
|
117
113
|
return acc;
|
|
118
|
-
}, {});
|
|
119
|
-
|
|
114
|
+
}, {});
|
|
115
|
+
// 格式化算法组件节点
|
|
120
116
|
var formattedNodes = nodes.map(function (nodeData) {
|
|
121
117
|
return formatNodeInfoToNodeMeta(nodeData, inputPortConnectedMap);
|
|
122
118
|
});
|
|
@@ -2,7 +2,6 @@ import "antd/es/form/style";
|
|
|
2
2
|
import _Form from "antd/es/form";
|
|
3
3
|
import "antd/es/button/style";
|
|
4
4
|
import _Button from "antd/es/button";
|
|
5
|
-
|
|
6
5
|
/*
|
|
7
6
|
* @Author: wangxian
|
|
8
7
|
* @Date: 2022-03-04 14:53:50
|
|
@@ -11,16 +10,13 @@ import _Button from "antd/es/button";
|
|
|
11
10
|
import React from 'react';
|
|
12
11
|
import { SettingOutlined } from '@ant-design/icons';
|
|
13
12
|
import { EditableContext } from '../interface';
|
|
14
|
-
|
|
15
13
|
function Index(props) {
|
|
16
14
|
var dataIndex = props.dataIndex,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
record = props.record,
|
|
16
|
+
disabled = props.disabled;
|
|
20
17
|
var _ref = React.useContext(EditableContext) || undefined,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
editableStream = _ref.editableStream,
|
|
19
|
+
editConfig = _ref.editConfig;
|
|
24
20
|
var onClick = function onClick(e) {
|
|
25
21
|
e.stopPropagation();
|
|
26
22
|
editableStream && editableStream.next({
|
|
@@ -28,7 +24,6 @@ function Index(props) {
|
|
|
28
24
|
payload: record
|
|
29
25
|
});
|
|
30
26
|
};
|
|
31
|
-
|
|
32
27
|
return /*#__PURE__*/React.createElement(_Form.Item, {
|
|
33
28
|
name: dataIndex,
|
|
34
29
|
style: {
|
|
@@ -41,5 +36,4 @@ function Index(props) {
|
|
|
41
36
|
icon: /*#__PURE__*/React.createElement(SettingOutlined, null)
|
|
42
37
|
}));
|
|
43
38
|
}
|
|
44
|
-
|
|
45
39
|
export default /*#__PURE__*/React.memo(Index);
|
|
@@ -2,7 +2,6 @@ import "antd/es/form/style";
|
|
|
2
2
|
import _Form from "antd/es/form";
|
|
3
3
|
import "antd/es/input/style";
|
|
4
4
|
import _Input from "antd/es/input";
|
|
5
|
-
|
|
6
5
|
/*
|
|
7
6
|
* @Author: wangxian
|
|
8
7
|
* @Date: 2022-03-04 14:53:50
|
|
@@ -10,14 +9,11 @@ import _Input from "antd/es/input";
|
|
|
10
9
|
*/
|
|
11
10
|
import React from 'react';
|
|
12
11
|
import { EditableContext } from '../interface';
|
|
13
|
-
|
|
14
12
|
function Index(props) {
|
|
15
13
|
var dataIndex = props.dataIndex,
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
disabled = props.disabled;
|
|
18
15
|
var _ref = React.useContext(EditableContext) || undefined,
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
editConfig = _ref.editConfig;
|
|
21
17
|
return /*#__PURE__*/React.createElement(_Form.Item, {
|
|
22
18
|
name: dataIndex,
|
|
23
19
|
style: {
|
|
@@ -29,5 +25,4 @@ function Index(props) {
|
|
|
29
25
|
disabled: editConfig.type === 'edit' ? disabled : false
|
|
30
26
|
}));
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
export default /*#__PURE__*/React.memo(Index);
|
|
@@ -2,7 +2,6 @@ import "antd/es/form/style";
|
|
|
2
2
|
import _Form from "antd/es/form";
|
|
3
3
|
import "antd/es/input/style";
|
|
4
4
|
import _Input from "antd/es/input";
|
|
5
|
-
|
|
6
5
|
/*
|
|
7
6
|
* @Author: wangxian
|
|
8
7
|
* @Date: 2022-03-04 14:53:50
|
|
@@ -10,32 +9,25 @@ import _Input from "antd/es/input";
|
|
|
10
9
|
*/
|
|
11
10
|
import React from 'react';
|
|
12
11
|
import { EditableContext } from '../interface';
|
|
13
|
-
|
|
14
12
|
function Index(props) {
|
|
15
13
|
var dataIndex = props.dataIndex,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
rowIndex = props.rowIndex,
|
|
15
|
+
disabled = props.disabled;
|
|
19
16
|
var _ref = React.useContext(EditableContext) || undefined,
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
editConfig = _ref.editConfig;
|
|
22
18
|
var inputRef = React.useRef();
|
|
23
19
|
var firstLoadRef = React.useRef(true);
|
|
24
20
|
React.useEffect(function () {
|
|
25
21
|
var _editConfig$editCellK, _editConfig$editCellK2;
|
|
26
|
-
|
|
27
22
|
if (!inputRef.current) return;
|
|
28
|
-
|
|
29
23
|
if (((_editConfig$editCellK = editConfig.editCellKey) === null || _editConfig$editCellK === void 0 ? void 0 : _editConfig$editCellK.dataIndex) === dataIndex && ((_editConfig$editCellK2 = editConfig.editCellKey) === null || _editConfig$editCellK2 === void 0 ? void 0 : _editConfig$editCellK2.rowIndex) === rowIndex) {
|
|
30
24
|
if (firstLoadRef.current) {
|
|
31
25
|
var _inputRef$current$sta, _inputRef$current$sta2;
|
|
32
|
-
|
|
33
26
|
// 选中内容
|
|
34
27
|
inputRef.current.input.setSelectionRange(0, ((_inputRef$current$sta = inputRef.current.state) === null || _inputRef$current$sta === void 0 ? void 0 : (_inputRef$current$sta2 = _inputRef$current$sta.value) === null || _inputRef$current$sta2 === void 0 ? void 0 : _inputRef$current$sta2.length) || 0);
|
|
35
28
|
firstLoadRef.current = false;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
}
|
|
30
|
+
// 设置焦点
|
|
39
31
|
inputRef.current.focus();
|
|
40
32
|
}
|
|
41
33
|
}, [editConfig]);
|
|
@@ -50,5 +42,4 @@ function Index(props) {
|
|
|
50
42
|
disabled: editConfig.type === 'edit' ? disabled : false
|
|
51
43
|
}));
|
|
52
44
|
}
|
|
53
|
-
|
|
54
45
|
export default /*#__PURE__*/React.memo(Index);
|
|
@@ -2,7 +2,6 @@ import "antd/es/form/style";
|
|
|
2
2
|
import _Form from "antd/es/form";
|
|
3
3
|
import "antd/es/input-number/style";
|
|
4
4
|
import _InputNumber from "antd/es/input-number";
|
|
5
|
-
|
|
6
5
|
/*
|
|
7
6
|
* @Author: wangxian
|
|
8
7
|
* @Date: 2022-03-04 14:53:50
|
|
@@ -10,21 +9,16 @@ import _InputNumber from "antd/es/input-number";
|
|
|
10
9
|
*/
|
|
11
10
|
import React from 'react';
|
|
12
11
|
import { EditableContext } from '../interface';
|
|
13
|
-
|
|
14
12
|
function Index(props) {
|
|
15
13
|
var dataIndex = props.dataIndex,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
rowIndex = props.rowIndex,
|
|
15
|
+
disabled = props.disabled;
|
|
19
16
|
var _ref = React.useContext(EditableContext) || undefined,
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
editConfig = _ref.editConfig;
|
|
22
18
|
var inputRef = React.useRef();
|
|
23
19
|
React.useEffect(function () {
|
|
24
20
|
var _editConfig$editCellK, _editConfig$editCellK2;
|
|
25
|
-
|
|
26
21
|
if (!inputRef.current) return;
|
|
27
|
-
|
|
28
22
|
if (((_editConfig$editCellK = editConfig.editCellKey) === null || _editConfig$editCellK === void 0 ? void 0 : _editConfig$editCellK.dataIndex) === dataIndex && ((_editConfig$editCellK2 = editConfig.editCellKey) === null || _editConfig$editCellK2 === void 0 ? void 0 : _editConfig$editCellK2.rowIndex) === rowIndex) {
|
|
29
23
|
inputRef.current.focus(); // 设置焦点
|
|
30
24
|
}
|
|
@@ -40,5 +34,4 @@ function Index(props) {
|
|
|
40
34
|
disabled: editConfig.type === 'edit' ? disabled : false
|
|
41
35
|
}));
|
|
42
36
|
}
|
|
43
|
-
|
|
44
37
|
export default /*#__PURE__*/React.memo(Index);
|
|
@@ -6,7 +6,6 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
6
6
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
7
7
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
8
8
|
var _excluded = ["dataIndex", "mode", "disabled"];
|
|
9
|
-
|
|
10
9
|
/*
|
|
11
10
|
* @Author: wangxian
|
|
12
11
|
* @Date: 2022-03-04 14:53:50
|
|
@@ -14,21 +13,17 @@ var _excluded = ["dataIndex", "mode", "disabled"];
|
|
|
14
13
|
*/
|
|
15
14
|
import React from 'react';
|
|
16
15
|
import { EditableContext } from '../interface';
|
|
17
|
-
|
|
18
16
|
function Index(props) {
|
|
19
17
|
var dataIndex = props.dataIndex,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
mode = props.mode,
|
|
19
|
+
disabled = props.disabled,
|
|
20
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
24
21
|
var _ref = React.useContext(EditableContext) || undefined,
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
editConfig = _ref.editConfig;
|
|
27
23
|
var _React$useState = React.useState([]),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
25
|
+
options = _React$useState2[0],
|
|
26
|
+
setOptions = _React$useState2[1];
|
|
32
27
|
React.useEffect(function () {
|
|
33
28
|
if (restProps.enum) {
|
|
34
29
|
Promise.resolve(restProps.enum).then(function (value) {
|
|
@@ -47,7 +42,6 @@ function Index(props) {
|
|
|
47
42
|
showSearch: true,
|
|
48
43
|
filterOption: function filterOption(input, option) {
|
|
49
44
|
var _option$label;
|
|
50
|
-
|
|
51
45
|
return (option === null || option === void 0 ? void 0 : (_option$label = option.label) === null || _option$label === void 0 ? void 0 : _option$label.toString().indexOf(input)) >= 0;
|
|
52
46
|
},
|
|
53
47
|
allowClear: true,
|
|
@@ -58,5 +52,4 @@ function Index(props) {
|
|
|
58
52
|
options: options
|
|
59
53
|
}));
|
|
60
54
|
}
|
|
61
|
-
|
|
62
55
|
export default /*#__PURE__*/React.memo(Index);
|
|
@@ -2,7 +2,6 @@ import "antd/es/form/style";
|
|
|
2
2
|
import _Form from "antd/es/form";
|
|
3
3
|
import "antd/es/switch/style";
|
|
4
4
|
import _Switch from "antd/es/switch";
|
|
5
|
-
|
|
6
5
|
/*
|
|
7
6
|
* @Author: wangxian
|
|
8
7
|
* @Date: 2022-03-04 14:53:50
|
|
@@ -10,14 +9,11 @@ import _Switch from "antd/es/switch";
|
|
|
10
9
|
*/
|
|
11
10
|
import React from 'react';
|
|
12
11
|
import { EditableContext } from '../interface';
|
|
13
|
-
|
|
14
12
|
function Index(props) {
|
|
15
13
|
var dataIndex = props.dataIndex,
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
disabled = props.disabled;
|
|
18
15
|
var _ref = React.useContext(EditableContext) || undefined,
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
editConfig = _ref.editConfig;
|
|
21
17
|
return /*#__PURE__*/React.createElement(_Form.Item, {
|
|
22
18
|
name: dataIndex,
|
|
23
19
|
valuePropName: "checked",
|
|
@@ -29,5 +25,4 @@ function Index(props) {
|
|
|
29
25
|
disabled: editConfig.type === 'edit' ? disabled : false
|
|
30
26
|
}));
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
export default /*#__PURE__*/React.memo(Index);
|
|
@@ -2,21 +2,22 @@ import "antd/es/popconfirm/style";
|
|
|
2
2
|
import _Popconfirm from "antd/es/popconfirm";
|
|
3
3
|
import "antd/es/button/style";
|
|
4
4
|
import _Button from "antd/es/button";
|
|
5
|
+
/*
|
|
6
|
+
* @Author: wangxian
|
|
7
|
+
* @Date: 2022-03-05 10:10:07
|
|
8
|
+
* @LastEditTime: 2022-06-14 14:28:34
|
|
9
|
+
*/
|
|
5
10
|
import React from 'react';
|
|
6
11
|
import { EditableContext } from '../interface';
|
|
7
12
|
import { isFreeEditRow } from '../utils';
|
|
8
13
|
import { tr } from '../../../framework/locale';
|
|
9
|
-
|
|
10
14
|
var EditableAction = function EditableAction(props) {
|
|
11
15
|
var _editConfig$editCellK;
|
|
12
|
-
|
|
13
16
|
var type = props.type,
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
record = props.record;
|
|
16
18
|
var _ref = React.useContext(EditableContext) || undefined,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
editableStream = _ref.editableStream,
|
|
20
|
+
editConfig = _ref.editConfig;
|
|
20
21
|
var onEdit = function onEdit(e) {
|
|
21
22
|
e.stopPropagation();
|
|
22
23
|
editableStream.next({
|
|
@@ -24,7 +25,6 @@ var EditableAction = function EditableAction(props) {
|
|
|
24
25
|
payload: record
|
|
25
26
|
});
|
|
26
27
|
};
|
|
27
|
-
|
|
28
28
|
var onCancel = function onCancel(e) {
|
|
29
29
|
e.stopPropagation();
|
|
30
30
|
editableStream.next({
|
|
@@ -34,7 +34,6 @@ var EditableAction = function EditableAction(props) {
|
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
|
-
|
|
38
37
|
var onSave = function onSave(e) {
|
|
39
38
|
e.stopPropagation();
|
|
40
39
|
editableStream.next({
|
|
@@ -49,7 +48,6 @@ var EditableAction = function EditableAction(props) {
|
|
|
49
48
|
}
|
|
50
49
|
});
|
|
51
50
|
};
|
|
52
|
-
|
|
53
51
|
var onDelete = function onDelete(e) {
|
|
54
52
|
e.stopPropagation();
|
|
55
53
|
editableStream.next({
|
|
@@ -57,7 +55,6 @@ var EditableAction = function EditableAction(props) {
|
|
|
57
55
|
payload: record
|
|
58
56
|
});
|
|
59
57
|
};
|
|
60
|
-
|
|
61
58
|
return /*#__PURE__*/React.createElement(React.Fragment, null, type === 'single' && /*#__PURE__*/React.createElement(React.Fragment, null, editConfig.curRow !== record._rowKey_ && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Button, {
|
|
62
59
|
type: "link",
|
|
63
60
|
style: {
|
|
@@ -106,5 +103,4 @@ var EditableAction = function EditableAction(props) {
|
|
|
106
103
|
}
|
|
107
104
|
}, tr('删除'))));
|
|
108
105
|
};
|
|
109
|
-
|
|
110
106
|
export default EditableAction;
|