liteflow-editor-process 1.0.0
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.
- package/LICENSE +21 -0
- package/README.md +1020 -0
- package/dist/LiteFlowEditor/assets/and-icon.svg +20 -0
- package/dist/LiteFlowEditor/assets/catch-icon.svg +14 -0
- package/dist/LiteFlowEditor/assets/chain-icon.svg +11 -0
- package/dist/LiteFlowEditor/assets/common-icon.svg +18 -0
- package/dist/LiteFlowEditor/assets/end-icon.svg +14 -0
- package/dist/LiteFlowEditor/assets/for-icon.svg +20 -0
- package/dist/LiteFlowEditor/assets/if-icon.svg +14 -0
- package/dist/LiteFlowEditor/assets/indicator-icons.svg +16 -0
- package/dist/LiteFlowEditor/assets/intermediate-end-icon.svg +20 -0
- package/dist/LiteFlowEditor/assets/intermediate-event-catch-error.svg +40 -0
- package/dist/LiteFlowEditor/assets/iterator-icon.svg +7 -0
- package/dist/LiteFlowEditor/assets/little-warning-icon.svg +1 -0
- package/dist/LiteFlowEditor/assets/not-icon.svg +20 -0
- package/dist/LiteFlowEditor/assets/or-icon.svg +20 -0
- package/dist/LiteFlowEditor/assets/start-icon.svg +16 -0
- package/dist/LiteFlowEditor/assets/switch-icon.svg +15 -0
- package/dist/LiteFlowEditor/assets/then-icon.svg +23 -0
- package/dist/LiteFlowEditor/assets/virtual-icon.svg +21 -0
- package/dist/LiteFlowEditor/assets/warning-icon.svg +1 -0
- package/dist/LiteFlowEditor/assets/when-icon.svg +21 -0
- package/dist/LiteFlowEditor/assets/while-icon.svg +24 -0
- package/dist/LiteFlowEditor/cells/and.d.ts +2 -0
- package/dist/LiteFlowEditor/cells/and.js +8 -0
- package/dist/LiteFlowEditor/cells/catch.d.ts +2 -0
- package/dist/LiteFlowEditor/cells/catch.js +8 -0
- package/dist/LiteFlowEditor/cells/chain.d.ts +2 -0
- package/dist/LiteFlowEditor/cells/chain.js +8 -0
- package/dist/LiteFlowEditor/cells/common.d.ts +2 -0
- package/dist/LiteFlowEditor/cells/common.js +8 -0
- package/dist/LiteFlowEditor/cells/end.d.ts +2 -0
- package/dist/LiteFlowEditor/cells/end.js +11 -0
- package/dist/LiteFlowEditor/cells/for.d.ts +2 -0
- package/dist/LiteFlowEditor/cells/for.js +8 -0
- package/dist/LiteFlowEditor/cells/if.d.ts +2 -0
- package/dist/LiteFlowEditor/cells/if.js +9 -0
- package/dist/LiteFlowEditor/cells/index.d.ts +25 -0
- package/dist/LiteFlowEditor/cells/index.js +219 -0
- package/dist/LiteFlowEditor/cells/intermediate-end.d.ts +2 -0
- package/dist/LiteFlowEditor/cells/intermediate-end.js +11 -0
- package/dist/LiteFlowEditor/cells/iterator.d.ts +2 -0
- package/dist/LiteFlowEditor/cells/iterator.js +8 -0
- package/dist/LiteFlowEditor/cells/not.d.ts +2 -0
- package/dist/LiteFlowEditor/cells/not.js +8 -0
- package/dist/LiteFlowEditor/cells/or.d.ts +2 -0
- package/dist/LiteFlowEditor/cells/or.js +8 -0
- package/dist/LiteFlowEditor/cells/start.d.ts +2 -0
- package/dist/LiteFlowEditor/cells/start.js +11 -0
- package/dist/LiteFlowEditor/cells/switch.d.ts +2 -0
- package/dist/LiteFlowEditor/cells/switch.js +9 -0
- package/dist/LiteFlowEditor/cells/then.d.ts +2 -0
- package/dist/LiteFlowEditor/cells/then.js +11 -0
- package/dist/LiteFlowEditor/cells/virtual.d.ts +2 -0
- package/dist/LiteFlowEditor/cells/virtual.js +8 -0
- package/dist/LiteFlowEditor/cells/when.d.ts +2 -0
- package/dist/LiteFlowEditor/cells/when.js +11 -0
- package/dist/LiteFlowEditor/cells/while.d.ts +2 -0
- package/dist/LiteFlowEditor/cells/while.js +8 -0
- package/dist/LiteFlowEditor/common/anchor.d.ts +2 -0
- package/dist/LiteFlowEditor/common/anchor.js +10 -0
- package/dist/LiteFlowEditor/common/connector.d.ts +2 -0
- package/dist/LiteFlowEditor/common/connector.js +20 -0
- package/dist/LiteFlowEditor/common/edge.d.ts +61 -0
- package/dist/LiteFlowEditor/common/edge.js +57 -0
- package/dist/LiteFlowEditor/common/events.d.ts +4 -0
- package/dist/LiteFlowEditor/common/events.js +97 -0
- package/dist/LiteFlowEditor/common/index.d.ts +4 -0
- package/dist/LiteFlowEditor/common/index.js +11 -0
- package/dist/LiteFlowEditor/common/layout.d.ts +12 -0
- package/dist/LiteFlowEditor/common/layout.js +308 -0
- package/dist/LiteFlowEditor/common/router.d.ts +2 -0
- package/dist/LiteFlowEditor/common/router.js +40 -0
- package/dist/LiteFlowEditor/common/shortcuts.d.ts +10 -0
- package/dist/LiteFlowEditor/common/shortcuts.js +183 -0
- package/dist/LiteFlowEditor/components/NodeBadge/index.d.ts +6 -0
- package/dist/LiteFlowEditor/components/NodeBadge/index.js +24 -0
- package/dist/LiteFlowEditor/components/NodeBadge/index.module.less +10 -0
- package/dist/LiteFlowEditor/components/NodeToolBar/index.d.ts +6 -0
- package/dist/LiteFlowEditor/components/NodeToolBar/index.js +121 -0
- package/dist/LiteFlowEditor/components/NodeToolBar/index.module.less +133 -0
- package/dist/LiteFlowEditor/components/NodeView/index.d.ts +7 -0
- package/dist/LiteFlowEditor/components/NodeView/index.js +14 -0
- package/dist/LiteFlowEditor/components/NodeView/index.module.less +14 -0
- package/dist/LiteFlowEditor/components/index.d.ts +3 -0
- package/dist/LiteFlowEditor/components/index.js +3 -0
- package/dist/LiteFlowEditor/constant/index.d.ts +79 -0
- package/dist/LiteFlowEditor/constant/index.js +215 -0
- package/dist/LiteFlowEditor/context/GraphContext.d.ts +13 -0
- package/dist/LiteFlowEditor/context/GraphContext.js +10 -0
- package/dist/LiteFlowEditor/context/ScriptContext.d.ts +37 -0
- package/dist/LiteFlowEditor/context/ScriptContext.js +15 -0
- package/dist/LiteFlowEditor/hooks/index.d.ts +5 -0
- package/dist/LiteFlowEditor/hooks/index.js +5 -0
- package/dist/LiteFlowEditor/hooks/useClickAway.d.ts +5 -0
- package/dist/LiteFlowEditor/hooks/useClickAway.js +38 -0
- package/dist/LiteFlowEditor/hooks/useGraph.d.ts +1 -0
- package/dist/LiteFlowEditor/hooks/useGraph.js +7 -0
- package/dist/LiteFlowEditor/hooks/useGraphWrapper.d.ts +2 -0
- package/dist/LiteFlowEditor/hooks/useGraphWrapper.js +7 -0
- package/dist/LiteFlowEditor/hooks/useHistory.d.ts +2 -0
- package/dist/LiteFlowEditor/hooks/useHistory.js +69 -0
- package/dist/LiteFlowEditor/hooks/useModel.d.ts +3 -0
- package/dist/LiteFlowEditor/hooks/useModel.js +7 -0
- package/dist/LiteFlowEditor/hooks/useUpdateEffect.d.ts +7 -0
- package/dist/LiteFlowEditor/hooks/useUpdateEffect.js +17 -0
- package/dist/LiteFlowEditor/i18n/en_US/translation.json +138 -0
- package/dist/LiteFlowEditor/i18n/index.d.ts +2 -0
- package/dist/LiteFlowEditor/i18n/index.js +28 -0
- package/dist/LiteFlowEditor/i18n/zh_CN/translation.json +139 -0
- package/dist/LiteFlowEditor/i18n/zh_TW/translation.json +139 -0
- package/dist/LiteFlowEditor/index.d.ts +37 -0
- package/dist/LiteFlowEditor/index.js +299 -0
- package/dist/LiteFlowEditor/index.module.less +127 -0
- package/dist/LiteFlowEditor/mock/index.d.ts +2 -0
- package/dist/LiteFlowEditor/mock/index.js +272 -0
- package/dist/LiteFlowEditor/model/builder.d.ts +43 -0
- package/dist/LiteFlowEditor/model/builder.js +239 -0
- package/dist/LiteFlowEditor/model/chain.d.ts +83 -0
- package/dist/LiteFlowEditor/model/chain.js +278 -0
- package/dist/LiteFlowEditor/model/el/and-operator.d.ts +53 -0
- package/dist/LiteFlowEditor/model/el/and-operator.js +178 -0
- package/dist/LiteFlowEditor/model/el/catch-operator.d.ts +81 -0
- package/dist/LiteFlowEditor/model/el/catch-operator.js +338 -0
- package/dist/LiteFlowEditor/model/el/chain-operator.d.ts +53 -0
- package/dist/LiteFlowEditor/model/el/chain-operator.js +170 -0
- package/dist/LiteFlowEditor/model/el/for-operator.d.ts +56 -0
- package/dist/LiteFlowEditor/model/el/for-operator.js +171 -0
- package/dist/LiteFlowEditor/model/el/if-operator.d.ts +64 -0
- package/dist/LiteFlowEditor/model/el/if-operator.js +265 -0
- package/dist/LiteFlowEditor/model/el/index.d.ts +40 -0
- package/dist/LiteFlowEditor/model/el/index.js +47 -0
- package/dist/LiteFlowEditor/model/el/iterator-operator.d.ts +56 -0
- package/dist/LiteFlowEditor/model/el/iterator-operator.js +183 -0
- package/dist/LiteFlowEditor/model/el/node-operator.d.ts +62 -0
- package/dist/LiteFlowEditor/model/el/node-operator.js +136 -0
- package/dist/LiteFlowEditor/model/el/not-operator.d.ts +68 -0
- package/dist/LiteFlowEditor/model/el/not-operator.js +231 -0
- package/dist/LiteFlowEditor/model/el/or-operator.d.ts +53 -0
- package/dist/LiteFlowEditor/model/el/or-operator.js +178 -0
- package/dist/LiteFlowEditor/model/el/switch-operator.d.ts +56 -0
- package/dist/LiteFlowEditor/model/el/switch-operator.js +173 -0
- package/dist/LiteFlowEditor/model/el/then-operator.d.ts +66 -0
- package/dist/LiteFlowEditor/model/el/then-operator.js +159 -0
- package/dist/LiteFlowEditor/model/el/when-operator.d.ts +58 -0
- package/dist/LiteFlowEditor/model/el/when-operator.js +181 -0
- package/dist/LiteFlowEditor/model/el/while-operator.d.ts +56 -0
- package/dist/LiteFlowEditor/model/el/while-operator.js +171 -0
- package/dist/LiteFlowEditor/model/node.d.ts +182 -0
- package/dist/LiteFlowEditor/model/node.js +463 -0
- package/dist/LiteFlowEditor/model/utils/createTag.d.ts +1 -0
- package/dist/LiteFlowEditor/model/utils/createTag.js +5 -0
- package/dist/LiteFlowEditor/model/utils/end.d.ts +87 -0
- package/dist/LiteFlowEditor/model/utils/end.js +185 -0
- package/dist/LiteFlowEditor/model/utils/index.d.ts +7 -0
- package/dist/LiteFlowEditor/model/utils/index.js +10 -0
- package/dist/LiteFlowEditor/model/utils/start.d.ts +87 -0
- package/dist/LiteFlowEditor/model/utils/start.js +185 -0
- package/dist/LiteFlowEditor/model/utils/virtual.d.ts +78 -0
- package/dist/LiteFlowEditor/model/utils/virtual.js +167 -0
- package/dist/LiteFlowEditor/model-checker/checkers/AnalysisNodeChecker.d.ts +7 -0
- package/dist/LiteFlowEditor/model-checker/checkers/AnalysisNodeChecker.js +44 -0
- package/dist/LiteFlowEditor/model-checker/checkers/CurScheduleSetChecker.d.ts +7 -0
- package/dist/LiteFlowEditor/model-checker/checkers/CurScheduleSetChecker.js +26 -0
- package/dist/LiteFlowEditor/model-checker/checkers/InputListChecker.d.ts +7 -0
- package/dist/LiteFlowEditor/model-checker/checkers/InputListChecker.js +39 -0
- package/dist/LiteFlowEditor/model-checker/checkers/InputListValueChecker.d.ts +7 -0
- package/dist/LiteFlowEditor/model-checker/checkers/InputListValueChecker.js +154 -0
- package/dist/LiteFlowEditor/model-checker/checkers/IteratorBindChecker.d.ts +7 -0
- package/dist/LiteFlowEditor/model-checker/checkers/IteratorBindChecker.js +27 -0
- package/dist/LiteFlowEditor/model-checker/checkers/QueryDimensionChecker.d.ts +7 -0
- package/dist/LiteFlowEditor/model-checker/checkers/QueryDimensionChecker.js +33 -0
- package/dist/LiteFlowEditor/model-checker/checkers/QueryLogChecker.d.ts +7 -0
- package/dist/LiteFlowEditor/model-checker/checkers/QueryLogChecker.js +27 -0
- package/dist/LiteFlowEditor/model-checker/checkers/ReportTemplateChecker.d.ts +7 -0
- package/dist/LiteFlowEditor/model-checker/checkers/ReportTemplateChecker.js +27 -0
- package/dist/LiteFlowEditor/model-checker/checkers/UnconfiguredComponentChecker.d.ts +7 -0
- package/dist/LiteFlowEditor/model-checker/checkers/UnconfiguredComponentChecker.js +27 -0
- package/dist/LiteFlowEditor/model-checker/checkers/index.d.ts +14 -0
- package/dist/LiteFlowEditor/model-checker/checkers/index.js +38 -0
- package/dist/LiteFlowEditor/model-checker/index.d.ts +22 -0
- package/dist/LiteFlowEditor/model-checker/index.js +43 -0
- package/dist/LiteFlowEditor/model-checker/types.d.ts +11 -0
- package/dist/LiteFlowEditor/model-checker/types.js +1 -0
- package/dist/LiteFlowEditor/panels/breadcrumb/index.d.ts +7 -0
- package/dist/LiteFlowEditor/panels/breadcrumb/index.js +67 -0
- package/dist/LiteFlowEditor/panels/breadcrumb/index.module.less +23 -0
- package/dist/LiteFlowEditor/panels/flowGraph/contextMenu/index.d.ts +11 -0
- package/dist/LiteFlowEditor/panels/flowGraph/contextMenu/index.js +98 -0
- package/dist/LiteFlowEditor/panels/flowGraph/contextMenu/index.module.less +7 -0
- package/dist/LiteFlowEditor/panels/flowGraph/contextMenu/menuConfig/blank.d.ts +8 -0
- package/dist/LiteFlowEditor/panels/flowGraph/contextMenu/menuConfig/blank.js +18 -0
- package/dist/LiteFlowEditor/panels/flowGraph/contextMenu/menuConfig/index.d.ts +3 -0
- package/dist/LiteFlowEditor/panels/flowGraph/contextMenu/menuConfig/index.js +3 -0
- package/dist/LiteFlowEditor/panels/flowGraph/contextMenu/menuConfig/node.d.ts +9 -0
- package/dist/LiteFlowEditor/panels/flowGraph/contextMenu/menuConfig/node.js +10 -0
- package/dist/LiteFlowEditor/panels/flowGraph/contextPad/index.d.ts +14 -0
- package/dist/LiteFlowEditor/panels/flowGraph/contextPad/index.js +108 -0
- package/dist/LiteFlowEditor/panels/flowGraph/contextPad/index.module.less +81 -0
- package/dist/LiteFlowEditor/panels/flowGraph/createFlowGraph.d.ts +3 -0
- package/dist/LiteFlowEditor/panels/flowGraph/createFlowGraph.js +199 -0
- package/dist/LiteFlowEditor/panels/flowGraph/miniMapSimpleNode/index.d.ts +7 -0
- package/dist/LiteFlowEditor/panels/flowGraph/miniMapSimpleNode/index.js +42 -0
- package/dist/LiteFlowEditor/panels/flowGraph/nodeEditorModal/index.d.ts +8 -0
- package/dist/LiteFlowEditor/panels/flowGraph/nodeEditorModal/index.js +110 -0
- package/dist/LiteFlowEditor/panels/flowGraph/nodeEditorModal/index.module.less +11 -0
- package/dist/LiteFlowEditor/panels/layout/index.d.ts +16 -0
- package/dist/LiteFlowEditor/panels/layout/index.js +117 -0
- package/dist/LiteFlowEditor/panels/layout/index.module.less +30 -0
- package/dist/LiteFlowEditor/panels/settingBar/basic/index.d.ts +7 -0
- package/dist/LiteFlowEditor/panels/settingBar/basic/index.js +50 -0
- package/dist/LiteFlowEditor/panels/settingBar/basic/index.module.less +17 -0
- package/dist/LiteFlowEditor/panels/settingBar/index.d.ts +7 -0
- package/dist/LiteFlowEditor/panels/settingBar/index.js +219 -0
- package/dist/LiteFlowEditor/panels/settingBar/index.module.less +45 -0
- package/dist/LiteFlowEditor/panels/settingBar/outline/index.d.ts +7 -0
- package/dist/LiteFlowEditor/panels/settingBar/outline/index.js +124 -0
- package/dist/LiteFlowEditor/panels/settingBar/outline/index.module.less +39 -0
- package/dist/LiteFlowEditor/panels/settingBar/parameters/index.d.ts +6 -0
- package/dist/LiteFlowEditor/panels/settingBar/parameters/index.js +415 -0
- package/dist/LiteFlowEditor/panels/settingBar/parameters/index.module.less +4 -0
- package/dist/LiteFlowEditor/panels/settingBar/properties/CustomDropdown.d.ts +13 -0
- package/dist/LiteFlowEditor/panels/settingBar/properties/CustomDropdown.js +62 -0
- package/dist/LiteFlowEditor/panels/settingBar/properties/DraggableWrapper.d.ts +48 -0
- package/dist/LiteFlowEditor/panels/settingBar/properties/DraggableWrapper.js +94 -0
- package/dist/LiteFlowEditor/panels/settingBar/properties/RichParamEditor-new.d.ts +33 -0
- package/dist/LiteFlowEditor/panels/settingBar/properties/RichParamEditor-new.js +433 -0
- package/dist/LiteFlowEditor/panels/settingBar/properties/RichParamEditor.d.ts +33 -0
- package/dist/LiteFlowEditor/panels/settingBar/properties/RichParamEditor.js +195 -0
- package/dist/LiteFlowEditor/panels/settingBar/properties/component.d.ts +10 -0
- package/dist/LiteFlowEditor/panels/settingBar/properties/component.js +2780 -0
- package/dist/LiteFlowEditor/panels/settingBar/properties/condition.d.ts +7 -0
- package/dist/LiteFlowEditor/panels/settingBar/properties/condition.js +54 -0
- package/dist/LiteFlowEditor/panels/settingBar/properties/index.d.ts +2 -0
- package/dist/LiteFlowEditor/panels/settingBar/properties/index.js +2 -0
- package/dist/LiteFlowEditor/panels/settingBar/properties/index.module.less +149 -0
- package/dist/LiteFlowEditor/panels/sideBar/index.d.ts +7 -0
- package/dist/LiteFlowEditor/panels/sideBar/index.js +153 -0
- package/dist/LiteFlowEditor/panels/sideBar/index.module.less +48 -0
- package/dist/LiteFlowEditor/panels/toolBar/index.d.ts +8 -0
- package/dist/LiteFlowEditor/panels/toolBar/index.js +42 -0
- package/dist/LiteFlowEditor/panels/toolBar/index.module.less +19 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/check.d.ts +7 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/check.js +40 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/common/badge.d.ts +12 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/common/badge.js +46 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/common/makeBtnWidget.d.ts +15 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/common/makeBtnWidget.js +133 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/common/makeDropdownWidget.d.ts +14 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/common/makeDropdownWidget.js +38 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/fitWindow.d.ts +7 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/fitWindow.js +17 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/fullscreen.d.ts +4 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/fullscreen.js +104 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/global.less +6 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/index.d.ts +7 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/index.js +12 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/index.module.less +169 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/mock.d.ts +7 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/mock.js +83 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/redo.d.ts +7 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/redo.js +16 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/save.d.ts +7 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/save.js +12 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/selection.d.ts +7 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/selection.js +23 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/undo.d.ts +7 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/undo.js +16 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/view.d.ts +7 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/view.js +37 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/zoom.d.ts +7 -0
- package/dist/LiteFlowEditor/panels/toolBar/widgets/zoom.js +67 -0
- package/dist/LiteFlowEditor/utils/eventBus.d.ts +34 -0
- package/dist/LiteFlowEditor/utils/eventBus.js +86 -0
- package/dist/LiteFlowEditor/utils/flowChartUtils.d.ts +9 -0
- package/dist/LiteFlowEditor/utils/flowChartUtils.js +34 -0
- package/dist/LiteFlowEditor/utils/index.d.ts +33 -0
- package/dist/LiteFlowEditor/utils/index.js +245 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/package.json +97 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { useState, useReducer, useEffect } from 'react';
|
|
3
|
+
import { Breadcrumb } from 'antd';
|
|
4
|
+
import { HomeOutlined } from '@ant-design/icons';
|
|
5
|
+
import { getIconByType } from "../../cells";
|
|
6
|
+
import styles from "./index.module.less";
|
|
7
|
+
var BreadcrumbPath = function BreadcrumbPath(props) {
|
|
8
|
+
var flowGraph = props.flowGraph;
|
|
9
|
+
var _useState = useState(null),
|
|
10
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
11
|
+
selectedModel = _useState2[0],
|
|
12
|
+
setSelectedModel = _useState2[1];
|
|
13
|
+
var forceUpdate = useReducer(function (n) {
|
|
14
|
+
return n + 1;
|
|
15
|
+
}, 0)[1];
|
|
16
|
+
useEffect(function () {
|
|
17
|
+
var handler = function handler() {
|
|
18
|
+
setSelectedModel(null);
|
|
19
|
+
forceUpdate();
|
|
20
|
+
};
|
|
21
|
+
var handleSelect = function handleSelect(component) {
|
|
22
|
+
setSelectedModel(component);
|
|
23
|
+
};
|
|
24
|
+
flowGraph.on('settingBar:forceUpdate', handler);
|
|
25
|
+
flowGraph.on('model:select', handleSelect);
|
|
26
|
+
return function () {
|
|
27
|
+
flowGraph.off('settingBar:forceUpdate', handler);
|
|
28
|
+
flowGraph.off('model:select', handleSelect);
|
|
29
|
+
};
|
|
30
|
+
}, [flowGraph, setSelectedModel, forceUpdate]);
|
|
31
|
+
var nodes = flowGraph.getSelectedCells().filter(function (v) {
|
|
32
|
+
return !v.isEdge();
|
|
33
|
+
});
|
|
34
|
+
var parents = [];
|
|
35
|
+
if (selectedModel || nodes.length === 1) {
|
|
36
|
+
var currentModel = selectedModel || nodes[0].getData().model;
|
|
37
|
+
var nextModel = currentModel.proxy || currentModel;
|
|
38
|
+
while (nextModel) {
|
|
39
|
+
if (nextModel.parent) {
|
|
40
|
+
parents.splice(0, 0, nextModel);
|
|
41
|
+
}
|
|
42
|
+
nextModel = nextModel.parent;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
var handleSelectModel = function handleSelectModel(selectedModel) {
|
|
46
|
+
flowGraph.trigger('model:select', selectedModel);
|
|
47
|
+
};
|
|
48
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: styles.liteflowEditorBreadcrumb
|
|
50
|
+
}, /*#__PURE__*/React.createElement(Breadcrumb, null, /*#__PURE__*/React.createElement(Breadcrumb.Item, null, /*#__PURE__*/React.createElement(HomeOutlined, null)), parents.map(function (elNodeModel, index) {
|
|
51
|
+
var icon = getIconByType(elNodeModel.type);
|
|
52
|
+
var handleClick = function handleClick() {
|
|
53
|
+
flowGraph.cleanSelection();
|
|
54
|
+
flowGraph.select(elNodeModel.getNodes());
|
|
55
|
+
setSelectedModel(elNodeModel);
|
|
56
|
+
handleSelectModel(elNodeModel);
|
|
57
|
+
};
|
|
58
|
+
return /*#__PURE__*/React.createElement(Breadcrumb.Item, {
|
|
59
|
+
key: index,
|
|
60
|
+
onClick: handleClick
|
|
61
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
62
|
+
className: styles.liteflowEditorBreadcrumbIcon,
|
|
63
|
+
src: icon
|
|
64
|
+
}), /*#__PURE__*/React.createElement("span", null, elNodeModel.type));
|
|
65
|
+
})));
|
|
66
|
+
};
|
|
67
|
+
export default BreadcrumbPath;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.liteflowEditorBreadcrumb {
|
|
2
|
+
position: absolute;
|
|
3
|
+
left: 8px;
|
|
4
|
+
bottom: 12px;
|
|
5
|
+
height: 36px;
|
|
6
|
+
padding: 6px;
|
|
7
|
+
border-radius: 2px;
|
|
8
|
+
background-color: #fff;
|
|
9
|
+
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.25);
|
|
10
|
+
user-select: none;
|
|
11
|
+
.liteflowEditorBreadcrumbIcon {
|
|
12
|
+
width: 16px;
|
|
13
|
+
height: 16px;
|
|
14
|
+
margin-right: 4px;
|
|
15
|
+
margin-top: -4px;
|
|
16
|
+
}
|
|
17
|
+
:global {
|
|
18
|
+
.ant-breadcrumb-link {
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
color: rgba(0, 0, 0, 0.65);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Graph } from '@antv/x6';
|
|
3
|
+
interface IProps {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
scene: string;
|
|
7
|
+
visible: boolean;
|
|
8
|
+
flowGraph: Graph;
|
|
9
|
+
}
|
|
10
|
+
declare const FlowGraphContextMenu: React.FC<IProps>;
|
|
11
|
+
export default FlowGraphContextMenu;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import React, { useRef, useCallback } from 'react';
|
|
3
|
+
import styles from "./index.module.less";
|
|
4
|
+
import { Menu } from 'antd';
|
|
5
|
+
import useClickAway from "../../../hooks/useClickAway";
|
|
6
|
+
import { nodeMenuConfig, blankMenuConfig } from "./menuConfig";
|
|
7
|
+
var menuConfigMap = {
|
|
8
|
+
node: nodeMenuConfig,
|
|
9
|
+
blank: blankMenuConfig
|
|
10
|
+
};
|
|
11
|
+
var FlowGraphContextMenu = function FlowGraphContextMenu(props) {
|
|
12
|
+
var menuRef = useRef(null);
|
|
13
|
+
var x = props.x,
|
|
14
|
+
y = props.y,
|
|
15
|
+
scene = props.scene,
|
|
16
|
+
visible = props.visible,
|
|
17
|
+
flowGraph = props.flowGraph;
|
|
18
|
+
var menuConfig = menuConfigMap[scene];
|
|
19
|
+
useClickAway(function () {
|
|
20
|
+
return onClickAway();
|
|
21
|
+
}, menuRef);
|
|
22
|
+
var onClickAway = useCallback(function () {
|
|
23
|
+
return flowGraph.trigger('graph:hideContextMenu');
|
|
24
|
+
}, [flowGraph]);
|
|
25
|
+
var onClickMenu = useCallback(function (_ref) {
|
|
26
|
+
var key = _ref.key;
|
|
27
|
+
var handlerMap = Helper.makeMenuHandlerMap(menuConfig);
|
|
28
|
+
var handler = handlerMap[key];
|
|
29
|
+
if (handler) {
|
|
30
|
+
onClickAway();
|
|
31
|
+
handler(flowGraph);
|
|
32
|
+
}
|
|
33
|
+
}, [flowGraph, menuConfig]);
|
|
34
|
+
return !visible ? null : /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
ref: menuRef,
|
|
36
|
+
className: styles.liteflowEditorContextMenu,
|
|
37
|
+
style: {
|
|
38
|
+
left: x,
|
|
39
|
+
top: y
|
|
40
|
+
}
|
|
41
|
+
}, /*#__PURE__*/React.createElement(Menu, {
|
|
42
|
+
mode: 'vertical',
|
|
43
|
+
selectable: false,
|
|
44
|
+
onClick: onClickMenu
|
|
45
|
+
}, Helper.makeMenuContent(flowGraph, menuConfig)));
|
|
46
|
+
};
|
|
47
|
+
var Helper = {
|
|
48
|
+
makeMenuHandlerMap: function makeMenuHandlerMap(config) {
|
|
49
|
+
var queue = config.slice(0);
|
|
50
|
+
var handlerMap = {};
|
|
51
|
+
while (queue.length > 0) {
|
|
52
|
+
var _ref2 = queue.pop(),
|
|
53
|
+
_key = _ref2.key,
|
|
54
|
+
handler = _ref2.handler,
|
|
55
|
+
children = _ref2.children;
|
|
56
|
+
if (children && children.length > 0) {
|
|
57
|
+
queue.push.apply(queue, _toConsumableArray(children));
|
|
58
|
+
} else {
|
|
59
|
+
handlerMap[_key] = handler;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return handlerMap;
|
|
63
|
+
},
|
|
64
|
+
makeMenuContent: function makeMenuContent(flowGraph, menuConfig) {
|
|
65
|
+
var loop = function loop(config) {
|
|
66
|
+
return config.map(function (item) {
|
|
67
|
+
var content = null;
|
|
68
|
+
var key = item.key,
|
|
69
|
+
title = item.title,
|
|
70
|
+
icon = item.icon,
|
|
71
|
+
children = item.children,
|
|
72
|
+
_item$disabled = item.disabled,
|
|
73
|
+
disabled = _item$disabled === void 0 ? false : _item$disabled,
|
|
74
|
+
showDividerBehind = item.showDividerBehind;
|
|
75
|
+
if (typeof disabled === 'function') {
|
|
76
|
+
disabled = disabled(flowGraph);
|
|
77
|
+
}
|
|
78
|
+
if (children && children.length > 0) {
|
|
79
|
+
content = /*#__PURE__*/React.createElement(Menu.SubMenu, {
|
|
80
|
+
key: key,
|
|
81
|
+
icon: icon,
|
|
82
|
+
title: title,
|
|
83
|
+
disabled: disabled
|
|
84
|
+
}, loop(children));
|
|
85
|
+
} else {
|
|
86
|
+
content = /*#__PURE__*/React.createElement(Menu.Item, {
|
|
87
|
+
key: key,
|
|
88
|
+
icon: icon,
|
|
89
|
+
disabled: disabled
|
|
90
|
+
}, title);
|
|
91
|
+
}
|
|
92
|
+
return [content, showDividerBehind && /*#__PURE__*/React.createElement(Menu.Divider, null)];
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
return loop(menuConfig);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
export default FlowGraphContextMenu;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { shortcuts } from "../../../../common/shortcuts";
|
|
3
|
+
import { SnippetsOutlined } from '@ant-design/icons';
|
|
4
|
+
var blankMenuConfig = [{
|
|
5
|
+
key: 'selectAll',
|
|
6
|
+
title: '全选',
|
|
7
|
+
icon: /*#__PURE__*/React.createElement(SnippetsOutlined, null),
|
|
8
|
+
handler: shortcuts.selectAll.handler
|
|
9
|
+
}
|
|
10
|
+
// {
|
|
11
|
+
// key: 'paste',
|
|
12
|
+
// title: '粘贴',
|
|
13
|
+
// icon: <SnippetsOutlined />,
|
|
14
|
+
// disabled: (flowGraph: Graph) => flowGraph.isClipboardEmpty(),
|
|
15
|
+
// handler: shortcuts.paste.handler,
|
|
16
|
+
// },
|
|
17
|
+
];
|
|
18
|
+
export default blankMenuConfig;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DeleteOutlined } from '@ant-design/icons';
|
|
3
|
+
import { shortcuts } from "../../../../common/shortcuts";
|
|
4
|
+
var nodeMenuConfig = [{
|
|
5
|
+
key: 'delete',
|
|
6
|
+
title: '删除',
|
|
7
|
+
icon: /*#__PURE__*/React.createElement(DeleteOutlined, null),
|
|
8
|
+
handler: shortcuts.delete.handler
|
|
9
|
+
}];
|
|
10
|
+
export default nodeMenuConfig;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Edge, Node, Graph } from '@antv/x6';
|
|
3
|
+
interface IProps {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
edge?: Edge;
|
|
7
|
+
node?: Node;
|
|
8
|
+
scene?: IContextPadScene;
|
|
9
|
+
title?: string;
|
|
10
|
+
visible: boolean;
|
|
11
|
+
flowGraph: Graph;
|
|
12
|
+
}
|
|
13
|
+
declare const FlowGraphContextPad: React.FC<IProps>;
|
|
14
|
+
export default FlowGraphContextPad;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import React, { useRef, useCallback, useContext } from 'react';
|
|
2
|
+
import { message } from 'antd';
|
|
3
|
+
import useClickAway from "../../../hooks/useClickAway";
|
|
4
|
+
import { NODE_GROUP, SEQUENCE_GROUP,
|
|
5
|
+
// BRANCH_GROUP,
|
|
6
|
+
CONTROL_GROUP
|
|
7
|
+
// OTHER_GROUP,
|
|
8
|
+
} from "../../../cells";
|
|
9
|
+
import ELBuilder from "../../../model/builder";
|
|
10
|
+
import { history } from "../../../hooks/useHistory";
|
|
11
|
+
import styles from "./index.module.less";
|
|
12
|
+
import { useTranslation } from 'react-i18next';
|
|
13
|
+
import { GraphContext } from "../../../context/GraphContext";
|
|
14
|
+
var groups = [NODE_GROUP, SEQUENCE_GROUP, /*BRANCH_GROUP,*/CONTROL_GROUP /*OTHER_GROUP*/];
|
|
15
|
+
var FlowGraphContextPad = function FlowGraphContextPad(props) {
|
|
16
|
+
var menuRef = useRef(null);
|
|
17
|
+
var _useTranslation = useTranslation(),
|
|
18
|
+
t = _useTranslation.t;
|
|
19
|
+
var _useContext = useContext(GraphContext),
|
|
20
|
+
chainObject = _useContext.chainObject;
|
|
21
|
+
var x = props.x,
|
|
22
|
+
y = props.y,
|
|
23
|
+
visible = props.visible,
|
|
24
|
+
flowGraph = props.flowGraph,
|
|
25
|
+
edge = props.edge,
|
|
26
|
+
node = props.node,
|
|
27
|
+
_props$scene = props.scene,
|
|
28
|
+
scene = _props$scene === void 0 ? 'append' : _props$scene,
|
|
29
|
+
_props$title = props.title,
|
|
30
|
+
title = _props$title === void 0 ? t('insert_node') : _props$title;
|
|
31
|
+
useClickAway(function () {
|
|
32
|
+
return onClickAway();
|
|
33
|
+
}, menuRef);
|
|
34
|
+
var onClickAway = useCallback(function () {
|
|
35
|
+
return flowGraph.trigger('graph:hideContextPad');
|
|
36
|
+
}, [flowGraph]);
|
|
37
|
+
var onClickMenu = useCallback(function (cellType) {
|
|
38
|
+
if (edge) {
|
|
39
|
+
if (!chainObject.hasPermission) {
|
|
40
|
+
return message.warning(t('no_permission_tips_add_node'));
|
|
41
|
+
}
|
|
42
|
+
var targetNode = edge.getTargetNode();
|
|
43
|
+
var _ref = (targetNode === null || targetNode === void 0 ? void 0 : targetNode.getData()) || {},
|
|
44
|
+
targetModel = _ref.model;
|
|
45
|
+
var sourceNode = edge.getSourceNode();
|
|
46
|
+
var _ref2 = (sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.getData()) || {},
|
|
47
|
+
sourceModel = _ref2.model;
|
|
48
|
+
var inComingEdgesLength = (flowGraph.getIncomingEdges(targetNode) || []).length;
|
|
49
|
+
if (inComingEdgesLength > 1 || sourceModel && targetModel !== null && targetModel !== void 0 && targetModel.isParentOf(sourceModel)) {
|
|
50
|
+
sourceModel === null || sourceModel === void 0 || sourceModel.append(ELBuilder.createELNode(cellType.type, targetModel));
|
|
51
|
+
} else {
|
|
52
|
+
targetModel === null || targetModel === void 0 || targetModel.prepend(ELBuilder.createELNode(cellType.type, targetModel));
|
|
53
|
+
}
|
|
54
|
+
history.push();
|
|
55
|
+
} else if (node) {
|
|
56
|
+
var _ref3 = node.getData() || {},
|
|
57
|
+
model = _ref3.model;
|
|
58
|
+
if (scene === 'prepend') {
|
|
59
|
+
model.prepend(ELBuilder.createELNode(cellType.type, model));
|
|
60
|
+
} else if (scene === 'replace') {
|
|
61
|
+
model.replace(ELBuilder.createELNode(cellType.type, model));
|
|
62
|
+
} else {
|
|
63
|
+
model.append(ELBuilder.createELNode(cellType.type, model));
|
|
64
|
+
}
|
|
65
|
+
history.push();
|
|
66
|
+
}
|
|
67
|
+
onClickAway();
|
|
68
|
+
}, [flowGraph, edge, node]);
|
|
69
|
+
return !visible ? null : /*#__PURE__*/React.createElement("div", {
|
|
70
|
+
ref: menuRef,
|
|
71
|
+
className: styles.liteflowEditorContextPad,
|
|
72
|
+
style: {
|
|
73
|
+
left: x,
|
|
74
|
+
top: y
|
|
75
|
+
}
|
|
76
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
77
|
+
className: styles.liteflowEditorContextPadHeader
|
|
78
|
+
}, /*#__PURE__*/React.createElement("h3", {
|
|
79
|
+
className: styles.liteflowEditorContextPadTitle
|
|
80
|
+
}, t(title))), /*#__PURE__*/React.createElement("div", {
|
|
81
|
+
className: styles.liteflowEditorContextPadBody
|
|
82
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
83
|
+
className: styles.liteflowEditorContextPadResults
|
|
84
|
+
}, groups.map(function (group) {
|
|
85
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
key: group.key,
|
|
87
|
+
className: styles.liteflowEditorContextPadGroup
|
|
88
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
89
|
+
className: styles.liteflowEditorContextPadGroupName
|
|
90
|
+
}, t(group.name)), /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
className: styles.liteflowEditorContextPadGroupItems
|
|
92
|
+
}, group.cellTypes.map(function (cellType, index) {
|
|
93
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
94
|
+
key: index,
|
|
95
|
+
className: styles.liteflowEditorContextPadGroupItem,
|
|
96
|
+
onClick: function onClick() {
|
|
97
|
+
onClickMenu(cellType);
|
|
98
|
+
}
|
|
99
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
100
|
+
className: styles.liteflowEditorContextPadGroupItemIcon,
|
|
101
|
+
src: cellType.icon
|
|
102
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
103
|
+
className: styles.liteflowEditorContextPadGroupItemLabel
|
|
104
|
+
}, t(cellType.label)));
|
|
105
|
+
})));
|
|
106
|
+
}))));
|
|
107
|
+
};
|
|
108
|
+
export default FlowGraphContextPad;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
.liteflowEditorContextPad {
|
|
2
|
+
z-index: 1003;
|
|
3
|
+
position: fixed;
|
|
4
|
+
min-width: 200px;
|
|
5
|
+
box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
6
|
+
0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05) !important;
|
|
7
|
+
background: #fff;
|
|
8
|
+
text-align: left !important;
|
|
9
|
+
.liteflowEditorContextPadHeader {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: stretch;
|
|
12
|
+
line-height: 20px;
|
|
13
|
+
margin: 10px 12px 10px 12px;
|
|
14
|
+
.liteflowEditorContextPadTitle {
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
text-overflow: ellipsis;
|
|
17
|
+
white-space: nowrap;
|
|
18
|
+
font-size: 14px;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
.liteflowEditorContextPadBody {
|
|
22
|
+
.liteflowEditorContextPadSearch {
|
|
23
|
+
margin: 10px 12px;
|
|
24
|
+
}
|
|
25
|
+
.liteflowEditorContextPadResults {
|
|
26
|
+
margin: 7px 3px 7px 12px;
|
|
27
|
+
max-height: 280px;
|
|
28
|
+
overflow: auto;
|
|
29
|
+
padding-right: 9px;
|
|
30
|
+
.liteflowEditorContextPadGroup {
|
|
31
|
+
.liteflowEditorContextPadGroupName {
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
text-overflow: ellipsis;
|
|
34
|
+
white-space: nowrap;
|
|
35
|
+
color: rgba(0, 0, 0, 0.45);
|
|
36
|
+
font-size: 12px;
|
|
37
|
+
padding: 5px 12px;
|
|
38
|
+
min-height: 32px;
|
|
39
|
+
}
|
|
40
|
+
.liteflowEditorContextPadGroupItems {
|
|
41
|
+
.liteflowEditorContextPadGroupItem {
|
|
42
|
+
display: flex;
|
|
43
|
+
min-height: 32px;
|
|
44
|
+
padding: 5px 12px;
|
|
45
|
+
color: rgba(0, 0, 0, 0.88);
|
|
46
|
+
font-size: 14px;
|
|
47
|
+
line-height: 1.5;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
&:hover {
|
|
50
|
+
background-color: rgba(0, 0, 0, 0.04);
|
|
51
|
+
}
|
|
52
|
+
.liteflowEditorContextPadGroupItemIcon {
|
|
53
|
+
margin-right: 8px;
|
|
54
|
+
}
|
|
55
|
+
.liteflowEditorContextPadGroupItemLabel {
|
|
56
|
+
flex: auto;
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
white-space: nowrap;
|
|
59
|
+
text-overflow: ellipsis;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
:global {
|
|
67
|
+
*::-webkit-scrollbar {
|
|
68
|
+
width: 6px;
|
|
69
|
+
}
|
|
70
|
+
*::-webkit-scrollbar-thumb {
|
|
71
|
+
border-radius: 3px;
|
|
72
|
+
background-color: rgba(0, 0, 0, 0.2);
|
|
73
|
+
}
|
|
74
|
+
*::-webkit-scrollbar-track {
|
|
75
|
+
box-shadow: none;
|
|
76
|
+
background: transparent;
|
|
77
|
+
margin: 0;
|
|
78
|
+
padding: 5px;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import { Button } from 'antd';
|
|
4
|
+
import { Graph, NodeView } from '@antv/x6';
|
|
5
|
+
import { debounce } from 'lodash';
|
|
6
|
+
import { MIN_ZOOM, MAX_ZOOM, NODE_TYPE_START, NODE_TYPE_END, NODE_TYPE_INTERMEDIATE_END } from "../../constant";
|
|
7
|
+
// import MiniMapSimpleNode from './miniMapSimpleNode';
|
|
8
|
+
import { LITEFLOW_ANCHOR, LITEFLOW_ROUTER, registerEvents, registerShortcuts } from "../../common";
|
|
9
|
+
var createFlowChart = function createFlowChart(container, miniMapContainer) {
|
|
10
|
+
var flowGraph = new Graph({
|
|
11
|
+
autoResize: true,
|
|
12
|
+
container: container,
|
|
13
|
+
rotating: false,
|
|
14
|
+
resizing: false,
|
|
15
|
+
onEdgeLabelRendered: function onEdgeLabelRendered(args) {
|
|
16
|
+
var edge = args.edge,
|
|
17
|
+
selectors = args.selectors,
|
|
18
|
+
label = args.label;
|
|
19
|
+
// console.log('onEdgeLabelRendered', edge, selectors, label);
|
|
20
|
+
var content = selectors.foContent;
|
|
21
|
+
if (content) {
|
|
22
|
+
var _label$attrs;
|
|
23
|
+
content.style.display = 'flex';
|
|
24
|
+
content.style.alignItems = 'center';
|
|
25
|
+
content.style.justifyContent = 'center';
|
|
26
|
+
content.style.overflow = 'hidden';
|
|
27
|
+
if ((label === null || label === void 0 || (_label$attrs = label.attrs) === null || _label$attrs === void 0 ? void 0 : _label$attrs.label.text) === '+') {
|
|
28
|
+
var showContextPad = debounce(function (info) {
|
|
29
|
+
flowGraph.trigger('graph:showContextPad', info);
|
|
30
|
+
}, 100);
|
|
31
|
+
var handleOnClick = function handleOnClick(event) {
|
|
32
|
+
showContextPad({
|
|
33
|
+
x: event.clientX,
|
|
34
|
+
y: event.clientY,
|
|
35
|
+
edge: edge
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(Button, {
|
|
39
|
+
size: "small",
|
|
40
|
+
onClick: handleOnClick,
|
|
41
|
+
className: "liteflow-edge-add-button"
|
|
42
|
+
}, "+"), content);
|
|
43
|
+
} else {
|
|
44
|
+
var _label$attrs2;
|
|
45
|
+
content.appendChild(document.createTextNode((label === null || label === void 0 || (_label$attrs2 = label.attrs) === null || _label$attrs2 === void 0 ? void 0 : _label$attrs2.label.text) + ''));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
// https://x6.antv.vision/zh/docs/tutorial/basic/clipboard
|
|
50
|
+
// clipboard: {
|
|
51
|
+
// enabled: true,
|
|
52
|
+
// useLocalStorage: true,
|
|
53
|
+
// },
|
|
54
|
+
// https://x6.antv.vision/zh/docs/tutorial/intermediate/connector
|
|
55
|
+
connecting: {
|
|
56
|
+
snap: true,
|
|
57
|
+
allowBlank: false,
|
|
58
|
+
allowLoop: false,
|
|
59
|
+
allowNode: false,
|
|
60
|
+
allowEdge: false,
|
|
61
|
+
dangling: true,
|
|
62
|
+
highlight: true,
|
|
63
|
+
anchor: LITEFLOW_ANCHOR,
|
|
64
|
+
// LITEFLOW_ANCHOR, // 'center',
|
|
65
|
+
connectionPoint: 'bbox',
|
|
66
|
+
connector: {
|
|
67
|
+
name: 'rounded',
|
|
68
|
+
//两条线交叉时,出现线桥。
|
|
69
|
+
args: {
|
|
70
|
+
radius: 8
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
router: LITEFLOW_ROUTER,
|
|
74
|
+
// LITEFLOW_ROUTER, // 'normal',
|
|
75
|
+
validateEdge: function validateEdge(args) {
|
|
76
|
+
var _edge$target;
|
|
77
|
+
var edge = args.edge;
|
|
78
|
+
return !!(edge !== null && edge !== void 0 && (_edge$target = edge.target) !== null && _edge$target !== void 0 && _edge$target.port);
|
|
79
|
+
},
|
|
80
|
+
validateConnection: function validateConnection(_ref) {
|
|
81
|
+
var sourceView = _ref.sourceView,
|
|
82
|
+
targetView = _ref.targetView,
|
|
83
|
+
sourceMagnet = _ref.sourceMagnet,
|
|
84
|
+
targetMagnet = _ref.targetMagnet;
|
|
85
|
+
if (!sourceMagnet) {
|
|
86
|
+
return false;
|
|
87
|
+
} else if (!targetMagnet) {
|
|
88
|
+
return false;
|
|
89
|
+
} else {
|
|
90
|
+
return sourceView !== targetView;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
// https://x6.antv.vision/zh/docs/tutorial/basic/background
|
|
95
|
+
background: {
|
|
96
|
+
color: '#f4f7fc'
|
|
97
|
+
},
|
|
98
|
+
// https://x6.antv.vision/zh/docs/tutorial/basic/grid
|
|
99
|
+
grid: {
|
|
100
|
+
visible: true
|
|
101
|
+
},
|
|
102
|
+
// https://x6.antv.vision/zh/docs/tutorial/basic/selection
|
|
103
|
+
selecting: {
|
|
104
|
+
enabled: true,
|
|
105
|
+
rubberband: false,
|
|
106
|
+
// 启用框选
|
|
107
|
+
movable: true,
|
|
108
|
+
multiple: true,
|
|
109
|
+
strict: true,
|
|
110
|
+
showNodeSelectionBox: true,
|
|
111
|
+
selectNodeOnMoved: true,
|
|
112
|
+
pointerEvents: 'none',
|
|
113
|
+
filter: function filter(cell) {
|
|
114
|
+
var noShapeList = [NODE_TYPE_START, NODE_TYPE_END, NODE_TYPE_INTERMEDIATE_END, 'WHEN'];
|
|
115
|
+
return cell.isNode() && !noShapeList.includes(cell.shape);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
// https://x6.antv.vision/zh/docs/tutorial/basic/snapline
|
|
119
|
+
snapline: {
|
|
120
|
+
enabled: true,
|
|
121
|
+
clean: 100
|
|
122
|
+
},
|
|
123
|
+
// https://x6.antv.vision/zh/docs/tutorial/basic/keyboard
|
|
124
|
+
keyboard: {
|
|
125
|
+
enabled: true,
|
|
126
|
+
global: false
|
|
127
|
+
},
|
|
128
|
+
// https://x6.antv.vision/zh/docs/tutorial/basic/history
|
|
129
|
+
history: {
|
|
130
|
+
enabled: true,
|
|
131
|
+
beforeAddCommand: function beforeAddCommand(event, args) {
|
|
132
|
+
if (args.options) {
|
|
133
|
+
return args.options.ignore !== true;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
// https://x6.antv.vision/zh/docs/tutorial/basic/minimap
|
|
138
|
+
minimap: {
|
|
139
|
+
width: 150,
|
|
140
|
+
height: 150,
|
|
141
|
+
minScale: MIN_ZOOM,
|
|
142
|
+
maxScale: MAX_ZOOM,
|
|
143
|
+
enabled: true,
|
|
144
|
+
scalable: false,
|
|
145
|
+
container: miniMapContainer,
|
|
146
|
+
graphOptions: {
|
|
147
|
+
async: true,
|
|
148
|
+
getCellView: function getCellView(cell) {
|
|
149
|
+
if (cell.isNode()) {
|
|
150
|
+
return NodeView.registry.get('react-shape-view');
|
|
151
|
+
// return MiniMapSimpleNode;
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
createCellView: function createCellView(cell) {
|
|
155
|
+
if (cell.isEdge()) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
// https://x6.antv.vision/zh/docs/tutorial/basic/scroller
|
|
162
|
+
scroller: {
|
|
163
|
+
enabled: true,
|
|
164
|
+
pageVisible: false,
|
|
165
|
+
pageBreak: false,
|
|
166
|
+
pannable: true,
|
|
167
|
+
autoResize: true
|
|
168
|
+
},
|
|
169
|
+
mousewheel: {
|
|
170
|
+
enabled: true,
|
|
171
|
+
minScale: MIN_ZOOM,
|
|
172
|
+
maxScale: MAX_ZOOM,
|
|
173
|
+
modifiers: ['ctrl', 'meta']
|
|
174
|
+
},
|
|
175
|
+
// embedding: {
|
|
176
|
+
// enabled: true,
|
|
177
|
+
// findParent({ node }) {
|
|
178
|
+
// const bbox = node.getBBox();
|
|
179
|
+
// return this.getNodes().filter((grahpNode) => {
|
|
180
|
+
// const nodeData = grahpNode.getData();
|
|
181
|
+
// if (nodeData && nodeData.parent) {
|
|
182
|
+
// const targetBBox = grahpNode.getBBox();
|
|
183
|
+
// return bbox.isIntersectWithRect(targetBBox);
|
|
184
|
+
// }
|
|
185
|
+
// return false;
|
|
186
|
+
// });
|
|
187
|
+
// },
|
|
188
|
+
// frontOnly: false,
|
|
189
|
+
// },
|
|
190
|
+
interacting: {
|
|
191
|
+
nodeMovable: true,
|
|
192
|
+
edgeLabelMovable: false
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
registerEvents(flowGraph);
|
|
196
|
+
registerShortcuts(flowGraph);
|
|
197
|
+
return flowGraph;
|
|
198
|
+
};
|
|
199
|
+
export default createFlowChart;
|