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,338 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
6
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
8
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
|
+
import { Node, Edge } from '@antv/x6';
|
|
10
|
+
import ELNode from "../node";
|
|
11
|
+
import { ELStartNode, ELEndNode, ELVirtualNode } from "../utils";
|
|
12
|
+
import { ConditionTypeEnum, LITEFLOW_EDGE, NODE_TYPE_INTERMEDIATE_END, NodeTypeEnum } from "../../constant";
|
|
13
|
+
import NodeOperator from "./node-operator";
|
|
14
|
+
import IntermediateErrorBoundaryIcon from "../../assets/intermediate-event-catch-error.svg";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 捕获异常操作符:CATCH。
|
|
18
|
+
*
|
|
19
|
+
* 例如一个捕获异常(CATCH)示例:
|
|
20
|
+
* (1) EL表达式语法:CATCH(THEN(a, b)).DO(c)
|
|
21
|
+
* (2) JSON表示形式:
|
|
22
|
+
* {
|
|
23
|
+
type: ConditionTypeEnum.CATCH,
|
|
24
|
+
condition: {
|
|
25
|
+
type: NodeTypeEnum.THEN,
|
|
26
|
+
children: [
|
|
27
|
+
{ type: NodeTypeEnum.COMMON, id: 'a' },
|
|
28
|
+
{ type: NodeTypeEnum.COMMON, id: 'b' }
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
children: [
|
|
32
|
+
{ type: NodeTypeEnum.COMMON, id: 'c' }
|
|
33
|
+
],
|
|
34
|
+
}
|
|
35
|
+
* (3) 通过ELNode节点模型进行表示的组合关系为:
|
|
36
|
+
┌─────────────────┐ ┌─────────────────┐
|
|
37
|
+
┌──▶│ ThenOperator │──┌──▶│ NodeOperator │
|
|
38
|
+
┌─────────┐ ┌─────────────────┐ │ └─────────────────┘ │ └─────────────────┘
|
|
39
|
+
│ Chain │───▶│ CatchOperator │──┤ ┌─────────────────┐ │ ┌─────────────────┐
|
|
40
|
+
└─────────┘ └─────────────────┘ └──▶│ NodeOperator │ └──▶│ NodeOperator │
|
|
41
|
+
└─────────────────┘ └─────────────────┘
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
*/
|
|
45
|
+
var CatchOperator = /*#__PURE__*/function (_ELNode) {
|
|
46
|
+
_inherits(CatchOperator, _ELNode);
|
|
47
|
+
var _super = _createSuper(CatchOperator);
|
|
48
|
+
function CatchOperator(parent, condition, children, properties) {
|
|
49
|
+
var _this;
|
|
50
|
+
_classCallCheck(this, CatchOperator);
|
|
51
|
+
_this = _super.call(this);
|
|
52
|
+
_defineProperty(_assertThisInitialized(_this), "type", ConditionTypeEnum.CATCH);
|
|
53
|
+
_defineProperty(_assertThisInitialized(_this), "parent", void 0);
|
|
54
|
+
_defineProperty(_assertThisInitialized(_this), "condition", new NodeOperator(_assertThisInitialized(_this), NodeTypeEnum.COMMON, 'x'));
|
|
55
|
+
_defineProperty(_assertThisInitialized(_this), "children", []);
|
|
56
|
+
_defineProperty(_assertThisInitialized(_this), "properties", void 0);
|
|
57
|
+
_defineProperty(_assertThisInitialized(_this), "startNode", void 0);
|
|
58
|
+
_defineProperty(_assertThisInitialized(_this), "endNode", void 0);
|
|
59
|
+
_this.parent = parent;
|
|
60
|
+
if (condition) {
|
|
61
|
+
_this.condition = condition;
|
|
62
|
+
}
|
|
63
|
+
if (children) {
|
|
64
|
+
_this.children = children;
|
|
65
|
+
}
|
|
66
|
+
_this.properties = properties;
|
|
67
|
+
return _this;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 创建新的节点
|
|
72
|
+
* @param parent 新节点的父节点
|
|
73
|
+
* @param type 新节点的子节点类型
|
|
74
|
+
*/
|
|
75
|
+
_createClass(CatchOperator, [{
|
|
76
|
+
key: "toCells",
|
|
77
|
+
value:
|
|
78
|
+
/**
|
|
79
|
+
* 转换为X6的图数据格式
|
|
80
|
+
*/
|
|
81
|
+
function toCells() {
|
|
82
|
+
var _this2 = this;
|
|
83
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
84
|
+
this.resetCells();
|
|
85
|
+
var condition = this.condition,
|
|
86
|
+
children = this.children,
|
|
87
|
+
cells = this.cells;
|
|
88
|
+
var start = Node.create({
|
|
89
|
+
shape: ConditionTypeEnum.CATCH,
|
|
90
|
+
attrs: {
|
|
91
|
+
label: {
|
|
92
|
+
text: ''
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
portMarkup: [{
|
|
96
|
+
tagName: 'image',
|
|
97
|
+
selector: 'circle',
|
|
98
|
+
attrs: {
|
|
99
|
+
x: -6,
|
|
100
|
+
y: -6,
|
|
101
|
+
width: 12,
|
|
102
|
+
height: 12,
|
|
103
|
+
'xlink:href': IntermediateErrorBoundaryIcon
|
|
104
|
+
}
|
|
105
|
+
}],
|
|
106
|
+
ports: {
|
|
107
|
+
groups: {
|
|
108
|
+
bottom: {
|
|
109
|
+
position: {
|
|
110
|
+
name: 'bottom'
|
|
111
|
+
},
|
|
112
|
+
zIndex: 1
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
items: [{
|
|
116
|
+
group: 'bottom',
|
|
117
|
+
id: 'bottom'
|
|
118
|
+
}]
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
start.setData({
|
|
122
|
+
model: new ELStartNode(this),
|
|
123
|
+
toolbar: {
|
|
124
|
+
prepend: true,
|
|
125
|
+
append: true,
|
|
126
|
+
delete: true,
|
|
127
|
+
replace: true,
|
|
128
|
+
collapse: true
|
|
129
|
+
}
|
|
130
|
+
}, {
|
|
131
|
+
overwrite: true
|
|
132
|
+
});
|
|
133
|
+
cells.push(this.addNode(start));
|
|
134
|
+
this.startNode = start;
|
|
135
|
+
if (!this.collapsed) {
|
|
136
|
+
var end = Node.create({
|
|
137
|
+
shape: NODE_TYPE_INTERMEDIATE_END,
|
|
138
|
+
attrs: {
|
|
139
|
+
label: {
|
|
140
|
+
text: ''
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
end.setData({
|
|
145
|
+
model: new ELEndNode(this)
|
|
146
|
+
}, {
|
|
147
|
+
overwrite: true
|
|
148
|
+
});
|
|
149
|
+
cells.push(this.addNode(end));
|
|
150
|
+
this.endNode = end;
|
|
151
|
+
[condition].concat(_toConsumableArray(children)).forEach(function (item, index) {
|
|
152
|
+
var next = item || NodeOperator.create(_this2, NodeTypeEnum.VIRTUAL, ' ');
|
|
153
|
+
next.toCells(options);
|
|
154
|
+
var nextStartNode = next.getStartNode();
|
|
155
|
+
cells.push(Edge.create({
|
|
156
|
+
shape: LITEFLOW_EDGE,
|
|
157
|
+
source: start.id,
|
|
158
|
+
target: nextStartNode.id,
|
|
159
|
+
label: index === 1 ? '异常' : ' ',
|
|
160
|
+
defaultLabel: {
|
|
161
|
+
position: {
|
|
162
|
+
distance: 0.3
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}));
|
|
166
|
+
var nextEndNode = next.getEndNode();
|
|
167
|
+
cells.push(Edge.create({
|
|
168
|
+
shape: LITEFLOW_EDGE,
|
|
169
|
+
source: nextEndNode.id,
|
|
170
|
+
target: end.id,
|
|
171
|
+
label: ' '
|
|
172
|
+
}));
|
|
173
|
+
if (!item) {
|
|
174
|
+
nextStartNode.setData({
|
|
175
|
+
model: new ELVirtualNode(_this2, index, next),
|
|
176
|
+
toolbar: {
|
|
177
|
+
prepend: false,
|
|
178
|
+
append: false,
|
|
179
|
+
delete: false,
|
|
180
|
+
replace: true
|
|
181
|
+
}
|
|
182
|
+
}, {
|
|
183
|
+
overwrite: true
|
|
184
|
+
});
|
|
185
|
+
cells.push(_this2.addNode(nextStartNode));
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
return this.getCells();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* 获取当前X6 Cell内容
|
|
194
|
+
*/
|
|
195
|
+
}, {
|
|
196
|
+
key: "getCells",
|
|
197
|
+
value: function getCells() {
|
|
198
|
+
var cells = _toConsumableArray(this.cells);
|
|
199
|
+
if (this.condition && !this.collapsed) {
|
|
200
|
+
cells = cells.concat(this.condition.getCells());
|
|
201
|
+
}
|
|
202
|
+
if (this.children && this.children.length && !this.collapsed) {
|
|
203
|
+
this.children.forEach(function (child) {
|
|
204
|
+
cells = cells.concat(child.getCells());
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
return cells;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* 在后面添加子节点
|
|
212
|
+
* @param newNode 子节点
|
|
213
|
+
* @param index 指定位置:可以是索引,也可以是兄弟节点
|
|
214
|
+
*/
|
|
215
|
+
}, {
|
|
216
|
+
key: "appendChild",
|
|
217
|
+
value: function appendChild(newNode, index) {
|
|
218
|
+
newNode.parent = this;
|
|
219
|
+
// 没有condition节点,则优先添加为condition节点
|
|
220
|
+
if (!this.condition) {
|
|
221
|
+
this.condition = newNode;
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
if (this.children) {
|
|
225
|
+
// 尝试在父节点中添加新节点
|
|
226
|
+
if (typeof index === 'number') {
|
|
227
|
+
// 1. 如果有索引
|
|
228
|
+
this.children[0] = newNode;
|
|
229
|
+
return true;
|
|
230
|
+
}
|
|
231
|
+
if (index) {
|
|
232
|
+
// 2. 如果有目标节点
|
|
233
|
+
var _index = this.children.indexOf(index);
|
|
234
|
+
if (_index !== -1) {
|
|
235
|
+
this.children[0] = newNode;
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
// 3. 如果是在condition之后追加
|
|
239
|
+
if (this.condition === index) {
|
|
240
|
+
this.condition = newNode;
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
// 4. 否则直接插入
|
|
245
|
+
this.children[0] = newNode;
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* 在后面添加子节点
|
|
253
|
+
* @param newNode 子节点
|
|
254
|
+
* @param index 指定位置:可以是索引,也可以是兄弟节点
|
|
255
|
+
*/
|
|
256
|
+
}, {
|
|
257
|
+
key: "prependChild",
|
|
258
|
+
value: function prependChild(newNode, index) {
|
|
259
|
+
newNode.parent = this;
|
|
260
|
+
// 没有condition节点,则优先添加为condition节点
|
|
261
|
+
if (!this.condition) {
|
|
262
|
+
this.condition = newNode;
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
if (this.children) {
|
|
266
|
+
// 尝试在父节点中添加新节点
|
|
267
|
+
if (typeof index === 'number') {
|
|
268
|
+
// 1. 如果有索引
|
|
269
|
+
this.children[0] = newNode;
|
|
270
|
+
return true;
|
|
271
|
+
}
|
|
272
|
+
if (index) {
|
|
273
|
+
// 2. 如果有目标节点
|
|
274
|
+
var _index = this.children.indexOf(index);
|
|
275
|
+
if (_index !== -1) {
|
|
276
|
+
this.children[0] = newNode;
|
|
277
|
+
return true;
|
|
278
|
+
}
|
|
279
|
+
if (this.condition === index) {
|
|
280
|
+
// 3. 如果是在condition之前追加
|
|
281
|
+
this.condition = newNode;
|
|
282
|
+
return true;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
// 4. 否则直接插入
|
|
286
|
+
this.children[0] = newNode;
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* 删除指定的子节点
|
|
294
|
+
* @param child 子节点
|
|
295
|
+
*/
|
|
296
|
+
}, {
|
|
297
|
+
key: "removeChild",
|
|
298
|
+
value: function removeChild(child) {
|
|
299
|
+
if (this.children) {
|
|
300
|
+
var _index2 = this.children.indexOf(child);
|
|
301
|
+
if (_index2 !== -1) {
|
|
302
|
+
this.children.splice(_index2, 1);
|
|
303
|
+
return true;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
if (this.condition && this.condition === child) {
|
|
307
|
+
this.condition = undefined;
|
|
308
|
+
return true;
|
|
309
|
+
}
|
|
310
|
+
return false;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* 转换为EL表达式字符串
|
|
315
|
+
*/
|
|
316
|
+
}, {
|
|
317
|
+
key: "toEL",
|
|
318
|
+
value: function toEL() {
|
|
319
|
+
var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
320
|
+
var catchNode = this.condition;
|
|
321
|
+
var _this$children = _slicedToArray(this.children, 1),
|
|
322
|
+
doNode = _this$children[0];
|
|
323
|
+
if (prefix) {
|
|
324
|
+
return "".concat(prefix, "CATCH(\n").concat(catchNode ? catchNode.toEL("".concat(prefix, " ")) : '', "\n").concat(prefix, ")").concat(doNode ? ".DO(\n".concat(doNode.toEL("".concat(prefix, " ")), "\n").concat(prefix, ")") : '').concat(this.propertiesToEL());
|
|
325
|
+
}
|
|
326
|
+
return "CATCH(".concat(catchNode ? catchNode.toEL() : '', ")").concat(doNode ? ".DO(".concat(doNode.toEL(), ")") : '').concat(this.propertiesToEL());
|
|
327
|
+
}
|
|
328
|
+
}], [{
|
|
329
|
+
key: "create",
|
|
330
|
+
value: function create(parent, type) {
|
|
331
|
+
var newNode = new CatchOperator(parent);
|
|
332
|
+
newNode.appendChild(NodeOperator.create(newNode, type));
|
|
333
|
+
return newNode;
|
|
334
|
+
}
|
|
335
|
+
}]);
|
|
336
|
+
return CatchOperator;
|
|
337
|
+
}(ELNode);
|
|
338
|
+
export { CatchOperator as default };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Cell, Node } from '@antv/x6';
|
|
2
|
+
import ELNode, { Properties } from '../node';
|
|
3
|
+
import { ConditionTypeEnum, NodeTypeEnum } from '../../constant';
|
|
4
|
+
/**
|
|
5
|
+
* 子流程操作符:CHAIN。
|
|
6
|
+
*
|
|
7
|
+
* 例如一个子流程(CHAIN)示例:
|
|
8
|
+
* (1) EL表达式语法:t1 = THEN(a, b, c)
|
|
9
|
+
* (2) JSON表示形式:
|
|
10
|
+
* {
|
|
11
|
+
type: ConditionTypeEnum.CHAIN,
|
|
12
|
+
id: 't1',
|
|
13
|
+
children: [
|
|
14
|
+
{ type: NodeTypeEnum.COMMON, id: 'a' },
|
|
15
|
+
{ type: NodeTypeEnum.COMMON, id: 'b' },,
|
|
16
|
+
{ type: NodeTypeEnum.COMMON, id: 'c' },
|
|
17
|
+
],
|
|
18
|
+
}
|
|
19
|
+
* (3) 通过ELNode节点模型进行表示的组合关系为:
|
|
20
|
+
┌─────────────────┐
|
|
21
|
+
┌──▶│ NodeOperator │
|
|
22
|
+
┌─────────┐ ┌─────────────────┐ │ └─────────────────┘
|
|
23
|
+
│ Chain │───▶│ ChainOperator │──┤ ┌─────────────────┐
|
|
24
|
+
└─────────┘ └─────────────────┘ ├──▶│ NodeOperator │
|
|
25
|
+
│ └─────────────────┘
|
|
26
|
+
│ ┌─────────────────┐
|
|
27
|
+
└──▶│ NodeOperator │
|
|
28
|
+
└─────────────────┘
|
|
29
|
+
*/
|
|
30
|
+
export default class ChainOperator extends ELNode {
|
|
31
|
+
type: ConditionTypeEnum;
|
|
32
|
+
parent?: ELNode;
|
|
33
|
+
children: ELNode[];
|
|
34
|
+
properties?: Properties;
|
|
35
|
+
startNode?: Node;
|
|
36
|
+
endNode?: Node;
|
|
37
|
+
id?: string;
|
|
38
|
+
constructor(parent?: ELNode, id?: string, children?: ELNode[], properties?: Properties);
|
|
39
|
+
/**
|
|
40
|
+
* 创建新的节点
|
|
41
|
+
* @param parent 新节点的父节点
|
|
42
|
+
* @param type 新节点的子节点类型
|
|
43
|
+
*/
|
|
44
|
+
static create(parent?: ELNode, type?: NodeTypeEnum): ELNode;
|
|
45
|
+
/**
|
|
46
|
+
* 转换为X6的图数据格式
|
|
47
|
+
*/
|
|
48
|
+
toCells(options?: Record<string, any>): Cell[];
|
|
49
|
+
/**
|
|
50
|
+
* 转换为EL表达式字符串
|
|
51
|
+
*/
|
|
52
|
+
toEL(prefix?: string): string;
|
|
53
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import _get from "@babel/runtime/helpers/esm/get";
|
|
7
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
8
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
|
+
import { Node, Edge } from '@antv/x6';
|
|
10
|
+
import ELNode from "../node";
|
|
11
|
+
import { ELStartNode, ELEndNode } from "../utils";
|
|
12
|
+
import { ConditionTypeEnum, LITEFLOW_EDGE, NODE_TYPE_INTERMEDIATE_END } from "../../constant";
|
|
13
|
+
import NodeOperator from "./node-operator";
|
|
14
|
+
import i18n from "../../i18n";
|
|
15
|
+
/**
|
|
16
|
+
* 子流程操作符:CHAIN。
|
|
17
|
+
*
|
|
18
|
+
* 例如一个子流程(CHAIN)示例:
|
|
19
|
+
* (1) EL表达式语法:t1 = THEN(a, b, c)
|
|
20
|
+
* (2) JSON表示形式:
|
|
21
|
+
* {
|
|
22
|
+
type: ConditionTypeEnum.CHAIN,
|
|
23
|
+
id: 't1',
|
|
24
|
+
children: [
|
|
25
|
+
{ type: NodeTypeEnum.COMMON, id: 'a' },
|
|
26
|
+
{ type: NodeTypeEnum.COMMON, id: 'b' },,
|
|
27
|
+
{ type: NodeTypeEnum.COMMON, id: 'c' },
|
|
28
|
+
],
|
|
29
|
+
}
|
|
30
|
+
* (3) 通过ELNode节点模型进行表示的组合关系为:
|
|
31
|
+
┌─────────────────┐
|
|
32
|
+
┌──▶│ NodeOperator │
|
|
33
|
+
┌─────────┐ ┌─────────────────┐ │ └─────────────────┘
|
|
34
|
+
│ Chain │───▶│ ChainOperator │──┤ ┌─────────────────┐
|
|
35
|
+
└─────────┘ └─────────────────┘ ├──▶│ NodeOperator │
|
|
36
|
+
│ └─────────────────┘
|
|
37
|
+
│ ┌─────────────────┐
|
|
38
|
+
└──▶│ NodeOperator │
|
|
39
|
+
└─────────────────┘
|
|
40
|
+
*/
|
|
41
|
+
var ChainOperator = /*#__PURE__*/function (_ELNode) {
|
|
42
|
+
_inherits(ChainOperator, _ELNode);
|
|
43
|
+
var _super = _createSuper(ChainOperator);
|
|
44
|
+
function ChainOperator(parent, id, children, properties) {
|
|
45
|
+
var _thisSuper, _this;
|
|
46
|
+
_classCallCheck(this, ChainOperator);
|
|
47
|
+
_this = _super.call(this);
|
|
48
|
+
_defineProperty(_assertThisInitialized(_this), "type", ConditionTypeEnum.CHAIN);
|
|
49
|
+
_defineProperty(_assertThisInitialized(_this), "parent", void 0);
|
|
50
|
+
_defineProperty(_assertThisInitialized(_this), "children", []);
|
|
51
|
+
_defineProperty(_assertThisInitialized(_this), "properties", void 0);
|
|
52
|
+
_defineProperty(_assertThisInitialized(_this), "startNode", void 0);
|
|
53
|
+
_defineProperty(_assertThisInitialized(_this), "endNode", void 0);
|
|
54
|
+
_defineProperty(_assertThisInitialized(_this), "id", void 0);
|
|
55
|
+
_this.parent = parent;
|
|
56
|
+
_this.id = id || i18n.t('empty_node');
|
|
57
|
+
if (children) {
|
|
58
|
+
_this.children = children;
|
|
59
|
+
}
|
|
60
|
+
_this.properties = properties;
|
|
61
|
+
_get((_thisSuper = _assertThisInitialized(_this), _getPrototypeOf(ChainOperator.prototype)), "toggleCollapse", _thisSuper).call(_thisSuper, true);
|
|
62
|
+
return _this;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 创建新的节点
|
|
67
|
+
* @param parent 新节点的父节点
|
|
68
|
+
* @param type 新节点的子节点类型
|
|
69
|
+
*/
|
|
70
|
+
_createClass(ChainOperator, [{
|
|
71
|
+
key: "toCells",
|
|
72
|
+
value:
|
|
73
|
+
/**
|
|
74
|
+
* 转换为X6的图数据格式
|
|
75
|
+
*/
|
|
76
|
+
function toCells() {
|
|
77
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
78
|
+
this.resetCells();
|
|
79
|
+
var id = this.id,
|
|
80
|
+
children = this.children,
|
|
81
|
+
cells = this.cells;
|
|
82
|
+
var start = Node.create({
|
|
83
|
+
shape: ConditionTypeEnum.CHAIN,
|
|
84
|
+
attrs: {
|
|
85
|
+
label: {
|
|
86
|
+
text: id
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
start.setData({
|
|
91
|
+
model: new ELStartNode(this),
|
|
92
|
+
toolbar: {
|
|
93
|
+
prepend: true,
|
|
94
|
+
append: true,
|
|
95
|
+
delete: true,
|
|
96
|
+
replace: true,
|
|
97
|
+
collapse: true
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
overwrite: true
|
|
101
|
+
});
|
|
102
|
+
cells.push(this.addNode(start));
|
|
103
|
+
this.startNode = start;
|
|
104
|
+
if (!this.collapsed) {
|
|
105
|
+
var end = Node.create({
|
|
106
|
+
shape: NODE_TYPE_INTERMEDIATE_END,
|
|
107
|
+
attrs: {
|
|
108
|
+
label: {
|
|
109
|
+
text: ''
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
end.setData({
|
|
114
|
+
model: new ELEndNode(this)
|
|
115
|
+
}, {
|
|
116
|
+
overwrite: true
|
|
117
|
+
});
|
|
118
|
+
cells.push(this.addNode(end));
|
|
119
|
+
this.endNode = end;
|
|
120
|
+
if (children.length) {
|
|
121
|
+
children.forEach(function (child) {
|
|
122
|
+
child.toCells(options);
|
|
123
|
+
var nextStartNode = child.getStartNode();
|
|
124
|
+
cells.push(Edge.create({
|
|
125
|
+
shape: LITEFLOW_EDGE,
|
|
126
|
+
source: start.id,
|
|
127
|
+
target: nextStartNode.id
|
|
128
|
+
}));
|
|
129
|
+
var nextEndNode = child.getEndNode();
|
|
130
|
+
cells.push(Edge.create({
|
|
131
|
+
shape: LITEFLOW_EDGE,
|
|
132
|
+
source: nextEndNode.id,
|
|
133
|
+
target: end.id
|
|
134
|
+
}));
|
|
135
|
+
});
|
|
136
|
+
} else {
|
|
137
|
+
cells.push(Edge.create({
|
|
138
|
+
shape: LITEFLOW_EDGE,
|
|
139
|
+
source: start.id,
|
|
140
|
+
target: end.id
|
|
141
|
+
}));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return this.getCells();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* 转换为EL表达式字符串
|
|
149
|
+
*/
|
|
150
|
+
}, {
|
|
151
|
+
key: "toEL",
|
|
152
|
+
value: function toEL() {
|
|
153
|
+
var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
154
|
+
var id = this.id;
|
|
155
|
+
if (prefix) {
|
|
156
|
+
return "".concat(prefix).concat(id).concat(this.propertiesToEL());
|
|
157
|
+
}
|
|
158
|
+
return "".concat(id).concat(this.propertiesToEL());
|
|
159
|
+
}
|
|
160
|
+
}], [{
|
|
161
|
+
key: "create",
|
|
162
|
+
value: function create(parent, type) {
|
|
163
|
+
var newNode = new ChainOperator(parent);
|
|
164
|
+
newNode.appendChild(NodeOperator.create(newNode, type));
|
|
165
|
+
return newNode;
|
|
166
|
+
}
|
|
167
|
+
}]);
|
|
168
|
+
return ChainOperator;
|
|
169
|
+
}(ELNode);
|
|
170
|
+
export { ChainOperator as default };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Cell, Node } from '@antv/x6';
|
|
2
|
+
import ELNode, { Properties } from '../node';
|
|
3
|
+
import { ConditionTypeEnum, NodeTypeEnum } from '../../constant';
|
|
4
|
+
/**
|
|
5
|
+
* 循环编排操作符:FOR。
|
|
6
|
+
*
|
|
7
|
+
* 例如一个FOR循环编排示例:
|
|
8
|
+
* (1) EL表达式语法:FOR(x).DO(THEN(a, b))
|
|
9
|
+
* (2) JSON表示形式:
|
|
10
|
+
* {
|
|
11
|
+
type: ConditionTypeEnum.FOR,
|
|
12
|
+
condition: { type: NodeTypeEnum.FOR, id: 'x' },
|
|
13
|
+
children: [
|
|
14
|
+
{
|
|
15
|
+
type: ConditionTypeEnum.THEN,
|
|
16
|
+
children: [
|
|
17
|
+
{ type: NodeTypeEnum.COMMON, id: 'a' },
|
|
18
|
+
{ type: NodeTypeEnum.COMMON, id: 'b' },
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
}
|
|
23
|
+
* (3) 通过ELNode节点模型进行表示的组合关系为:
|
|
24
|
+
┌─────────────────┐
|
|
25
|
+
┌──▶│ NodeOperator │
|
|
26
|
+
┌─────────┐ ┌─────────────────┐ │ └─────────────────┘ ┌─────────────────┐
|
|
27
|
+
│ Chain │───▶│ ForOperator │──┤ ┌─────────────────┐ ┌──▶│ NodeOperator │
|
|
28
|
+
└─────────┘ └─────────────────┘ └──▶│ ThenOperator │──┤ └─────────────────┘
|
|
29
|
+
└─────────────────┘ │ ┌─────────────────┐
|
|
30
|
+
└──▶│ NodeOperator │
|
|
31
|
+
└─────────────────┘
|
|
32
|
+
*/
|
|
33
|
+
export default class ForOperator extends ELNode {
|
|
34
|
+
type: ConditionTypeEnum;
|
|
35
|
+
parent?: ELNode;
|
|
36
|
+
condition: ELNode;
|
|
37
|
+
children: ELNode[];
|
|
38
|
+
properties?: Properties;
|
|
39
|
+
startNode?: Node;
|
|
40
|
+
endNode?: Node;
|
|
41
|
+
constructor(parent?: ELNode, condition?: ELNode, children?: ELNode[], properties?: Properties);
|
|
42
|
+
/**
|
|
43
|
+
* 创建新的节点
|
|
44
|
+
* @param parent 新节点的父节点
|
|
45
|
+
* @param type 新节点的子节点类型
|
|
46
|
+
*/
|
|
47
|
+
static create(parent?: ELNode, type?: NodeTypeEnum): ELNode;
|
|
48
|
+
/**
|
|
49
|
+
* 转换为X6的图数据格式
|
|
50
|
+
*/
|
|
51
|
+
toCells(options?: Record<string, any>): Cell[];
|
|
52
|
+
/**
|
|
53
|
+
* 转换为EL表达式字符串
|
|
54
|
+
*/
|
|
55
|
+
toEL(prefix?: string): string;
|
|
56
|
+
}
|