ronds-metadata 1.3.13 → 1.3.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ import React from "react";
4
4
  /*
5
5
  * @Author: wangxian
6
6
  * @Date: 2022-05-26 08:50:06
7
- * @LastEditTime: 2023-09-15 14:55:47
7
+ * @LastEditTime: 2023-09-15 15:23:06
8
8
  */
9
9
  import { DragSource } from 'react-dnd';
10
10
  import { GlobalOutlined } from '@ant-design/icons';
@@ -12,7 +12,7 @@ import Icon from '../../../comps/Icons';
12
12
  import { DRAGGABLE_COMPONENT } from '../constant';
13
13
  import '../index.less';
14
14
  var InnerNodeTitle = function InnerNodeTitle(props) {
15
- var _data$param;
15
+ var _data$param, _data$param2;
16
16
  var data = props.data,
17
17
  connectDragPreview = props.connectDragPreview,
18
18
  connectDragSource = props.connectDragSource;
@@ -22,7 +22,7 @@ var InnerNodeTitle = function InnerNodeTitle(props) {
22
22
  width: '100%'
23
23
  }
24
24
  }, /*#__PURE__*/React.createElement(_Tooltip, {
25
- title: /*#__PURE__*/React.createElement("div", {
25
+ title: (data === null || data === void 0 ? void 0 : (_data$param = data.param) === null || _data$param === void 0 ? void 0 : _data$param.remark) ? /*#__PURE__*/React.createElement("div", {
26
26
  style: {
27
27
  maxHeight: '200px',
28
28
  whiteSpace: 'pre-line',
@@ -30,7 +30,7 @@ var InnerNodeTitle = function InnerNodeTitle(props) {
30
30
  overflowX: 'hidden',
31
31
  wordBreak: 'break-all'
32
32
  }
33
- }, /*#__PURE__*/React.createElement("span", null, data === null || data === void 0 ? void 0 : (_data$param = data.param) === null || _data$param === void 0 ? void 0 : _data$param.remark))
33
+ }, /*#__PURE__*/React.createElement("span", null, data === null || data === void 0 ? void 0 : (_data$param2 = data.param) === null || _data$param2 === void 0 ? void 0 : _data$param2.remark)) : undefined
34
34
  }, /*#__PURE__*/React.createElement("div", {
35
35
  className: "icon",
36
36
  style: {
@@ -7,7 +7,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
7
7
  /*
8
8
  * @Author: wangxian
9
9
  * @Date: 2022-05-24 08:50:16
10
- * @LastEditTime: 2023-09-15 14:56:57
10
+ * @LastEditTime: 2023-09-15 16:07:13
11
11
  */
12
12
  import { GlobalOutlined } from '@ant-design/icons';
13
13
  import { filter } from 'rxjs/operators';
@@ -31,6 +31,10 @@ var NodeElement = function NodeElement(props) {
31
31
  _React$useState4 = _slicedToArray(_React$useState3, 2),
32
32
  isNameEidt = _React$useState4[0],
33
33
  setIsNameEdit = _React$useState4[1];
34
+ var _React$useState5 = React.useState(false),
35
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
36
+ isCanEidt = _React$useState6[0],
37
+ setIsCanEdit = _React$useState6[1];
34
38
  React.useEffect(function () {
35
39
  var sub = gDPGraph && gDPGraph.factory$.executionStatus.pipe(filter(function (x) {
36
40
  return !!x;
@@ -46,6 +50,14 @@ var NodeElement = function NodeElement(props) {
46
50
  sub.unsubscribe();
47
51
  };
48
52
  }, [gDPGraph]);
53
+ React.useEffect(function () {
54
+ var sub = gDPGraph && gDPGraph.factory$.isUpdateNodeName.subscribe(function (v) {
55
+ setIsCanEdit(v);
56
+ });
57
+ return function () {
58
+ sub.unsubscribe();
59
+ };
60
+ }, [gDPGraph]);
49
61
  var onStatusClick = function onStatusClick(e) {
50
62
  e.stopPropagation();
51
63
  gDPGraph.factory$.statusClick.next(_objectSpread(_objectSpread({}, data), {}, {
@@ -54,10 +66,14 @@ var NodeElement = function NodeElement(props) {
54
66
  }, nodeStatus)
55
67
  }));
56
68
  };
69
+ var onPressEnter = function onPressEnter(e) {
70
+ setIsNameEdit(false);
71
+ gDPGraph.updateNodeNameById(id, e.target.value);
72
+ };
57
73
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
58
74
  className: "node-element"
59
75
  }, /*#__PURE__*/React.createElement(_Tooltip, {
60
- title: /*#__PURE__*/React.createElement("div", {
76
+ title: (param === null || param === void 0 ? void 0 : param.remark) ? /*#__PURE__*/React.createElement("div", {
61
77
  style: {
62
78
  maxHeight: '200px',
63
79
  whiteSpace: 'pre-line',
@@ -65,7 +81,7 @@ var NodeElement = function NodeElement(props) {
65
81
  overflowX: 'hidden',
66
82
  wordBreak: 'break-all'
67
83
  }
68
- }, /*#__PURE__*/React.createElement("span", null, param === null || param === void 0 ? void 0 : param.remark))
84
+ }, /*#__PURE__*/React.createElement("span", null, param === null || param === void 0 ? void 0 : param.remark)) : undefined
69
85
  }, /*#__PURE__*/React.createElement("div", {
70
86
  className: "icon",
71
87
  style: {
@@ -78,12 +94,15 @@ var NodeElement = function NodeElement(props) {
78
94
  }, isNameEidt ? /*#__PURE__*/React.createElement(_Input, {
79
95
  size: "small",
80
96
  defaultValue: name,
81
- onPressEnter: function onPressEnter() {
82
- setIsNameEdit(false);
83
- }
97
+ onPressEnter: onPressEnter
84
98
  }) : /*#__PURE__*/React.createElement("div", {
85
99
  className: "name",
86
- title: name
100
+ title: name,
101
+ onDoubleClick: function onDoubleClick() {
102
+ if (isCanEidt) {
103
+ setIsNameEdit(true);
104
+ }
105
+ }
87
106
  }, name), nodeStatus && (nodeStatus === null || nodeStatus === void 0 ? void 0 : nodeStatus.nodeStatus) && /*#__PURE__*/React.createElement(NodeStatus, {
88
107
  onClick: onStatusClick,
89
108
  className: "statusIcon",
@@ -16,6 +16,10 @@ interface IFactory$ {
16
16
  * 实验图加载状态
17
17
  */
18
18
  running: BehaviorSubject<boolean>;
19
+ /**
20
+ * 是否可以双击重命名节点名称
21
+ */
22
+ isUpdateNodeName: BehaviorSubject<boolean>;
19
23
  executionStatus: BehaviorSubject<NDPGraph.ExecutionStatus>;
20
24
  /**
21
25
  * 图数据流
@@ -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-09-13 16:28:08
16
+ * @LastEditTime: 2023-09-15 15:58:12
17
17
  */
18
18
  import _regeneratorRuntime from "@babel/runtime/regenerator";
19
19
  import produce from 'immer';
@@ -175,6 +175,7 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
175
175
  _this.factory$ = {
176
176
  loading: new BehaviorSubject(false),
177
177
  running: new BehaviorSubject(false),
178
+ isUpdateNodeName: new BehaviorSubject(false),
178
179
  executionStatus: new BehaviorSubject(null),
179
180
  dpGraph: new BehaviorSubject(null),
180
181
  statusClick: new BehaviorSubject(null),
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
3
  /*
4
4
  * @Author: wangxian
5
5
  * @Date: 2022-05-16 18:53:31
6
- * @LastEditTime: 2023-09-15 11:05:34
6
+ * @LastEditTime: 2023-09-15 16:07:36
7
7
  */
8
8
  import React from 'react';
9
9
  import { filter } from 'rxjs';
@@ -20,6 +20,7 @@ var DynamicPorts = function DynamicPorts(props) {
20
20
  var defaultValue = props.defaultValue,
21
21
  _props$dispose = props.dispose,
22
22
  dispose = _props$dispose === void 0 ? true : _props$dispose,
23
+ isUpdateNodeName = props.isUpdateNodeName,
23
24
  onChange = props.onChange,
24
25
  onNodeSelect = props.onNodeSelect,
25
26
  onStopGraph = props.onStopGraph,
@@ -81,6 +82,11 @@ var DynamicPorts = function DynamicPorts(props) {
81
82
  firstLoadRef.current = false;
82
83
  }
83
84
  }, [defaultValue]);
85
+ React.useEffect(function () {
86
+ if (dpGraph) {
87
+ dpGraphRef.current.factory$.isUpdateNodeName.next(isUpdateNodeName);
88
+ }
89
+ }, [dpGraph, isUpdateNodeName]);
84
90
  // 处理组件拖拽落下事件
85
91
  var _useDrop = useDrop({
86
92
  accept: [DRAGGABLE_COMPONENT, DRAGGABLE_MODEL],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.3.13",
4
+ "version": "1.3.14",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",