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,272 @@
|
|
|
1
|
+
import { ConditionTypeEnum, NodeTypeEnum } from "../constant";
|
|
2
|
+
export default {
|
|
3
|
+
// 串行编排(THEN)
|
|
4
|
+
THEN: {
|
|
5
|
+
type: ConditionTypeEnum.THEN,
|
|
6
|
+
children: [{
|
|
7
|
+
type: NodeTypeEnum.COMMON,
|
|
8
|
+
id: 'a'
|
|
9
|
+
}, {
|
|
10
|
+
type: NodeTypeEnum.COMMON,
|
|
11
|
+
id: 'b'
|
|
12
|
+
}, {
|
|
13
|
+
type: NodeTypeEnum.COMMON,
|
|
14
|
+
id: 'c'
|
|
15
|
+
}, {
|
|
16
|
+
type: NodeTypeEnum.COMMON,
|
|
17
|
+
id: 'd'
|
|
18
|
+
}]
|
|
19
|
+
},
|
|
20
|
+
// 并行编排(WHEN)
|
|
21
|
+
WHEN: {
|
|
22
|
+
type: ConditionTypeEnum.THEN,
|
|
23
|
+
children: [{
|
|
24
|
+
type: NodeTypeEnum.COMMON,
|
|
25
|
+
id: 'a'
|
|
26
|
+
}, {
|
|
27
|
+
type: ConditionTypeEnum.WHEN,
|
|
28
|
+
children: [{
|
|
29
|
+
type: NodeTypeEnum.COMMON,
|
|
30
|
+
id: 'b'
|
|
31
|
+
}, {
|
|
32
|
+
type: NodeTypeEnum.COMMON,
|
|
33
|
+
id: 'c'
|
|
34
|
+
}, {
|
|
35
|
+
type: NodeTypeEnum.COMMON,
|
|
36
|
+
id: 'd'
|
|
37
|
+
}]
|
|
38
|
+
}, {
|
|
39
|
+
type: NodeTypeEnum.COMMON,
|
|
40
|
+
id: 'e'
|
|
41
|
+
}]
|
|
42
|
+
},
|
|
43
|
+
// 选择编排(SWITCH)
|
|
44
|
+
SWITCH: {
|
|
45
|
+
type: ConditionTypeEnum.SWITCH,
|
|
46
|
+
condition: {
|
|
47
|
+
type: NodeTypeEnum.SWITCH,
|
|
48
|
+
id: 'x'
|
|
49
|
+
},
|
|
50
|
+
children: [{
|
|
51
|
+
type: NodeTypeEnum.COMMON,
|
|
52
|
+
id: 'a'
|
|
53
|
+
}, {
|
|
54
|
+
type: NodeTypeEnum.COMMON,
|
|
55
|
+
id: 'b'
|
|
56
|
+
}, {
|
|
57
|
+
type: NodeTypeEnum.COMMON,
|
|
58
|
+
id: 'c'
|
|
59
|
+
}, {
|
|
60
|
+
type: NodeTypeEnum.COMMON,
|
|
61
|
+
id: 'd'
|
|
62
|
+
}]
|
|
63
|
+
},
|
|
64
|
+
// 条件编排(IF)
|
|
65
|
+
IF: {
|
|
66
|
+
type: ConditionTypeEnum.IF,
|
|
67
|
+
condition: {
|
|
68
|
+
type: NodeTypeEnum.BOOLEAN,
|
|
69
|
+
id: 'x'
|
|
70
|
+
},
|
|
71
|
+
children: [{
|
|
72
|
+
type: NodeTypeEnum.COMMON,
|
|
73
|
+
id: 'a'
|
|
74
|
+
}]
|
|
75
|
+
},
|
|
76
|
+
// FOR循环
|
|
77
|
+
FOR: {
|
|
78
|
+
type: ConditionTypeEnum.FOR,
|
|
79
|
+
condition: {
|
|
80
|
+
type: NodeTypeEnum.BOOLEAN,
|
|
81
|
+
id: 'x'
|
|
82
|
+
},
|
|
83
|
+
children: [{
|
|
84
|
+
type: ConditionTypeEnum.THEN,
|
|
85
|
+
children: [{
|
|
86
|
+
type: NodeTypeEnum.COMMON,
|
|
87
|
+
id: 'a'
|
|
88
|
+
}, {
|
|
89
|
+
type: NodeTypeEnum.COMMON,
|
|
90
|
+
id: 'b'
|
|
91
|
+
}]
|
|
92
|
+
}]
|
|
93
|
+
},
|
|
94
|
+
// WHILE循环
|
|
95
|
+
WHILE: {
|
|
96
|
+
type: ConditionTypeEnum.WHILE,
|
|
97
|
+
condition: {
|
|
98
|
+
type: NodeTypeEnum.BOOLEAN,
|
|
99
|
+
id: 'x'
|
|
100
|
+
},
|
|
101
|
+
children: [{
|
|
102
|
+
type: ConditionTypeEnum.THEN,
|
|
103
|
+
children: [{
|
|
104
|
+
type: NodeTypeEnum.COMMON,
|
|
105
|
+
id: 'a'
|
|
106
|
+
}, {
|
|
107
|
+
type: NodeTypeEnum.COMMON,
|
|
108
|
+
id: 'b'
|
|
109
|
+
}]
|
|
110
|
+
}]
|
|
111
|
+
},
|
|
112
|
+
// ITERATOR循环
|
|
113
|
+
ITERATOR: {
|
|
114
|
+
type: ConditionTypeEnum.ITERATOR,
|
|
115
|
+
condition: {
|
|
116
|
+
type: NodeTypeEnum.ITERATOR,
|
|
117
|
+
id: 'x'
|
|
118
|
+
},
|
|
119
|
+
children: [{
|
|
120
|
+
type: ConditionTypeEnum.THEN,
|
|
121
|
+
children: [{
|
|
122
|
+
type: NodeTypeEnum.COMMON,
|
|
123
|
+
id: 'a'
|
|
124
|
+
}, {
|
|
125
|
+
type: NodeTypeEnum.COMMON,
|
|
126
|
+
id: 'b'
|
|
127
|
+
}]
|
|
128
|
+
}]
|
|
129
|
+
},
|
|
130
|
+
// CATCH 捕获异常
|
|
131
|
+
CATCH: {
|
|
132
|
+
type: ConditionTypeEnum.CATCH,
|
|
133
|
+
condition: {
|
|
134
|
+
type: ConditionTypeEnum.WHEN,
|
|
135
|
+
children: [{
|
|
136
|
+
type: NodeTypeEnum.COMMON,
|
|
137
|
+
id: 'a'
|
|
138
|
+
}, {
|
|
139
|
+
type: NodeTypeEnum.COMMON,
|
|
140
|
+
id: 'b'
|
|
141
|
+
}, {
|
|
142
|
+
type: NodeTypeEnum.COMMON,
|
|
143
|
+
id: 'c'
|
|
144
|
+
}]
|
|
145
|
+
},
|
|
146
|
+
children: [{
|
|
147
|
+
type: ConditionTypeEnum.IF,
|
|
148
|
+
condition: {
|
|
149
|
+
type: NodeTypeEnum.IF,
|
|
150
|
+
id: 'x'
|
|
151
|
+
},
|
|
152
|
+
children: [{
|
|
153
|
+
type: NodeTypeEnum.COMMON,
|
|
154
|
+
id: 'y'
|
|
155
|
+
}]
|
|
156
|
+
}]
|
|
157
|
+
},
|
|
158
|
+
// AND_OR_NOT 与或非
|
|
159
|
+
AND: {
|
|
160
|
+
type: ConditionTypeEnum.IF,
|
|
161
|
+
condition: {
|
|
162
|
+
type: ConditionTypeEnum.AND,
|
|
163
|
+
children: [{
|
|
164
|
+
type: ConditionTypeEnum.OR,
|
|
165
|
+
children: [{
|
|
166
|
+
type: NodeTypeEnum.BOOLEAN,
|
|
167
|
+
id: 'a'
|
|
168
|
+
}, {
|
|
169
|
+
type: NodeTypeEnum.BOOLEAN,
|
|
170
|
+
id: 'b'
|
|
171
|
+
}]
|
|
172
|
+
}, {
|
|
173
|
+
type: ConditionTypeEnum.NOT,
|
|
174
|
+
children: [{
|
|
175
|
+
type: NodeTypeEnum.BOOLEAN,
|
|
176
|
+
id: 'c'
|
|
177
|
+
}]
|
|
178
|
+
}]
|
|
179
|
+
},
|
|
180
|
+
children: [{
|
|
181
|
+
type: NodeTypeEnum.COMMON,
|
|
182
|
+
id: 'x'
|
|
183
|
+
}, {
|
|
184
|
+
type: NodeTypeEnum.COMMON,
|
|
185
|
+
id: 'y'
|
|
186
|
+
}]
|
|
187
|
+
},
|
|
188
|
+
// CHAIN 子流程
|
|
189
|
+
CHAIN: {
|
|
190
|
+
type: ConditionTypeEnum.THEN,
|
|
191
|
+
children: [{
|
|
192
|
+
type: NodeTypeEnum.COMMON,
|
|
193
|
+
id: 'A'
|
|
194
|
+
}, {
|
|
195
|
+
type: NodeTypeEnum.COMMON,
|
|
196
|
+
id: 'B'
|
|
197
|
+
}, {
|
|
198
|
+
type: ConditionTypeEnum.WHEN,
|
|
199
|
+
children: [{
|
|
200
|
+
type: ConditionTypeEnum.CHAIN,
|
|
201
|
+
id: 't1',
|
|
202
|
+
children: [{
|
|
203
|
+
type: ConditionTypeEnum.THEN,
|
|
204
|
+
children: [{
|
|
205
|
+
type: NodeTypeEnum.COMMON,
|
|
206
|
+
id: 'C'
|
|
207
|
+
}, {
|
|
208
|
+
type: ConditionTypeEnum.WHEN,
|
|
209
|
+
children: [{
|
|
210
|
+
type: NodeTypeEnum.COMMON,
|
|
211
|
+
id: 'J'
|
|
212
|
+
}, {
|
|
213
|
+
type: NodeTypeEnum.COMMON,
|
|
214
|
+
id: 'K'
|
|
215
|
+
}]
|
|
216
|
+
}]
|
|
217
|
+
}]
|
|
218
|
+
}, {
|
|
219
|
+
type: NodeTypeEnum.COMMON,
|
|
220
|
+
id: 'D'
|
|
221
|
+
}, {
|
|
222
|
+
type: ConditionTypeEnum.CHAIN,
|
|
223
|
+
id: 't2',
|
|
224
|
+
children: [{
|
|
225
|
+
type: ConditionTypeEnum.THEN,
|
|
226
|
+
children: [{
|
|
227
|
+
type: NodeTypeEnum.COMMON,
|
|
228
|
+
id: 'H'
|
|
229
|
+
}, {
|
|
230
|
+
type: NodeTypeEnum.COMMON,
|
|
231
|
+
id: 'I'
|
|
232
|
+
}]
|
|
233
|
+
}]
|
|
234
|
+
}]
|
|
235
|
+
}, {
|
|
236
|
+
type: ConditionTypeEnum.SWITCH,
|
|
237
|
+
condition: {
|
|
238
|
+
type: NodeTypeEnum.COMMON,
|
|
239
|
+
id: 'X'
|
|
240
|
+
},
|
|
241
|
+
children: [{
|
|
242
|
+
type: NodeTypeEnum.COMMON,
|
|
243
|
+
id: 'M'
|
|
244
|
+
}, {
|
|
245
|
+
type: NodeTypeEnum.COMMON,
|
|
246
|
+
id: 'N'
|
|
247
|
+
}, {
|
|
248
|
+
type: ConditionTypeEnum.CHAIN,
|
|
249
|
+
id: 'w1',
|
|
250
|
+
children: [{
|
|
251
|
+
type: ConditionTypeEnum.WHEN,
|
|
252
|
+
children: [{
|
|
253
|
+
type: NodeTypeEnum.COMMON,
|
|
254
|
+
id: 'Q'
|
|
255
|
+
}, {
|
|
256
|
+
type: ConditionTypeEnum.THEN,
|
|
257
|
+
children: [{
|
|
258
|
+
type: NodeTypeEnum.COMMON,
|
|
259
|
+
id: 'P'
|
|
260
|
+
}, {
|
|
261
|
+
type: NodeTypeEnum.COMMON,
|
|
262
|
+
id: 'R'
|
|
263
|
+
}]
|
|
264
|
+
}],
|
|
265
|
+
properties: {
|
|
266
|
+
id: 'w01'
|
|
267
|
+
}
|
|
268
|
+
}]
|
|
269
|
+
}]
|
|
270
|
+
}]
|
|
271
|
+
}
|
|
272
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ConditionTypeEnum, NodeTypeEnum } from '../constant';
|
|
2
|
+
import ELNode from './node';
|
|
3
|
+
interface ParseParameters {
|
|
4
|
+
data: Record<string, any>;
|
|
5
|
+
parent: ELNode;
|
|
6
|
+
type?: NodeTypeEnum | ConditionTypeEnum;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 将EL表达式的JSON表示,构造成ELNode模型表示。
|
|
10
|
+
* EL表达式的模型表示:数据结构本质上是一个树形结构。
|
|
11
|
+
* 例如一个串行编排(THEN):
|
|
12
|
+
* (1) EL表达式形式:THEN(a, b, c, d)
|
|
13
|
+
* (2) JSON表示形式:
|
|
14
|
+
* {
|
|
15
|
+
type: ConditionTypeEnum.THEN,
|
|
16
|
+
children: [
|
|
17
|
+
{ type: NodeTypeEnum.COMMON, id: 'a' },
|
|
18
|
+
{ type: NodeTypeEnum.COMMON, id: 'b' },
|
|
19
|
+
{ type: NodeTypeEnum.COMMON, id: 'c' },
|
|
20
|
+
{ type: NodeTypeEnum.COMMON, id: 'd' },
|
|
21
|
+
],
|
|
22
|
+
}
|
|
23
|
+
* (3) 通过ELNode节点模型进行表示的组合关系为:
|
|
24
|
+
┌─────────────────┐
|
|
25
|
+
┌──▶│ NodeOperator │
|
|
26
|
+
│ └─────────────────┘
|
|
27
|
+
│ ┌─────────────────┐
|
|
28
|
+
├──▶│ NodeOperator │
|
|
29
|
+
┌─────────┐ ┌─────────────────┐ │ └─────────────────┘
|
|
30
|
+
│ Chain │───▶│ ThenOperator │──┤ ┌─────────────────┐
|
|
31
|
+
└─────────┘ └─────────────────┘ ├──▶│ NodeOperator │
|
|
32
|
+
│ └─────────────────┘
|
|
33
|
+
│ ┌─────────────────┐
|
|
34
|
+
└──▶│ NodeOperator │
|
|
35
|
+
└─────────────────┘
|
|
36
|
+
*/
|
|
37
|
+
export default class ELBuilder {
|
|
38
|
+
static build(data: Record<string, any> | Record<string, any>[]): ELNode;
|
|
39
|
+
static createELNode(type: ConditionTypeEnum | NodeTypeEnum, parent?: ELNode, id?: string): ELNode;
|
|
40
|
+
}
|
|
41
|
+
export declare function builder(data: Record<string, any> | Record<string, any>[]): ELNode;
|
|
42
|
+
export declare function parse({ parent, data }: ParseParameters): ELNode | undefined;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import Chain from "./chain";
|
|
4
|
+
import { AndOperator, CatchOperator, ForOperator, IfOperator, IteratorOperator, NodeOperator, NotOperator, OrOperator, SwitchOperator, ThenOperator, WhenOperator, WhileOperator, ChainOperator } from "./el";
|
|
5
|
+
import { ConditionTypeEnum, NodeTypeEnum } from "../constant";
|
|
6
|
+
import { generateUniqueId } from "./utils";
|
|
7
|
+
/**
|
|
8
|
+
* 将EL表达式的JSON表示,构造成ELNode模型表示。
|
|
9
|
+
* EL表达式的模型表示:数据结构本质上是一个树形结构。
|
|
10
|
+
* 例如一个串行编排(THEN):
|
|
11
|
+
* (1) EL表达式形式:THEN(a, b, c, d)
|
|
12
|
+
* (2) JSON表示形式:
|
|
13
|
+
* {
|
|
14
|
+
type: ConditionTypeEnum.THEN,
|
|
15
|
+
children: [
|
|
16
|
+
{ type: NodeTypeEnum.COMMON, id: 'a' },
|
|
17
|
+
{ type: NodeTypeEnum.COMMON, id: 'b' },
|
|
18
|
+
{ type: NodeTypeEnum.COMMON, id: 'c' },
|
|
19
|
+
{ type: NodeTypeEnum.COMMON, id: 'd' },
|
|
20
|
+
],
|
|
21
|
+
}
|
|
22
|
+
* (3) 通过ELNode节点模型进行表示的组合关系为:
|
|
23
|
+
┌─────────────────┐
|
|
24
|
+
┌──▶│ NodeOperator │
|
|
25
|
+
│ └─────────────────┘
|
|
26
|
+
│ ┌─────────────────┐
|
|
27
|
+
├──▶│ NodeOperator │
|
|
28
|
+
┌─────────┐ ┌─────────────────┐ │ └─────────────────┘
|
|
29
|
+
│ Chain │───▶│ ThenOperator │──┤ ┌─────────────────┐
|
|
30
|
+
└─────────┘ └─────────────────┘ ├──▶│ NodeOperator │
|
|
31
|
+
│ └─────────────────┘
|
|
32
|
+
│ ┌─────────────────┐
|
|
33
|
+
└──▶│ NodeOperator │
|
|
34
|
+
└─────────────────┘
|
|
35
|
+
*/
|
|
36
|
+
var ELBuilder = /*#__PURE__*/function () {
|
|
37
|
+
function ELBuilder() {
|
|
38
|
+
_classCallCheck(this, ELBuilder);
|
|
39
|
+
}
|
|
40
|
+
_createClass(ELBuilder, null, [{
|
|
41
|
+
key: "build",
|
|
42
|
+
value: function build(data) {
|
|
43
|
+
return builder(data);
|
|
44
|
+
}
|
|
45
|
+
}, {
|
|
46
|
+
key: "createELNode",
|
|
47
|
+
value: function createELNode(type, parent, id) {
|
|
48
|
+
switch (type) {
|
|
49
|
+
// 1. 编排类型
|
|
50
|
+
case ConditionTypeEnum.THEN:
|
|
51
|
+
case ConditionTypeEnum.SER:
|
|
52
|
+
return ThenOperator.create(parent);
|
|
53
|
+
case ConditionTypeEnum.WHEN:
|
|
54
|
+
case ConditionTypeEnum.PAR:
|
|
55
|
+
return WhenOperator.create(parent);
|
|
56
|
+
case ConditionTypeEnum.SWITCH:
|
|
57
|
+
return SwitchOperator.create(parent);
|
|
58
|
+
case ConditionTypeEnum.IF:
|
|
59
|
+
return IfOperator.create(parent);
|
|
60
|
+
case ConditionTypeEnum.FOR:
|
|
61
|
+
return ForOperator.create(parent);
|
|
62
|
+
case ConditionTypeEnum.WHILE:
|
|
63
|
+
return WhileOperator.create(parent);
|
|
64
|
+
case ConditionTypeEnum.ITERATOR:
|
|
65
|
+
return IteratorOperator.create(parent);
|
|
66
|
+
case ConditionTypeEnum.CATCH:
|
|
67
|
+
return CatchOperator.create(parent);
|
|
68
|
+
case ConditionTypeEnum.AND:
|
|
69
|
+
return AndOperator.create(parent);
|
|
70
|
+
case ConditionTypeEnum.OR:
|
|
71
|
+
return OrOperator.create(parent);
|
|
72
|
+
case ConditionTypeEnum.NOT:
|
|
73
|
+
return NotOperator.create(parent);
|
|
74
|
+
case ConditionTypeEnum.CHAIN:
|
|
75
|
+
return ChainOperator.create(parent);
|
|
76
|
+
case ConditionTypeEnum.PRE:
|
|
77
|
+
case ConditionTypeEnum.FINALLY:
|
|
78
|
+
case ConditionTypeEnum.BREAK:
|
|
79
|
+
case ConditionTypeEnum.ABSTRACT:
|
|
80
|
+
case ConditionTypeEnum.DEFAULT:
|
|
81
|
+
return ThenOperator.create(parent);
|
|
82
|
+
// 2. 节点类型
|
|
83
|
+
case NodeTypeEnum.COMMON:
|
|
84
|
+
default:
|
|
85
|
+
// return NodeOperator.create(parent, type as NodeTypeEnum);
|
|
86
|
+
return NodeOperator.create(parent, type, id, {
|
|
87
|
+
tag: generateUniqueId()
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}]);
|
|
92
|
+
return ELBuilder;
|
|
93
|
+
}();
|
|
94
|
+
export { ELBuilder as default };
|
|
95
|
+
export function builder(data) {
|
|
96
|
+
var chain = new Chain();
|
|
97
|
+
if (Array.isArray(data)) {
|
|
98
|
+
data.forEach(function (item) {
|
|
99
|
+
var next = parse({
|
|
100
|
+
parent: chain,
|
|
101
|
+
data: item
|
|
102
|
+
});
|
|
103
|
+
if (next) {
|
|
104
|
+
chain.appendChild(next);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
} else {
|
|
108
|
+
var next = parse({
|
|
109
|
+
parent: chain,
|
|
110
|
+
data: data
|
|
111
|
+
});
|
|
112
|
+
if (next) {
|
|
113
|
+
chain.appendChild(next);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return chain;
|
|
117
|
+
}
|
|
118
|
+
export function parse(_ref) {
|
|
119
|
+
var parent = _ref.parent,
|
|
120
|
+
data = _ref.data;
|
|
121
|
+
if (!(data !== null && data !== void 0 && data.type)) {
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
switch (data.type) {
|
|
125
|
+
// 1、编排类:顺序、分支、循环
|
|
126
|
+
case ConditionTypeEnum.THEN:
|
|
127
|
+
case ConditionTypeEnum.SER:
|
|
128
|
+
return parseOperator({
|
|
129
|
+
parent: new ThenOperator(parent),
|
|
130
|
+
data: data
|
|
131
|
+
});
|
|
132
|
+
case ConditionTypeEnum.WHEN:
|
|
133
|
+
case ConditionTypeEnum.PAR:
|
|
134
|
+
return parseOperator({
|
|
135
|
+
parent: new WhenOperator(parent),
|
|
136
|
+
data: data
|
|
137
|
+
});
|
|
138
|
+
case ConditionTypeEnum.SWITCH:
|
|
139
|
+
return parseOperator({
|
|
140
|
+
parent: new SwitchOperator(parent),
|
|
141
|
+
data: data
|
|
142
|
+
});
|
|
143
|
+
case ConditionTypeEnum.IF:
|
|
144
|
+
return parseOperator({
|
|
145
|
+
parent: new IfOperator(parent),
|
|
146
|
+
data: data
|
|
147
|
+
});
|
|
148
|
+
case ConditionTypeEnum.FOR:
|
|
149
|
+
return parseOperator({
|
|
150
|
+
parent: new ForOperator(parent),
|
|
151
|
+
data: data
|
|
152
|
+
});
|
|
153
|
+
case ConditionTypeEnum.WHILE:
|
|
154
|
+
return parseOperator({
|
|
155
|
+
parent: new WhileOperator(parent),
|
|
156
|
+
data: data
|
|
157
|
+
});
|
|
158
|
+
case ConditionTypeEnum.ITERATOR:
|
|
159
|
+
return parseOperator({
|
|
160
|
+
parent: new IteratorOperator(parent),
|
|
161
|
+
data: data
|
|
162
|
+
});
|
|
163
|
+
case ConditionTypeEnum.CATCH:
|
|
164
|
+
return parseOperator({
|
|
165
|
+
parent: new CatchOperator(parent),
|
|
166
|
+
data: data
|
|
167
|
+
});
|
|
168
|
+
case ConditionTypeEnum.AND:
|
|
169
|
+
return parseOperator({
|
|
170
|
+
parent: new AndOperator(parent),
|
|
171
|
+
data: data
|
|
172
|
+
});
|
|
173
|
+
case ConditionTypeEnum.OR:
|
|
174
|
+
return parseOperator({
|
|
175
|
+
parent: new OrOperator(parent),
|
|
176
|
+
data: data
|
|
177
|
+
});
|
|
178
|
+
case ConditionTypeEnum.NOT:
|
|
179
|
+
return parseOperator({
|
|
180
|
+
parent: new NotOperator(parent),
|
|
181
|
+
data: data
|
|
182
|
+
});
|
|
183
|
+
case ConditionTypeEnum.CHAIN:
|
|
184
|
+
return parseOperator({
|
|
185
|
+
parent: new ChainOperator(parent, data.id),
|
|
186
|
+
data: data
|
|
187
|
+
});
|
|
188
|
+
case ConditionTypeEnum.PRE:
|
|
189
|
+
case ConditionTypeEnum.FINALLY:
|
|
190
|
+
case ConditionTypeEnum.BREAK:
|
|
191
|
+
case ConditionTypeEnum.ABSTRACT:
|
|
192
|
+
case ConditionTypeEnum.DEFAULT:
|
|
193
|
+
return parseOperator({
|
|
194
|
+
parent: new ThenOperator(parent),
|
|
195
|
+
data: data,
|
|
196
|
+
type: data.type
|
|
197
|
+
});
|
|
198
|
+
// 2、组件类:顺序、分支、循环
|
|
199
|
+
case NodeTypeEnum.COMMON:
|
|
200
|
+
default:
|
|
201
|
+
return new NodeOperator(parent, data.type, data.id, data.properties);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function parseOperator(_ref2) {
|
|
205
|
+
var parent = _ref2.parent,
|
|
206
|
+
data = _ref2.data,
|
|
207
|
+
type = _ref2.type;
|
|
208
|
+
var condition = data.condition,
|
|
209
|
+
_data$children = data.children,
|
|
210
|
+
children = _data$children === void 0 ? [] : _data$children,
|
|
211
|
+
properties = data.properties;
|
|
212
|
+
if (condition) {
|
|
213
|
+
var conditionNode = parse({
|
|
214
|
+
parent: parent,
|
|
215
|
+
data: condition
|
|
216
|
+
});
|
|
217
|
+
if (conditionNode) {
|
|
218
|
+
parent.condition = conditionNode;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (children && children.length) {
|
|
222
|
+
children.forEach(function (child) {
|
|
223
|
+
var childNode = parse({
|
|
224
|
+
parent: parent,
|
|
225
|
+
data: child
|
|
226
|
+
});
|
|
227
|
+
if (childNode) {
|
|
228
|
+
parent.appendChild(childNode);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
if (properties) {
|
|
233
|
+
parent.setProperties(properties);
|
|
234
|
+
}
|
|
235
|
+
if (type) {
|
|
236
|
+
parent.type = type;
|
|
237
|
+
}
|
|
238
|
+
return parent;
|
|
239
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Cell, Node } from '@antv/x6';
|
|
2
|
+
import ELNode from './node';
|
|
3
|
+
import { ConditionTypeEnum } from '../constant';
|
|
4
|
+
/**
|
|
5
|
+
* EL表达式的根节点——EL表达式的所有延伸内容,都是在根节点上开始的。
|
|
6
|
+
* 例如一个串行编排(THEN):
|
|
7
|
+
* (1) EL表达式形式:THEN(a, b, c, d)
|
|
8
|
+
* (2) JSON表示形式:
|
|
9
|
+
* {
|
|
10
|
+
type: ConditionTypeEnum.THEN,
|
|
11
|
+
children: [
|
|
12
|
+
{ type: NodeTypeEnum.COMMON, id: 'a' },
|
|
13
|
+
{ type: NodeTypeEnum.COMMON, id: 'b' },
|
|
14
|
+
{ type: NodeTypeEnum.COMMON, id: 'c' },
|
|
15
|
+
{ type: NodeTypeEnum.COMMON, id: 'd' },
|
|
16
|
+
],
|
|
17
|
+
}
|
|
18
|
+
* (3) 通过ELNode节点模型进行表示的组合关系为:
|
|
19
|
+
┌─────────────────┐
|
|
20
|
+
┌──▶│ NodeOperator │
|
|
21
|
+
│ └─────────────────┘
|
|
22
|
+
│ ┌─────────────────┐
|
|
23
|
+
├──▶│ NodeOperator │
|
|
24
|
+
┌─────────┐ ┌─────────────────┐ │ └─────────────────┘
|
|
25
|
+
│ Chain │───▶│ ThenOperator │──┤ ┌─────────────────┐
|
|
26
|
+
└─────────┘ └─────────────────┘ ├──▶│ NodeOperator │
|
|
27
|
+
│ └─────────────────┘
|
|
28
|
+
│ ┌─────────────────┐
|
|
29
|
+
└──▶│ NodeOperator │
|
|
30
|
+
└─────────────────┘
|
|
31
|
+
*/
|
|
32
|
+
export default class Chain extends ELNode {
|
|
33
|
+
type: ConditionTypeEnum;
|
|
34
|
+
children: ELNode[];
|
|
35
|
+
startNode?: Node;
|
|
36
|
+
endNode?: Node;
|
|
37
|
+
constructor(children?: ELNode[]);
|
|
38
|
+
/**
|
|
39
|
+
* 转换为X6的图数据格式
|
|
40
|
+
*/
|
|
41
|
+
toCells(): Cell[];
|
|
42
|
+
/**
|
|
43
|
+
* 转换为EL表达式字符串
|
|
44
|
+
*/
|
|
45
|
+
toEL(prefix?: string): string;
|
|
46
|
+
dataPropertyToEL(prefix?: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* 转换为JSON格式
|
|
49
|
+
*/
|
|
50
|
+
toJSON(): Record<string, any>;
|
|
51
|
+
/**
|
|
52
|
+
* 在开始节点的后面、插入新节点
|
|
53
|
+
* @param newNode 新节点
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
append(newNode: ELNode): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* 在后面添加子节点
|
|
59
|
+
* @param newNode 子节点
|
|
60
|
+
* @param index 指定位置:可以是索引,也可以是兄弟节点
|
|
61
|
+
*/
|
|
62
|
+
appendChild(newNode: ELNode, index?: number | ELNode): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* 在结束节点的前面、插入新节点
|
|
65
|
+
* @param child 新节点
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
prepend(newNode: ELNode): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* 在后面添加子节点
|
|
71
|
+
* @param newNode 子节点
|
|
72
|
+
* @param index 指定位置:可以是索引,也可以是兄弟节点
|
|
73
|
+
*/
|
|
74
|
+
prependChild(newNode: ELNode, index?: number | ELNode): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* 对于根节点,只要添加了任何子节点,就自动包一层 THEN
|
|
77
|
+
*/
|
|
78
|
+
addWrapperIfPossible(): void;
|
|
79
|
+
/**
|
|
80
|
+
* 根节点不允许删除
|
|
81
|
+
*/
|
|
82
|
+
remove(): boolean;
|
|
83
|
+
}
|