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,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import makeBtnWidget from "./common/makeBtnWidget";
|
|
3
|
+
import { GatewayOutlined } from '@ant-design/icons';
|
|
4
|
+
var ToggleSelection = makeBtnWidget({
|
|
5
|
+
tooltip: 'select_nodes',
|
|
6
|
+
getIcon: function getIcon() {
|
|
7
|
+
return /*#__PURE__*/React.createElement(GatewayOutlined, null);
|
|
8
|
+
},
|
|
9
|
+
handler: function handler(flowGraph) {
|
|
10
|
+
var needEnableRubberBand = !flowGraph.isRubberbandEnabled();
|
|
11
|
+
if (needEnableRubberBand) {
|
|
12
|
+
flowGraph.disablePanning();
|
|
13
|
+
flowGraph.enableRubberband();
|
|
14
|
+
} else {
|
|
15
|
+
flowGraph.enablePanning();
|
|
16
|
+
flowGraph.disableRubberband();
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
selected: function selected(flowGraph) {
|
|
20
|
+
return flowGraph.isRubberbandEnabled();
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
export default ToggleSelection;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UndoOutlined } from '@ant-design/icons';
|
|
3
|
+
import { shortcuts } from "../../../common/shortcuts";
|
|
4
|
+
import makeBtnWidget from "./common/makeBtnWidget";
|
|
5
|
+
import { history } from "../../../hooks/useHistory";
|
|
6
|
+
var Save = makeBtnWidget({
|
|
7
|
+
tooltip: 'revoke',
|
|
8
|
+
handler: shortcuts.undo.handler,
|
|
9
|
+
getIcon: function getIcon() {
|
|
10
|
+
return /*#__PURE__*/React.createElement(UndoOutlined, null);
|
|
11
|
+
},
|
|
12
|
+
disabled: function disabled() {
|
|
13
|
+
return !history.canUndo();
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
export default Save;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { EyeOutlined } from '@ant-design/icons';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Modal } from 'antd';
|
|
4
|
+
import JsonView from 'react-json-view';
|
|
5
|
+
import makeBtnWidget from "./common/makeBtnWidget";
|
|
6
|
+
import { useModel } from "../../../hooks";
|
|
7
|
+
var View = makeBtnWidget({
|
|
8
|
+
tooltip: '查看DSL',
|
|
9
|
+
handler: function handler() {
|
|
10
|
+
var model = useModel();
|
|
11
|
+
Modal.info({
|
|
12
|
+
title: '查看DSL',
|
|
13
|
+
width: 1000,
|
|
14
|
+
maskClosable: true,
|
|
15
|
+
closable: true,
|
|
16
|
+
content:
|
|
17
|
+
/*#__PURE__*/
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
React.createElement(JsonView, {
|
|
20
|
+
name: null,
|
|
21
|
+
collapsed: false,
|
|
22
|
+
enableClipboard: true,
|
|
23
|
+
displayDataTypes: false,
|
|
24
|
+
displayObjectSize: false,
|
|
25
|
+
src: JSON.parse(JSON.stringify(model.toJSON()))
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
// console.log(JSON.stringify(model.toJSON(), null, 2));
|
|
29
|
+
},
|
|
30
|
+
getIcon: function getIcon() {
|
|
31
|
+
return /*#__PURE__*/React.createElement(EyeOutlined, null);
|
|
32
|
+
},
|
|
33
|
+
disabled: function disabled(flowGraph) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
export default View;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { useState, useEffect, useContext } from 'react';
|
|
3
|
+
import { ZoomOutOutlined, ZoomInOutlined } from '@ant-design/icons';
|
|
4
|
+
import { MAX_ZOOM, MIN_ZOOM } from "../../../constant";
|
|
5
|
+
import { shortcuts } from "../../../common/shortcuts";
|
|
6
|
+
import makeBtnWidget from "./common/makeBtnWidget";
|
|
7
|
+
import { useGraph } from "../../../hooks";
|
|
8
|
+
import styles from "./index.module.less";
|
|
9
|
+
import GraphContext from "../../../context/GraphContext";
|
|
10
|
+
var ZoomOut = makeBtnWidget({
|
|
11
|
+
tooltip: 'shrink',
|
|
12
|
+
handler: shortcuts.zoomOut.handler,
|
|
13
|
+
getIcon: function getIcon() {
|
|
14
|
+
return /*#__PURE__*/React.createElement(ZoomOutOutlined, null);
|
|
15
|
+
},
|
|
16
|
+
disabled: function disabled(flowGraph) {
|
|
17
|
+
return flowGraph.zoom() <= MIN_ZOOM;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
var ZoomIn = makeBtnWidget({
|
|
21
|
+
tooltip: 'magnify',
|
|
22
|
+
handler: shortcuts.zoomIn.handler,
|
|
23
|
+
getIcon: function getIcon() {
|
|
24
|
+
return /*#__PURE__*/React.createElement(ZoomInOutlined, null);
|
|
25
|
+
},
|
|
26
|
+
disabled: function disabled(flowGraph) {
|
|
27
|
+
return flowGraph.zoom() >= MAX_ZOOM;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var Zoom = function Zoom(props) {
|
|
31
|
+
var flowGraph = useGraph();
|
|
32
|
+
var _useState = useState(flowGraph.zoom()),
|
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
+
scale = _useState2[0],
|
|
35
|
+
setScale = _useState2[1];
|
|
36
|
+
var _useContext = useContext(GraphContext),
|
|
37
|
+
currentEditor = _useContext.currentEditor,
|
|
38
|
+
chainObject = _useContext.chainObject;
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
var handleScale = function handleScale() {
|
|
41
|
+
setScale(flowGraph.zoom());
|
|
42
|
+
};
|
|
43
|
+
flowGraph.on('scale', handleScale);
|
|
44
|
+
setTimeout(function () {
|
|
45
|
+
if (chainObject !== null && chainObject !== void 0 && chainObject.dslData) {
|
|
46
|
+
typeof (chainObject === null || chainObject === void 0 ? void 0 : chainObject.dslData) === 'string' && (chainObject.dslData = JSON.parse(chainObject === null || chainObject === void 0 ? void 0 : chainObject.dslData));
|
|
47
|
+
currentEditor.fromJSON(chainObject === null || chainObject === void 0 ? void 0 : chainObject.dslData);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
currentEditor.fromJSON({});
|
|
51
|
+
}, 500);
|
|
52
|
+
return function () {
|
|
53
|
+
flowGraph.off('scale', handleScale);
|
|
54
|
+
};
|
|
55
|
+
}, [flowGraph]);
|
|
56
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
className: styles.zoomContainer
|
|
58
|
+
}, /*#__PURE__*/React.createElement(ZoomOut, props), /*#__PURE__*/React.createElement("span", {
|
|
59
|
+
className: styles.zoomText
|
|
60
|
+
}, Helper.scaleFormatter(scale)), /*#__PURE__*/React.createElement(ZoomIn, props));
|
|
61
|
+
};
|
|
62
|
+
var Helper = {
|
|
63
|
+
scaleFormatter: function scaleFormatter(scale) {
|
|
64
|
+
return (scale * 100).toFixed(0) + '%';
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
export default Zoom;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
type EventHandler<T = any> = (payload: T) => void;
|
|
2
|
+
declare class EventBus {
|
|
3
|
+
private events;
|
|
4
|
+
/**
|
|
5
|
+
* 添加监听器
|
|
6
|
+
* @param event 事件名称
|
|
7
|
+
* @param handler 事件处理函数
|
|
8
|
+
*/
|
|
9
|
+
on<T = any>(event: string, handler: EventHandler<T>): void;
|
|
10
|
+
/**
|
|
11
|
+
* 添加一次性监听器
|
|
12
|
+
* @param event 事件名称
|
|
13
|
+
* @param handler 事件处理函数
|
|
14
|
+
*/
|
|
15
|
+
once<T = any>(event: string, handler: EventHandler<T>): void;
|
|
16
|
+
/**
|
|
17
|
+
* 移除某事件的所有监听器
|
|
18
|
+
* @param event 事件名称
|
|
19
|
+
*/
|
|
20
|
+
off(event: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* 触发事件
|
|
23
|
+
* @param event 事件名称
|
|
24
|
+
* @param payload 事件参数
|
|
25
|
+
*/
|
|
26
|
+
emit<T = any>(event: string, payload?: T): void;
|
|
27
|
+
/**
|
|
28
|
+
* 清除所有事件
|
|
29
|
+
* @description 移除所有事件监听器,谨慎使用
|
|
30
|
+
*/
|
|
31
|
+
clear(): void;
|
|
32
|
+
}
|
|
33
|
+
export declare const eventBus: EventBus;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
var EventBus = /*#__PURE__*/function () {
|
|
5
|
+
function EventBus() {
|
|
6
|
+
_classCallCheck(this, EventBus);
|
|
7
|
+
_defineProperty(this, "events", new Map());
|
|
8
|
+
}
|
|
9
|
+
_createClass(EventBus, [{
|
|
10
|
+
key: "on",
|
|
11
|
+
value:
|
|
12
|
+
/**
|
|
13
|
+
* 添加监听器
|
|
14
|
+
* @param event 事件名称
|
|
15
|
+
* @param handler 事件处理函数
|
|
16
|
+
*/
|
|
17
|
+
function on(event, handler) {
|
|
18
|
+
if (!this.events.has(event)) {
|
|
19
|
+
this.events.set(event, new Set());
|
|
20
|
+
}
|
|
21
|
+
this.events.get(event).add(handler);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 添加一次性监听器
|
|
26
|
+
* @param event 事件名称
|
|
27
|
+
* @param handler 事件处理函数
|
|
28
|
+
*/
|
|
29
|
+
}, {
|
|
30
|
+
key: "once",
|
|
31
|
+
value: function once(event, handler) {
|
|
32
|
+
var _this = this;
|
|
33
|
+
/**
|
|
34
|
+
* @description 移除当前监听器
|
|
35
|
+
*/
|
|
36
|
+
var wrapper = function wrapper(payload) {
|
|
37
|
+
_this.off(event); // 移除当前监听器
|
|
38
|
+
handler(payload);
|
|
39
|
+
};
|
|
40
|
+
this.on(event, wrapper);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 移除某事件的所有监听器
|
|
45
|
+
* @param event 事件名称
|
|
46
|
+
*/
|
|
47
|
+
}, {
|
|
48
|
+
key: "off",
|
|
49
|
+
value: function off(event) {
|
|
50
|
+
this.events.delete(event);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 触发事件
|
|
55
|
+
* @param event 事件名称
|
|
56
|
+
* @param payload 事件参数
|
|
57
|
+
*/
|
|
58
|
+
}, {
|
|
59
|
+
key: "emit",
|
|
60
|
+
value: function emit(event, payload) {
|
|
61
|
+
var handlers = this.events.get(event);
|
|
62
|
+
if (handlers) {
|
|
63
|
+
// 使用 values() 方法获取迭代器来遍历 Set,避免扩展运算符兼容性问题
|
|
64
|
+
var iterator = handlers.values();
|
|
65
|
+
var result = iterator.next();
|
|
66
|
+
while (!result.done) {
|
|
67
|
+
var handler = result.value;
|
|
68
|
+
handler(payload);
|
|
69
|
+
result = iterator.next();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 清除所有事件
|
|
76
|
+
* @description 移除所有事件监听器,谨慎使用
|
|
77
|
+
*/
|
|
78
|
+
}, {
|
|
79
|
+
key: "clear",
|
|
80
|
+
value: function clear() {
|
|
81
|
+
this.events.clear();
|
|
82
|
+
}
|
|
83
|
+
}]);
|
|
84
|
+
return EventBus;
|
|
85
|
+
}();
|
|
86
|
+
export var eventBus = new EventBus();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Cell, Graph } from '@antv/x6';
|
|
2
|
+
export declare const hasCellSelected: (flowGraph: Graph) => boolean;
|
|
3
|
+
export declare const hasNodeSelected: (flowGraph: Graph) => boolean;
|
|
4
|
+
export declare const hasEdgeSelected: (flowGraph: Graph) => boolean;
|
|
5
|
+
export declare const getSelectedNodes: (flowGraph: Graph) => Cell[];
|
|
6
|
+
export declare const getSelectedEdges: (flowGraph: Graph) => Cell[];
|
|
7
|
+
export declare const toSelectedCellsJSON: (flowGraph: Graph) => {
|
|
8
|
+
cells: Cell.Properties[];
|
|
9
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export var hasCellSelected = function hasCellSelected(flowGraph) {
|
|
2
|
+
return flowGraph.getSelectedCellCount() > 0;
|
|
3
|
+
};
|
|
4
|
+
export var hasNodeSelected = function hasNodeSelected(flowGraph) {
|
|
5
|
+
return flowGraph.getSelectedCells().filter(function (cell) {
|
|
6
|
+
return cell.isNode();
|
|
7
|
+
}).length > 0;
|
|
8
|
+
};
|
|
9
|
+
export var hasEdgeSelected = function hasEdgeSelected(flowGraph) {
|
|
10
|
+
return flowGraph.getSelectedCells().filter(function (cell) {
|
|
11
|
+
return cell.isEdge();
|
|
12
|
+
}).length > 0;
|
|
13
|
+
};
|
|
14
|
+
export var getSelectedNodes = function getSelectedNodes(flowGraph) {
|
|
15
|
+
return flowGraph.getSelectedCells().filter(function (cell) {
|
|
16
|
+
return cell.isNode();
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
export var getSelectedEdges = function getSelectedEdges(flowGraph) {
|
|
20
|
+
return flowGraph.getSelectedCells().filter(function (cell) {
|
|
21
|
+
return cell.isEdge();
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
export var toSelectedCellsJSON = function toSelectedCellsJSON(flowGraph) {
|
|
25
|
+
var json = flowGraph.toJSON();
|
|
26
|
+
var selectedCells = flowGraph.getSelectedCells();
|
|
27
|
+
return {
|
|
28
|
+
cells: json.cells.filter(function (cell) {
|
|
29
|
+
return selectedCells.find(function (o) {
|
|
30
|
+
return o.id === cell.id;
|
|
31
|
+
});
|
|
32
|
+
})
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const safeParse: (json: string) => Record<string, any>;
|
|
2
|
+
export declare const safeGet: (obj: any, keyChain: string, defaultVal?: any) => any;
|
|
3
|
+
export declare const executeScript: (code: string, type?: string) => void;
|
|
4
|
+
/**
|
|
5
|
+
* @description: 查找在当前节点之前的所有节点
|
|
6
|
+
* @param {Record<string, any>} data
|
|
7
|
+
* @param {string} targetTag
|
|
8
|
+
* @param {any[]} result
|
|
9
|
+
*/
|
|
10
|
+
export declare const findNodesBeforeTag: (data: Record<string, any>, targetTag: string, result?: any[]) => any[];
|
|
11
|
+
/**
|
|
12
|
+
* @description 提取{{}}内的内容
|
|
13
|
+
* @param {string} str
|
|
14
|
+
* @return 提取到的内容数组
|
|
15
|
+
*/
|
|
16
|
+
export declare const extractBracedContent: (str: string) => string[];
|
|
17
|
+
/**
|
|
18
|
+
* @description: 查找使用工作流参数的节点
|
|
19
|
+
* @param {Record<string, any>} data
|
|
20
|
+
*/
|
|
21
|
+
export declare const findWorkInputs: (data: Record<string, any>) => any[];
|
|
22
|
+
/**
|
|
23
|
+
* @description: 使用正则匹配括号内的内容
|
|
24
|
+
* @param {string} text
|
|
25
|
+
*/
|
|
26
|
+
export declare const extractTextInParentheses: (text: string) => string;
|
|
27
|
+
/**
|
|
28
|
+
* @description: 格式化时间
|
|
29
|
+
* @param {string} time
|
|
30
|
+
* @return 格式化后的时间
|
|
31
|
+
*/
|
|
32
|
+
export declare const formatDateTime: (time: string) => string;
|
|
33
|
+
export declare const useTagGetModel: (tag: string, useModel: any) => any;
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
3
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
4
|
+
export var safeParse = function safeParse(json) {
|
|
5
|
+
try {
|
|
6
|
+
return JSON.parse(json);
|
|
7
|
+
} catch (error) {
|
|
8
|
+
return {};
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export var safeGet = function safeGet(obj, keyChain, defaultVal) {
|
|
12
|
+
if (_typeof(obj) !== 'object' || obj === null) {
|
|
13
|
+
return defaultVal;
|
|
14
|
+
}
|
|
15
|
+
var val = obj;
|
|
16
|
+
var keys = keyChain.split('.');
|
|
17
|
+
var _iterator = _createForOfIteratorHelper(keys),
|
|
18
|
+
_step;
|
|
19
|
+
try {
|
|
20
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
21
|
+
var key = _step.value;
|
|
22
|
+
if (val[key] === undefined) {
|
|
23
|
+
return defaultVal;
|
|
24
|
+
} else {
|
|
25
|
+
val = val[key];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
} catch (err) {
|
|
29
|
+
_iterator.e(err);
|
|
30
|
+
} finally {
|
|
31
|
+
_iterator.f();
|
|
32
|
+
}
|
|
33
|
+
return val;
|
|
34
|
+
};
|
|
35
|
+
export var executeScript = function executeScript(code) {
|
|
36
|
+
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'module';
|
|
37
|
+
var script = document.createElement('script');
|
|
38
|
+
script.type = type;
|
|
39
|
+
script.text = code;
|
|
40
|
+
document.body.appendChild(script);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @description: 查找在当前节点之前的所有节点
|
|
45
|
+
* @param {Record<string, any>} data
|
|
46
|
+
* @param {string} targetTag
|
|
47
|
+
* @param {any[]} result
|
|
48
|
+
*/
|
|
49
|
+
export var findNodesBeforeTag = function findNodesBeforeTag(data, targetTag) {
|
|
50
|
+
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
51
|
+
if (Array.isArray(data)) {
|
|
52
|
+
var _iterator2 = _createForOfIteratorHelper(data),
|
|
53
|
+
_step2;
|
|
54
|
+
try {
|
|
55
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
56
|
+
var item = _step2.value;
|
|
57
|
+
// console.log('item', item);
|
|
58
|
+
if (item.type === 'NodeComponent') {
|
|
59
|
+
var _item$properties;
|
|
60
|
+
if (((_item$properties = item.properties) === null || _item$properties === void 0 ? void 0 : _item$properties.tag) === targetTag) {
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
result.push({
|
|
64
|
+
properties: item.properties,
|
|
65
|
+
id: item.id
|
|
66
|
+
});
|
|
67
|
+
} else if (item.type === 'WHEN' && item.children) {
|
|
68
|
+
// 检查目标节点是否在 WHEN 内部
|
|
69
|
+
var isTargetInWhen = item.children.some(function (child) {
|
|
70
|
+
var _child$properties;
|
|
71
|
+
return ((_child$properties = child.properties) === null || _child$properties === void 0 ? void 0 : _child$properties.tag) === targetTag;
|
|
72
|
+
});
|
|
73
|
+
if (isTargetInWhen) {
|
|
74
|
+
// 若目标节点在 WHEN 内部,直接跳过整个 WHEN 节点
|
|
75
|
+
continue;
|
|
76
|
+
} else {
|
|
77
|
+
// 若目标节点不在 WHEN 内部,递归处理 WHEN 的子节点
|
|
78
|
+
findNodesBeforeTag(item.children, targetTag, result);
|
|
79
|
+
}
|
|
80
|
+
} else if (item.type === "ITERATOR") {
|
|
81
|
+
var _item$condition$prope;
|
|
82
|
+
var isTargetInIterator = ((_item$condition$prope = item.condition.properties) === null || _item$condition$prope === void 0 ? void 0 : _item$condition$prope.tag) === targetTag;
|
|
83
|
+
if (isTargetInIterator) {
|
|
84
|
+
// 若目标节点在 ITERATOR 内部,直接跳过整个 ITERATOR 节点
|
|
85
|
+
continue;
|
|
86
|
+
} else {
|
|
87
|
+
// 若目标节点不在 ITERATOR 内部,递归处理 ITERATOR 的子节点
|
|
88
|
+
findNodesBeforeTag(item.children, targetTag, result);
|
|
89
|
+
}
|
|
90
|
+
} else if (item.children) {
|
|
91
|
+
findNodesBeforeTag(item.children, targetTag, result);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
} catch (err) {
|
|
95
|
+
_iterator2.e(err);
|
|
96
|
+
} finally {
|
|
97
|
+
_iterator2.f();
|
|
98
|
+
}
|
|
99
|
+
} else if (data.children) {
|
|
100
|
+
findNodesBeforeTag(data.children, targetTag, result);
|
|
101
|
+
}
|
|
102
|
+
return result;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @description 提取{{}}内的内容
|
|
107
|
+
* @param {string} str
|
|
108
|
+
* @return 提取到的内容数组
|
|
109
|
+
*/
|
|
110
|
+
export var extractBracedContent = function extractBracedContent(str) {
|
|
111
|
+
var regex = /\{\{(.*?)\}\}/g;
|
|
112
|
+
var matches = [];
|
|
113
|
+
var match;
|
|
114
|
+
while ((match = regex.exec(str)) !== null) {
|
|
115
|
+
matches.push(match[1]); // match[1] 是括号内的内容
|
|
116
|
+
}
|
|
117
|
+
return matches;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @description: 查找使用工作流参数的节点
|
|
122
|
+
* @param {Record<string, any>} data
|
|
123
|
+
*/
|
|
124
|
+
export var findWorkInputs = function findWorkInputs(data) {
|
|
125
|
+
var result = [];
|
|
126
|
+
function traverse(nodes) {
|
|
127
|
+
if (!Array.isArray(nodes)) return;
|
|
128
|
+
var _iterator3 = _createForOfIteratorHelper(nodes),
|
|
129
|
+
_step3;
|
|
130
|
+
try {
|
|
131
|
+
var _loop = function _loop() {
|
|
132
|
+
var _node$properties, _node$properties2;
|
|
133
|
+
var node = _step3.value;
|
|
134
|
+
if (node.type === 'NodeComponent' && Array.isArray((_node$properties = node.properties) === null || _node$properties === void 0 ? void 0 : _node$properties.inputList)) {
|
|
135
|
+
node.properties.inputList.forEach(function (input) {
|
|
136
|
+
var _input$value;
|
|
137
|
+
if (input.type === 'input') {
|
|
138
|
+
var usePramsList = extractBracedContent(input.value);
|
|
139
|
+
if (usePramsList.length > 0) {
|
|
140
|
+
usePramsList.forEach(function (item) {
|
|
141
|
+
if (item.split('~~~')[0] === 'work') {
|
|
142
|
+
result.push({
|
|
143
|
+
tag: node.properties.tag,
|
|
144
|
+
label: input.label,
|
|
145
|
+
value: item.split('~~~')[1]
|
|
146
|
+
}); // 也可以换成 `result.push(input.value);`
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
var prefix = (_input$value = input.value) === null || _input$value === void 0 ? void 0 : _input$value.split('~~~')[0];
|
|
153
|
+
if (prefix === 'work') {
|
|
154
|
+
var _input$value2;
|
|
155
|
+
result.push({
|
|
156
|
+
tag: node.properties.tag,
|
|
157
|
+
label: input.label,
|
|
158
|
+
value: (_input$value2 = input.value) === null || _input$value2 === void 0 ? void 0 : _input$value2.split('~~~')[1]
|
|
159
|
+
}); // 也可以换成 `result.push(input.value);`
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
if (node.type === 'NodeComponent' && (_node$properties2 = node.properties) !== null && _node$properties2 !== void 0 && _node$properties2.filterParam) {
|
|
164
|
+
var _node$properties3;
|
|
165
|
+
var filterParam = JSON.parse((_node$properties3 = node.properties) === null || _node$properties3 === void 0 ? void 0 : _node$properties3.filterParam);
|
|
166
|
+
filterParam.forEach(function (item) {
|
|
167
|
+
var _loop2 = function _loop2(key) {
|
|
168
|
+
if (key.split('-')[0] === 'initialize' && !result.find(function (i) {
|
|
169
|
+
return i.value === JSON.parse(item.param[key]).value.split('@@')[1];
|
|
170
|
+
})) {
|
|
171
|
+
result.push({
|
|
172
|
+
tag: node.properties.tag,
|
|
173
|
+
label: '过滤器条件',
|
|
174
|
+
value: JSON.parse(item.param[key]).value.split('@@')[1]
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
for (var key in item.param) {
|
|
179
|
+
_loop2(key);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
if (Array.isArray(node.children)) {
|
|
184
|
+
traverse(node.children);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
188
|
+
_loop();
|
|
189
|
+
}
|
|
190
|
+
} catch (err) {
|
|
191
|
+
_iterator3.e(err);
|
|
192
|
+
} finally {
|
|
193
|
+
_iterator3.f();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
traverse(data.children);
|
|
197
|
+
return result;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* @description: 使用正则匹配括号内的内容
|
|
202
|
+
* @param {string} text
|
|
203
|
+
*/
|
|
204
|
+
export var extractTextInParentheses = function extractTextInParentheses(text) {
|
|
205
|
+
var match = text.match(/\(([^)]+)\)/);
|
|
206
|
+
return match ? match[1] : text;
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* @description: 格式化时间
|
|
210
|
+
* @param {string} time
|
|
211
|
+
* @return 格式化后的时间
|
|
212
|
+
*/
|
|
213
|
+
export var formatDateTime = function formatDateTime(time) {
|
|
214
|
+
var date = new Date(time);
|
|
215
|
+
if (isNaN(date.getTime())) return ''; // 处理非法时间输入
|
|
216
|
+
|
|
217
|
+
var year = date.getFullYear();
|
|
218
|
+
var month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始
|
|
219
|
+
var day = String(date.getDate()).padStart(2, '0');
|
|
220
|
+
return "".concat(year, "/").concat(month, "/").concat(day);
|
|
221
|
+
};
|
|
222
|
+
export var useTagGetModel = function useTagGetModel(tag, useModel) {
|
|
223
|
+
if (typeof useModel !== 'function') return null;
|
|
224
|
+
var stack = [];
|
|
225
|
+
var model = useModel();
|
|
226
|
+
var modelJSON = model.toJSON();
|
|
227
|
+
if (!modelJSON.children) return null;
|
|
228
|
+
|
|
229
|
+
// 初始时,将所有子节点入栈
|
|
230
|
+
stack.push.apply(stack, _toConsumableArray(modelJSON.children));
|
|
231
|
+
while (stack.length > 0) {
|
|
232
|
+
var _item$properties2;
|
|
233
|
+
var item = stack.pop(); // 取出栈顶元素
|
|
234
|
+
|
|
235
|
+
if (item.type === "NodeComponent" && ((_item$properties2 = item.properties) === null || _item$properties2 === void 0 ? void 0 : _item$properties2.tag) === tag) {
|
|
236
|
+
return item; // 找到目标节点,直接返回
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// 如果当前节点有子节点,将其子节点入栈(继续遍历)
|
|
240
|
+
if (item.children) {
|
|
241
|
+
stack.push.apply(stack, _toConsumableArray(item.children));
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return null; // 遍历完所有节点仍未找到,返回 null
|
|
245
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED