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,183 @@
|
|
|
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 _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
|
+
import { Edge, Node } from '@antv/x6';
|
|
8
|
+
import ELNode from "../node";
|
|
9
|
+
import { ELEndNode, generateUniqueId } from "../utils";
|
|
10
|
+
import { ConditionTypeEnum, LITEFLOW_EDGE, NODE_TYPE_INTERMEDIATE_END, NodeTypeEnum } from "../../constant";
|
|
11
|
+
import NodeOperator from "./node-operator";
|
|
12
|
+
import i18n from "../../i18n";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Iterator编排操作符:ITERATOR。
|
|
16
|
+
*
|
|
17
|
+
* 例如一个ITERATOR循环编排示例:
|
|
18
|
+
* (1) EL表达式语法:ITERATOR(x).DO(THEN(a, b))
|
|
19
|
+
* (2) JSON表示形式:
|
|
20
|
+
* {
|
|
21
|
+
type: ConditionTypeEnum.ITERATOR,
|
|
22
|
+
condition: { type: NodeTypeEnum.ITERATOR, id: 'x' },
|
|
23
|
+
children: [
|
|
24
|
+
{
|
|
25
|
+
type: ConditionTypeEnum.THEN,
|
|
26
|
+
children: [
|
|
27
|
+
{ type: NodeTypeEnum.COMMON, id: 'a' },
|
|
28
|
+
{ type: NodeTypeEnum.COMMON, id: 'b' },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
}
|
|
33
|
+
* (3) 通过ELNode节点模型进行表示的组合关系为:
|
|
34
|
+
┌─────────────────┐
|
|
35
|
+
┌──▶│ NodeOperator │
|
|
36
|
+
┌─────────┐ ┌──────────────────┐ │ └─────────────────┘ ┌─────────────────┐
|
|
37
|
+
│ Chain │───▶│ IteratorOperator │──┤ ┌─────────────────┐ ┌──▶│ NodeOperator │
|
|
38
|
+
└─────────┘ └──────────────────┘ └──▶│ ThenOperator │──┤ └─────────────────┘
|
|
39
|
+
└─────────────────┘ │ ┌─────────────────┐
|
|
40
|
+
└──▶│ NodeOperator │
|
|
41
|
+
└─────────────────┘
|
|
42
|
+
*/
|
|
43
|
+
var IteratorOperator = /*#__PURE__*/function (_ELNode) {
|
|
44
|
+
_inherits(IteratorOperator, _ELNode);
|
|
45
|
+
var _super = _createSuper(IteratorOperator);
|
|
46
|
+
function IteratorOperator(parent, condition, children, properties) {
|
|
47
|
+
var _this;
|
|
48
|
+
_classCallCheck(this, IteratorOperator);
|
|
49
|
+
_this = _super.call(this);
|
|
50
|
+
_defineProperty(_assertThisInitialized(_this), "type", ConditionTypeEnum.ITERATOR);
|
|
51
|
+
_defineProperty(_assertThisInitialized(_this), "parent", void 0);
|
|
52
|
+
_defineProperty(_assertThisInitialized(_this), "condition", new NodeOperator(_assertThisInitialized(_this), NodeTypeEnum.ITERATOR, i18n.t('iterator'), {
|
|
53
|
+
scriptName: i18n.t('iterator'),
|
|
54
|
+
tag: generateUniqueId()
|
|
55
|
+
}));
|
|
56
|
+
_defineProperty(_assertThisInitialized(_this), "children", []);
|
|
57
|
+
_defineProperty(_assertThisInitialized(_this), "properties", void 0);
|
|
58
|
+
_defineProperty(_assertThisInitialized(_this), "startNode", void 0);
|
|
59
|
+
_defineProperty(_assertThisInitialized(_this), "endNode", void 0);
|
|
60
|
+
_this.parent = parent;
|
|
61
|
+
if (condition) {
|
|
62
|
+
_this.condition = condition;
|
|
63
|
+
}
|
|
64
|
+
if (children) {
|
|
65
|
+
_this.children = children;
|
|
66
|
+
}
|
|
67
|
+
_this.properties = properties;
|
|
68
|
+
return _this;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 创建新的节点
|
|
73
|
+
* @param parent 新节点的父节点
|
|
74
|
+
* @param type 新节点的子节点类型
|
|
75
|
+
*/
|
|
76
|
+
_createClass(IteratorOperator, [{
|
|
77
|
+
key: "toCells",
|
|
78
|
+
value:
|
|
79
|
+
/**
|
|
80
|
+
* 转换为X6的图数据格式
|
|
81
|
+
*/
|
|
82
|
+
function toCells() {
|
|
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
|
+
condition.toCells({
|
|
89
|
+
shape: NodeTypeEnum.ITERATOR
|
|
90
|
+
});
|
|
91
|
+
var start = condition.getStartNode();
|
|
92
|
+
start.setData({
|
|
93
|
+
model: condition,
|
|
94
|
+
toolbar: {
|
|
95
|
+
prepend: true,
|
|
96
|
+
append: true,
|
|
97
|
+
delete: true,
|
|
98
|
+
replace: true,
|
|
99
|
+
collapse: true
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
overwrite: true
|
|
103
|
+
});
|
|
104
|
+
this.startNode = start;
|
|
105
|
+
start = condition.getEndNode();
|
|
106
|
+
if (!this.collapsed) {
|
|
107
|
+
var end = Node.create({
|
|
108
|
+
shape: NODE_TYPE_INTERMEDIATE_END,
|
|
109
|
+
attrs: {
|
|
110
|
+
label: {
|
|
111
|
+
text: ''
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
end.setData({
|
|
116
|
+
model: new ELEndNode(this),
|
|
117
|
+
toolbar: {
|
|
118
|
+
prepend: true,
|
|
119
|
+
append: true,
|
|
120
|
+
delete: true,
|
|
121
|
+
replace: true
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
overwrite: true
|
|
125
|
+
});
|
|
126
|
+
cells.push(this.addNode(end));
|
|
127
|
+
this.endNode = end;
|
|
128
|
+
if (children.length) {
|
|
129
|
+
children.forEach(function (child) {
|
|
130
|
+
child.toCells(options);
|
|
131
|
+
var nextStartNode = child.getStartNode();
|
|
132
|
+
cells.push(Edge.create({
|
|
133
|
+
shape: LITEFLOW_EDGE,
|
|
134
|
+
source: start.id,
|
|
135
|
+
target: nextStartNode.id
|
|
136
|
+
}));
|
|
137
|
+
var nextEndNode = child.getEndNode();
|
|
138
|
+
cells.push(Edge.create({
|
|
139
|
+
shape: LITEFLOW_EDGE,
|
|
140
|
+
source: nextEndNode.id,
|
|
141
|
+
target: end.id
|
|
142
|
+
}));
|
|
143
|
+
});
|
|
144
|
+
} else {
|
|
145
|
+
cells.push(Edge.create({
|
|
146
|
+
shape: LITEFLOW_EDGE,
|
|
147
|
+
source: start.id,
|
|
148
|
+
target: end.id
|
|
149
|
+
}));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return this.getCells();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* 转换为EL表达式字符串
|
|
157
|
+
*/
|
|
158
|
+
}, {
|
|
159
|
+
key: "toEL",
|
|
160
|
+
value: function toEL() {
|
|
161
|
+
var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
162
|
+
if (prefix) {
|
|
163
|
+
return "".concat(prefix, "ITERATOR(").concat(this.condition.toEL(), ").DO(\n").concat(this.children.map(function (x) {
|
|
164
|
+
return x.toEL("".concat(prefix, " "));
|
|
165
|
+
}).join(', \n'), "\n").concat(prefix, ")");
|
|
166
|
+
}
|
|
167
|
+
return "ITERATOR(".concat(this.condition.toEL(), ").DO(").concat(this.children.map(function (x) {
|
|
168
|
+
return x.toEL();
|
|
169
|
+
}).join(', '), ")");
|
|
170
|
+
}
|
|
171
|
+
}], [{
|
|
172
|
+
key: "create",
|
|
173
|
+
value: function create(parent, type) {
|
|
174
|
+
var newNode = new IteratorOperator(parent);
|
|
175
|
+
newNode.appendChild(NodeOperator.create(newNode, type, undefined, {
|
|
176
|
+
tag: generateUniqueId()
|
|
177
|
+
}));
|
|
178
|
+
return newNode;
|
|
179
|
+
}
|
|
180
|
+
}]);
|
|
181
|
+
return IteratorOperator;
|
|
182
|
+
}(ELNode);
|
|
183
|
+
export { IteratorOperator as default };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Cell, Node } from '@antv/x6';
|
|
2
|
+
import ELNode, { Properties } from '../node';
|
|
3
|
+
import { NodeTypeEnum } from '../../constant';
|
|
4
|
+
/**
|
|
5
|
+
* 节点组件操作符:是EL表达式树型结构的叶子结点。
|
|
6
|
+
*
|
|
7
|
+
* 例如一个串行编排(THEN):
|
|
8
|
+
* (1) EL表达式形式:THEN(a, b, c, d)
|
|
9
|
+
* (2) JSON表示形式:
|
|
10
|
+
* {
|
|
11
|
+
type: ConditionTypeEnum.THEN,
|
|
12
|
+
children: [
|
|
13
|
+
{ type: NodeTypeEnum.COMMON, id: 'a' },
|
|
14
|
+
{ type: NodeTypeEnum.COMMON, id: 'b' },
|
|
15
|
+
{ type: NodeTypeEnum.COMMON, id: 'c' },
|
|
16
|
+
{ type: NodeTypeEnum.COMMON, id: 'd' },
|
|
17
|
+
],
|
|
18
|
+
}
|
|
19
|
+
* (3) 通过ELNode节点模型进行表示的组合关系为:
|
|
20
|
+
┌─────────────────┐
|
|
21
|
+
┌──▶│ NodeOperator │
|
|
22
|
+
│ └─────────────────┘
|
|
23
|
+
│ ┌─────────────────┐
|
|
24
|
+
├──▶│ NodeOperator │
|
|
25
|
+
┌─────────┐ ┌─────────────────┐ │ └─────────────────┘
|
|
26
|
+
│ Chain │───▶│ ThenOperator │──┤ ┌─────────────────┐
|
|
27
|
+
└─────────┘ └─────────────────┘ ├──▶│ NodeOperator │
|
|
28
|
+
│ └─────────────────┘
|
|
29
|
+
│ ┌─────────────────┐
|
|
30
|
+
└──▶│ NodeOperator │
|
|
31
|
+
└─────────────────┘
|
|
32
|
+
*/
|
|
33
|
+
export default class NodeOperator extends ELNode {
|
|
34
|
+
type: NodeTypeEnum;
|
|
35
|
+
parent?: ELNode;
|
|
36
|
+
id: string;
|
|
37
|
+
node?: Node;
|
|
38
|
+
constructor(parent?: ELNode, type?: NodeTypeEnum, id?: string, properties?: Properties);
|
|
39
|
+
/**
|
|
40
|
+
* 创建新的节点
|
|
41
|
+
* @param parent 新节点的父节点
|
|
42
|
+
* @param type 新节点的节点类型
|
|
43
|
+
* @param id 新节点的节点Id
|
|
44
|
+
*/
|
|
45
|
+
static create(parent?: ELNode, type?: NodeTypeEnum, id?: string, properties?: Properties): ELNode;
|
|
46
|
+
/**
|
|
47
|
+
* 转换为X6的图数据格式
|
|
48
|
+
*/
|
|
49
|
+
toCells(options?: Record<string, any>): Cell[];
|
|
50
|
+
/**
|
|
51
|
+
* 获取当前节点的开始节点
|
|
52
|
+
*/
|
|
53
|
+
getStartNode(): Node;
|
|
54
|
+
/**
|
|
55
|
+
* 获取当前节点的结束节点
|
|
56
|
+
*/
|
|
57
|
+
getEndNode(): Node;
|
|
58
|
+
/**
|
|
59
|
+
* 转换为EL表达式字符串
|
|
60
|
+
*/
|
|
61
|
+
toEL(prefix?: string): string;
|
|
62
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
+
import { Node } from '@antv/x6';
|
|
9
|
+
import ELNode from "../node";
|
|
10
|
+
import { NodeTypeEnum } from "../../constant";
|
|
11
|
+
import { getNodeShapeByType } from "../../cells";
|
|
12
|
+
import i18n from "../../i18n";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 节点组件操作符:是EL表达式树型结构的叶子结点。
|
|
16
|
+
*
|
|
17
|
+
* 例如一个串行编排(THEN):
|
|
18
|
+
* (1) EL表达式形式:THEN(a, b, c, d)
|
|
19
|
+
* (2) JSON表示形式:
|
|
20
|
+
* {
|
|
21
|
+
type: ConditionTypeEnum.THEN,
|
|
22
|
+
children: [
|
|
23
|
+
{ type: NodeTypeEnum.COMMON, id: 'a' },
|
|
24
|
+
{ type: NodeTypeEnum.COMMON, id: 'b' },
|
|
25
|
+
{ type: NodeTypeEnum.COMMON, id: 'c' },
|
|
26
|
+
{ type: NodeTypeEnum.COMMON, id: 'd' },
|
|
27
|
+
],
|
|
28
|
+
}
|
|
29
|
+
* (3) 通过ELNode节点模型进行表示的组合关系为:
|
|
30
|
+
┌─────────────────┐
|
|
31
|
+
┌──▶│ NodeOperator │
|
|
32
|
+
│ └─────────────────┘
|
|
33
|
+
│ ┌─────────────────┐
|
|
34
|
+
├──▶│ NodeOperator │
|
|
35
|
+
┌─────────┐ ┌─────────────────┐ │ └─────────────────┘
|
|
36
|
+
│ Chain │───▶│ ThenOperator │──┤ ┌─────────────────┐
|
|
37
|
+
└─────────┘ └─────────────────┘ ├──▶│ NodeOperator │
|
|
38
|
+
│ └─────────────────┘
|
|
39
|
+
│ ┌─────────────────┐
|
|
40
|
+
└──▶│ NodeOperator │
|
|
41
|
+
└─────────────────┘
|
|
42
|
+
*/
|
|
43
|
+
var NodeOperator = /*#__PURE__*/function (_ELNode) {
|
|
44
|
+
_inherits(NodeOperator, _ELNode);
|
|
45
|
+
var _super = _createSuper(NodeOperator);
|
|
46
|
+
function NodeOperator(parent, type, id, properties) {
|
|
47
|
+
var _this;
|
|
48
|
+
_classCallCheck(this, NodeOperator);
|
|
49
|
+
_this = _super.call(this);
|
|
50
|
+
_defineProperty(_assertThisInitialized(_this), "type", void 0);
|
|
51
|
+
_defineProperty(_assertThisInitialized(_this), "parent", void 0);
|
|
52
|
+
_defineProperty(_assertThisInitialized(_this), "id", void 0);
|
|
53
|
+
_defineProperty(_assertThisInitialized(_this), "node", void 0);
|
|
54
|
+
_this.parent = parent;
|
|
55
|
+
_this.type = type || NodeTypeEnum.COMMON;
|
|
56
|
+
// console.log(id, properties)
|
|
57
|
+
_this.id = id || i18n.t('empty_node');
|
|
58
|
+
_this.properties = properties;
|
|
59
|
+
return _this;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 创建新的节点
|
|
64
|
+
* @param parent 新节点的父节点
|
|
65
|
+
* @param type 新节点的节点类型
|
|
66
|
+
* @param id 新节点的节点Id
|
|
67
|
+
*/
|
|
68
|
+
_createClass(NodeOperator, [{
|
|
69
|
+
key: "toCells",
|
|
70
|
+
value:
|
|
71
|
+
/**
|
|
72
|
+
* 转换为X6的图数据格式
|
|
73
|
+
*/
|
|
74
|
+
function toCells() {
|
|
75
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
76
|
+
if (!this.node) {
|
|
77
|
+
this.resetCells();
|
|
78
|
+
var id = this.id,
|
|
79
|
+
type = this.type,
|
|
80
|
+
cells = this.cells,
|
|
81
|
+
properties = this.properties;
|
|
82
|
+
var node = Node.create(_objectSpread({
|
|
83
|
+
shape: getNodeShapeByType(type),
|
|
84
|
+
attrs: {
|
|
85
|
+
label: {
|
|
86
|
+
text: (properties === null || properties === void 0 ? void 0 : properties.scriptName) || id
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}, options || {}));
|
|
90
|
+
node.setData({
|
|
91
|
+
model: this
|
|
92
|
+
}, {
|
|
93
|
+
overwrite: true
|
|
94
|
+
});
|
|
95
|
+
cells.push(this.addNode(node));
|
|
96
|
+
this.node = node;
|
|
97
|
+
}
|
|
98
|
+
return this.getCells();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* 获取当前节点的开始节点
|
|
103
|
+
*/
|
|
104
|
+
}, {
|
|
105
|
+
key: "getStartNode",
|
|
106
|
+
value: function getStartNode() {
|
|
107
|
+
return this.node;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 获取当前节点的结束节点
|
|
112
|
+
*/
|
|
113
|
+
}, {
|
|
114
|
+
key: "getEndNode",
|
|
115
|
+
value: function getEndNode() {
|
|
116
|
+
return this.node;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* 转换为EL表达式字符串
|
|
121
|
+
*/
|
|
122
|
+
}, {
|
|
123
|
+
key: "toEL",
|
|
124
|
+
value: function toEL() {
|
|
125
|
+
var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
126
|
+
return "".concat(prefix).concat(this.id).concat(this.propertiesToEL());
|
|
127
|
+
}
|
|
128
|
+
}], [{
|
|
129
|
+
key: "create",
|
|
130
|
+
value: function create(parent, type, id, properties) {
|
|
131
|
+
return new NodeOperator(parent, type, id, properties);
|
|
132
|
+
}
|
|
133
|
+
}]);
|
|
134
|
+
return NodeOperator;
|
|
135
|
+
}(ELNode);
|
|
136
|
+
export { NodeOperator as default };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Cell, Node } from '@antv/x6';
|
|
2
|
+
import ELNode, { Properties } from '../node';
|
|
3
|
+
import { ConditionTypeEnum, NodeTypeEnum } from '../../constant';
|
|
4
|
+
/**
|
|
5
|
+
* 非操作符:NOT。
|
|
6
|
+
*
|
|
7
|
+
* 例如一个非(NOT)示例:
|
|
8
|
+
* (1) EL表达式语法:IF(NOT(a)), b)
|
|
9
|
+
* (2) JSON表示形式:
|
|
10
|
+
* {
|
|
11
|
+
type: ConditionTypeEnum.IF,
|
|
12
|
+
condition: {
|
|
13
|
+
type: ConditionTypeEnum.NOT,
|
|
14
|
+
children: [
|
|
15
|
+
{ type: NodeTypeEnum.COMMON, id: 'a' }
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
children: [
|
|
19
|
+
{ type: NodeTypeEnum.COMMON, id: 'b' }
|
|
20
|
+
],
|
|
21
|
+
}
|
|
22
|
+
* (3) 通过ELNode节点模型进行表示的组合关系为:
|
|
23
|
+
┌─────────────────┐ ┌─────────────────┐
|
|
24
|
+
┌──▶│ NotOperator │───▶│ NodeOperator │
|
|
25
|
+
┌─────────┐ ┌─────────────────┐ │ └─────────────────┘ └─────────────────┘
|
|
26
|
+
│ Chain │───▶│ IfOperator │──┤ ┌─────────────────┐
|
|
27
|
+
└─────────┘ └─────────────────┘ └──▶│ NodeOperator │
|
|
28
|
+
└─────────────────┘
|
|
29
|
+
*/
|
|
30
|
+
export default class NotOperator extends ELNode {
|
|
31
|
+
type: ConditionTypeEnum;
|
|
32
|
+
parent?: ELNode;
|
|
33
|
+
children: ELNode[];
|
|
34
|
+
properties?: Properties;
|
|
35
|
+
startNode?: Node;
|
|
36
|
+
endNode?: Node;
|
|
37
|
+
constructor(parent?: ELNode, children?: ELNode[], properties?: Properties);
|
|
38
|
+
/**
|
|
39
|
+
* 创建新的节点
|
|
40
|
+
* @param parent 新节点的父节点
|
|
41
|
+
* @param type 新节点的子节点类型
|
|
42
|
+
*/
|
|
43
|
+
static create(parent?: ELNode, type?: NodeTypeEnum): ELNode;
|
|
44
|
+
/**
|
|
45
|
+
* 转换为X6的图数据格式
|
|
46
|
+
*/
|
|
47
|
+
toCells(options?: Record<string, any>): Cell[];
|
|
48
|
+
/**
|
|
49
|
+
* 在后面添加子节点
|
|
50
|
+
* @param newNode 子节点
|
|
51
|
+
* @param index 指定位置:可以是索引,也可以是兄弟节点
|
|
52
|
+
*/
|
|
53
|
+
appendChild(newNode: ELNode): boolean;
|
|
54
|
+
appendChild(newNode: ELNode, index: number): boolean;
|
|
55
|
+
appendChild(newNode: ELNode, sibling: ELNode): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* 在后面添加子节点
|
|
58
|
+
* @param newNode 子节点
|
|
59
|
+
* @param index 指定位置:可以是索引,也可以是兄弟节点
|
|
60
|
+
*/
|
|
61
|
+
prependChild(newNode: ELNode): boolean;
|
|
62
|
+
prependChild(newNode: ELNode, index: number): boolean;
|
|
63
|
+
prependChild(newNode: ELNode, sibling: ELNode): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* 转换为EL表达式字符串
|
|
66
|
+
*/
|
|
67
|
+
toEL(prefix?: string): string;
|
|
68
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
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
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 非操作符:NOT。
|
|
17
|
+
*
|
|
18
|
+
* 例如一个非(NOT)示例:
|
|
19
|
+
* (1) EL表达式语法:IF(NOT(a)), b)
|
|
20
|
+
* (2) JSON表示形式:
|
|
21
|
+
* {
|
|
22
|
+
type: ConditionTypeEnum.IF,
|
|
23
|
+
condition: {
|
|
24
|
+
type: ConditionTypeEnum.NOT,
|
|
25
|
+
children: [
|
|
26
|
+
{ type: NodeTypeEnum.COMMON, id: 'a' }
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
children: [
|
|
30
|
+
{ type: NodeTypeEnum.COMMON, id: 'b' }
|
|
31
|
+
],
|
|
32
|
+
}
|
|
33
|
+
* (3) 通过ELNode节点模型进行表示的组合关系为:
|
|
34
|
+
┌─────────────────┐ ┌─────────────────┐
|
|
35
|
+
┌──▶│ NotOperator │───▶│ NodeOperator │
|
|
36
|
+
┌─────────┐ ┌─────────────────┐ │ └─────────────────┘ └─────────────────┘
|
|
37
|
+
│ Chain │───▶│ IfOperator │──┤ ┌─────────────────┐
|
|
38
|
+
└─────────┘ └─────────────────┘ └──▶│ NodeOperator │
|
|
39
|
+
└─────────────────┘
|
|
40
|
+
*/
|
|
41
|
+
var NotOperator = /*#__PURE__*/function (_ELNode) {
|
|
42
|
+
_inherits(NotOperator, _ELNode);
|
|
43
|
+
var _super = _createSuper(NotOperator);
|
|
44
|
+
function NotOperator(parent, children, properties) {
|
|
45
|
+
var _this;
|
|
46
|
+
_classCallCheck(this, NotOperator);
|
|
47
|
+
_this = _super.call(this);
|
|
48
|
+
_defineProperty(_assertThisInitialized(_this), "type", ConditionTypeEnum.NOT);
|
|
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
|
+
_this.parent = parent;
|
|
55
|
+
if (children) {
|
|
56
|
+
_this.children = children;
|
|
57
|
+
}
|
|
58
|
+
_this.properties = properties;
|
|
59
|
+
return _this;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 创建新的节点
|
|
64
|
+
* @param parent 新节点的父节点
|
|
65
|
+
* @param type 新节点的子节点类型
|
|
66
|
+
*/
|
|
67
|
+
_createClass(NotOperator, [{
|
|
68
|
+
key: "toCells",
|
|
69
|
+
value:
|
|
70
|
+
/**
|
|
71
|
+
* 转换为X6的图数据格式
|
|
72
|
+
*/
|
|
73
|
+
function toCells() {
|
|
74
|
+
var _this2 = this;
|
|
75
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
76
|
+
this.resetCells();
|
|
77
|
+
var children = this.children,
|
|
78
|
+
cells = this.cells;
|
|
79
|
+
var start = Node.create(_objectSpread({
|
|
80
|
+
shape: ConditionTypeEnum.NOT,
|
|
81
|
+
attrs: {
|
|
82
|
+
label: {
|
|
83
|
+
text: ''
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, options));
|
|
87
|
+
start.setData({
|
|
88
|
+
model: new ELStartNode(this),
|
|
89
|
+
toolbar: {
|
|
90
|
+
prepend: true,
|
|
91
|
+
append: false,
|
|
92
|
+
delete: true,
|
|
93
|
+
replace: true,
|
|
94
|
+
collapse: true
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
overwrite: true
|
|
98
|
+
});
|
|
99
|
+
cells.push(this.addNode(start));
|
|
100
|
+
this.startNode = start;
|
|
101
|
+
if (!this.collapsed) {
|
|
102
|
+
var end = Node.create({
|
|
103
|
+
shape: NODE_TYPE_INTERMEDIATE_END,
|
|
104
|
+
attrs: {
|
|
105
|
+
label: {
|
|
106
|
+
text: ''
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
end.setData({
|
|
111
|
+
model: new ELEndNode(this),
|
|
112
|
+
toolbar: {
|
|
113
|
+
prepend: false,
|
|
114
|
+
append: true,
|
|
115
|
+
delete: true,
|
|
116
|
+
replace: true
|
|
117
|
+
}
|
|
118
|
+
}, {
|
|
119
|
+
overwrite: true
|
|
120
|
+
});
|
|
121
|
+
cells.push(this.addNode(end));
|
|
122
|
+
this.endNode = end;
|
|
123
|
+
var _children = _slicedToArray(children, 1),
|
|
124
|
+
notNode = _children[0];
|
|
125
|
+
[notNode].forEach(function (item, index) {
|
|
126
|
+
var next = item || NodeOperator.create(_this2, NodeTypeEnum.VIRTUAL, ' ');
|
|
127
|
+
next.toCells();
|
|
128
|
+
var nextStartNode = next.getStartNode();
|
|
129
|
+
cells.push(Edge.create({
|
|
130
|
+
shape: LITEFLOW_EDGE,
|
|
131
|
+
source: start.id,
|
|
132
|
+
target: nextStartNode.id,
|
|
133
|
+
label: ' - ',
|
|
134
|
+
defaultLabel: {
|
|
135
|
+
attrs: {
|
|
136
|
+
fo: {
|
|
137
|
+
x: -20,
|
|
138
|
+
y: -20
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
position: {
|
|
142
|
+
options: {
|
|
143
|
+
keepGradient: false,
|
|
144
|
+
ensureLegibility: false
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}));
|
|
149
|
+
var nextEndNode = next.getEndNode();
|
|
150
|
+
cells.push(Edge.create({
|
|
151
|
+
shape: LITEFLOW_EDGE,
|
|
152
|
+
source: nextEndNode.id,
|
|
153
|
+
target: end.id,
|
|
154
|
+
label: ' '
|
|
155
|
+
}));
|
|
156
|
+
if (!item) {
|
|
157
|
+
nextStartNode.setData({
|
|
158
|
+
model: new ELVirtualNode(_this2, index, next),
|
|
159
|
+
toolbar: {
|
|
160
|
+
prepend: false,
|
|
161
|
+
append: false,
|
|
162
|
+
delete: false,
|
|
163
|
+
replace: true
|
|
164
|
+
}
|
|
165
|
+
}, {
|
|
166
|
+
overwrite: true
|
|
167
|
+
});
|
|
168
|
+
cells.push(_this2.addNode(nextStartNode));
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
return this.getCells();
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* 在后面添加子节点
|
|
177
|
+
* @param newNode 子节点
|
|
178
|
+
* @param index 指定位置:可以是索引,也可以是兄弟节点
|
|
179
|
+
*/
|
|
180
|
+
}, {
|
|
181
|
+
key: "appendChild",
|
|
182
|
+
value:
|
|
183
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
184
|
+
function appendChild(newNode, index) {
|
|
185
|
+
newNode.parent = this;
|
|
186
|
+
this.children[0] = newNode;
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* 在后面添加子节点
|
|
192
|
+
* @param newNode 子节点
|
|
193
|
+
* @param index 指定位置:可以是索引,也可以是兄弟节点
|
|
194
|
+
*/
|
|
195
|
+
}, {
|
|
196
|
+
key: "prependChild",
|
|
197
|
+
value:
|
|
198
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
199
|
+
function prependChild(newNode, index) {
|
|
200
|
+
newNode.parent = this;
|
|
201
|
+
this.children[0] = newNode;
|
|
202
|
+
return true;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* 转换为EL表达式字符串
|
|
207
|
+
*/
|
|
208
|
+
}, {
|
|
209
|
+
key: "toEL",
|
|
210
|
+
value: function toEL() {
|
|
211
|
+
var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
212
|
+
if (prefix) {
|
|
213
|
+
return "".concat(prefix, "NOT(\n").concat(this.children.map(function (x) {
|
|
214
|
+
return x.toEL("".concat(prefix, " "));
|
|
215
|
+
}).join(', \n'), "\n").concat(prefix, ")").concat(this.propertiesToEL());
|
|
216
|
+
}
|
|
217
|
+
return "NOT(".concat(this.children.map(function (x) {
|
|
218
|
+
return x.toEL();
|
|
219
|
+
}).join(', '), ")").concat(this.propertiesToEL());
|
|
220
|
+
}
|
|
221
|
+
}], [{
|
|
222
|
+
key: "create",
|
|
223
|
+
value: function create(parent, type) {
|
|
224
|
+
var newNode = new NotOperator(parent);
|
|
225
|
+
newNode.appendChild(NodeOperator.create(newNode, type));
|
|
226
|
+
return newNode;
|
|
227
|
+
}
|
|
228
|
+
}]);
|
|
229
|
+
return NotOperator;
|
|
230
|
+
}(ELNode);
|
|
231
|
+
export { NotOperator as default };
|