ronds-metadata 1.2.8 → 1.2.10
Sign up to get free protection for your applications and to get access to all the features.
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.d.ts +2 -0
- package/es/comps/FormGenerator/comps/Canvas/core/index.less +23 -23
- package/es/comps/FormGenerator/index.d.ts +4 -0
- package/es/comps/FormGenerator/settings/index.d.ts +668 -49
- package/es/comps/JsonEdit/index.d.ts +5 -1
- package/es/comps/MetadataForm/index.less +1 -1
- package/es/comps/MetadataForm/utils.d.ts +1 -1
- package/package.json +1 -1
- package/es/api/index.js +0 -249
- package/es/comps/DynamicPorts/comps/ContextMenu.js +0 -44
- package/es/comps/DynamicPorts/comps/DragNode.js +0 -55
- package/es/comps/DynamicPorts/comps/GraphHandler/index.js +0 -51
- package/es/comps/DynamicPorts/comps/NodeElement.js +0 -30
- package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +0 -42
- package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +0 -40
- package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +0 -55
- package/es/comps/DynamicPorts/comps/shape/connector.js +0 -19
- package/es/comps/DynamicPorts/comps/shape/edge.js +0 -91
- package/es/comps/DynamicPorts/comps/shape/node.js +0 -190
- package/es/comps/DynamicPorts/constant/index.js +0 -19
- package/es/comps/DynamicPorts/graph.js +0 -697
- package/es/comps/DynamicPorts/index.js +0 -143
- package/es/comps/DynamicPorts/interface.js +0 -6
- package/es/comps/DynamicPorts/utils.js +0 -127
- package/es/comps/Editable/DataCell/ButtonCell.js +0 -45
- package/es/comps/Editable/DataCell/ColorPicker.js +0 -33
- package/es/comps/Editable/DataCell/Input.js +0 -54
- package/es/comps/Editable/DataCell/Number.js +0 -44
- package/es/comps/Editable/DataCell/Select.js +0 -48
- package/es/comps/Editable/DataCell/Switch.js +0 -33
- package/es/comps/Editable/comps/EditableAction.js +0 -110
- package/es/comps/Editable/comps/EditableCell.js +0 -108
- package/es/comps/Editable/comps/EditableHeardCell.js +0 -172
- package/es/comps/Editable/comps/EditableRow.js +0 -118
- package/es/comps/Editable/comps/Texty.js +0 -277
- package/es/comps/Editable/index.js +0 -385
- package/es/comps/Editable/interface.js +0 -8
- package/es/comps/Editable/utils.js +0 -46
- package/es/comps/FileView/index.js +0 -198
- package/es/comps/FormGenerator/Provider.js +0 -8
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +0 -16
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +0 -55
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +0 -14
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +0 -50
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +0 -55
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +0 -13
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +0 -14
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +0 -250
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +0 -60
- package/es/comps/FormGenerator/comps/Canvas/core/index.js +0 -313
- package/es/comps/FormGenerator/comps/Canvas/index.js +0 -216
- package/es/comps/FormGenerator/comps/Settings/index.js +0 -150
- package/es/comps/FormGenerator/comps/Sidebar/Elements.js +0 -48
- package/es/comps/FormGenerator/comps/Sidebar/index.js +0 -37
- package/es/comps/FormGenerator/index.js +0 -56
- package/es/comps/FormGenerator/settings/index.js +0 -303
- package/es/comps/FormGenerator/settings/ruleConfig.js +0 -557
- package/es/comps/FormGenerator/transformer.js +0 -214
- package/es/comps/Icons/index.js +0 -23
- package/es/comps/JsonEdit/constant/index.js +0 -87
- package/es/comps/JsonEdit/index.js +0 -217
- package/es/comps/JsonView/index.js +0 -109
- package/es/comps/MdEdit/index.js +0 -41
- package/es/comps/MdNavbar/index.js +0 -180
- package/es/comps/MdNavbar/utils.js +0 -34
- package/es/comps/MdView/index.js +0 -70
- package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +0 -419
- package/es/comps/MetadataEdit/components/MetaPropsEdit.js +0 -368
- package/es/comps/MetadataEdit/constant/index.js +0 -69
- package/es/comps/MetadataEdit/hooks/index.js +0 -43
- package/es/comps/MetadataEdit/index.js +0 -255
- package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +0 -237
- package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +0 -367
- package/es/comps/MetadataEditV2/constant/index.js +0 -69
- package/es/comps/MetadataEditV2/hooks/index.js +0 -43
- package/es/comps/MetadataEditV2/index.js +0 -298
- package/es/comps/MetadataForm/DataCell/Array.js +0 -157
- package/es/comps/MetadataForm/DataCell/Input.js +0 -197
- package/es/comps/MetadataForm/DataCell/Number.js +0 -130
- package/es/comps/MetadataForm/DataCell/Ref.js +0 -323
- package/es/comps/MetadataForm/DataCell/Select.js +0 -517
- package/es/comps/MetadataForm/DataCell/Switch.js +0 -115
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +0 -359
- package/es/comps/MetadataForm/HOC/index.js +0 -111
- package/es/comps/MetadataForm/constants.js +0 -11
- package/es/comps/MetadataForm/hooks/index.js +0 -128
- package/es/comps/MetadataForm/index.js +0 -268
- package/es/comps/MetadataForm/interface.js +0 -8
- package/es/comps/MetadataForm/utils.js +0 -108
- package/es/comps/locales/en-US.js +0 -24
- package/es/comps/locales/index.js +0 -8
- package/es/comps/locales/zh-CN.js +0 -24
- package/es/config.js +0 -50
- package/es/framework/graph/index.js +0 -515
- package/es/framework/hooks/use-async-memo.js +0 -32
- package/es/framework/hooks/use-sync-scroll.js +0 -106
- package/es/framework/http/cache.js +0 -137
- package/es/framework/http/cancel.js +0 -44
- package/es/framework/http/index.js +0 -392
- package/es/framework/http/msgpack.js +0 -34
- package/es/framework/http/msgpack5/index.js +0 -84
- package/es/framework/http/msgpack5/lib/codecs/DateCodec.js +0 -71
- package/es/framework/http/msgpack5/lib/decoder.js +0 -287
- package/es/framework/http/msgpack5/lib/encoder.js +0 -252
- package/es/framework/http/msgpack5/lib/helpers.js +0 -23
- package/es/framework/http/msgpack5/lib/streams.js +0 -93
- package/es/framework/http/types.js +0 -1
- package/es/framework/libs/jquery.min.js +0 -4022
- package/es/framework/locale/dil8/di18n.js +0 -132
- package/es/framework/locale/dil8/index.js +0 -3
- package/es/framework/locale/dil8/translate.js +0 -76
- package/es/framework/locale/dil8/util.js +0 -17
- package/es/framework/locale/index.js +0 -26
- package/es/framework/metadata/MetadataService.js +0 -169
- package/es/framework/metadata/index.js +0 -384
- package/es/framework/rxjs-hooks/useMemoSubject.js +0 -16
- package/es/framework/rxjs-hooks/useObservable.js +0 -22
- package/es/framework/rxjs-hooks/useObservableState.js +0 -45
- package/es/index.js +0 -27
- package/es/utils.js +0 -138
@@ -1,143 +0,0 @@
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
|
-
|
4
|
-
/*
|
5
|
-
* @Author: wangxian
|
6
|
-
* @Date: 2022-05-16 18:53:31
|
7
|
-
* @LastEditTime: 2022-06-28 14:58:00
|
8
|
-
*/
|
9
|
-
import React from 'react';
|
10
|
-
import { filter } from 'rxjs';
|
11
|
-
import { useDrop } from 'react-dnd';
|
12
|
-
import './index.less';
|
13
|
-
import './comps/shape/connector';
|
14
|
-
import { useDPGraph, useUnmountDPGraph } from './graph';
|
15
|
-
import { DRAGGABLE_COMPONENT, DRAGGABLE_MODEL } from './constant';
|
16
|
-
import { guid } from '../../utils';
|
17
|
-
import ContextMenu from './comps/ContextMenu';
|
18
|
-
import { GraphHandler } from './comps/GraphHandler';
|
19
|
-
|
20
|
-
var DynamicPorts = function DynamicPorts(props) {
|
21
|
-
var defaultValue = props.defaultValue,
|
22
|
-
onChange = props.onChange,
|
23
|
-
onNodeSelect = props.onNodeSelect,
|
24
|
-
getDPGraphInstance = props.getDPGraphInstance;
|
25
|
-
var divRef = React.useRef(null);
|
26
|
-
var containerRef = React.useRef(null);
|
27
|
-
|
28
|
-
var _React$useState = React.useState(),
|
29
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
30
|
-
dpGraph = _React$useState2[0],
|
31
|
-
setGraph = _React$useState2[1];
|
32
|
-
|
33
|
-
var dpGraphRef = React.useRef();
|
34
|
-
var firstLoadRef = React.useRef(true); // 处理画布卸载
|
35
|
-
|
36
|
-
useUnmountDPGraph(); // 渲染画布
|
37
|
-
|
38
|
-
React.useEffect(function () {
|
39
|
-
if (firstLoadRef.current) {
|
40
|
-
var _dpGraph = useDPGraph(defaultValue);
|
41
|
-
|
42
|
-
dpGraphRef.current = _dpGraph;
|
43
|
-
setGraph(_dpGraph);
|
44
|
-
|
45
|
-
_dpGraph.renderGraph(containerRef.current, divRef.current); // 获取图信息的订阅
|
46
|
-
|
47
|
-
|
48
|
-
_dpGraph.factory$.dpGraph.pipe(filter(function (x) {
|
49
|
-
return !!x;
|
50
|
-
})).subscribe(function (v) {
|
51
|
-
onChange && onChange(v);
|
52
|
-
}); // 获取选中节点的订阅
|
53
|
-
|
54
|
-
|
55
|
-
_dpGraph.factory$.selectedNodes.subscribe(function (v) {
|
56
|
-
onNodeSelect && onNodeSelect(v[0]);
|
57
|
-
});
|
58
|
-
|
59
|
-
getDPGraphInstance && getDPGraphInstance(_dpGraph);
|
60
|
-
firstLoadRef.current = false;
|
61
|
-
}
|
62
|
-
}, [defaultValue]); // 处理组件拖拽落下事件
|
63
|
-
|
64
|
-
var _useDrop = useDrop({
|
65
|
-
accept: [DRAGGABLE_COMPONENT, DRAGGABLE_MODEL],
|
66
|
-
drop: function drop(item, monitor) {
|
67
|
-
var currentMouseOffset = monitor.getClientOffset();
|
68
|
-
var sourceMouseOffset = monitor.getInitialClientOffset();
|
69
|
-
var sourceElementOffset = monitor.getInitialSourceClientOffset();
|
70
|
-
var diffX = sourceMouseOffset.x - sourceElementOffset.x;
|
71
|
-
var diffY = sourceMouseOffset.y - sourceElementOffset.y;
|
72
|
-
var x = currentMouseOffset.x - diffX;
|
73
|
-
var y = currentMouseOffset.y - diffY;
|
74
|
-
|
75
|
-
if (dpGraphRef.current.isGraphReady()) {
|
76
|
-
dpGraphRef.current.addDragNode(_objectSpread(_objectSpread({}, item.comp), {}, {
|
77
|
-
libId: item.comp.id,
|
78
|
-
id: guid(),
|
79
|
-
x: x,
|
80
|
-
y: y
|
81
|
-
}));
|
82
|
-
} else {
|
83
|
-
console.warn('请稍后再尝试添加节点');
|
84
|
-
}
|
85
|
-
}
|
86
|
-
}),
|
87
|
-
_useDrop2 = _slicedToArray(_useDrop, 2),
|
88
|
-
dropRef = _useDrop2[1]; // 画布侧边 toolbar handler
|
89
|
-
|
90
|
-
|
91
|
-
var onHandleSideToolbar = React.useCallback(function (action) {
|
92
|
-
return function () {
|
93
|
-
// 确保画布已渲染
|
94
|
-
if (dpGraphRef.current.isGraphReady()) {
|
95
|
-
switch (action) {
|
96
|
-
case 'in':
|
97
|
-
dpGraphRef.current.zoomGraph(0.1);
|
98
|
-
break;
|
99
|
-
|
100
|
-
case 'out':
|
101
|
-
dpGraphRef.current.zoomGraph(-0.1);
|
102
|
-
break;
|
103
|
-
|
104
|
-
case 'fit':
|
105
|
-
dpGraphRef.current.zoomGraphToFit();
|
106
|
-
break;
|
107
|
-
|
108
|
-
case 'real':
|
109
|
-
dpGraphRef.current.zoomGraphRealSize();
|
110
|
-
break;
|
111
|
-
|
112
|
-
default:
|
113
|
-
}
|
114
|
-
}
|
115
|
-
};
|
116
|
-
}, [dpGraph]);
|
117
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
118
|
-
ref: function ref(elem) {
|
119
|
-
containerRef.current = elem;
|
120
|
-
dropRef(elem);
|
121
|
-
},
|
122
|
-
className: "dynamic-ports",
|
123
|
-
style: {
|
124
|
-
height: '100%',
|
125
|
-
width: '100%'
|
126
|
-
}
|
127
|
-
}, /*#__PURE__*/React.createElement(ContextMenu, {
|
128
|
-
graph: dpGraph
|
129
|
-
}), /*#__PURE__*/React.createElement(GraphHandler, {
|
130
|
-
onZoomIn: onHandleSideToolbar('in'),
|
131
|
-
onZoomOut: onHandleSideToolbar('out'),
|
132
|
-
onFitContent: onHandleSideToolbar('fit'),
|
133
|
-
onRealContent: onHandleSideToolbar('real')
|
134
|
-
}), /*#__PURE__*/React.createElement("div", {
|
135
|
-
style: {
|
136
|
-
height: '100%',
|
137
|
-
width: '100%'
|
138
|
-
},
|
139
|
-
ref: divRef
|
140
|
-
})));
|
141
|
-
};
|
142
|
-
|
143
|
-
export default DynamicPorts;
|
@@ -1,127 +0,0 @@
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
|
-
|
4
|
-
/*
|
5
|
-
* @Author: wangxian
|
6
|
-
* @Date: 2022-05-24 16:40:49
|
7
|
-
* @LastEditTime: 2022-05-27 16:02:48
|
8
|
-
*/
|
9
|
-
import { sortBy } from 'lodash-es';
|
10
|
-
import { NODE_HEIGHT, NODE_WIDTH } from './constant'; // 将画布上的点转换成相对于 offset parent 的点
|
11
|
-
|
12
|
-
export function graphPointToOffsetPoint(graph, graphPoint, containerElem) {
|
13
|
-
if (graph) {
|
14
|
-
var point = graph.localToPage({
|
15
|
-
x: graphPoint.x,
|
16
|
-
y: graphPoint.y
|
17
|
-
});
|
18
|
-
var clientRect = containerElem === null || containerElem === void 0 ? void 0 : containerElem.getBoundingClientRect();
|
19
|
-
var y = point.y - ((clientRect === null || clientRect === void 0 ? void 0 : clientRect.y) || 0); // ! offset parent 不能是画布容器,否则会影响内部布局,所以 offset parent 在外部,算上上方 toolbar 的高度
|
20
|
-
|
21
|
-
var x = point.x - ((clientRect === null || clientRect === void 0 ? void 0 : clientRect.x) || 0);
|
22
|
-
return {
|
23
|
-
x: x,
|
24
|
-
y: y
|
25
|
-
};
|
26
|
-
}
|
27
|
-
|
28
|
-
return {
|
29
|
-
x: 0,
|
30
|
-
y: 0
|
31
|
-
};
|
32
|
-
} // 格式化单个节点,新增节点时复用
|
33
|
-
|
34
|
-
export function formatNodeInfoToNodeMeta(nodeData) {
|
35
|
-
var inputPortConnectedMap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
36
|
-
var portItems = [];
|
37
|
-
var id = nodeData.id,
|
38
|
-
_nodeData$x = nodeData.x,
|
39
|
-
x = _nodeData$x === void 0 ? 0 : _nodeData$x,
|
40
|
-
_nodeData$y = nodeData.y,
|
41
|
-
y = _nodeData$y === void 0 ? 0 : _nodeData$y,
|
42
|
-
inPorts = nodeData.inPorts,
|
43
|
-
outPorts = nodeData.outPorts;
|
44
|
-
sortBy(inPorts, 'seq').forEach(function (inPort) {
|
45
|
-
portItems.push(_objectSpread(_objectSpread({}, inPort), {}, {
|
46
|
-
group: 'in',
|
47
|
-
id: inPort.id.toString(),
|
48
|
-
connected: !!inputPortConnectedMap[inPort.id.toString()]
|
49
|
-
}));
|
50
|
-
});
|
51
|
-
sortBy(outPorts, 'seq').forEach(function (outPort) {
|
52
|
-
portItems.push(_objectSpread(_objectSpread({}, outPort), {}, {
|
53
|
-
group: 'out',
|
54
|
-
id: outPort.id.toString(),
|
55
|
-
connected: !!inputPortConnectedMap[outPort.id.toString()]
|
56
|
-
}));
|
57
|
-
});
|
58
|
-
return _objectSpread(_objectSpread({}, nodeData), {}, {
|
59
|
-
x: x,
|
60
|
-
y: y,
|
61
|
-
type: 'node',
|
62
|
-
id: id.toString(),
|
63
|
-
width: NODE_WIDTH,
|
64
|
-
height: NODE_HEIGHT,
|
65
|
-
data: _objectSpread(_objectSpread({}, nodeData), {}, {
|
66
|
-
type: 'node',
|
67
|
-
x: x,
|
68
|
-
y: y,
|
69
|
-
id: id.toString()
|
70
|
-
}),
|
71
|
-
ports: {
|
72
|
-
items: portItems
|
73
|
-
},
|
74
|
-
zIndex: 10
|
75
|
-
});
|
76
|
-
}
|
77
|
-
/**
|
78
|
-
* 将暴露给接口的图信息转换可渲染的结图结构信息
|
79
|
-
* @returns
|
80
|
-
*/
|
81
|
-
|
82
|
-
export function formatGraphData(graphData) {
|
83
|
-
var _graphData$nodes = graphData.nodes,
|
84
|
-
nodes = _graphData$nodes === void 0 ? [] : _graphData$nodes,
|
85
|
-
_graphData$edges = graphData.edges,
|
86
|
-
edges = _graphData$edges === void 0 ? [] : _graphData$edges; // 格式化边
|
87
|
-
|
88
|
-
var formattedEdges = edges.map(function (edges) {
|
89
|
-
var source = edges.source,
|
90
|
-
outPortId = edges.outPortId,
|
91
|
-
target = edges.target,
|
92
|
-
inPortId = edges.inPortId;
|
93
|
-
return _objectSpread(_objectSpread({}, edges), {}, {
|
94
|
-
data: _objectSpread({}, edges),
|
95
|
-
sourceAnchor: 'bottom',
|
96
|
-
source: {
|
97
|
-
cell: source.toString(),
|
98
|
-
port: outPortId.toString(),
|
99
|
-
anchor: {
|
100
|
-
name: 'bottom'
|
101
|
-
}
|
102
|
-
},
|
103
|
-
target: {
|
104
|
-
cell: target.toString(),
|
105
|
-
port: inPortId.toString(),
|
106
|
-
anchor: {
|
107
|
-
name: 'center'
|
108
|
-
}
|
109
|
-
},
|
110
|
-
label: '',
|
111
|
-
zIndex: 1
|
112
|
-
});
|
113
|
-
}); // 记录所有已连线的输入桩
|
114
|
-
|
115
|
-
var inputPortConnectedMap = formattedEdges.reduce(function (acc, edge) {
|
116
|
-
acc[edge.inPortId] = true;
|
117
|
-
return acc;
|
118
|
-
}, {}); // 格式化算法组件节点
|
119
|
-
|
120
|
-
var formattedNodes = nodes.map(function (nodeData) {
|
121
|
-
return formatNodeInfoToNodeMeta(nodeData, inputPortConnectedMap);
|
122
|
-
});
|
123
|
-
return {
|
124
|
-
nodes: _toConsumableArray(formattedNodes),
|
125
|
-
edges: formattedEdges
|
126
|
-
};
|
127
|
-
}
|
@@ -1,45 +0,0 @@
|
|
1
|
-
import "antd/es/form/style";
|
2
|
-
import _Form from "antd/es/form";
|
3
|
-
import "antd/es/button/style";
|
4
|
-
import _Button from "antd/es/button";
|
5
|
-
|
6
|
-
/*
|
7
|
-
* @Author: wangxian
|
8
|
-
* @Date: 2022-03-04 14:53:50
|
9
|
-
* @LastEditTime: 2022-07-08 08:57:41
|
10
|
-
*/
|
11
|
-
import React from 'react';
|
12
|
-
import { SettingOutlined } from '@ant-design/icons';
|
13
|
-
import { EditableContext } from '../interface';
|
14
|
-
|
15
|
-
function Index(props) {
|
16
|
-
var dataIndex = props.dataIndex,
|
17
|
-
record = props.record,
|
18
|
-
disabled = props.disabled;
|
19
|
-
|
20
|
-
var _ref = React.useContext(EditableContext) || undefined,
|
21
|
-
editableStream = _ref.editableStream,
|
22
|
-
editConfig = _ref.editConfig;
|
23
|
-
|
24
|
-
var onClick = function onClick(e) {
|
25
|
-
e.stopPropagation();
|
26
|
-
editableStream && editableStream.next({
|
27
|
-
type: 'onButtonCellClick',
|
28
|
-
payload: record
|
29
|
-
});
|
30
|
-
};
|
31
|
-
|
32
|
-
return /*#__PURE__*/React.createElement(_Form.Item, {
|
33
|
-
name: dataIndex,
|
34
|
-
style: {
|
35
|
-
margin: 0
|
36
|
-
}
|
37
|
-
}, /*#__PURE__*/React.createElement(_Button, {
|
38
|
-
type: "link",
|
39
|
-
disabled: editConfig.type === 'edit' ? disabled : false,
|
40
|
-
onClick: onClick,
|
41
|
-
icon: /*#__PURE__*/React.createElement(SettingOutlined, null)
|
42
|
-
}));
|
43
|
-
}
|
44
|
-
|
45
|
-
export default /*#__PURE__*/React.memo(Index);
|
@@ -1,33 +0,0 @@
|
|
1
|
-
import "antd/es/form/style";
|
2
|
-
import _Form from "antd/es/form";
|
3
|
-
import "antd/es/input/style";
|
4
|
-
import _Input from "antd/es/input";
|
5
|
-
|
6
|
-
/*
|
7
|
-
* @Author: wangxian
|
8
|
-
* @Date: 2022-03-04 14:53:50
|
9
|
-
* @LastEditTime: 2022-09-29 16:44:57
|
10
|
-
*/
|
11
|
-
import React from 'react';
|
12
|
-
import { EditableContext } from '../interface';
|
13
|
-
|
14
|
-
function Index(props) {
|
15
|
-
var dataIndex = props.dataIndex,
|
16
|
-
disabled = props.disabled;
|
17
|
-
|
18
|
-
var _ref = React.useContext(EditableContext) || undefined,
|
19
|
-
editConfig = _ref.editConfig;
|
20
|
-
|
21
|
-
return /*#__PURE__*/React.createElement(_Form.Item, {
|
22
|
-
name: dataIndex,
|
23
|
-
style: {
|
24
|
-
margin: 0
|
25
|
-
}
|
26
|
-
}, /*#__PURE__*/React.createElement(_Input, {
|
27
|
-
type: "color",
|
28
|
-
size: "small",
|
29
|
-
disabled: editConfig.type === 'edit' ? disabled : false
|
30
|
-
}));
|
31
|
-
}
|
32
|
-
|
33
|
-
export default /*#__PURE__*/React.memo(Index);
|
@@ -1,54 +0,0 @@
|
|
1
|
-
import "antd/es/form/style";
|
2
|
-
import _Form from "antd/es/form";
|
3
|
-
import "antd/es/input/style";
|
4
|
-
import _Input from "antd/es/input";
|
5
|
-
|
6
|
-
/*
|
7
|
-
* @Author: wangxian
|
8
|
-
* @Date: 2022-03-04 14:53:50
|
9
|
-
* @LastEditTime: 2022-09-29 16:44:52
|
10
|
-
*/
|
11
|
-
import React from 'react';
|
12
|
-
import { EditableContext } from '../interface';
|
13
|
-
|
14
|
-
function Index(props) {
|
15
|
-
var dataIndex = props.dataIndex,
|
16
|
-
rowIndex = props.rowIndex,
|
17
|
-
disabled = props.disabled;
|
18
|
-
|
19
|
-
var _ref = React.useContext(EditableContext) || undefined,
|
20
|
-
editConfig = _ref.editConfig;
|
21
|
-
|
22
|
-
var inputRef = React.useRef();
|
23
|
-
var firstLoadRef = React.useRef(true);
|
24
|
-
React.useEffect(function () {
|
25
|
-
var _editConfig$editCellK, _editConfig$editCellK2;
|
26
|
-
|
27
|
-
if (!inputRef.current) return;
|
28
|
-
|
29
|
-
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
|
-
if (firstLoadRef.current) {
|
31
|
-
var _inputRef$current$sta, _inputRef$current$sta2;
|
32
|
-
|
33
|
-
// 选中内容
|
34
|
-
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
|
-
firstLoadRef.current = false;
|
36
|
-
} // 设置焦点
|
37
|
-
|
38
|
-
|
39
|
-
inputRef.current.focus();
|
40
|
-
}
|
41
|
-
}, [editConfig]);
|
42
|
-
return /*#__PURE__*/React.createElement(_Form.Item, {
|
43
|
-
name: dataIndex,
|
44
|
-
style: {
|
45
|
-
margin: 0
|
46
|
-
}
|
47
|
-
}, /*#__PURE__*/React.createElement(_Input, {
|
48
|
-
ref: inputRef,
|
49
|
-
size: "small",
|
50
|
-
disabled: editConfig.type === 'edit' ? disabled : false
|
51
|
-
}));
|
52
|
-
}
|
53
|
-
|
54
|
-
export default /*#__PURE__*/React.memo(Index);
|
@@ -1,44 +0,0 @@
|
|
1
|
-
import "antd/es/form/style";
|
2
|
-
import _Form from "antd/es/form";
|
3
|
-
import "antd/es/input-number/style";
|
4
|
-
import _InputNumber from "antd/es/input-number";
|
5
|
-
|
6
|
-
/*
|
7
|
-
* @Author: wangxian
|
8
|
-
* @Date: 2022-03-04 14:53:50
|
9
|
-
* @LastEditTime: 2022-09-29 16:44:49
|
10
|
-
*/
|
11
|
-
import React from 'react';
|
12
|
-
import { EditableContext } from '../interface';
|
13
|
-
|
14
|
-
function Index(props) {
|
15
|
-
var dataIndex = props.dataIndex,
|
16
|
-
rowIndex = props.rowIndex,
|
17
|
-
disabled = props.disabled;
|
18
|
-
|
19
|
-
var _ref = React.useContext(EditableContext) || undefined,
|
20
|
-
editConfig = _ref.editConfig;
|
21
|
-
|
22
|
-
var inputRef = React.useRef();
|
23
|
-
React.useEffect(function () {
|
24
|
-
var _editConfig$editCellK, _editConfig$editCellK2;
|
25
|
-
|
26
|
-
if (!inputRef.current) return;
|
27
|
-
|
28
|
-
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
|
-
inputRef.current.focus(); // 设置焦点
|
30
|
-
}
|
31
|
-
}, [editConfig]);
|
32
|
-
return /*#__PURE__*/React.createElement(_Form.Item, {
|
33
|
-
name: dataIndex,
|
34
|
-
style: {
|
35
|
-
margin: 0
|
36
|
-
}
|
37
|
-
}, /*#__PURE__*/React.createElement(_InputNumber, {
|
38
|
-
size: "small",
|
39
|
-
ref: inputRef,
|
40
|
-
disabled: editConfig.type === 'edit' ? disabled : false
|
41
|
-
}));
|
42
|
-
}
|
43
|
-
|
44
|
-
export default /*#__PURE__*/React.memo(Index);
|
@@ -1,48 +0,0 @@
|
|
1
|
-
import "antd/es/form/style";
|
2
|
-
import _Form from "antd/es/form";
|
3
|
-
import "antd/es/select/style";
|
4
|
-
import _Select from "antd/es/select";
|
5
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
6
|
-
var _excluded = ["dataIndex", "mode", "disabled"];
|
7
|
-
|
8
|
-
/*
|
9
|
-
* @Author: wangxian
|
10
|
-
* @Date: 2022-03-04 14:53:50
|
11
|
-
* @LastEditTime: 2022-10-10 13:47:12
|
12
|
-
*/
|
13
|
-
import React from 'react';
|
14
|
-
import { EditableContext } from '../interface';
|
15
|
-
|
16
|
-
function Index(props) {
|
17
|
-
var dataIndex = props.dataIndex,
|
18
|
-
mode = props.mode,
|
19
|
-
disabled = props.disabled,
|
20
|
-
restProps = _objectWithoutProperties(props, _excluded);
|
21
|
-
|
22
|
-
var _ref = React.useContext(EditableContext) || undefined,
|
23
|
-
editConfig = _ref.editConfig;
|
24
|
-
|
25
|
-
return /*#__PURE__*/React.createElement(_Form.Item, {
|
26
|
-
name: dataIndex,
|
27
|
-
style: {
|
28
|
-
margin: 0
|
29
|
-
}
|
30
|
-
}, /*#__PURE__*/React.createElement(_Select, {
|
31
|
-
disabled: editConfig.type === 'edit' ? disabled : false,
|
32
|
-
mode: mode || undefined,
|
33
|
-
showSearch: true,
|
34
|
-
filterOption: function filterOption(input, option) {
|
35
|
-
var _option$label;
|
36
|
-
|
37
|
-
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;
|
38
|
-
},
|
39
|
-
allowClear: true,
|
40
|
-
style: {
|
41
|
-
width: '100%'
|
42
|
-
},
|
43
|
-
size: "small",
|
44
|
-
options: restProps.enum
|
45
|
-
}));
|
46
|
-
}
|
47
|
-
|
48
|
-
export default /*#__PURE__*/React.memo(Index);
|
@@ -1,33 +0,0 @@
|
|
1
|
-
import "antd/es/form/style";
|
2
|
-
import _Form from "antd/es/form";
|
3
|
-
import "antd/es/switch/style";
|
4
|
-
import _Switch from "antd/es/switch";
|
5
|
-
|
6
|
-
/*
|
7
|
-
* @Author: wangxian
|
8
|
-
* @Date: 2022-03-04 14:53:50
|
9
|
-
* @LastEditTime: 2022-09-29 16:44:43
|
10
|
-
*/
|
11
|
-
import React from 'react';
|
12
|
-
import { EditableContext } from '../interface';
|
13
|
-
|
14
|
-
function Index(props) {
|
15
|
-
var dataIndex = props.dataIndex,
|
16
|
-
disabled = props.disabled;
|
17
|
-
|
18
|
-
var _ref = React.useContext(EditableContext) || undefined,
|
19
|
-
editConfig = _ref.editConfig;
|
20
|
-
|
21
|
-
return /*#__PURE__*/React.createElement(_Form.Item, {
|
22
|
-
name: dataIndex,
|
23
|
-
valuePropName: "checked",
|
24
|
-
style: {
|
25
|
-
margin: 0
|
26
|
-
}
|
27
|
-
}, /*#__PURE__*/React.createElement(_Switch, {
|
28
|
-
size: "small",
|
29
|
-
disabled: editConfig.type === 'edit' ? disabled : false
|
30
|
-
}));
|
31
|
-
}
|
32
|
-
|
33
|
-
export default /*#__PURE__*/React.memo(Index);
|
@@ -1,110 +0,0 @@
|
|
1
|
-
import "antd/es/popconfirm/style";
|
2
|
-
import _Popconfirm from "antd/es/popconfirm";
|
3
|
-
import "antd/es/button/style";
|
4
|
-
import _Button from "antd/es/button";
|
5
|
-
import React from 'react';
|
6
|
-
import { EditableContext } from '../interface';
|
7
|
-
import { isFreeEditRow } from '../utils';
|
8
|
-
import { tr } from '../../../framework/locale';
|
9
|
-
|
10
|
-
var EditableAction = function EditableAction(props) {
|
11
|
-
var _editConfig$editCellK;
|
12
|
-
|
13
|
-
var type = props.type,
|
14
|
-
record = props.record;
|
15
|
-
|
16
|
-
var _ref = React.useContext(EditableContext) || undefined,
|
17
|
-
editableStream = _ref.editableStream,
|
18
|
-
editConfig = _ref.editConfig;
|
19
|
-
|
20
|
-
var onEdit = function onEdit(e) {
|
21
|
-
e.stopPropagation();
|
22
|
-
editableStream.next({
|
23
|
-
type: 'editRowKey',
|
24
|
-
payload: record
|
25
|
-
});
|
26
|
-
};
|
27
|
-
|
28
|
-
var onCancel = function onCancel(e) {
|
29
|
-
e.stopPropagation();
|
30
|
-
editableStream.next({
|
31
|
-
type: 'editRowKey',
|
32
|
-
payload: {
|
33
|
-
_rowkey_: undefined
|
34
|
-
}
|
35
|
-
});
|
36
|
-
};
|
37
|
-
|
38
|
-
var onSave = function onSave(e) {
|
39
|
-
e.stopPropagation();
|
40
|
-
editableStream.next({
|
41
|
-
type: 'onSingleSave',
|
42
|
-
payload: record
|
43
|
-
});
|
44
|
-
editableStream.next({
|
45
|
-
type: 'editCellKey',
|
46
|
-
payload: {
|
47
|
-
dataIndex: undefined,
|
48
|
-
rowIndex: undefined
|
49
|
-
}
|
50
|
-
});
|
51
|
-
};
|
52
|
-
|
53
|
-
var onDelete = function onDelete(e) {
|
54
|
-
e.stopPropagation();
|
55
|
-
editableStream.next({
|
56
|
-
type: 'onDelete',
|
57
|
-
payload: record
|
58
|
-
});
|
59
|
-
};
|
60
|
-
|
61
|
-
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
|
-
type: "link",
|
63
|
-
style: {
|
64
|
-
padding: 0,
|
65
|
-
marginRight: '10px'
|
66
|
-
},
|
67
|
-
disabled: (editConfig.curRow || editConfig.curRow === 0) && editConfig.curRow !== record._rowKey_,
|
68
|
-
size: "small",
|
69
|
-
onClick: onEdit,
|
70
|
-
title: tr('编辑')
|
71
|
-
}, tr('编辑'))), editConfig.curRow === record._rowKey_ && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Button, {
|
72
|
-
type: "link",
|
73
|
-
onClick: onSave,
|
74
|
-
style: {
|
75
|
-
padding: 0,
|
76
|
-
marginRight: '10px'
|
77
|
-
}
|
78
|
-
}, tr('确定')), editConfig.type === 'edit' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Button, {
|
79
|
-
type: "link",
|
80
|
-
onClick: onCancel,
|
81
|
-
style: {
|
82
|
-
padding: 0,
|
83
|
-
marginRight: '10px'
|
84
|
-
}
|
85
|
-
}, tr('取消'))))), 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, {
|
86
|
-
type: "link",
|
87
|
-
onClick: onSave,
|
88
|
-
style: {
|
89
|
-
padding: 0,
|
90
|
-
marginRight: '10px'
|
91
|
-
}
|
92
|
-
}, tr('确定')))), /*#__PURE__*/React.createElement(_Popconfirm, {
|
93
|
-
placement: 'left',
|
94
|
-
title: tr('确认删除该条数据'),
|
95
|
-
onConfirm: onDelete,
|
96
|
-
onCancel: function onCancel(e) {
|
97
|
-
e.stopPropagation();
|
98
|
-
},
|
99
|
-
okText: tr('确定'),
|
100
|
-
cancelText: tr('取消')
|
101
|
-
}, /*#__PURE__*/React.createElement(_Button, {
|
102
|
-
type: "link",
|
103
|
-
style: {
|
104
|
-
padding: 0,
|
105
|
-
marginRight: '10px'
|
106
|
-
}
|
107
|
-
}, tr('删除'))));
|
108
|
-
};
|
109
|
-
|
110
|
-
export default EditableAction;
|