ronds-metadata 1.2.78 → 1.2.80

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.
@@ -5,7 +5,7 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  /*
6
6
  * @Author: wangxian
7
7
  * @Date: 2022-05-24 09:18:34
8
- * @LastEditTime: 2022-05-24 10:43:18
8
+ * @LastEditTime: 2023-07-03 16:20:13
9
9
  */
10
10
  import { Shape, Edge } from '@antv/x6';
11
11
  import './edge.less';
@@ -13,7 +13,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
13
13
  /*
14
14
  * @Author: wangxian
15
15
  * @Date: 2022-05-24 14:31:01
16
- * @LastEditTime: 2023-03-24 11:12:35
16
+ * @LastEditTime: 2023-07-03 16:49:09
17
17
  */
18
18
  import _regeneratorRuntime from "@babel/runtime/regenerator";
19
19
  import produce from 'immer';
@@ -156,7 +156,10 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
156
156
  title: port.name,
157
157
  placement: placement
158
158
  }, /*#__PURE__*/React.createElement("span", {
159
- className: "dp-port ".concat(port.connected ? 'connected' : '')
159
+ className: "dp-port ".concat(port.connected ? 'connected' : ''),
160
+ style: port.color && {
161
+ borderColor: "".concat(port.connected ? "".concat(port.color, " transparent transparent") : port.color)
162
+ }
160
163
  })), container);
161
164
  }
162
165
  }
@@ -436,7 +439,7 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
436
439
  value: // 处理连线事件
