ronds-metadata 1.1.7 → 1.1.10

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.
Files changed (53) hide show
  1. package/es/comps/DynamicPorts/comps/ContextMenu.css +8 -0
  2. package/es/comps/DynamicPorts/comps/ContextMenu.d.ts +7 -0
  3. package/es/comps/DynamicPorts/comps/ContextMenu.js +44 -0
  4. package/es/comps/DynamicPorts/comps/DragNode.d.ts +7 -0
  5. package/es/comps/DynamicPorts/comps/DragNode.js +52 -0
  6. package/es/comps/DynamicPorts/comps/GraphHandler/index.css +27 -0
  7. package/es/comps/DynamicPorts/comps/GraphHandler/index.d.ts +11 -0
  8. package/es/comps/DynamicPorts/comps/GraphHandler/index.js +51 -0
  9. package/es/comps/DynamicPorts/comps/NodeElement.js +8 -4
  10. package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.css +5 -0
  11. package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.d.ts +8 -0
  12. package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +42 -0
  13. package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.css +21 -0
  14. package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.d.ts +8 -0
  15. package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +40 -0
  16. package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.css +23 -0
  17. package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.d.ts +7 -0
  18. package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +55 -0
  19. package/es/comps/DynamicPorts/comps/shape/node.js +1 -1
  20. package/es/comps/DynamicPorts/constant/index.d.ts +2 -2
  21. package/es/comps/DynamicPorts/constant/index.js +3 -3
  22. package/es/comps/DynamicPorts/graph.d.ts +62 -0
  23. package/es/comps/DynamicPorts/graph.js +584 -0
  24. package/es/comps/DynamicPorts/index.css +29 -19
  25. package/es/comps/DynamicPorts/index.d.ts +16 -1
  26. package/es/comps/DynamicPorts/index.js +122 -168
  27. package/es/comps/DynamicPorts/interface.d.ts +44 -0
  28. package/es/comps/DynamicPorts/interface.js +6 -0
  29. package/es/comps/DynamicPorts/utils.d.ts +104 -0
  30. package/es/comps/DynamicPorts/utils.js +127 -0
  31. package/es/comps/Icons/index.d.ts +18 -0
  32. package/es/comps/Icons/index.js +23 -0
  33. package/es/comps/MetadataForm/DataCell/layout/TableArray.js +63 -25
  34. package/es/comps/MetadataForm/utils.d.ts +1 -0
  35. package/es/comps/MetadataForm/utils.js +10 -1
  36. package/es/comps/locales/en-US.d.ts +4 -0
  37. package/es/comps/locales/en-US.js +10 -1
  38. package/es/comps/locales/zh-CN.d.ts +4 -0
  39. package/es/comps/locales/zh-CN.js +10 -1
  40. package/es/config.js +1 -1
  41. package/es/framework/graph/index.css +12 -0
  42. package/es/framework/graph/index.d.ts +60 -1
  43. package/es/framework/graph/index.js +425 -0
  44. package/es/framework/libs/iconfont/iconfont.css +187 -0
  45. package/es/framework/libs/iconfont/iconfont.ttf +0 -0
  46. package/es/framework/libs/iconfont/iconfont.woff +0 -0
  47. package/es/framework/libs/iconfont/iconfont.woff2 +0 -0
  48. package/es/framework/rxjs-hooks/useObservableState.d.ts +3 -0
  49. package/es/framework/rxjs-hooks/useObservableState.js +45 -0
  50. package/es/index.d.ts +2 -0
  51. package/es/index.js +3 -1
  52. package/es/theme.css +6 -0
  53. package/package.json +6 -1
