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,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text, Descendant, BaseEditor } from 'slate';
|
|
3
|
+
import { ReactEditor } from 'slate-react';
|
|
4
|
+
interface VariableElement {
|
|
5
|
+
type: 'variable';
|
|
6
|
+
label: string;
|
|
7
|
+
value: string;
|
|
8
|
+
children: Text[];
|
|
9
|
+
}
|
|
10
|
+
type CustomElement = VariableElement | {
|
|
11
|
+
type: 'paragraph';
|
|
12
|
+
children: Descendant[];
|
|
13
|
+
};
|
|
14
|
+
declare module 'slate' {
|
|
15
|
+
interface CustomTypes {
|
|
16
|
+
Editor: BaseEditor & ReactEditor;
|
|
17
|
+
Element: CustomElement;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
interface ParamItem {
|
|
21
|
+
label: string;
|
|
22
|
+
value?: string;
|
|
23
|
+
options: ParamItem[];
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
interface RichParamEditorProps {
|
|
27
|
+
value: Descendant[];
|
|
28
|
+
onChange: (value: Descendant[]) => void;
|
|
29
|
+
options: ParamItem[];
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
}
|
|
32
|
+
declare const RichParamEditor: React.FC<RichParamEditorProps>;
|
|
33
|
+
export default RichParamEditor;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
4
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
5
|
+
import React, { useMemo, useCallback, useState, useRef } from 'react';
|
|
6
|
+
import { createEditor, Transforms, Text, Editor, Range } from 'slate';
|
|
7
|
+
import { Slate, Editable, withReact, ReactEditor } from 'slate-react';
|
|
8
|
+
import { css } from '@emotion/css';
|
|
9
|
+
import CustomDropdown from "./CustomDropdown";
|
|
10
|
+
import { useTranslation } from 'react-i18next';
|
|
11
|
+
var VariableTag = function VariableTag(_ref) {
|
|
12
|
+
var attributes = _ref.attributes,
|
|
13
|
+
children = _ref.children,
|
|
14
|
+
element = _ref.element;
|
|
15
|
+
var el = element;
|
|
16
|
+
return /*#__PURE__*/React.createElement("span", _extends({}, attributes, {
|
|
17
|
+
contentEditable: false,
|
|
18
|
+
className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-block;\n margin: 0 2px;\n padding: 0 4px;\n background: #e6f7ff;\n border: 1px solid #91d5ff;\n border-radius: 4px;\n font-size: 12px;\n "])))
|
|
19
|
+
}), el.label);
|
|
20
|
+
};
|
|
21
|
+
var Element = function Element(props) {
|
|
22
|
+
var attributes = props.attributes,
|
|
23
|
+
children = props.children,
|
|
24
|
+
element = props.element;
|
|
25
|
+
switch (element.type) {
|
|
26
|
+
case 'variable':
|
|
27
|
+
return /*#__PURE__*/React.createElement(VariableTag, props);
|
|
28
|
+
default:
|
|
29
|
+
return /*#__PURE__*/React.createElement("span", attributes, children);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var withVariables = function withVariables(editor) {
|
|
33
|
+
var isInline = editor.isInline;
|
|
34
|
+
editor.isInline = function (element) {
|
|
35
|
+
return element.type === 'variable' ? true : isInline(element);
|
|
36
|
+
};
|
|
37
|
+
return editor;
|
|
38
|
+
};
|
|
39
|
+
var insertVariable = function insertVariable(editor, variable) {
|
|
40
|
+
var variableElement = {
|
|
41
|
+
type: 'variable',
|
|
42
|
+
label: variable.label,
|
|
43
|
+
value: variable.value,
|
|
44
|
+
children: [{
|
|
45
|
+
text: ''
|
|
46
|
+
}]
|
|
47
|
+
};
|
|
48
|
+
Transforms.delete(editor, {
|
|
49
|
+
unit: 'character',
|
|
50
|
+
reverse: true
|
|
51
|
+
});
|
|
52
|
+
Transforms.insertNodes(editor, variableElement);
|
|
53
|
+
setTimeout(function () {
|
|
54
|
+
var endPoint = Editor.end(editor, []);
|
|
55
|
+
Transforms.select(editor, endPoint);
|
|
56
|
+
ReactEditor.focus(editor);
|
|
57
|
+
}, 0);
|
|
58
|
+
};
|
|
59
|
+
var RichParamEditor = function RichParamEditor(_ref2) {
|
|
60
|
+
var value = _ref2.value,
|
|
61
|
+
_onChange = _ref2.onChange,
|
|
62
|
+
options = _ref2.options,
|
|
63
|
+
_ref2$disabled = _ref2.disabled,
|
|
64
|
+
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled;
|
|
65
|
+
var editor = useMemo(function () {
|
|
66
|
+
return withVariables(withReact(createEditor()));
|
|
67
|
+
}, []);
|
|
68
|
+
var renderElement = useCallback(function (props) {
|
|
69
|
+
return /*#__PURE__*/React.createElement(Element, props);
|
|
70
|
+
}, []);
|
|
71
|
+
var editorContainerRef = useRef(null);
|
|
72
|
+
var _useState = useState(null),
|
|
73
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
74
|
+
target = _useState2[0],
|
|
75
|
+
setTarget = _useState2[1];
|
|
76
|
+
var _useState3 = useState({
|
|
77
|
+
top: 0,
|
|
78
|
+
left: 0,
|
|
79
|
+
width: 0
|
|
80
|
+
}),
|
|
81
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
82
|
+
dropdownPos = _useState4[0],
|
|
83
|
+
setDropdownPos = _useState4[1];
|
|
84
|
+
var _useTranslation = useTranslation(),
|
|
85
|
+
t = _useTranslation.t;
|
|
86
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
87
|
+
// console.log(event.key,'event.key');
|
|
88
|
+
if (event.key === '/') {
|
|
89
|
+
var selection = editor.selection;
|
|
90
|
+
if (selection && Range.isCollapsed(selection)) {
|
|
91
|
+
setTarget(selection);
|
|
92
|
+
setTimeout(function () {
|
|
93
|
+
if (editorContainerRef.current) {
|
|
94
|
+
var rect = editorContainerRef.current.getBoundingClientRect();
|
|
95
|
+
// console.log(rect,'rect');
|
|
96
|
+
setDropdownPos({
|
|
97
|
+
top: rect.bottom + window.scrollY,
|
|
98
|
+
left: rect.left + window.scrollX,
|
|
99
|
+
width: rect.width
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}, 0);
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
setTarget(null);
|
|
106
|
+
}
|
|
107
|
+
if (event.key === 'Enter') {
|
|
108
|
+
event.preventDefault();
|
|
109
|
+
Transforms.insertText(editor, '\n');
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
var handleSelect = function handleSelect(item) {
|
|
113
|
+
if (item.disabled) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (target) {
|
|
117
|
+
Transforms.select(editor, target);
|
|
118
|
+
insertVariable(editor, item);
|
|
119
|
+
}
|
|
120
|
+
setTarget(null);
|
|
121
|
+
// setDropdownPos(null);
|
|
122
|
+
};
|
|
123
|
+
return /*#__PURE__*/React.createElement(Slate, {
|
|
124
|
+
editor: editor,
|
|
125
|
+
value: value.length ? value : [{
|
|
126
|
+
type: 'paragraph',
|
|
127
|
+
children: [{
|
|
128
|
+
text: ''
|
|
129
|
+
}]
|
|
130
|
+
}],
|
|
131
|
+
onChange: function onChange(val) {
|
|
132
|
+
_onChange(val);
|
|
133
|
+
var selection = editor.selection;
|
|
134
|
+
if (selection && Range.isCollapsed(selection)) {
|
|
135
|
+
var _Editor$node = Editor.node(editor, selection.focus.path),
|
|
136
|
+
_Editor$node2 = _slicedToArray(_Editor$node, 1),
|
|
137
|
+
node = _Editor$node2[0];
|
|
138
|
+
var text = Text.isText(node) ? node.text : '';
|
|
139
|
+
if (text.endsWith('/')) {
|
|
140
|
+
setTarget(selection);
|
|
141
|
+
// 💡 延迟以等待 DOM 更新完成
|
|
142
|
+
setTimeout(function () {
|
|
143
|
+
if (editorContainerRef.current) {
|
|
144
|
+
var rect = editorContainerRef.current.getBoundingClientRect();
|
|
145
|
+
// console.log(rect,'rect');
|
|
146
|
+
setDropdownPos({
|
|
147
|
+
top: rect.bottom + window.scrollY,
|
|
148
|
+
left: rect.left + window.scrollX,
|
|
149
|
+
width: rect.width
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}, 0);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
157
|
+
ref: editorContainerRef,
|
|
158
|
+
className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border: 1px solid #d9d9d9;\n padding: 6px;\n min-height: 36px;\n border-radius: 4px;\n cursor: ", ";\n background: ", ";\n "])), disabled ? 'not-allowed' : 'text', disabled ? '#f5f5f5' : 'white')
|
|
159
|
+
}, /*#__PURE__*/React.createElement(Editable, {
|
|
160
|
+
renderElement: renderElement,
|
|
161
|
+
onKeyDown: handleKeyDown,
|
|
162
|
+
placeholder: t('input_insert_variables'),
|
|
163
|
+
readOnly: disabled
|
|
164
|
+
})), /*#__PURE__*/React.createElement(CustomDropdown, {
|
|
165
|
+
open: !!target,
|
|
166
|
+
position: dropdownPos,
|
|
167
|
+
onClose: function onClose() {
|
|
168
|
+
return setTarget(null);
|
|
169
|
+
}
|
|
170
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
171
|
+
className: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["padding: 4px 0;"])))
|
|
172
|
+
}, options.length > 0 ? options.map(function (optP) {
|
|
173
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
174
|
+
key: optP.label
|
|
175
|
+
}, optP.value ? /*#__PURE__*/React.createElement("div", {
|
|
176
|
+
className: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: 8px 12px;\n color: #999;\n fontWeight: bold;\n fontSize: 14px;\n cursor: pointer;\n &:hover {\n background: #f5f5f5;\n }\n "]))),
|
|
177
|
+
onClick: function onClick() {
|
|
178
|
+
return handleSelect(optP);
|
|
179
|
+
}
|
|
180
|
+
}, optP.label) : /*#__PURE__*/React.createElement("div", {
|
|
181
|
+
className: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding: 8px 12px;\n color: #999;\n fontWeight: bold;\n fontSize: 14px;\n "])))
|
|
182
|
+
}, optP.label), optP.options.map(function (opt) {
|
|
183
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
184
|
+
key: opt.value,
|
|
185
|
+
onClick: function onClick() {
|
|
186
|
+
return handleSelect(opt);
|
|
187
|
+
},
|
|
188
|
+
className: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n padding: 6px 6px 6px 18px;\n cursor: ", ";\n color: ", ";\n background: ", ";\n &:hover {\n background: ", ";\n }\n "])), opt.disabled ? 'not-allowed' : 'pointer', opt.disabled ? '#999' : 'inherit', opt.disabled ? 'transparent' : 'inherit', opt.disabled ? 'transparent' : '#f5f5f5')
|
|
189
|
+
}, opt.label);
|
|
190
|
+
}));
|
|
191
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
|
192
|
+
className: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n padding: 8px 12px;\n color: #999;\n text-align: center;\n "])))
|
|
193
|
+
}, t('no_available_variables')))));
|
|
194
|
+
};
|
|
195
|
+
export default RichParamEditor;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Graph } from '@antv/x6';
|
|
3
|
+
import ELNode from '../../../model/node';
|
|
4
|
+
interface IProps {
|
|
5
|
+
model: ELNode;
|
|
6
|
+
paramsList: any[];
|
|
7
|
+
flowGraph: Graph;
|
|
8
|
+
}
|
|
9
|
+
declare const ComponentPropertiesEditor: React.FC<IProps>;
|
|
10
|
+
export default ComponentPropertiesEditor;
|