437
440
  function () {
438
441
  var _onConnectNode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(args) {
439
- var _args$edge, edge, isNew, source, target, node, portId, data;
442
+ var _args$edge, edge, isNew, source, target, _edge$getTargetCell, _edge$getTargetCell$p, _ports$find, node, portId, ports, color, data;
440
443
  return _regeneratorRuntime.wrap(function _callee6$(_context6) {
441
444
  while (1) switch (_context6.prev = _context6.next) {
442
445
  case 0:
@@ -446,6 +449,10 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
446
449
  // 处理边虚线样式更新的问题。
447
450
  node = args.currentCell;
448
451
  portId = edge.getTargetPortId();
452
+ ports = ((_edge$getTargetCell = edge.getTargetCell()) === null || _edge$getTargetCell === void 0 ? void 0 : (_edge$getTargetCell$p = _edge$getTargetCell.port) === null || _edge$getTargetCell$p === void 0 ? void 0 : _edge$getTargetCell$p.ports) || [];
453
+ color = (_ports$find = ports.find(function (v) {
454
+ return v.id === portId;
455
+ })) === null || _ports$find === void 0 ? void 0 : _ports$find.color;
449
456
  if (node && portId) {
450
457
  // 触发 port 重新渲染
451
458
  node.setPortProp(portId, 'connected', true);
@@ -454,7 +461,7 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
454
461
  line: {
455
462
  strokeDasharray: '',
456
463
  targetMarker: '',
457
- stroke: '#808080'
464
+ stroke: color || '#808080'
458
465
  }
459
466
  });
460
467
  data = {
@@ -463,6 +470,9 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
463
470
  outPortId: source.port,
464
471
  inPortId: target.port
465
472
  };
473
+ if (color) {
474
+ data.color = color;
475
+ }
466
476
  edge.setData(data);
467
477
  this.updateDPGraph([], [data]);
468
478
  }
@@ -195,4 +195,22 @@
195
195
  z-index: 10;
196
196
  box-sizing: border-box;
197
197
  }
198
+
199
+ .error {
200
+ stroke-width: 2px;
201
+ path:nth-child(2) {
202
+ stroke: rgba(245, 34, 45, 0.45) !important;
203
+ stroke-width: 2px;
204
+ }
205
+ }
206
+ .edgeProcessing {
207
+ path:nth-child(2) {
208
+ stroke: rgba(57, 202, 116, 0.8);
209
+ stroke-width: 2px;
210
+ stroke-dasharray: 8px, 2px;
211
+ &:local {
212
+ animation: processing-line 30s infinite linear;
213
+ }
214
+ }
215
+ }
198
216
  }
@@ -46,6 +46,7 @@ export declare namespace NDPGraph {
46
46
  target: string;
47
47
  outPortId: string;
48
48
  inPortId: string;
49
+ color?: string;
49
50
  }
50
51
  interface OutPort extends Port {
51
52
  }
@@ -54,6 +55,7 @@ export declare namespace NDPGraph {
54
55
  interface Port {
55
56
  id: string;
56
57
  name: string;
58
+ color?: string;
57
59
  seq: number;
58
60
  type: number | string;
59
61
  }
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * @Author: wangxian
3
3
  * @Date: 2022-05-24 16:10:46
4
- * @LastEditTime: 2023-03-20 14:04:22
4
+ * @LastEditTime: 2023-07-03 16:30:28
5
5
  */
6
6
  export {};
@@ -80,6 +80,7 @@ export declare function formatGraphData(graphData: NDPGraph.GraphData): {
80
80
  target: string;
81
81
  outPortId: string;
82
82
  inPortId: string;
83
+ color?: string;
83
84
  };
84
85
  sourceAnchor: string;
85
86
  source: {
@@ -98,7 +99,15 @@ export declare function formatGraphData(graphData: NDPGraph.GraphData): {
98
99
  };
99
100
  label: string;
100
101
  zIndex: number;
102
+ attrs: {
103
+ line: {
104
+ strokeDasharray: string;
105
+ targetMarker: string;
106
+ stroke: string;
107
+ };
108
+ };
101
109
  outPortId: string;
102
110
  inPortId: string;
111
+ color?: string;
103
112
  }[];
104
113
  };
@@ -3,7 +3,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  /*
4
4
  * @Author: wangxian
5
5
  * @Date: 2022-05-24 16:40:49
6
- * @LastEditTime: 2022-05-27 16:02:48
6
+ * @LastEditTime: 2023-07-03 16:31:06
7
7
  */
8
8
  import { sortBy } from 'lodash-es';
9
9
  import { NODE_HEIGHT, NODE_WIDTH } from './constant';
@@ -40,16 +40,18 @@ export function formatNodeInfoToNodeMeta(nodeData) {
40
40
  outPorts = nodeData.outPorts;
41
41
  sortBy(inPorts, 'seq').forEach(function (inPort) {
42
42
  portItems.push(_objectSpread(_objectSpread({}, inPort), {}, {
43
+ color: inPort === null || inPort === void 0 ? void 0 : inPort.color,
43
44
  group: 'in',
44
45
  id: inPort.id.toString(),
45
- connected: !!inputPortConnectedMap[inPort.id.toString()]
46
+ connected: !!inputPortConnectedMap["".concat(id.toString()).concat(inPort.id.toString())]
46
47
  }));
47
48
  });
48
49
  sortBy(outPorts, 'seq').forEach(function (outPort) {
49
50
  portItems.push(_objectSpread(_objectSpread({}, outPort), {}, {
51
+ color: outPort === null || outPort === void 0 ? void 0 : outPort.color,
50
52
  group: 'out',
51
53
  id: outPort.id.toString(),
52
- connected: !!inputPortConnectedMap[outPort.id.toString()]
54
+ connected: !!inputPortConnectedMap["".concat(id.toString()).concat(outPort.id.toString())]
53
55
  }));
54
56
  });
55
57
  return _objectSpread(_objectSpread({}, nodeData), {}, {
@@ -81,13 +83,14 @@ export function formatGraphData(graphData) {
81
83
  _graphData$edges = graphData.edges,
82
84
  edges = _graphData$edges === void 0 ? [] : _graphData$edges;
83
85
  // 格式化边
84
- var formattedEdges = edges.map(function (edges) {
85
- var source = edges.source,
86
- outPortId = edges.outPortId,
87
- target = edges.target,
88
- inPortId = edges.inPortId;
89
- return _objectSpread(_objectSpread({}, edges), {}, {
90
- data: _objectSpread({}, edges),
86
+ var formattedEdges = edges.map(function (edge) {
87
+ var source = edge.source,
88
+ outPortId = edge.outPortId,
89
+ target = edge.target,
90
+ inPortId = edge.inPortId,
91
+ color = edge.color;
92
+ return _objectSpread(_objectSpread({}, edge), {}, {
93
+ data: _objectSpread({}, edge),
91
94
  sourceAnchor: 'bottom',
92
95
  source: {
93
96
  cell: source.toString(),
@@ -104,12 +107,20 @@ export function formatGraphData(graphData) {
104
107
  }
105
108
  },
106
109
  label: '',
107
- zIndex: 1
110
+ zIndex: 1,
111
+ attrs: {
112
+ line: {
113
+ strokeDasharray: '',
114
+ targetMarker: '',
115
+ stroke: color || '#808080'
116
+ }
117
+ }
108
118
  });
109
119
  });
110
120
  // 记录所有已连线的输入桩
111
121
  var inputPortConnectedMap = formattedEdges.reduce(function (acc, edge) {
112
- acc[edge.inPortId] = true;
122
+ var _edge$target;
123
+ acc["".concat((_edge$target = edge.target) === null || _edge$target === void 0 ? void 0 : _edge$target.cell).concat(edge.inPortId)] = true;
113
124
  return acc;
114
125
  }, {});
115
126
  // 格式化算法组件节点
@@ -0,0 +1,5 @@
1
+ interface IJsonSchemaProps {
2
+ json: string;
3
+ }
4
+ declare const JsonSchema: (props: IJsonSchemaProps) => JSX.Element;
5
+ export default JsonSchema;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import JsonView from '../../../../comps/JsonView';
3
+ var JsonSchema = function JsonSchema(props) {
4
+ var json = props.json;
5
+ var onChange = function onChange(txt) {};
6
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(JsonView, {
7
+ json: json
8
+ }));
9
+ };
10
+ export default JsonSchema;
@@ -1,2 +1,3 @@
1
+ import './index.less';
1
2
  declare const Sidebar: () => JSX.Element;
2
3
  export default Sidebar;
@@ -1,21 +1,33 @@
1
+ import "antd/es/radio/style";
2
+ import _Radio from "antd/es/radio";
1
3
  import "antd/es/row/style";
2
4
  import _Row from "antd/es/row";
5
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
6
  /*
4
7
  * @Author: uloveits 719310130@qq.com
5
8
  * @Date: 2023-02-04 16:35:16
6
9
  * @LastEditors: Please set LastEditors
7
- * @LastEditTime: 2023-06-26 08:46:07
10
+ * @LastEditTime: 2023-06-30 10:15:25
8
11
  */
9
12
  import React from 'react';
10
13
  import { sidebarCtx } from '../../settings';
11
14
  import Elements from './Elements';
15
+ import './index.less';
16
+ import JsonSchema from './JsonSchema';
12
17
  var Sidebar = function Sidebar() {
18
+ var _React$useState = React.useState('comps'),
19
+ _React$useState2 = _slicedToArray(_React$useState, 2),
20
+ active = _React$useState2[0],
21
+ setActive = _React$useState2[1];
13
22
  return /*#__PURE__*/React.createElement("div", {
23
+ className: "fg-sidebar"
24
+ }, /*#__PURE__*/React.createElement("div", {
14
25
  style: {
15
- height: '100%',
16
- width: '100%',
26
+ height: 'calc(100% - 40px)',
17
27
  padding: '4px',
18
- overflowY: 'auto'
28
+ width: '100%',
29
+ overflowY: 'auto',
30
+ display: "".concat(active === 'comps' ? '' : 'none')
19
31
  }
20
32
  }, sidebarCtx.map(function (it) {
21
33
  return /*#__PURE__*/React.createElement("div", {
@@ -36,6 +48,33 @@ var Sidebar = function Sidebar() {
36
48
  data: v
37
49
  });
38
50
  })));
39
- }));
51
+ })), /*#__PURE__*/React.createElement("div", {
52
+ style: {
53
+ height: 'calc(100% - 40px)',
54
+ padding: '4px',
55
+ width: '100%',
56
+ overflowY: 'auto',
57
+ display: "".concat(active === 'json' ? '' : 'none')
58
+ }
59
+ }, /*#__PURE__*/React.createElement(JsonSchema, {
60
+ json: ""
61
+ })), /*#__PURE__*/React.createElement("div", {
62
+ className: "fg-sidebar-bottom-tool"
63
+ }, /*#__PURE__*/React.createElement(_Radio.Group, {
64
+ options: [{
65
+ label: '组件',
66
+ value: 'comps'
67
+ }, {
68
+ label: 'JSON',
69
+ value: 'json'
70
+ }],
71
+ onChange: function onChange(_ref) {
72
+ var value = _ref.target.value;
73
+ setActive(value);
74
+ },
75
+ value: active,
76
+ optionType: "button",
77
+ buttonStyle: "solid"
78
+ })));
40
79
  };
41
80
  export default Sidebar;
@@ -0,0 +1,21 @@
1
+ .fg-sidebar {
2
+ height: 100%;
3
+ position: relative;
4
+
5
+ &-bottom-tool {
6
+ position: absolute;
7
+ display: flex;
8
+ left: 0;
9
+ right: 0;
10
+ align-items: center;
11
+ bottom: 0;
12
+ cursor: pointer;
13
+ .ant-radio-group {
14
+ width: 100%;
15
+ .ant-radio-button-wrapper {
16
+ width: 50%;
17
+ text-align: center;
18
+ }
19
+ }
20
+ }
21
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.2.78",
4
+ "version": "1.2.80",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",