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,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Graph } from '@antv/x6';
|
|
3
|
+
import '@antv/x6/dist/x6.css';
|
|
4
|
+
interface ILiteFlowEditorProps {
|
|
5
|
+
/**
|
|
6
|
+
* 样式类
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
* 生成图示例事件
|
|
11
|
+
* @param graph 图实例
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
onReady?: (graph: Graph) => void;
|
|
15
|
+
/**
|
|
16
|
+
* 工具栏组件
|
|
17
|
+
*/
|
|
18
|
+
widgets?: React.FC<any>[];
|
|
19
|
+
/**
|
|
20
|
+
* 更多子节点
|
|
21
|
+
*/
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* 用户
|
|
25
|
+
*/
|
|
26
|
+
user?: Record<string, any>;
|
|
27
|
+
/**
|
|
28
|
+
* 回显数据
|
|
29
|
+
*/
|
|
30
|
+
chainObject?: any;
|
|
31
|
+
/**
|
|
32
|
+
* 其他可扩展属性
|
|
33
|
+
*/
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
}
|
|
36
|
+
declare const LiteFlowEditor: React.ForwardRefExoticComponent<Omit<ILiteFlowEditorProps, "ref"> & React.RefAttributes<React.FC<{}>>>;
|
|
37
|
+
export default LiteFlowEditor;
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
import React, { useRef, useState, useEffect, forwardRef, useImperativeHandle } from 'react';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import createFlowGraph from "./panels/flowGraph/createFlowGraph";
|
|
7
|
+
import FlowGraphContextMenu from "./panels/flowGraph/contextMenu";
|
|
8
|
+
import FlowGraphContextPad from "./panels/flowGraph/contextPad";
|
|
9
|
+
import GraphContext from "./context/GraphContext";
|
|
10
|
+
import Layout from "./panels/layout";
|
|
11
|
+
import SideBar from "./panels/sideBar";
|
|
12
|
+
import ToolBar from "./panels/toolBar";
|
|
13
|
+
import SettingBar from "./panels/settingBar";
|
|
14
|
+
import Breadcrumb from "./panels/breadcrumb";
|
|
15
|
+
import styles from "./index.module.less";
|
|
16
|
+
import '@antv/x6/dist/x6.css';
|
|
17
|
+
import { forceLayout } from "./common/layout";
|
|
18
|
+
import { useModel } from "./hooks";
|
|
19
|
+
import { history } from "./hooks/useHistory";
|
|
20
|
+
import ELBuilder from "./model/builder";
|
|
21
|
+
import { setModel } from "./hooks/useModel";
|
|
22
|
+
import { MIN_ZOOM } from "./constant";
|
|
23
|
+
import { checkerList } from "./model-checker/checkers";
|
|
24
|
+
import { ModelCheckEngine } from "./model-checker";
|
|
25
|
+
import { useScriptContext } from "./context/ScriptContext";
|
|
26
|
+
import { I18nextProvider } from 'react-i18next';
|
|
27
|
+
import i18n from "./i18n";
|
|
28
|
+
var defaultMenuInfo = {
|
|
29
|
+
x: 0,
|
|
30
|
+
y: 0,
|
|
31
|
+
scene: 'blank',
|
|
32
|
+
visible: false
|
|
33
|
+
};
|
|
34
|
+
var defaultPadInfo = {
|
|
35
|
+
x: 0,
|
|
36
|
+
y: 0,
|
|
37
|
+
scene: 'append',
|
|
38
|
+
visible: false
|
|
39
|
+
};
|
|
40
|
+
var LiteFlowEditor = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
41
|
+
var _chainObject$isEdit;
|
|
42
|
+
var className = props.className,
|
|
43
|
+
onReady = props.onReady,
|
|
44
|
+
widgets = props.widgets,
|
|
45
|
+
children = props.children,
|
|
46
|
+
chainObject = props.chainObject,
|
|
47
|
+
edit = props.edit;
|
|
48
|
+
var _useState = useState((_chainObject$isEdit = chainObject === null || chainObject === void 0 ? void 0 : chainObject.isEdit) !== null && _chainObject$isEdit !== void 0 ? _chainObject$isEdit : false),
|
|
49
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
50
|
+
isEdit = _useState2[0],
|
|
51
|
+
setIsEdit = _useState2[1];
|
|
52
|
+
var hasInitRef = useRef(false);
|
|
53
|
+
// 保存当前节点 ID 集合
|
|
54
|
+
var nodeIdSetRef = useRef(new Set());
|
|
55
|
+
var isEditRef = useRef(isEdit);
|
|
56
|
+
var _useScriptContext = useScriptContext(),
|
|
57
|
+
language = _useScriptContext.language;
|
|
58
|
+
var engine = new ModelCheckEngine();
|
|
59
|
+
checkerList.forEach(function (item) {
|
|
60
|
+
engine.register(new item.checker(), item.isActive);
|
|
61
|
+
});
|
|
62
|
+
var wrapperRef = useRef(null);
|
|
63
|
+
var graphRef = useRef(null);
|
|
64
|
+
var miniMapRef = useRef(null);
|
|
65
|
+
var _useState3 = useState(),
|
|
66
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
67
|
+
flowGraph = _useState4[0],
|
|
68
|
+
setFlowGraph = _useState4[1];
|
|
69
|
+
var _useState5 = useState([]),
|
|
70
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
71
|
+
checkList = _useState6[0],
|
|
72
|
+
setCheckList = _useState6[1];
|
|
73
|
+
var _useState7 = useState(defaultMenuInfo),
|
|
74
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
75
|
+
contextMenuInfo = _useState8[0],
|
|
76
|
+
setContextMenuInfo = _useState8[1];
|
|
77
|
+
var _useState9 = useState(defaultPadInfo),
|
|
78
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
79
|
+
contextPadInfo = _useState10[0],
|
|
80
|
+
setContextPadInfo = _useState10[1];
|
|
81
|
+
useEffect(function () {
|
|
82
|
+
i18n.changeLanguage(language);
|
|
83
|
+
}, [language]);
|
|
84
|
+
var currentEditor = {
|
|
85
|
+
getGraphInstance: function getGraphInstance() {
|
|
86
|
+
return flowGraph;
|
|
87
|
+
},
|
|
88
|
+
toJSON: function toJSON() {
|
|
89
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
90
|
+
return useModel().toJSON();
|
|
91
|
+
},
|
|
92
|
+
fromJSON: function fromJSON(data) {
|
|
93
|
+
var model = ELBuilder.build(data || {});
|
|
94
|
+
setModel(model);
|
|
95
|
+
history.cleanHistory();
|
|
96
|
+
flowGraph === null || flowGraph === void 0 || flowGraph.zoomToFit({
|
|
97
|
+
minScale: MIN_ZOOM,
|
|
98
|
+
maxScale: 1
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
useEffect(function () {
|
|
103
|
+
isEditRef.current = isEdit;
|
|
104
|
+
}, [isEdit]);
|
|
105
|
+
var getModelCheckList = function getModelCheckList() {
|
|
106
|
+
if (!(graphRef.current && miniMapRef.current)) return;
|
|
107
|
+
var model = useModel();
|
|
108
|
+
var dslData = model.toJSON();
|
|
109
|
+
if (Object.keys(dslData).length === 0) {
|
|
110
|
+
setCheckList([{
|
|
111
|
+
message: i18n.t('check_list_tips_4'),
|
|
112
|
+
model: dslData
|
|
113
|
+
}]);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
var modelJSON = model.toCells();
|
|
117
|
+
var nodeList = modelJSON.filter(function (item) {
|
|
118
|
+
var _item$attrs;
|
|
119
|
+
return item.isNode() && ((_item$attrs = item.attrs) === null || _item$attrs === void 0 ? void 0 : _item$attrs.label.text);
|
|
120
|
+
}).slice(2);
|
|
121
|
+
var allIssues = nodeList.flatMap(function (item) {
|
|
122
|
+
var ctx = {
|
|
123
|
+
model: item.data.model,
|
|
124
|
+
dslData: dslData
|
|
125
|
+
};
|
|
126
|
+
return engine.runChecks(ctx);
|
|
127
|
+
});
|
|
128
|
+
setCheckList(allIssues);
|
|
129
|
+
};
|
|
130
|
+
useImperativeHandle(ref, function () {
|
|
131
|
+
return currentEditor;
|
|
132
|
+
});
|
|
133
|
+
useEffect(function () {
|
|
134
|
+
var _chainObject$hasPermi;
|
|
135
|
+
localStorage.setItem('hasPermission', (_chainObject$hasPermi = chainObject === null || chainObject === void 0 ? void 0 : chainObject.hasPermission) !== null && _chainObject$hasPermi !== void 0 ? _chainObject$hasPermi : false);
|
|
136
|
+
if (graphRef.current && miniMapRef.current) {
|
|
137
|
+
var _flowGraph = createFlowGraph(graphRef.current, miniMapRef.current);
|
|
138
|
+
onReady === null || onReady === void 0 || onReady(_flowGraph);
|
|
139
|
+
setFlowGraph(_flowGraph);
|
|
140
|
+
history.init(_flowGraph);
|
|
141
|
+
}
|
|
142
|
+
}, []);
|
|
143
|
+
useEffect(function () {
|
|
144
|
+
if (!flowGraph) return;
|
|
145
|
+
|
|
146
|
+
// 初始化
|
|
147
|
+
var getCurrentNodeSet = function getCurrentNodeSet() {
|
|
148
|
+
return new Set(flowGraph.getNodes().map(function (n) {
|
|
149
|
+
return n.id;
|
|
150
|
+
}));
|
|
151
|
+
};
|
|
152
|
+
nodeIdSetRef.current = getCurrentNodeSet();
|
|
153
|
+
var checkNodeDiff = function checkNodeDiff() {
|
|
154
|
+
var prev = nodeIdSetRef.current;
|
|
155
|
+
var cur = getCurrentNodeSet();
|
|
156
|
+
var added = [];
|
|
157
|
+
cur.forEach(function (id) {
|
|
158
|
+
if (!prev.has(id)) {
|
|
159
|
+
added.push(id);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
var removed = [];
|
|
163
|
+
prev.forEach(function (id) {
|
|
164
|
+
if (!cur.has(id)) {
|
|
165
|
+
removed.push(id);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
if ((added.length || removed.length) && !isEditRef.current && hasInitRef.current) {
|
|
169
|
+
setIsEdit(true);
|
|
170
|
+
isEditRef.current = true;
|
|
171
|
+
console.log('[LiteFlowEditor] 节点变化 -> 新增:', added, ' 删除:', removed);
|
|
172
|
+
edit(); // 只在新增或删除节点时触发
|
|
173
|
+
} else if (!hasInitRef.current) {
|
|
174
|
+
hasInitRef.current = true;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// 更新缓存集合
|
|
178
|
+
nodeIdSetRef.current = cur;
|
|
179
|
+
};
|
|
180
|
+
flowGraph.on('model:change', checkNodeDiff);
|
|
181
|
+
return function () {
|
|
182
|
+
flowGraph.off('model:change', checkNodeDiff);
|
|
183
|
+
};
|
|
184
|
+
}, [flowGraph, edit]);
|
|
185
|
+
|
|
186
|
+
// resize flowGraph's size when window size changes
|
|
187
|
+
useEffect(function () {
|
|
188
|
+
var handler = function handler() {
|
|
189
|
+
requestAnimationFrame(function () {
|
|
190
|
+
if (flowGraph && wrapperRef && wrapperRef.current) {
|
|
191
|
+
var width = wrapperRef.current.clientWidth;
|
|
192
|
+
var height = wrapperRef.current.clientHeight;
|
|
193
|
+
flowGraph.resize(width, height);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
window.addEventListener('resize', handler);
|
|
198
|
+
return function () {
|
|
199
|
+
window.removeEventListener('resize', handler);
|
|
200
|
+
};
|
|
201
|
+
}, [flowGraph, wrapperRef]);
|
|
202
|
+
|
|
203
|
+
// NOTE: listen toggling context menu event
|
|
204
|
+
useEffect(function () {
|
|
205
|
+
var showHandler = function showHandler(info) {
|
|
206
|
+
flowGraph === null || flowGraph === void 0 || flowGraph.lockScroller();
|
|
207
|
+
setContextMenuInfo(_objectSpread(_objectSpread({}, info), {}, {
|
|
208
|
+
visible: true
|
|
209
|
+
}));
|
|
210
|
+
};
|
|
211
|
+
var hideHandler = function hideHandler() {
|
|
212
|
+
flowGraph === null || flowGraph === void 0 || flowGraph.unlockScroller();
|
|
213
|
+
setContextMenuInfo(_objectSpread(_objectSpread({}, contextMenuInfo), {}, {
|
|
214
|
+
visible: false
|
|
215
|
+
}));
|
|
216
|
+
};
|
|
217
|
+
var showContextPad = function showContextPad(info) {
|
|
218
|
+
flowGraph === null || flowGraph === void 0 || flowGraph.lockScroller();
|
|
219
|
+
setContextPadInfo(_objectSpread(_objectSpread({}, info), {}, {
|
|
220
|
+
visible: true
|
|
221
|
+
}));
|
|
222
|
+
};
|
|
223
|
+
var hideContextPad = function hideContextPad() {
|
|
224
|
+
flowGraph === null || flowGraph === void 0 || flowGraph.unlockScroller();
|
|
225
|
+
setContextPadInfo(_objectSpread(_objectSpread({}, contextPadInfo), {}, {
|
|
226
|
+
visible: false
|
|
227
|
+
}));
|
|
228
|
+
};
|
|
229
|
+
var handleModelChange = function handleModelChange() {
|
|
230
|
+
if (flowGraph) {
|
|
231
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
232
|
+
var model = useModel();
|
|
233
|
+
var modelJSON = model.toCells();
|
|
234
|
+
flowGraph.startBatch('update');
|
|
235
|
+
flowGraph.resetCells(modelJSON);
|
|
236
|
+
forceLayout(flowGraph);
|
|
237
|
+
flowGraph.stopBatch('update');
|
|
238
|
+
flowGraph.trigger('model:changed');
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
if (flowGraph) {
|
|
242
|
+
flowGraph.on('graph:showContextMenu', showHandler);
|
|
243
|
+
flowGraph.on('graph:hideContextMenu', hideHandler);
|
|
244
|
+
flowGraph.on('graph:showContextPad', showContextPad);
|
|
245
|
+
flowGraph.on('graph:hideContextPad', hideContextPad);
|
|
246
|
+
flowGraph.on('model:change', handleModelChange);
|
|
247
|
+
flowGraph.on('node:change:*', getModelCheckList);
|
|
248
|
+
}
|
|
249
|
+
return function () {
|
|
250
|
+
if (flowGraph) {
|
|
251
|
+
flowGraph.off('graph:showContextMenu', showHandler);
|
|
252
|
+
flowGraph.off('graph:hideContextMenu', hideHandler);
|
|
253
|
+
flowGraph.off('graph:showContextPad', showContextPad);
|
|
254
|
+
flowGraph.off('graph:hideContextPad', hideContextPad);
|
|
255
|
+
flowGraph.off('model:change', handleModelChange);
|
|
256
|
+
flowGraph.off('node:change:*', getModelCheckList);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
}, [flowGraph]);
|
|
260
|
+
return (
|
|
261
|
+
/*#__PURE__*/
|
|
262
|
+
// @ts-ignore
|
|
263
|
+
React.createElement(I18nextProvider, {
|
|
264
|
+
i18n: i18n
|
|
265
|
+
}, /*#__PURE__*/React.createElement(GraphContext.Provider, {
|
|
266
|
+
// @ts-ignore
|
|
267
|
+
value: {
|
|
268
|
+
graph: flowGraph,
|
|
269
|
+
graphWrapper: wrapperRef,
|
|
270
|
+
model: null,
|
|
271
|
+
currentEditor: currentEditor,
|
|
272
|
+
chainObject: chainObject,
|
|
273
|
+
checkList: checkList
|
|
274
|
+
}
|
|
275
|
+
}, /*#__PURE__*/React.createElement(Layout, {
|
|
276
|
+
flowGraph: flowGraph,
|
|
277
|
+
SideBar: SideBar,
|
|
278
|
+
ToolBar: ToolBar,
|
|
279
|
+
SettingBar: SettingBar,
|
|
280
|
+
widgets: widgets
|
|
281
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
282
|
+
className: classNames(styles.liteflowEditorContainer, className),
|
|
283
|
+
ref: wrapperRef
|
|
284
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
285
|
+
className: styles.liteflowEditorGraph,
|
|
286
|
+
ref: graphRef
|
|
287
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
288
|
+
className: styles.liteflowEditorMiniMap,
|
|
289
|
+
ref: miniMapRef
|
|
290
|
+
}), flowGraph && /*#__PURE__*/React.createElement(Breadcrumb, {
|
|
291
|
+
flowGraph: flowGraph
|
|
292
|
+
}), flowGraph && /*#__PURE__*/React.createElement(FlowGraphContextMenu, _extends({}, contextMenuInfo, {
|
|
293
|
+
flowGraph: flowGraph
|
|
294
|
+
})), flowGraph && /*#__PURE__*/React.createElement(FlowGraphContextPad, _extends({}, contextPadInfo, {
|
|
295
|
+
flowGraph: flowGraph
|
|
296
|
+
})), children))))
|
|
297
|
+
);
|
|
298
|
+
});
|
|
299
|
+
export default LiteFlowEditor;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
.liteflowEditorContainer {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex: 1;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
|
|
8
|
+
.liteflowEditorGraph {
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
|
|
12
|
+
:global {
|
|
13
|
+
.liteflow-edge-add-button {
|
|
14
|
+
display: none;
|
|
15
|
+
pointer-events: all !important;
|
|
16
|
+
margin: 0;
|
|
17
|
+
border: dashed 1px #feb663;
|
|
18
|
+
color: #feb663;
|
|
19
|
+
}
|
|
20
|
+
.x6-edge:hover .liteflow-edge-add-button {
|
|
21
|
+
display: block;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.liteflowEditorMiniMap {
|
|
27
|
+
position: absolute;
|
|
28
|
+
right: 40px;
|
|
29
|
+
bottom: 40px;
|
|
30
|
+
|
|
31
|
+
:global {
|
|
32
|
+
.x6-widget-minimap-viewport {
|
|
33
|
+
border: 1px solid #e0e0e0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// add global for x6
|
|
40
|
+
:global {
|
|
41
|
+
.x6-widget-transform {
|
|
42
|
+
border-color: rgba(0, 0, 0, 0.3);
|
|
43
|
+
border-style: dashed;
|
|
44
|
+
background-color: rgba(0, 0, 0, 0.14);
|
|
45
|
+
border-radius: 0;
|
|
46
|
+
padding: 6px;
|
|
47
|
+
margin: -7px 0 0 -7px;
|
|
48
|
+
.x6-widget-transform-resize {
|
|
49
|
+
width: 6px;
|
|
50
|
+
height: 6px;
|
|
51
|
+
border-radius: 0;
|
|
52
|
+
border-color: rgba(0, 0, 0, 0.3);
|
|
53
|
+
// border: 0 none;
|
|
54
|
+
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.15);
|
|
55
|
+
}
|
|
56
|
+
.x6-widget-transform-cursor-nw {
|
|
57
|
+
top: -6px;
|
|
58
|
+
left: -6px;
|
|
59
|
+
}
|
|
60
|
+
.x6-widget-transform-cursor-n {
|
|
61
|
+
margin-left: -3px;
|
|
62
|
+
top: -6px;
|
|
63
|
+
}
|
|
64
|
+
.x6-widget-transform-cursor-ne {
|
|
65
|
+
top: -6px;
|
|
66
|
+
right: -6px;
|
|
67
|
+
}
|
|
68
|
+
.x6-widget-transform-cursor-e {
|
|
69
|
+
margin-top: -3px;
|
|
70
|
+
right: -6px;
|
|
71
|
+
}
|
|
72
|
+
.x6-widget-transform-cursor-se {
|
|
73
|
+
right: -6px;
|
|
74
|
+
bottom: -6px;
|
|
75
|
+
}
|
|
76
|
+
.x6-widget-transform-cursor-s {
|
|
77
|
+
margin-left: -3px;
|
|
78
|
+
bottom: -6px;
|
|
79
|
+
}
|
|
80
|
+
.x6-widget-transform-cursor-sw {
|
|
81
|
+
left: -6px;
|
|
82
|
+
bottom: -6px;
|
|
83
|
+
}
|
|
84
|
+
.x6-widget-transform-cursor-w {
|
|
85
|
+
left: -6px;
|
|
86
|
+
margin-top: -3px;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
.x6-widget-dnd.dragging {
|
|
90
|
+
pointer-events: none;
|
|
91
|
+
}
|
|
92
|
+
.x6-edge path:nth-child(2) {
|
|
93
|
+
stroke: #c1c1c1;
|
|
94
|
+
stroke-width: 1px;
|
|
95
|
+
}
|
|
96
|
+
.x6-edge:hover,
|
|
97
|
+
.x6-edge.edge-moving,
|
|
98
|
+
.x6-edge.x6-edge-selected {
|
|
99
|
+
path:nth-child(2) {
|
|
100
|
+
stroke: #feb663;
|
|
101
|
+
stroke-width: 3px;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// .x6-node {
|
|
105
|
+
// .x6-port-body {
|
|
106
|
+
// visibility: hidden;
|
|
107
|
+
// }
|
|
108
|
+
// &:hover {
|
|
109
|
+
// .x6-port-body {
|
|
110
|
+
// visibility: visible;
|
|
111
|
+
// }
|
|
112
|
+
// }
|
|
113
|
+
// }
|
|
114
|
+
.x6-node {
|
|
115
|
+
& > text {
|
|
116
|
+
pointer-events: none;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
.react-json-view {
|
|
120
|
+
.collapsed-icon,
|
|
121
|
+
.expanded-icon {
|
|
122
|
+
svg {
|
|
123
|
+
vertical-align: middle !important;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|