ronds-metadata 1.3.7 → 1.3.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,16 @@
1
+ import "antd/es/input/style";
2
+ import _Input from "antd/es/input";
3
+ import "antd/es/tooltip/style";
4
+ import _Tooltip from "antd/es/tooltip";
1
5
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
6
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
7
  /*
4
8
  * @Author: wangxian
5
9
  * @Date: 2022-05-24 08:50:16
6
- * @LastEditTime: 2023-09-12 18:29:22
10
+ * @LastEditTime: 2023-09-15 11:09:38
7
11
  */
8
12
  import { GlobalOutlined } from '@ant-design/icons';
9
- import { filter, map } from 'rxjs/operators';
13
+ import { filter } from 'rxjs/operators';
10
14
  import '../index.less';
11
15
  import Icon from '../../../comps/Icons';
12
16
  import { NodeStatus } from './NodeStatus';
@@ -17,23 +21,26 @@ var NodeElement = function NodeElement(props) {
17
21
  var data = (node === null || node === void 0 ? void 0 : node.getData()) || {};
18
22
  var id = data.id,
19
23
  name = data.name,
20
- icon = data.icon;
24
+ icon = data.icon,
25
+ param = data.param;
21
26
  var _React$useState = React.useState({}),
22
27
  _React$useState2 = _slicedToArray(_React$useState, 2),
23
28
  nodeStatus = _React$useState2[0],
24
29
  setNodeStatus = _React$useState2[1];
30
+ var _React$useState3 = React.useState(false),
31
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
32
+ isNameEidt = _React$useState4[0],
33
+ setIsNameEdit = _React$useState4[1];
25
34
  React.useEffect(function () {
26
35
  var sub = gDPGraph && gDPGraph.factory$.executionStatus.pipe(filter(function (x) {
27
36
  return !!x;
28
- }), map(function (x) {
29
- return _objectSpread(_objectSpread({}, x.statusList), {}, {
30
- debugId: x === null || x === void 0 ? void 0 : x.debugId
31
- });
32
37
  })).subscribe(function (v) {
33
- var _status = v.find(function (it) {
38
+ var _status = v.statusList.find(function (it) {
34
39
  return (it === null || it === void 0 ? void 0 : it.nodeId) === id;
35
40
  });
36
- setNodeStatus(_status);
41
+ setNodeStatus(_objectSpread(_objectSpread({}, _status), {}, {
42
+ debugId: v.debugId
43
+ }));
37
44
  });
38
45
  return function () {
39
46
  sub.unsubscribe();
@@ -49,13 +56,24 @@ var NodeElement = function NodeElement(props) {
49
56
  };
50
57
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
51
58
  className: "node-element"
59
+ }, /*#__PURE__*/React.createElement(_Tooltip, {
60
+ title: param.remark
52
61
  }, /*#__PURE__*/React.createElement("div", {
53
- className: "icon"
62
+ className: "icon",
63
+ style: {
64
+ cursor: 'pointer'
65
+ }
54
66
  }, icon ? /*#__PURE__*/React.createElement(Icon, {
55
67
  type: icon
56
- }) : /*#__PURE__*/React.createElement(GlobalOutlined, null)), /*#__PURE__*/React.createElement("div", {
68
+ }) : /*#__PURE__*/React.createElement(GlobalOutlined, null))), /*#__PURE__*/React.createElement("div", {
57
69
  className: "notation"
58
- }, /*#__PURE__*/React.createElement("div", {
70
+ }, isNameEidt ? /*#__PURE__*/React.createElement(_Input, {
71
+ size: "small",
72
+ defaultValue: name,
73
+ onPressEnter: function onPressEnter() {
74
+ setIsNameEdit(false);
75
+ }
76
+ }) : /*#__PURE__*/React.createElement("div", {
59
77
  className: "name",
60
78
  title: name
61
79
  }, name), nodeStatus && (nodeStatus === null || nodeStatus === void 0 ? void 0 : nodeStatus.nodeStatus) && /*#__PURE__*/React.createElement(NodeStatus, {
@@ -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-12 15:56:37
16
+ * @LastEditTime: 2023-09-13 16:28:08
17
17
  */
18
18
  import _regeneratorRuntime from "@babel/runtime/regenerator";
19
19
  import produce from 'immer';
@@ -160,8 +160,13 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
160
160
  placement: placement
161
161
  }, /*#__PURE__*/React.createElement("span", {
162
162
  className: "dp-port ".concat(port.connected ? 'connected' : ''),
163
- style: port.color && {
164
- borderColor: "".concat(port.connected ? "".concat(port.color, " transparent transparent") : port.color)
163
+ style: port.color ? {
164
+ borderColor: "".concat(port.connected ? "".concat(port.color, " transparent transparent") : port.color),
165
+ width: '8px',
166
+ height: '8px'
167
+ } : {
168
+ width: '8px',
169
+ height: '8px'
165
170
  }
166
171
  })), container);
167
172
  }
@@ -337,7 +342,7 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
337
342
  (_this$queryStatusSub = _this.queryStatusSub) === null || _this$queryStatusSub === void 0 ? void 0 : _this$queryStatusSub.unsubscribe();
338
343
  // 每三秒查询一次执行状态
339
344
  server = new MetadataService();
340
- _this.queryStatusSub = timer(0, 5000).subscribe( /*#__PURE__*/function () {
345
+ _this.queryStatusSub = timer(0, 2000).subscribe( /*#__PURE__*/function () {
341
346
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(resPromise) {
342
347
  var execStatusRes, status, _this$queryStatusSub2;
343
348
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
@@ -11,6 +11,10 @@ interface IDynamicPortsProps {
11
11
  * 离开销毁
12
12
  */
13
13
  dispose?: boolean;
14
+ /**
15
+ * 更新节点名称
16
+ */
17
+ isUpdateNodeName?: boolean;
14
18
  /**
15
19
  * 图更新事件
16
20
  */
@@ -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-08-30 08:50:08
6
+ * @LastEditTime: 2023-09-15 11:05:34
7
7
  */
8
8
  import React from 'react';
9
9
  import { filter } from 'rxjs';
package/es/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { default as MetaPropsEdit } from './comps/MetadataEdit/components/MetaPr
4
4
  export { default as MetadataForm } from './comps/MetadataForm';
5
5
  export { default as JsonView } from './comps/JsonView';
6
6
  export { default as JsonEdit } from './comps/JsonEdit';
7
+ export { default as CodeEdit } from './comps/CodeEdit';
7
8
  export { default as MdEditor } from './comps/MdEdit';
8
9
  export { default as MdView } from './comps/MdView';
9
10
  export { default as FileView } from './comps/FileView';
package/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author:wangxian
3
3
  * @Date: 2021-09-18 14:15:04
4
- * @LastEditTime: 2023-09-12 17:44:57
4
+ * @LastEditTime: 2023-09-13 08:44:19
5
5
  */
6
6
  import './theme.less';
7
7
  export { default as MetadataEdit } from './comps/MetadataEdit';
@@ -9,7 +9,7 @@ export { default as MetaPropsEdit } from './comps/MetadataEdit/components/MetaPr
9
9
  export { default as MetadataForm } from './comps/MetadataForm';
10
10
  export { default as JsonView } from './comps/JsonView';
11
11
  export { default as JsonEdit } from './comps/JsonEdit';
12
- // export { default as CodeEdit } from './comps/CodeEdit';
12
+ export { default as CodeEdit } from './comps/CodeEdit';
13
13
  export { default as MdEditor } from './comps/MdEdit';
14
14
  export { default as MdView } from './comps/MdView';
15
15
  export { default as FileView } from './comps/FileView';
package/es/utils.js CHANGED
@@ -6,7 +6,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  /*
7
7
  * @Author: wangxian
8
8
  * @Date: 2021-09-18 14:15:04
9
- * @LastEditTime: 2023-07-19 10:10:33
9
+ * @LastEditTime: 2023-09-14 16:28:26
10
10
  */
11
11
  import saveAs from 'file-saver';
12
12
  import { asBlob } from 'html-docx-js-typescript';
@@ -192,6 +192,7 @@ function _handleMd2Doc() {
192
192
  // 修改图片路径;
193
193
  token.attrs[token.attrIndex('src')][1] = "".concat(window.location.origin, "/").concat(src);
194
194
  }
195
+ token.attrs[token.attrIndex('src')][1] = 'https://images.app.goo.gl/fxbwKFuGSmgXPZ6a8';
195
196
  var width = '620'; // 自定义宽度
196
197
  var height = 'auto'; // 自适应高度
197
198
  // 添加自定义宽高属性
@@ -240,7 +241,7 @@ function _handleMd2Doc() {
240
241
  return asBlob(commonHtml, opt);
241
242
  case 13:
242
243
  blob = _context.sent;
243
- saveAs(blob, "".concat(fileName, ".doc"));
244
+ saveAs(blob, "".concat(fileName, ".docx"));
244
245
  case 15:
245
246
  case "end":
246
247
  return _context.stop();
@@ -248,4 +249,27 @@ function _handleMd2Doc() {
248
249
  }, _callee);
249
250
  }));
250
251
  return _handleMd2Doc.apply(this, arguments);
252
+ }
253
+ function convertImagePathToBase64(imagePath) {
254
+ return new Promise(function (resolve, reject) {
255
+ var img = new Image();
256
+ img.crossOrigin = "anonymous";
257
+ img.onload = function () {
258
+ var canvas = document.createElement("canvas");
259
+ canvas.width = img.width;
260
+ canvas.height = img.height;
261
+ var context = canvas.getContext("2d");
262
+ if (context) {
263
+ context.drawImage(img, 0, 0);
264
+ var base64 = canvas.toDataURL("image/png");
265
+ resolve(base64);
266
+ } else {
267
+ reject(new Error("Unable to convert image to base64."));
268
+ }
269
+ };
270
+ img.onerror = function () {
271
+ reject(new Error("Failed to load the image."));
272
+ };
273
+ img.src = imagePath;
274
+ });
251
275
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.3.7",
4
+ "version": "1.3.9",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",