@@ -0,0 +1,8 @@
1
+ .mask {
2
+ position: absolute;
3
+ top: 0;
4
+ bottom: 0;
5
+ right: 0;
6
+ left: 0;
7
+ z-index: 99999;
8
+ }
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import './ContextMenu.less';
3
+ interface IContextMenuProps {
4
+ graph: any;
5
+ }
6
+ declare const ContextMenu: React.FC<IContextMenuProps>;
7
+ export default ContextMenu;
@@ -0,0 +1,44 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+
3
+ /*
4
+ * @Author: wangxian
5
+ * @Date: 2022-05-27 09:56:39
6
+ * @LastEditTime: 2022-05-27 16:16:25
7
+ */
8
+ import useObservable from '@/framework/rxjs-hooks/useObservable';
9
+ import React from 'react';
10
+ import NodeContextMenu from './contextMenu/NodeContextMenu';
11
+ import "./ContextMenu.css";
12
+ import { EdgeContextMenu } from './contextMenu/EdgeContextMenu';
13
+
14
+ var ContextMenu = function ContextMenu(props) {
15
+ var _graph$factory$;
16
+
17
+ var graph = props.graph;
18
+
19
+ var _React$useState = React.useState(),
20
+ _React$useState2 = _slicedToArray(_React$useState, 2),
21
+ menu = _React$useState2[0],
22
+ setMenu = _React$useState2[1];
23
+
24
+ useObservable(function (v) {
25
+ setMenu(v);
26
+ }, [graph === null || graph === void 0 ? void 0 : (_graph$factory$ = graph.factory$) === null || _graph$factory$ === void 0 ? void 0 : _graph$factory$.contextMenuInfo]);
27
+
28
+ // 暂时屏蔽graph的右击菜单
29
+ if (!(menu === null || menu === void 0 ? void 0 : menu.type) || (menu === null || menu === void 0 ? void 0 : menu.type) === 'graph') {
30
+ return null;
31
+ }
32
+
33
+ return /*#__PURE__*/React.createElement("div", {
34
+ className: "mask"
35
+ }, (menu === null || menu === void 0 ? void 0 : menu.type) === 'node' && /*#__PURE__*/React.createElement(NodeContextMenu, {
36
+ graph: graph,
37
+ data: menu.data
38
+ }), (menu === null || menu === void 0 ? void 0 : menu.type) === 'edge' && /*#__PURE__*/React.createElement(EdgeContextMenu, {
39
+ graph: graph,
40
+ data: menu.data
41
+ }));
42
+ };
43
+
44
+ export default ContextMenu;
@@ -0,0 +1,7 @@
1
+ import { NDPGraph } from '../interface';
2
+ import '../index.less';
3
+ interface IDragNodeProps {
4
+ data: NDPGraph.Node;
5
+ }
6
+ declare const DragNode: (props: IDragNodeProps) => JSX.Element;
7
+ export default DragNode;
@@ -0,0 +1,52 @@
1
+ import React from "react";
2
+
3
+ /*
4
+ * @Author: wangxian
5
+ * @Date: 2022-05-26 08:50:06
6
+ * @LastEditTime: 2022-05-28 11:10:24
7
+ */
8
+ import { DragSource } from 'react-dnd';
9
+ import { GlobalOutlined } from '@ant-design/icons';
10
+ import Icon from '../../../comps/Icons';
11
+ import { DRAGGABLE_COMPONENT } from '../constant';
12
+ import "../index.css";
13
+
14
+ var InnerNodeTitle = function InnerNodeTitle(props) {
15
+ var data = props.data,
16
+ connectDragPreview = props.connectDragPreview,
17
+ connectDragSource = props.connectDragSource;
18
+ return /*#__PURE__*/React.createElement("div", null, connectDragPreview(connectDragSource( /*#__PURE__*/React.createElement("div", {
19
+ className: "node-element"
20
+ }, /*#__PURE__*/React.createElement("div", {
21
+ className: "icon"
22
+ }, (data === null || data === void 0 ? void 0 : data.icon) ? /*#__PURE__*/React.createElement(Icon, {
23
+ type: data === null || data === void 0 ? void 0 : data.icon
24
+ }) : /*#__PURE__*/React.createElement(GlobalOutlined, null)), /*#__PURE__*/React.createElement("div", {
25
+ className: "notation"
26
+ }, /*#__PURE__*/React.createElement("div", {
27
+ className: "name"
28
+ }, data.name))))));
29
+ };
30
+
31
+ var NodeTitle = DragSource(DRAGGABLE_COMPONENT, {
32
+ beginDrag: function beginDrag(props) {
33
+ return {
34
+ comp: props.data
35
+ };
36
+ }
37
+ }, function (connect, monitor) {
38
+ return {
39
+ connectDragSource: connect.dragSource(),
40
+ connectDragPreview: connect.dragPreview(),
41
+ isDragging: monitor.isDragging()
42
+ };
43
+ })(InnerNodeTitle);
44
+
45
+ var DragNode = function DragNode(props) {
46
+ var data = props.data;
47
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(NodeTitle, {
48
+ data: data
49
+ }));
50
+ };
51
+
52
+ export default DragNode;
@@ -0,0 +1,27 @@
1
+ .handler {
2
+ position: absolute;
3
+ top: 61px;
4
+ right: 14px;
5
+ z-index: 99;
6
+ width: 32px;
7
+ margin: 0;
8
+ padding: 3px 0;
9
+ color: rgba(0, 0, 0, 0.45);
10
+ font-size: 16px;
11
+ list-style-type: none;
12
+ background-color: #fff;
13
+ border: 1px solid rgba(0, 0, 0, 0.04);
14
+ border-radius: 3px;
15
+ box-shadow: 0 0 20px rgba(0, 0, 0, 0.01);
16
+ }
17
+ .handler .item {
18
+ text-align: center;
19
+ cursor: pointer;
20
+ }
21
+ .handler .item:hover {
22
+ color: #000;
23
+ background-color: #e0e0e0;
24
+ }
25
+ .popover :global .ant-popover-inner-content {
26
+ padding: 3px 8px;
27
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface Props {
4
+ className?: string;
5
+ onZoomIn: () => void;
6
+ onZoomOut: () => void;
7
+ onFitContent: () => void;
8
+ onRealContent: () => void;
9
+ }
10
+ export declare const GraphHandler: React.FC<Props>;
11
+ export {};
@@ -0,0 +1,51 @@
1
+ import "antd/es/popover/style";
2
+ import _Popover from "antd/es/popover";
3
+
4
+ /*
5
+ * @Author: wangxian
6
+ * @Date: 2022-05-27 14:21:23
7
+ * @LastEditTime: 2022-05-28 10:18:24
8
+ */
9
+ import React from 'react';
10
+ import { CompressOutlined, OneToOneOutlined, ZoomInOutlined, ZoomOutOutlined } from '@ant-design/icons';
11
+ import classNames from 'classnames';
12
+ import "./index.css";
13
+ import { tr } from '@/framework/locale';
14
+ export var GraphHandler = function GraphHandler(props) {
15
+ var className = props.className,
16
+ onZoomIn = props.onZoomIn,
17
+ onZoomOut = props.onZoomOut,
18
+ onFitContent = props.onFitContent,
19
+ onRealContent = props.onRealContent;
20
+ return /*#__PURE__*/React.createElement("ul", {
21
+ className: classNames('handler', className)
22
+ }, /*#__PURE__*/React.createElement(_Popover, {
23
+ overlayClassName: "popover",
24
+ content: tr('放大'),
25
+ placement: "left"
26
+ }, /*#__PURE__*/React.createElement("li", {
27
+ onClick: onZoomIn,
28
+ className: "item"
29
+ }, /*#__PURE__*/React.createElement(ZoomInOutlined, null))), /*#__PURE__*/React.createElement(_Popover, {
30
+ overlayClassName: "popover",
31
+ content: tr('缩小'),
32
+ placement: "left"
33
+ }, /*#__PURE__*/React.createElement("li", {
34
+ onClick: onZoomOut,
35
+ className: "item"
36
+ }, /*#__PURE__*/React.createElement(ZoomOutOutlined, null))), /*#__PURE__*/React.createElement(_Popover, {
37
+ overlayClassName: "popover",
38
+ content: tr('实际尺寸'),
39
+ placement: "left"
40
+ }, /*#__PURE__*/React.createElement("li", {
41
+ onClick: onRealContent,
42
+ className: "item"
43
+ }, /*#__PURE__*/React.createElement(OneToOneOutlined, null))), /*#__PURE__*/React.createElement(_Popover, {
44
+ overlayClassName: "popover",
45
+ content: tr('适应画布'),
46
+ placement: "left"
47
+ }, /*#__PURE__*/React.createElement("li", {
48
+ onClick: onFitContent,
49
+ className: "item"
50
+ }, /*#__PURE__*/React.createElement(CompressOutlined, null))));
51
+ };
@@ -3,20 +3,24 @@ import React from "react";
3
3
  /*
4
4
  * @Author: wangxian
5
5
  * @Date: 2022-05-24 08:50:16
6
- * @LastEditTime: 2022-05-24 11:58:52
6
+ * @LastEditTime: 2022-05-28 11:09:22
7
7
  */
8
8
  import { GlobalOutlined } from '@ant-design/icons';
9
9
  import "../index.css";
10
+ import Icon from '../../../comps/Icons';
10
11
 
11
12
  var NodeElement = function NodeElement(props) {
12
13
  var node = props.node;
13
14
  var data = (node === null || node === void 0 ? void 0 : node.getData()) || {};
14
- var name = data.name;
15
+ var name = data.name,
16
+ icon = data.icon;
15
17
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
16
18
  className: "node-element"
17
19
  }, /*#__PURE__*/React.createElement("div", {
18
- className: 'icon'
19
- }, /*#__PURE__*/React.createElement(GlobalOutlined, null)), /*#__PURE__*/React.createElement("div", {
20
+ className: "icon"
21
+ }, icon ? /*#__PURE__*/React.createElement(Icon, {
22
+ type: icon
23
+ }) : /*#__PURE__*/React.createElement(GlobalOutlined, null)), /*#__PURE__*/React.createElement("div", {
20
24
  className: "notation"
21
25
  }, /*#__PURE__*/React.createElement("div", {
22
26
  className: "name"
@@ -0,0 +1,5 @@
1
+ .edgeContextMenu {
2
+ position: absolute;
3
+ z-index: 1;
4
+ background-color: #fff;
5
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface Props {
4
+ graph: any;
5
+ data: any;
6
+ }
7
+ export declare const EdgeContextMenu: React.FC<Props>;
8
+ export {};
@@ -0,0 +1,42 @@
1
+ import "antd/es/menu/style";
2
+ import _Menu from "antd/es/menu";
3
+
4
+ /*
5
+ * @Author: wangxian
6
+ * @Date: 2022-05-27 15:55:57
7
+ * @LastEditTime: 2022-05-28 10:07:16
8
+ */
9
+ import React, { useCallback, useRef } from 'react';
10
+ import { DeleteOutlined } from '@ant-design/icons';
11
+ import { useClickAway } from 'ahooks';
12
+ import { graphPointToOffsetPoint } from '../../../utils';
13
+ import "./index.css";
14
+ import { tr } from '../../../../../framework/locale';
15
+ export var EdgeContextMenu = function EdgeContextMenu(props) {
16
+ var graph = props.graph,
17
+ data = props.data;
18
+ var containerRef = useRef(null);
19
+ useClickAway(function () {
20
+ graph.clearContextMenuInfo();
21
+ }, containerRef);
22
+ var onDeleteEdge = useCallback(function () {
23
+ graph.onDeleteEdges(data.edge);
24
+ graph.clearContextMenuInfo();
25
+ }, [graph, data]);
26
+
27
+ var _graphPointToOffsetPo = graphPointToOffsetPoint(graph.graph, data, graph.wrapper),
28
+ left = _graphPointToOffsetPo.x,
29
+ top = _graphPointToOffsetPo.y;
30
+
31
+ return /*#__PURE__*/React.createElement("div", {
32
+ ref: containerRef,
33
+ className: "edgeContextMenu",
34
+ style: {
35
+ top: top,
36
+ left: left
37
+ }
38
+ }, /*#__PURE__*/React.createElement(_Menu, null, /*#__PURE__*/React.createElement(_Menu.Item, {
39
+ onClick: onDeleteEdge,
40
+ icon: /*#__PURE__*/React.createElement(DeleteOutlined, null)
41
+ }, tr('删除'))));
42
+ };
@@ -0,0 +1,21 @@
1
+ .graphContextMenu {
2
+ position: absolute;
3
+ z-index: 1;
4
+ background-color: #fff;
5
+ }
6
+ .loadExperimentModal :global .ant-modal-title {
7
+ font-size: 14px;
8
+ }
9
+ .loadExperimentModal :global .ant-btn {
10
+ font-size: 12px;
11
+ }
12
+ .loadExperimentModal .versionTable :global .ant-table.ant-table-small {
13
+ font-size: 12px;
14
+ }
15
+ .loadExperimentModal .versionTable .operations :global .ant-btn:first-of-type {
16
+ padding-left: 0;
17
+ border-left: 0;
18
+ }
19
+ .loadExperimentModal .versionTable .operations :global .ant-btn.ant-btn-sm {
20
+ font-size: 12px;
21
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface Props {
4
+ graph: any;
5
+ data: any;
6
+ }
7
+ export declare const GraphContextMenu: React.FC<Props>;
8
+ export {};
@@ -0,0 +1,40 @@
1
+ import "antd/es/menu/style";
2
+ import _Menu from "antd/es/menu";
3
+
4
+ /*
5
+ * @Author: wangxian
6
+ * @Date: 2022-05-27 16:04:27
7
+ * @LastEditTime: 2022-05-28 10:07:54
8
+ */
9
+ import React, { useRef } from 'react';
10
+ import { ReloadOutlined } from '@ant-design/icons';
11
+ import { useClickAway } from 'ahooks';
12
+ import { graphPointToOffsetPoint } from '../../../utils';
13
+ import { tr } from '../../../../../framework/locale';
14
+ import "./index.css";
15
+ export var GraphContextMenu = function GraphContextMenu(props) {
16
+ var graph = props.graph,
17
+ data = props.data;
18
+ var containerRef = useRef(null);
19
+ useClickAway(function () {
20
+ graph.clearContextMenuInfo();
21
+ }, containerRef);
22
+
23
+ var onRefresh = function onRefresh() {};
24
+
25
+ var _graphPointToOffsetPo = graphPointToOffsetPoint(graph.graph, data, graph.wrapper),
26
+ left = _graphPointToOffsetPo.x,
27
+ top = _graphPointToOffsetPo.y;
28
+
29
+ return /*#__PURE__*/React.createElement("div", {
30
+ ref: containerRef,
31
+ className: "graphContextMenu",
32
+ style: {
33
+ top: top,
34
+ left: left
35
+ }
36
+ }, /*#__PURE__*/React.createElement(_Menu, null, /*#__PURE__*/React.createElement(_Menu.Item, {
37
+ onClick: onRefresh,
38
+ icon: /*#__PURE__*/React.createElement(ReloadOutlined, null)
39
+ }, tr('刷新'))));
40
+ };
@@ -0,0 +1,23 @@
1
+ .graphContextMenu {
2
+ position: absolute;
3
+ z-index: 1;
4
+ width: 100px;
5
+ background-color: #fff;
6
+ box-shadow: 0 2px 10px rgb(0 0 0 1);
7
+ }
8
+ .loadExperimentModal :global .ant-modal-title {
9
+ font-size: 14px;
10
+ }
11
+ .loadExperimentModal :global .ant-btn {
12
+ font-size: 12px;
13
+ }
14
+ .loadExperimentModal .versionTable :global .ant-table.ant-table-small {
15
+ font-size: 12px;
16
+ }
17
+ .loadExperimentModal .versionTable .operations :global .ant-btn:first-of-type {
18
+ padding-left: 0;
19
+ border-left: 0;
20
+ }
21
+ .loadExperimentModal .versionTable .operations :global .ant-btn.ant-btn-sm {
22
+ font-size: 12px;
23
+ }
@@ -0,0 +1,7 @@
1
+ import './index.less';
2
+ interface INodeContextMenuProps {
3
+ graph: any;
4
+ data: any;
5
+ }
6
+ declare const NodeContextMenu: (props: INodeContextMenuProps) => JSX.Element;
7
+ export default NodeContextMenu;
@@ -0,0 +1,55 @@
1
+ import "antd/es/menu/style";
2
+ import _Menu from "antd/es/menu";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
5
+ import { DeleteOutlined } from '@ant-design/icons';
6
+ import React from 'react';
7
+ import { useClickAway } from 'ahooks';
8
+ import { graphPointToOffsetPoint } from '../../../utils';
9
+ import { tr } from '../../../../../framework/locale';
10
+ import "./index.css";
11
+
12
+ var NodeContextMenu = function NodeContextMenu(props) {
13
+ var graph = props.graph,
14
+ data = props.data;
15
+ var containerRef = React.useRef(null);
16
+ useClickAway(function () {
17
+ graph.clearContextMenuInfo();
18
+ }, containerRef);
19
+ var onNodeDel = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
20
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
21
+ while (1) {
22
+ switch (_context.prev = _context.next) {
23
+ case 0:
24
+ _context.next = 2;
25
+ return graph.onDeleteNodes([data.node.id]);
26
+
27
+ case 2:
28
+ graph.clearContextMenuInfo();
29
+
30
+ case 3:
31
+ case "end":
32
+ return _context.stop();
33
+ }
34
+ }
35
+ }, _callee);
36
+ })), [graph]);
37
+
38
+ var _graphPointToOffsetPo = graphPointToOffsetPoint(graph.graph, data, graph.wrapper),
39
+ left = _graphPointToOffsetPo.x,
40
+ top = _graphPointToOffsetPo.y;
41
+
42
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
43
+ ref: containerRef,
44
+ className: "graphContextMenu",
45
+ style: {
46
+ top: top,
47
+ left: left
48
+ }
49
+ }, /*#__PURE__*/React.createElement(_Menu, null, /*#__PURE__*/React.createElement(_Menu.Item, {
50
+ onClick: onNodeDel,
51
+ icon: /*#__PURE__*/React.createElement(DeleteOutlined, null)
52
+ }, tr('删除')))));
53
+ };
54
+
55
+ export default NodeContextMenu;
@@ -106,7 +106,7 @@ DPNode.config({
106
106
  height: '100%'
107
107
  },
108
108
  children: [{
109
- tagName: 'div',
109
+ tagName: 'span',
110
110
  selector: 'content',
111
111
  style: {
112
112
  width: '100%',
@@ -3,5 +3,5 @@ export declare const GROUP_VERTICAL__PADDING = 40;
3
3
  export declare const NODE_WIDTH = 180;
4
4
  export declare const NODE_HEIGHT = 32;
5
5
  export declare const RERENDER_EVENT = "RERENDER_EVENT";
6
- export declare const DRAGGABLE_ALGO_COMPONENT = "ALGO_COMPONENT";
7
- export declare const DRAGGABLE_MODEL = "MODEL";
6
+ export declare const DRAGGABLE_COMPONENT = "DRAGGABLE_COMPONENT";
7
+ export declare const DRAGGABLE_MODEL = "DRAGGABLE_MODEL";
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: wangxian
3
3
  * @Date: 2022-05-24 08:48:57
4
- * @LastEditTime: 2022-05-24 08:49:24
4
+ * @LastEditTime: 2022-05-25 11:37:48
5
5
  */
6
6
  export var GROUP_HORIZONTAL__PADDING = 24; // 分组横向 padding
7
7
 
@@ -15,5 +15,5 @@ export var RERENDER_EVENT = 'RERENDER_EVENT';
15
15
  * 以下是拖拽相关
16
16
  */
17
17
 
18
- export var DRAGGABLE_ALGO_COMPONENT = 'ALGO_COMPONENT';
19
- export var DRAGGABLE_MODEL = 'MODEL';
18
+ export var DRAGGABLE_COMPONENT = 'DRAGGABLE_COMPONENT';
19
+ export var DRAGGABLE_MODEL = 'DRAGGABLE_MODEL';
@@ -0,0 +1,62 @@
1
+ import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';
2
+ import { Subscription } from 'rxjs/internal/Subscription';
3
+ import { ConnectionRemovedArgs, ContextMenuInfo, GraphCore } from '../../framework/graph';
4
+ import { BaseEdge, DPEdge } from './comps/shape/edge';
5
+ import { BaseNode, DPNode } from './comps/shape/node';
6
+ import { NDPGraph } from './interface';
7
+ import { formatGraphData } from './utils';
8
+ declare type NodeMeta = ReturnType<typeof formatGraphData>['nodes'][number];
9
+ declare type EdgeMeta = ReturnType<typeof formatGraphData>['edges'][number];
10
+ interface IFactory$ {
11
+ /**
12
+ * 实验图加载状态
13
+ */
14
+ loading: BehaviorSubject<boolean>;
15
+ /**
16
+ * 图数据流
17
+ */
18
+ dpGraph: BehaviorSubject<NDPGraph.GraphData>;
19
+ /**
20
+ * 选中的节点
21
+ */
22
+ selectedNodes: BehaviorSubject<NDPGraph.Node[]>;
23
+ /**
24
+ * 右击菜单
25
+ */
26
+ contextMenuInfo: BehaviorSubject<ContextMenuInfo>;
27
+ }
28
+ declare class DPGraph extends GraphCore<BaseNode, BaseEdge> {
29
+ factory$: IFactory$;
30
+ dpGraphSub?: Subscription;
31
+ constructor(graphData?: NDPGraph.GraphData);
32
+ initialize(graphData: NDPGraph.GraphData): Promise<void>;
33
+ loadDPGraph(graphData: any): Promise<void>;
34
+ isGraphReady(): boolean;
35
+ renderGraph: (wrapper: HTMLElement, container: HTMLElement) => void;
36
+ renderNode(nodeMeta: NodeMeta): BaseNode | undefined;
37
+ renderEdge(edgeMeta: EdgeMeta): BaseEdge | undefined;
38
+ addDragNode(data: NDPGraph.Node): void;
39
+ updateDPGraph(nodes?: NDPGraph.Node[], edges?: NDPGraph.Edge[]): Promise<void>;
40
+ delDPGraphElement(nodes?: string[], edges?: NDPGraph.Edge[]): Promise<void>;
41
+ zoomGraph: (factor: number) => void;
42
+ zoomGraphToFit: () => void;
43
+ zoomGraphRealSize: () => void;
44
+ onConnectNode(args: any): Promise<{
45
+ success: boolean;
46
+ }>;
47
+ onSelectNodes(nodes: BaseNode[]): void;
48
+ onConnectionRemoved(args: ConnectionRemovedArgs): void;
49
+ onDeleteNodes: (ids: string[] | string) => void;
50
+ onDeleteEdges: (edges: BaseEdge | BaseEdge[]) => void;
51
+ onDeleteNodeOrEdge(args: {
52
+ nodes: DPNode[];
53
+ edges: DPEdge[];
54
+ }): void;
55
+ onContextMenu(data: ContextMenuInfo): any;
56
+ clearContextMenuInfo: () => void;
57
+ dispose(): void;
58
+ }
59
+ export declare let gDPGraph: DPGraph;
60
+ export declare const useDPGraph: (graphData: NDPGraph.GraphData) => DPGraph;
61
+ export declare const useUnmountDPGraph: () => void;
62
+ export {};