strategy-panel 1.0.1 → 1.0.2
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/.fatherrc.ts +11 -26
- package/.umirc.ts +4 -0
- package/README.md +33 -33
- package/es/assets/decive.svg +1 -1
- package/es/assets/hand.svg +1 -1
- package/es/assets/lock.svg +8 -0
- package/es/components/canvas/component-tree-panel/category-tree/category-type.d.ts +1 -0
- package/es/{common/graph-common → components/canvas/component-tree-panel/category-tree}/category-type.js +28 -12
- package/es/{pages → components/canvas}/component-tree-panel/category-tree/index.d.ts +17 -16
- package/es/{pages → components/canvas}/component-tree-panel/category-tree/index.js +14 -14
- package/es/{pages → components/canvas}/component-tree-panel/category-tree/index.less +36 -36
- package/es/{pages → components/canvas}/component-tree-panel/category-tree/node-title.d.ts +12 -12
- package/es/{pages → components/canvas}/component-tree-panel/category-tree/node-title.js +5 -3
- package/es/{pages → components/canvas}/component-tree-panel/index.d.ts +17 -17
- package/es/{pages → components/canvas}/component-tree-panel/index.js +1 -0
- package/es/{pages → components/canvas}/component-tree-panel/index.less +1 -0
- package/es/{pages → components/canvas}/config-panel/components/condition-configuration/configure-modal/data-origin.d.ts +49 -49
- package/es/{pages → components/canvas}/config-panel/components/condition-configuration/configure-modal/data-origin.js +26 -34
- package/es/{pages → components/canvas}/config-panel/components/condition-configuration/configure-modal/index.d.ts +11 -11
- package/es/{pages → components/canvas}/config-panel/components/condition-configuration/configure-modal/index.js +15 -23
- package/es/{pages → components/canvas}/config-panel/components/condition-configuration/configure-modal/style.less +1 -1
- package/es/{pages → components/canvas}/config-panel/components/condition-configuration/cross-line.d.ts +9 -9
- package/es/{pages → components/canvas}/config-panel/components/condition-configuration/cross-line.js +6 -10
- package/es/{pages → components/canvas}/config-panel/components/condition-configuration/index.d.ts +10 -9
- package/es/{pages → components/canvas}/config-panel/components/condition-configuration/index.js +17 -13
- package/es/{pages → components/canvas}/config-panel/components/condition-configuration/style.less +74 -74
- package/es/{pages → components/canvas}/config-panel/components/time-trigger/components/cycle-time.d.ts +9 -9
- package/es/{pages → components/canvas}/config-panel/components/time-trigger/components/cycle-time.js +24 -33
- package/es/{pages → components/canvas}/config-panel/components/time-trigger/components/time-horizon.d.ts +10 -10
- package/es/{pages → components/canvas}/config-panel/components/time-trigger/components/time-horizon.js +18 -28
- package/es/{pages → components/canvas}/config-panel/components/time-trigger/delay-time.d.ts +9 -9
- package/es/components/canvas/config-panel/components/time-trigger/effective-time.d.ts +7 -0
- package/es/components/canvas/config-panel/components/time-trigger/effective-time.js +43 -0
- package/es/{pages → components/canvas}/config-panel/components/time-trigger/index.d.ts +9 -8
- package/es/{pages → components/canvas}/config-panel/components/time-trigger/index.js +18 -17
- package/es/{pages → components/canvas}/config-panel/components/time-trigger/interval-time.d.ts +9 -9
- package/es/{pages → components/canvas}/config-panel/components/time-trigger/interval-time.js +4 -8
- package/es/{pages → components/canvas}/config-panel/components/time-trigger/persistent-time.d.ts +9 -9
- package/es/components/canvas/config-panel/components/time-trigger/section-Detail.d.ts +10 -0
- package/es/components/canvas/config-panel/components/time-trigger/section-Detail.js +125 -0
- package/es/components/canvas/config-panel/components/time-trigger/section-time.d.ts +9 -0
- package/es/components/canvas/config-panel/components/time-trigger/section-time.js +81 -0
- package/es/{pages → components/canvas}/config-panel/components/time-trigger/timing-time.d.ts +9 -9
- package/es/{pages → components/canvas}/config-panel/components/time-trigger/timing-time.js +7 -11
- package/es/{pages → components/canvas}/config-panel/config-common.d.ts +38 -37
- package/es/{pages → components/canvas}/config-panel/config-common.js +9 -15
- package/es/{pages → components/canvas}/config-panel/index.d.ts +14 -13
- package/es/{pages → components/canvas}/config-panel/index.js +2 -2
- package/es/{pages → components/canvas}/config-panel/node-form.d.ts +23 -22
- package/es/{pages → components/canvas}/config-panel/node-form.js +14 -16
- package/es/{pages → components/canvas}/config-panel/style.less +90 -81
- package/es/{pages → components/canvas}/dag-canvas/canvas-content.d.ts +11 -10
- package/es/{pages → components/canvas}/dag-canvas/canvas-content.js +23 -12
- package/es/{pages → components/canvas}/dag-canvas/index.d.ts +23 -18
- package/es/{pages → components/canvas}/dag-canvas/index.js +5 -2
- package/es/{pages → components/canvas}/dag-canvas/preview.d.ts +10 -10
- package/es/components/canvas/dag-canvas/preview.js +53 -0
- package/es/{pages → components/canvas}/index.d.ts +48 -42
- package/es/{pages → components/canvas}/index.js +20 -10
- package/es/{pages → components/canvas}/index.less +2 -2
- package/es/{pages → components/canvas}/strategy-header/index.d.ts +48 -56
- package/es/components/canvas/strategy-header/index.js +210 -0
- package/es/{pages → components/canvas}/strategy-header/style.less +4 -3
- package/es/{pages → components/canvas}/strategy-header/theme-switch/index.d.ts +4 -4
- package/es/{pages → components/canvas}/strategy-header/theme-switch/index.js +2 -3
- package/es/index.d.ts +9 -8
- package/es/index.js +8 -7
- package/es/packages/graph-canvas/graph-common.d.ts +19 -0
- package/es/packages/graph-canvas/graph-common.js +19 -0
- package/es/packages/graph-canvas/graph-model/edge/group-edge/index.d.ts +4 -0
- package/es/packages/graph-canvas/graph-model/edge/group-edge/index.js +63 -0
- package/es/packages/graph-canvas/graph-model/edge/index.d.ts +2 -0
- package/es/packages/graph-canvas/graph-model/edge/index.js +2 -0
- package/es/packages/graph-canvas/graph-model/node/application-node/application-element.d.ts +9 -0
- package/es/packages/graph-canvas/graph-model/node/application-node/application-element.js +20 -0
- package/es/packages/graph-canvas/graph-model/node/application-node/application-element.less +17 -0
- package/es/packages/graph-canvas/graph-model/node/application-node/index.d.ts +7 -0
- package/es/{common/graph-common/shape/nodes/GroupNode.js → packages/graph-canvas/graph-model/node/application-node/index.js} +42 -22
- package/es/{common/graph-common/shape/nodes/CommonNode.d.ts → packages/graph-canvas/graph-model/node/common-node/index.d.ts} +7 -5
- package/es/{common/graph-common/shape/nodes/CommonNode.js → packages/graph-canvas/graph-model/node/common-node/index.js} +8 -7
- package/es/{common/graph-common/node-element → packages/graph-canvas/graph-model/node/common-node}/node-element.d.ts +9 -9
- package/es/{common/graph-common/node-element → packages/graph-canvas/graph-model/node/common-node}/node-element.js +16 -14
- package/es/{common/graph-common/node-element → packages/graph-canvas/graph-model/node/common-node}/node-element.less +4 -4
- package/es/{common/graph-common/node-element → packages/graph-canvas/graph-model/node/condition-node}/condition-element.d.ts +9 -9
- package/es/{common/graph-common/node-element → packages/graph-canvas/graph-model/node/condition-node}/condition-element.js +20 -15
- package/es/{common/graph-common/node-element → packages/graph-canvas/graph-model/node/condition-node}/condition-element.less +76 -81
- package/es/packages/graph-canvas/graph-model/node/condition-node/images/rhombus.svg +3 -0
- package/es/{common/graph-common/shape/nodes/ConditionJudgment.d.ts → packages/graph-canvas/graph-model/node/condition-node/index.d.ts} +5 -5
- package/es/{common/graph-common/shape/nodes/ConditionJudgment.js → packages/graph-canvas/graph-model/node/condition-node/index.js} +7 -6
- package/es/packages/graph-canvas/graph-model/node/index.d.ts +5 -0
- package/es/packages/graph-canvas/graph-model/node/index.js +5 -0
- package/es/packages/graph-canvas/graph-model/node/logical-node/images/AND.svg +11 -0
- package/es/packages/graph-canvas/graph-model/node/logical-node/images/OR.svg +11 -0
- package/es/packages/graph-canvas/graph-model/node/logical-node/images/XOR.svg +11 -0
- package/es/packages/graph-canvas/graph-model/node/logical-node/images/locking.svg +5 -0
- package/es/packages/graph-canvas/graph-model/node/logical-node/images/unlock.svg +5 -0
- package/es/packages/graph-canvas/graph-model/node/logical-node/index.d.ts +6 -0
- package/es/{common/graph-common/shape/nodes/LogicalNode.js → packages/graph-canvas/graph-model/node/logical-node/index.js} +15 -15
- package/es/packages/graph-canvas/graph-model/node/logical-node/logical-element.d.ts +9 -0
- package/es/{common/graph-common/node-element → packages/graph-canvas/graph-model/node/logical-node}/logical-element.js +36 -19
- package/es/{common/graph-common/node-element → packages/graph-canvas/graph-model/node/logical-node}/logical-element.less +4 -9
- package/es/packages/graph-canvas/graph-model/node/style.less +8 -0
- package/es/{common → packages/graph-canvas}/graph-utils/graph.d.ts +87 -83
- package/es/{common → packages/graph-canvas}/graph-utils/graph.js +8 -4
- package/es/{pages/rx-models/experiment-graph.d.ts → packages/graph-canvas/index.d.ts} +79 -82
- package/es/{pages/rx-models/experiment-graph.js → packages/graph-canvas/index.js} +285 -252
- package/es/packages/graph-canvas/node-types.d.ts +6 -0
- package/es/packages/graph-canvas/node-types.js +54 -0
- package/es/packages/graph-canvas/typings.d.ts +5 -0
- package/es/{common/constants → packages/graph-common}/global.d.ts +1 -1
- package/es/{common/constants → packages/graph-common}/graph.d.ts +12 -10
- package/es/{common/constants → packages/graph-common}/graph.js +4 -2
- package/es/{pages/rx-models → packages/graph-core}/graph-util.d.ts +182 -186
- package/es/{pages/rx-models → packages/graph-core}/graph-util.js +8 -15
- package/es/{pages/rx-models/graph-core.d.ts → packages/graph-core/index.d.ts} +96 -96
- package/es/{pages/rx-models/graph-core.js → packages/graph-core/index.js} +119 -87
- package/es/packages/graph-core/typing.d.ts +107 -0
- package/es/{common/graph-common → packages/graph-model}/connector/index.d.ts +1 -1
- package/es/packages/graph-model/connector/index.js +14 -0
- package/es/packages/graph-model/edge/edge.less +8 -0
- package/es/packages/graph-model/edge/index.d.ts +5 -0
- package/es/{common/graph-common/shape/edge.js → packages/graph-model/edge/index.js} +10 -61
- package/es/packages/graph-model/node/index.d.ts +7 -0
- package/es/{common/graph-common/shape/nodes/BaseNode.js → packages/graph-model/node/index.js} +12 -3
- package/es/{common/graph-common/node-element/common-element.less → packages/graph-model/node/node-basic.less} +1 -0
- package/es/{hooks → packages/hooks}/useObservableState.d.ts +3 -3
- package/es/packages/hooks/withMode.d.ts +3 -0
- package/es/packages/hooks/withMode.js +12 -0
- package/es/style/default.less +8 -0
- package/es/style/svgRaw.d.ts +1 -0
- package/es/style/svgRaw.js +1 -0
- package/es/typings.d.ts +2 -8
- package/es/utils/utils.d.ts +1 -1
- package/lib/assets/AND.svg +11 -0
- package/lib/assets/OR.svg +11 -0
- package/lib/assets/XOR.svg +11 -0
- package/lib/assets/add.svg +13 -0
- package/lib/assets/alarm.svg +11 -0
- package/lib/assets/application.svg +11 -0
- package/lib/assets/cancel.svg +13 -0
- package/lib/assets/check.svg +12 -0
- package/lib/assets/condition.svg +12 -0
- package/lib/assets/control.svg +11 -0
- package/lib/assets/decive.svg +11 -0
- package/lib/assets/delete.svg +11 -0
- package/lib/assets/device.svg +11 -0
- package/lib/assets/edit.svg +11 -0
- package/lib/assets/hand.svg +11 -0
- package/lib/assets/link.svg +11 -0
- package/lib/assets/lock.svg +8 -0
- package/lib/assets/logical.svg +12 -0
- package/lib/assets/notice.svg +11 -0
- package/lib/assets/order.svg +11 -0
- package/lib/assets/relation.svg +11 -0
- package/lib/assets/rhombus.svg +3 -0
- package/lib/assets/save.svg +13 -0
- package/lib/assets/time.svg +11 -0
- package/lib/assets/variate.svg +12 -0
- package/lib/components/canvas/component-tree-panel/category-tree/category-type.d.ts +1 -0
- package/lib/components/canvas/component-tree-panel/category-tree/category-type.js +111 -0
- package/lib/components/canvas/component-tree-panel/category-tree/index.d.ts +17 -0
- package/lib/components/canvas/component-tree-panel/category-tree/index.js +115 -0
- package/lib/components/canvas/component-tree-panel/category-tree/index.less +36 -0
- package/lib/components/canvas/component-tree-panel/category-tree/node-title.d.ts +12 -0
- package/lib/components/canvas/component-tree-panel/category-tree/node-title.js +75 -0
- package/lib/components/canvas/component-tree-panel/category-tree/node-title.less +113 -0
- package/lib/components/canvas/component-tree-panel/index.d.ts +17 -0
- package/lib/components/canvas/component-tree-panel/index.js +33 -0
- package/lib/components/canvas/component-tree-panel/index.less +52 -0
- package/lib/components/canvas/config-panel/components/condition-configuration/configure-modal/data-origin.d.ts +49 -0
- package/lib/components/canvas/config-panel/components/condition-configuration/configure-modal/data-origin.js +229 -0
- package/lib/components/canvas/config-panel/components/condition-configuration/configure-modal/index.d.ts +11 -0
- package/lib/components/canvas/config-panel/components/condition-configuration/configure-modal/index.js +187 -0
- package/lib/components/canvas/config-panel/components/condition-configuration/configure-modal/style.less +13 -0
- package/lib/components/canvas/config-panel/components/condition-configuration/cross-line.d.ts +9 -0
- package/lib/components/canvas/config-panel/components/condition-configuration/cross-line.js +57 -0
- package/lib/components/canvas/config-panel/components/condition-configuration/index.d.ts +10 -0
- package/lib/components/canvas/config-panel/components/condition-configuration/index.js +216 -0
- package/lib/components/canvas/config-panel/components/condition-configuration/style.less +74 -0
- package/lib/components/canvas/config-panel/components/time-trigger/components/cycle-time.d.ts +9 -0
- package/lib/components/canvas/config-panel/components/time-trigger/components/cycle-time.js +108 -0
- package/lib/components/canvas/config-panel/components/time-trigger/components/time-horizon.d.ts +10 -0
- package/lib/components/canvas/config-panel/components/time-trigger/components/time-horizon.js +78 -0
- package/lib/components/canvas/config-panel/components/time-trigger/delay-time.d.ts +9 -0
- package/lib/components/canvas/config-panel/components/time-trigger/delay-time.js +33 -0
- package/lib/components/canvas/config-panel/components/time-trigger/effective-time.d.ts +7 -0
- package/lib/components/canvas/config-panel/components/time-trigger/effective-time.js +58 -0
- package/lib/components/canvas/config-panel/components/time-trigger/index.d.ts +9 -0
- package/lib/components/canvas/config-panel/components/time-trigger/index.js +114 -0
- package/lib/components/canvas/config-panel/components/time-trigger/interval-time.d.ts +9 -0
- package/lib/components/canvas/config-panel/components/time-trigger/interval-time.js +63 -0
- package/lib/components/canvas/config-panel/components/time-trigger/persistent-time.d.ts +9 -0
- package/lib/components/canvas/config-panel/components/time-trigger/persistent-time.js +33 -0
- package/lib/components/canvas/config-panel/components/time-trigger/section-Detail.d.ts +10 -0
- package/lib/components/canvas/config-panel/components/time-trigger/section-Detail.js +140 -0
- package/lib/components/canvas/config-panel/components/time-trigger/section-time.d.ts +9 -0
- package/lib/components/canvas/config-panel/components/time-trigger/section-time.js +96 -0
- package/lib/components/canvas/config-panel/components/time-trigger/timing-time.d.ts +9 -0
- package/lib/components/canvas/config-panel/components/time-trigger/timing-time.js +65 -0
- package/lib/components/canvas/config-panel/config-common.d.ts +38 -0
- package/lib/components/canvas/config-panel/config-common.js +152 -0
- package/lib/components/canvas/config-panel/index.d.ts +14 -0
- package/lib/components/canvas/config-panel/index.js +68 -0
- package/lib/components/canvas/config-panel/node-form.d.ts +23 -0
- package/lib/components/canvas/config-panel/node-form.js +97 -0
- package/lib/components/canvas/config-panel/style.less +90 -0
- package/lib/components/canvas/dag-canvas/canvas-content.d.ts +11 -0
- package/lib/components/canvas/dag-canvas/canvas-content.js +130 -0
- package/lib/components/canvas/dag-canvas/canvas-content.less +5 -0
- package/lib/components/canvas/dag-canvas/index.d.ts +23 -0
- package/lib/components/canvas/dag-canvas/index.js +53 -0
- package/lib/components/canvas/dag-canvas/index.less +11 -0
- package/lib/components/canvas/dag-canvas/preview.d.ts +10 -0
- package/lib/components/canvas/dag-canvas/preview.js +73 -0
- package/lib/components/canvas/index.d.ts +48 -0
- package/lib/components/canvas/index.js +107 -0
- package/lib/components/canvas/index.less +50 -0
- package/lib/components/canvas/strategy-header/index.d.ts +48 -0
- package/lib/components/canvas/strategy-header/index.js +229 -0
- package/lib/components/canvas/strategy-header/style.less +23 -0
- package/lib/components/canvas/strategy-header/theme-switch/index.d.ts +4 -0
- package/lib/components/canvas/strategy-header/theme-switch/index.js +30 -0
- package/lib/components/canvas/strategy-header/theme-switch/style.less +11 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +71 -0
- package/lib/packages/graph-canvas/graph-common.d.ts +19 -0
- package/lib/packages/graph-canvas/graph-common.js +27 -0
- package/lib/packages/graph-canvas/graph-model/edge/group-edge/edge.less +8 -0
- package/lib/packages/graph-canvas/graph-model/edge/group-edge/index.d.ts +4 -0
- package/lib/packages/graph-canvas/graph-model/edge/group-edge/index.js +74 -0
- package/lib/packages/graph-canvas/graph-model/edge/index.d.ts +2 -0
- package/lib/packages/graph-canvas/graph-model/edge/index.js +15 -0
- package/lib/packages/graph-canvas/graph-model/node/application-node/application-element.d.ts +9 -0
- package/lib/packages/graph-canvas/graph-model/node/application-node/application-element.js +31 -0
- package/lib/packages/graph-canvas/graph-model/node/application-node/application-element.less +17 -0
- package/lib/packages/graph-canvas/graph-model/node/application-node/index.d.ts +7 -0
- package/lib/packages/graph-canvas/graph-model/node/application-node/index.js +133 -0
- package/lib/packages/graph-canvas/graph-model/node/common-node/index.d.ts +7 -0
- package/lib/packages/graph-canvas/graph-model/node/common-node/index.js +133 -0
- package/lib/packages/graph-canvas/graph-model/node/common-node/node-element.d.ts +9 -0
- package/lib/packages/graph-canvas/graph-model/node/common-node/node-element.js +69 -0
- package/lib/packages/graph-canvas/graph-model/node/common-node/node-element.less +48 -0
- package/{es/common/graph-common/node-element/logical-element.d.ts → lib/packages/graph-canvas/graph-model/node/condition-node/condition-element.d.ts} +9 -9
- package/lib/packages/graph-canvas/graph-model/node/condition-node/condition-element.js +81 -0
- package/lib/packages/graph-canvas/graph-model/node/condition-node/condition-element.less +76 -0
- package/lib/packages/graph-canvas/graph-model/node/condition-node/images/rhombus.svg +3 -0
- package/{es/common/graph-common/shape/nodes/LogicalNode.d.ts → lib/packages/graph-canvas/graph-model/node/condition-node/index.d.ts} +5 -5
- package/lib/packages/graph-canvas/graph-model/node/condition-node/index.js +143 -0
- package/lib/packages/graph-canvas/graph-model/node/index.d.ts +5 -0
- package/lib/packages/graph-canvas/graph-model/node/index.js +39 -0
- package/lib/packages/graph-canvas/graph-model/node/logical-node/images/AND.svg +11 -0
- package/lib/packages/graph-canvas/graph-model/node/logical-node/images/OR.svg +11 -0
- package/lib/packages/graph-canvas/graph-model/node/logical-node/images/XOR.svg +11 -0
- package/lib/packages/graph-canvas/graph-model/node/logical-node/images/locking.svg +5 -0
- package/lib/packages/graph-canvas/graph-model/node/logical-node/images/unlock.svg +5 -0
- package/lib/packages/graph-canvas/graph-model/node/logical-node/index.d.ts +6 -0
- package/lib/packages/graph-canvas/graph-model/node/logical-node/index.js +143 -0
- package/lib/packages/graph-canvas/graph-model/node/logical-node/logical-element.d.ts +9 -0
- package/lib/packages/graph-canvas/graph-model/node/logical-node/logical-element.js +98 -0
- package/lib/packages/graph-canvas/graph-model/node/logical-node/logical-element.less +49 -0
- package/lib/packages/graph-canvas/graph-model/node/style.less +8 -0
- package/lib/packages/graph-canvas/graph-utils/graph.d.ts +87 -0
- package/lib/packages/graph-canvas/graph-utils/graph.js +124 -0
- package/lib/packages/graph-canvas/index.d.ts +79 -0
- package/lib/packages/graph-canvas/index.js +1292 -0
- package/lib/packages/graph-canvas/node-types.d.ts +6 -0
- package/lib/packages/graph-canvas/node-types.js +66 -0
- package/lib/packages/graph-canvas/typings.d.ts +5 -0
- package/lib/packages/graph-common/global.d.ts +1 -0
- package/lib/packages/graph-common/global.js +8 -0
- package/lib/packages/graph-common/graph.d.ts +12 -0
- package/lib/packages/graph-common/graph.js +37 -0
- package/lib/packages/graph-core/graph-util.d.ts +182 -0
- package/lib/packages/graph-core/graph-util.js +368 -0
- package/lib/packages/graph-core/index.d.ts +96 -0
- package/lib/packages/graph-core/index.js +798 -0
- package/lib/packages/graph-core/typing.d.ts +107 -0
- package/lib/packages/graph-model/connector/index.d.ts +1 -0
- package/lib/packages/graph-model/connector/index.js +17 -0
- package/lib/packages/graph-model/edge/edge.less +8 -0
- package/lib/packages/graph-model/edge/index.d.ts +5 -0
- package/lib/packages/graph-model/edge/index.js +73 -0
- package/lib/packages/graph-model/node/index.d.ts +7 -0
- package/lib/packages/graph-model/node/index.js +63 -0
- package/lib/packages/graph-model/node/node-basic.less +118 -0
- package/lib/packages/hooks/useObservableState.d.ts +3 -0
- package/lib/packages/hooks/useObservableState.js +55 -0
- package/lib/packages/hooks/withMode.d.ts +3 -0
- package/lib/packages/hooks/withMode.js +22 -0
- package/lib/style/basic.less +12 -0
- package/lib/style/default.less +10 -0
- package/lib/style/position.less +25 -0
- package/lib/style/svgRaw.d.ts +1 -0
- package/lib/style/svgRaw.js +8 -0
- package/lib/style/theme-light.less +7 -0
- package/lib/style/variable.less +3 -0
- package/lib/typings.d.ts +8 -0
- package/lib/utils/utils.d.ts +1 -0
- package/lib/utils/utils.js +13 -0
- package/package.json +38 -37
- package/tsconfig.json +1 -1
- package/es/common/graph-common/category-type.d.ts +0 -16
- package/es/common/graph-common/connector/index.js +0 -14
- package/es/common/graph-common/node-element/node-group.d.ts +0 -8
- package/es/common/graph-common/node-element/node-group.js +0 -395
- package/es/common/graph-common/node-element/node-group.less +0 -53
- package/es/common/graph-common/node-popover/index.d.ts +0 -7
- package/es/common/graph-common/node-popover/index.js +0 -11
- package/es/common/graph-common/node-popover/index.less +0 -5
- package/es/common/graph-common/node-types.d.ts +0 -28
- package/es/common/graph-common/node-types.js +0 -60
- package/es/common/graph-common/shape/edge.d.ts +0 -10
- package/es/common/graph-common/shape/node.d.ts +0 -6
- package/es/common/graph-common/shape/node.js +0 -6
- package/es/common/graph-common/shape/nodes/BaseNode.d.ts +0 -4
- package/es/common/graph-common/shape/nodes/GroupNode.d.ts +0 -4
- package/es/component/cut.d.ts +0 -10
- package/es/component/cut.js +0 -34
- package/es/component/cut.less +0 -6
- package/es/component/item-name.d.ts +0 -6
- package/es/component/item-name.js +0 -30
- package/es/component/keyword.d.ts +0 -9
- package/es/component/keyword.js +0 -26
- package/es/component/keyword.less +0 -11
- package/es/component/rx-component/rx-input.d.ts +0 -8
- package/es/component/rx-component/rx-input.js +0 -47
- package/es/hooks/withMode.d.ts +0 -1
- package/es/hooks/withMode.js +0 -16
- package/es/pages/dag-canvas/preview.js +0 -42
- package/es/pages/rx-models/graph-core.less +0 -14
- package/es/pages/rx-models/typing.d.ts +0 -126
- package/es/pages/strategy-header/index.js +0 -154
- /package/es/{pages → components/canvas}/component-tree-panel/category-tree/node-title.less +0 -0
- /package/es/{pages → components/canvas}/config-panel/components/time-trigger/delay-time.js +0 -0
- /package/es/{pages → components/canvas}/config-panel/components/time-trigger/persistent-time.js +0 -0
- /package/es/{pages → components/canvas}/dag-canvas/canvas-content.less +0 -0
- /package/es/{pages → components/canvas}/dag-canvas/index.less +0 -0
- /package/es/{pages → components/canvas}/strategy-header/theme-switch/style.less +0 -0
- /package/es/{common/graph-common/shape → packages/graph-canvas/graph-model/edge/group-edge}/edge.less +0 -0
- /package/es/{common/constants → packages/graph-common}/global.js +0 -0
- /package/es/{hooks → packages/hooks}/useObservableState.js +0 -0
|
@@ -0,0 +1,1292 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useUnmountExperimentGraph = exports.useExperimentGraph = exports.gModelMap = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
13
|
+
|
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
+
|
|
16
|
+
var _rxjs = require("rxjs");
|
|
17
|
+
|
|
18
|
+
var _operators = require("rxjs/operators");
|
|
19
|
+
|
|
20
|
+
var _lodashEs = require("lodash-es");
|
|
21
|
+
|
|
22
|
+
var _immer = _interopRequireDefault(require("immer"));
|
|
23
|
+
|
|
24
|
+
var _antd = require("antd");
|
|
25
|
+
|
|
26
|
+
var _graph = require("../graph-common/graph");
|
|
27
|
+
|
|
28
|
+
var _graphCore = require("../graph-core");
|
|
29
|
+
|
|
30
|
+
var _node = require("./graph-model/node");
|
|
31
|
+
|
|
32
|
+
var _edge = _interopRequireDefault(require("../graph-model/edge"));
|
|
33
|
+
|
|
34
|
+
var _edge2 = require("./graph-model/edge");
|
|
35
|
+
|
|
36
|
+
var _graphUtil = require("../graph-core/graph-util");
|
|
37
|
+
|
|
38
|
+
var _graph2 = require("./graph-utils/graph");
|
|
39
|
+
|
|
40
|
+
var _nodeTypes = require("./node-types");
|
|
41
|
+
|
|
42
|
+
var _x11 = require("@antv/x6");
|
|
43
|
+
|
|
44
|
+
var _conditionElement = _interopRequireDefault(require("./graph-model/node/condition-node/condition-element"));
|
|
45
|
+
|
|
46
|
+
var _logicalElement = _interopRequireDefault(require("./graph-model/node/logical-node/logical-element"));
|
|
47
|
+
|
|
48
|
+
var _applicationElement = _interopRequireDefault(require("./graph-model/node/application-node/application-element"));
|
|
49
|
+
|
|
50
|
+
var _nodeElement = _interopRequireDefault(require("./graph-model/node/common-node/node-element"));
|
|
51
|
+
|
|
52
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
53
|
+
|
|
54
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
55
|
+
|
|
56
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
57
|
+
|
|
58
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
59
|
+
|
|
60
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
61
|
+
|
|
62
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
63
|
+
|
|
64
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
65
|
+
|
|
66
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
67
|
+
|
|
68
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
69
|
+
|
|
70
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
71
|
+
|
|
72
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
73
|
+
|
|
74
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
75
|
+
|
|
76
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
77
|
+
|
|
78
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
79
|
+
|
|
80
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
81
|
+
|
|
82
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
83
|
+
|
|
84
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
85
|
+
|
|
86
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
87
|
+
|
|
88
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
89
|
+
|
|
90
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
91
|
+
|
|
92
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
93
|
+
|
|
94
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
95
|
+
|
|
96
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
97
|
+
|
|
98
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
99
|
+
|
|
100
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
101
|
+
|
|
102
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
103
|
+
|
|
104
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
105
|
+
|
|
106
|
+
var ANT_PREFIX = ';ant';
|
|
107
|
+
|
|
108
|
+
var ExperimentGraph = /*#__PURE__*/function (_GraphCore) {
|
|
109
|
+
_inherits(ExperimentGraph, _GraphCore);
|
|
110
|
+
|
|
111
|
+
var _super = _createSuper(ExperimentGraph);
|
|
112
|
+
|
|
113
|
+
// 重新声明节点元信息的类型
|
|
114
|
+
// @ts-ignore
|
|
115
|
+
// 重新声明边的元信息的类型
|
|
116
|
+
// @ts-ignore
|
|
117
|
+
// 等待渲染的节点,由于初次渲染 group 时需要 group 内的节点和边都渲染完成,因此放到 afterLayout 里面渲染 group
|
|
118
|
+
// 实验 id
|
|
119
|
+
// 实验图加载状态
|
|
120
|
+
// 实验数据
|
|
121
|
+
// 实验图数据
|
|
122
|
+
// 当前选中节点
|
|
123
|
+
// 图数据的订阅
|
|
124
|
+
// 查询执行状态的定时器订阅
|
|
125
|
+
// 主动触发的重新渲染订阅
|
|
126
|
+
function ExperimentGraph(expId) {
|
|
127
|
+
var _thisSuper, _this;
|
|
128
|
+
|
|
129
|
+
_classCallCheck(this, ExperimentGraph);
|
|
130
|
+
|
|
131
|
+
_this = _super.call(this, {
|
|
132
|
+
history: true,
|
|
133
|
+
frozen: true,
|
|
134
|
+
// 异步渲染的画布是否处于冻结状态,处于冻结状态的画布不会立即响应画布中节点和边的变更,直到调用 unfreeze(...) 方法来解除冻结并重新渲染画布。
|
|
135
|
+
background: {
|
|
136
|
+
color: '#ffffff'
|
|
137
|
+
},
|
|
138
|
+
grid: {
|
|
139
|
+
size: 10,
|
|
140
|
+
visible: true,
|
|
141
|
+
type: 'doubleMesh',
|
|
142
|
+
// 'dot' | 'fixedDot' | 'mesh' | 'doubleMesh'
|
|
143
|
+
args: [{
|
|
144
|
+
color: '#DCDCDC',
|
|
145
|
+
// 主网格线颜色
|
|
146
|
+
thickness: 2 // 主网格线宽度
|
|
147
|
+
|
|
148
|
+
}, {
|
|
149
|
+
color: '#F3F3F3',
|
|
150
|
+
// 次网格线颜色
|
|
151
|
+
thickness: 1,
|
|
152
|
+
// 次网格线宽度
|
|
153
|
+
factor: 2 // 主次网格线间隔
|
|
154
|
+
|
|
155
|
+
}]
|
|
156
|
+
},
|
|
157
|
+
// 网格线
|
|
158
|
+
snapline: true,
|
|
159
|
+
// 对齐线
|
|
160
|
+
selecting: {
|
|
161
|
+
enabled: true,
|
|
162
|
+
rubberband: false,
|
|
163
|
+
// 是否启用框选
|
|
164
|
+
multiple: true,
|
|
165
|
+
// 是否启用点击多选
|
|
166
|
+
strict: true,
|
|
167
|
+
// 启用框选时,选框完全包围节点时才选中节点,否则只需要选框与节点的包围盒(BBox)相交即可选中节点,默认为 false。
|
|
168
|
+
showNodeSelectionBox: false,
|
|
169
|
+
// 是否显示节点的选择框
|
|
170
|
+
selectNodeOnMoved: false
|
|
171
|
+
},
|
|
172
|
+
// 点选/框选
|
|
173
|
+
keyboard: {
|
|
174
|
+
enabled: true
|
|
175
|
+
},
|
|
176
|
+
// 键盘快捷键
|
|
177
|
+
connecting: {
|
|
178
|
+
snap: {
|
|
179
|
+
radius: 10
|
|
180
|
+
},
|
|
181
|
+
// 当 snap 设置为 true 时连线的过程中距离节点或者连接桩 50px 时会触发自动吸附,可以通过配置 radius 属性自定义触发吸附的距离。当 snap 设置为 false 时不会触发自动吸附。默认值为 false。
|
|
182
|
+
allowBlank: false,
|
|
183
|
+
// 是否允许连接到画布空白位置的点
|
|
184
|
+
allowMulti: false,
|
|
185
|
+
highlight: true,
|
|
186
|
+
// 拖动边时,是否高亮显示所有可用的连接桩或节点
|
|
187
|
+
router: 'manhattan',
|
|
188
|
+
// 路由
|
|
189
|
+
// connector: 'pai', // 连接器将起点、路由返回的点、终点加工为 元素的 d 属性,决定了边渲染到画布后的样式,默认值为 normal。
|
|
190
|
+
sourceAnchor: 'bottom',
|
|
191
|
+
// 当连接到节点时,通过 sourceAnchor 来指定源节点的锚点。
|
|
192
|
+
targetAnchor: 'center',
|
|
193
|
+
// 当连接到节点时,通过 targetAnchor 来指定目标节点的锚点。
|
|
194
|
+
connectionPoint: 'anchor',
|
|
195
|
+
// 指定连接点,默认值为 boundary。
|
|
196
|
+
createEdge: function createEdge() {
|
|
197
|
+
return new _edge.default({
|
|
198
|
+
attrs: {
|
|
199
|
+
line: {
|
|
200
|
+
strokeDasharray: 5,
|
|
201
|
+
stroke: '#00A6FF',
|
|
202
|
+
strokeWidth: 1,
|
|
203
|
+
targetMarker: {
|
|
204
|
+
name: 'block',
|
|
205
|
+
args: {
|
|
206
|
+
size: '6'
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
validateEdge: function validateEdge(args) {
|
|
214
|
+
var _edge$target;
|
|
215
|
+
|
|
216
|
+
var edge = args.edge;
|
|
217
|
+
return !!(edge !== null && edge !== void 0 && (_edge$target = edge.target) !== null && _edge$target !== void 0 && _edge$target.port);
|
|
218
|
+
},
|
|
219
|
+
// 连接的过程中创建新的边
|
|
220
|
+
// 是否触发交互事件 点击 magnet 时 根据 validateMagnet 返回值来判断是否新增边,触发时机是 magnet 被按下,如果返回 false,则没有任何反应,如果返回 true,会在当前 magnet 创建一条新的边。
|
|
221
|
+
validateMagnet: function validateMagnet(_ref) {
|
|
222
|
+
var magnet = _ref.magnet;
|
|
223
|
+
return magnet.getAttribute('port-group') !== 'in';
|
|
224
|
+
},
|
|
225
|
+
// 显示可用的链接桩 在移动边的时候判断连接是否有效,如果返回 false,当鼠标放开的时候,不会连接到当前元素,否则会连接到当前元素。
|
|
226
|
+
validateConnection: function validateConnection(_ref2) {
|
|
227
|
+
var sourceView = _ref2.sourceView,
|
|
228
|
+
targetView = _ref2.targetView,
|
|
229
|
+
sourceMagnet = _ref2.sourceMagnet,
|
|
230
|
+
targetMagnet = _ref2.targetMagnet;
|
|
231
|
+
|
|
232
|
+
// 不允许连接到自己
|
|
233
|
+
if (sourceView === targetView) {
|
|
234
|
+
return false;
|
|
235
|
+
} // 只能从输出链接桩创建连接
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
if (!sourceMagnet || sourceMagnet.getAttribute('port-group') === 'in') {
|
|
239
|
+
return false;
|
|
240
|
+
} // 只能连接到输入链接桩
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
if (!targetMagnet || targetMagnet.getAttribute('port-group') !== 'in') {
|
|
244
|
+
return false;
|
|
245
|
+
} // 判断目标链接桩是否可连接
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
var portId = targetMagnet.getAttribute('port');
|
|
249
|
+
var node = targetView.cell;
|
|
250
|
+
var port = node.getPort(portId);
|
|
251
|
+
return !!port;
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
// 配置全局的连线规则
|
|
255
|
+
scroller: {
|
|
256
|
+
enabled: true,
|
|
257
|
+
pageVisible: false,
|
|
258
|
+
// 是否分页,默认为 false。
|
|
259
|
+
pageBreak: false,
|
|
260
|
+
// 是否显示分页符,默认为 false。
|
|
261
|
+
pannable: true // 是否启用画布平移能力(在空白位置按下鼠标后拖动平移画布),默认为 false。
|
|
262
|
+
|
|
263
|
+
},
|
|
264
|
+
// 使画布具备滚动、平移、居中、缩放等能力
|
|
265
|
+
mousewheel: {
|
|
266
|
+
enabled: true // modifiers: ['ctrl', 'meta'],
|
|
267
|
+
|
|
268
|
+
},
|
|
269
|
+
// 用滚轮来缩放画布
|
|
270
|
+
highlighting: {
|
|
271
|
+
nodeAvailable: {
|
|
272
|
+
name: 'className',
|
|
273
|
+
args: {
|
|
274
|
+
className: 'available'
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
// 连线过程中,节点可以被链接时被使用
|
|
278
|
+
magnetAvailable: {
|
|
279
|
+
name: 'className',
|
|
280
|
+
args: {
|
|
281
|
+
className: 'available'
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
// 连线过程中,链接桩可以被链接时被使用
|
|
285
|
+
magnetAdsorbed: {
|
|
286
|
+
name: 'className',
|
|
287
|
+
args: {
|
|
288
|
+
className: 'adsorbed'
|
|
289
|
+
}
|
|
290
|
+
} // 连线过程中,自动吸附到链接桩时被使用
|
|
291
|
+
|
|
292
|
+
},
|
|
293
|
+
// 触发某种交互时的高亮样式
|
|
294
|
+
// 当某个链接桩渲染完成时触发的回调。
|
|
295
|
+
onPortRendered: function onPortRendered(args) {
|
|
296
|
+
var port = args.port;
|
|
297
|
+
var contentSelectors = args.contentSelectors;
|
|
298
|
+
var container = contentSelectors && contentSelectors.content;
|
|
299
|
+
var placement = port.group === 'in' ? 'top' : 'bottom';
|
|
300
|
+
|
|
301
|
+
if (container) {
|
|
302
|
+
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
|
|
303
|
+
prefixCls: ANT_PREFIX
|
|
304
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Tooltip, {
|
|
305
|
+
title: port.description,
|
|
306
|
+
placement: placement
|
|
307
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
308
|
+
className: (0, _classnames.default)('ais-port', {
|
|
309
|
+
connected: port.connected
|
|
310
|
+
})
|
|
311
|
+
}))), container);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
_defineProperty(_assertThisInitialized(_this), "nodeMetas", void 0);
|
|
317
|
+
|
|
318
|
+
_defineProperty(_assertThisInitialized(_this), "edgeMetas", void 0);
|
|
319
|
+
|
|
320
|
+
_defineProperty(_assertThisInitialized(_this), "pendingNodes", []);
|
|
321
|
+
|
|
322
|
+
_defineProperty(_assertThisInitialized(_this), "experimentId", void 0);
|
|
323
|
+
|
|
324
|
+
_defineProperty(_assertThisInitialized(_this), "loading$", new _rxjs.BehaviorSubject(false));
|
|
325
|
+
|
|
326
|
+
_defineProperty(_assertThisInitialized(_this), "experiment$", new _rxjs.BehaviorSubject(null));
|
|
327
|
+
|
|
328
|
+
_defineProperty(_assertThisInitialized(_this), "experimentGraph$", new _rxjs.BehaviorSubject(null));
|
|
329
|
+
|
|
330
|
+
_defineProperty(_assertThisInitialized(_this), "activeNodeInstance$", new _rxjs.BehaviorSubject(null));
|
|
331
|
+
|
|
332
|
+
_defineProperty(_assertThisInitialized(_this), "experimentGraphSub", void 0);
|
|
333
|
+
|
|
334
|
+
_defineProperty(_assertThisInitialized(_this), "executionStatusQuerySub", void 0);
|
|
335
|
+
|
|
336
|
+
_defineProperty(_assertThisInitialized(_this), "reRenderSub", void 0);
|
|
337
|
+
|
|
338
|
+
_defineProperty(_assertThisInitialized(_this), "renderGraph", function (wrapper, container) {
|
|
339
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
340
|
+
console.log('renderGraph');
|
|
341
|
+
_this.experimentGraphSub = _this.experimentGraph$.pipe((0, _operators.filter)(function (x) {
|
|
342
|
+
return !!x;
|
|
343
|
+
}), // 过滤出有效数据
|
|
344
|
+
(0, _operators.take)(1) // 只做一次挂载渲染
|
|
345
|
+
).subscribe(function (graphData) {
|
|
346
|
+
if (!_this.graph) {
|
|
347
|
+
var _formatGraphData = (0, _graphUtil.formatGraphData)(graphData),
|
|
348
|
+
nodes = _formatGraphData.nodes,
|
|
349
|
+
edges = _formatGraphData.edges;
|
|
350
|
+
|
|
351
|
+
_get((_thisSuper = _assertThisInitialized(_this), _getPrototypeOf(ExperimentGraph.prototype)), "render", _thisSuper).call(_thisSuper, {
|
|
352
|
+
wrapper: wrapper,
|
|
353
|
+
container: container,
|
|
354
|
+
nodes: nodes,
|
|
355
|
+
edges: edges,
|
|
356
|
+
options: options
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
}); // 监听主动触发的重新渲染事件,避免从 IDE 返回后画布消失
|
|
360
|
+
|
|
361
|
+
_this.reRenderSub = (0, _rxjs.fromEventPattern)(function (handler) {
|
|
362
|
+
window.addEventListener(_graph.RERENDER_EVENT, handler);
|
|
363
|
+
}, function (handler) {
|
|
364
|
+
window.removeEventListener(_graph.RERENDER_EVENT, handler);
|
|
365
|
+
}).subscribe(_this.handlerResize);
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
_defineProperty(_assertThisInitialized(_this), "registerEdge", function () {
|
|
369
|
+
_x11.Graph.registerEdge('group-edge', _edge2.GroupEdge);
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
_defineProperty(_assertThisInitialized(_this), "createTypeNodeMeta", function (nodeMeta, nodeType, experimentId) {
|
|
373
|
+
console.log('===================== createTypeNodeMeta', nodeMeta);
|
|
374
|
+
var data = nodeMeta.data;
|
|
375
|
+
var _ref3 = data,
|
|
376
|
+
type = _ref3.type; // 节点
|
|
377
|
+
|
|
378
|
+
if (type === 'node') {
|
|
379
|
+
/* 条件判断 */
|
|
380
|
+
if (nodeType === _nodeTypes.SIGN_OPERATION.CONDITION) {
|
|
381
|
+
return _this.graph.addNode(new _node.ConditionJudgment(_objectSpread(_objectSpread({}, nodeMeta), {}, {
|
|
382
|
+
shape: 'condition-judgement-element',
|
|
383
|
+
component: /*#__PURE__*/_react.default.createElement(_conditionElement.default, {
|
|
384
|
+
experimentId: experimentId
|
|
385
|
+
})
|
|
386
|
+
})));
|
|
387
|
+
}
|
|
388
|
+
/* 逻辑运算 */
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
if (nodeType === _nodeTypes.SIGN_OPERATION.LOGICAL || nodeType === _nodeTypes.COMMONLY_USED.LOCKED) {
|
|
392
|
+
return _this.graph.addNode(new _node.LogicalNode(_objectSpread(_objectSpread({}, nodeMeta), {}, {
|
|
393
|
+
shape: 'logical-node',
|
|
394
|
+
component: /*#__PURE__*/_react.default.createElement(_logicalElement.default, {
|
|
395
|
+
experimentId: experimentId
|
|
396
|
+
})
|
|
397
|
+
})));
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
if ((nodeType === null || nodeType === void 0 ? void 0 : nodeType.indexOf(_nodeTypes.COMPONENTS_TYPE.APPLICATION)) === 0) {
|
|
401
|
+
return _this.graph.addNode(new _node.ApplicationNode(_objectSpread(_objectSpread({}, nodeMeta), {}, {
|
|
402
|
+
shape: 'application-node',
|
|
403
|
+
component: /*#__PURE__*/_react.default.createElement(_applicationElement.default, {
|
|
404
|
+
experimentId: experimentId
|
|
405
|
+
})
|
|
406
|
+
})));
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
return _this.graph.addNode(new _node.CommonNode(_objectSpread(_objectSpread({}, nodeMeta), {}, {
|
|
410
|
+
shape: 'application-node',
|
|
411
|
+
component: /*#__PURE__*/_react.default.createElement(_nodeElement.default, {
|
|
412
|
+
experimentId: experimentId
|
|
413
|
+
})
|
|
414
|
+
})));
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
return undefined;
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
_defineProperty(_assertThisInitialized(_this), "validateContextMenu", function (info) {
|
|
421
|
+
var _info$data, _info$data$edge;
|
|
422
|
+
|
|
423
|
+
return !(info.type === 'edge' && info !== null && info !== void 0 && (_info$data = info.data) !== null && _info$data !== void 0 && (_info$data$edge = _info$data.edge) !== null && _info$data$edge !== void 0 && _info$data$edge.isGroupEdge());
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
_defineProperty(_assertThisInitialized(_this), "handlerResize", function (e) {
|
|
427
|
+
if (e.detail === _this.experimentId) {
|
|
428
|
+
_this.resizeGraph();
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
_defineProperty(_assertThisInitialized(_this), "setActiveAlgoData", function (data) {
|
|
433
|
+
if (!data) {
|
|
434
|
+
_this.activeNodeInstance$.next(null);
|
|
435
|
+
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
var oldData = _this.activeNodeInstance$.getValue();
|
|
440
|
+
|
|
441
|
+
_this.activeNodeInstance$.next(_objectSpread(_objectSpread({}, oldData), data)); // 完成两种格式的融合,数据结构更复杂以后,这一句可以变成一个专门的方法
|
|
442
|
+
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
_defineProperty(_assertThisInitialized(_this), "requestAddNode", /*#__PURE__*/function () {
|
|
446
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(param) {
|
|
447
|
+
var _assertThisInitialize, graph, nodeMeta, clientX, clientY, pos, nodeRes, newNode;
|
|
448
|
+
|
|
449
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
450
|
+
while (1) {
|
|
451
|
+
switch (_context.prev = _context.next) {
|
|
452
|
+
case 0:
|
|
453
|
+
console.log('requestAddNode');
|
|
454
|
+
_assertThisInitialize = _assertThisInitialized(_this), graph = _assertThisInitialize.graph;
|
|
455
|
+
|
|
456
|
+
if (!graph) {
|
|
457
|
+
_context.next = 14;
|
|
458
|
+
break;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
nodeMeta = param.nodeMeta, clientX = param.clientX, clientY = param.clientY;
|
|
462
|
+
pos = graph.clientToLocal(clientX, clientY);
|
|
463
|
+
console.log('nodeMeta', nodeMeta, pos);
|
|
464
|
+
nodeRes = (0, _graph2.addNode)(_objectSpread(_objectSpread({}, nodeMeta), pos));
|
|
465
|
+
_context.next = 9;
|
|
466
|
+
return _this.updateExperimentGraph([nodeRes]);
|
|
467
|
+
|
|
468
|
+
case 9:
|
|
469
|
+
console.log('requestAddNode nodeRes', nodeRes);
|
|
470
|
+
newNode = (0, _graphUtil.formatNodeInfoToNodeMeta)(nodeRes);
|
|
471
|
+
console.log('formatNodeInfoToNodeMeta', newNode);
|
|
472
|
+
|
|
473
|
+
_this.addNode(newNode);
|
|
474
|
+
|
|
475
|
+
return _context.abrupt("return", {
|
|
476
|
+
success: true
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
case 14:
|
|
480
|
+
return _context.abrupt("return", {
|
|
481
|
+
success: false
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
case 15:
|
|
485
|
+
case "end":
|
|
486
|
+
return _context.stop();
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}, _callee);
|
|
490
|
+
}));
|
|
491
|
+
|
|
492
|
+
return function (_x) {
|
|
493
|
+
return _ref4.apply(this, arguments);
|
|
494
|
+
};
|
|
495
|
+
}());
|
|
496
|
+
|
|
497
|
+
_defineProperty(_assertThisInitialized(_this), "requestDeleteNodes", /*#__PURE__*/function () {
|
|
498
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(ids) {
|
|
499
|
+
var nodeInstanceIds, activeNodeInstance;
|
|
500
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
501
|
+
while (1) {
|
|
502
|
+
switch (_context2.prev = _context2.next) {
|
|
503
|
+
case 0:
|
|
504
|
+
nodeInstanceIds = [].concat(ids);
|
|
505
|
+
|
|
506
|
+
if (!(_this.graph && nodeInstanceIds.length)) {
|
|
507
|
+
_context2.next = 8;
|
|
508
|
+
break;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
_this.deleteNodes(nodeInstanceIds);
|
|
512
|
+
|
|
513
|
+
_this.clearContextMenuInfo(); // 如果被选中节点中包含当前打开的配置面板的节点,则取消激活
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
activeNodeInstance = _this.activeNodeInstance$.getValue();
|
|
517
|
+
|
|
518
|
+
if (activeNodeInstance && nodeInstanceIds.map(function (i) {
|
|
519
|
+
return i.toString();
|
|
520
|
+
}).includes(activeNodeInstance.id.toString())) {
|
|
521
|
+
_this.activeNodeInstance$.next(null);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
_this.delExperimentGraphElement(nodeInstanceIds, []);
|
|
525
|
+
|
|
526
|
+
return _context2.abrupt("return", {
|
|
527
|
+
success: true
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
case 8:
|
|
531
|
+
return _context2.abrupt("return", {
|
|
532
|
+
success: false
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
case 9:
|
|
536
|
+
case "end":
|
|
537
|
+
return _context2.stop();
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}, _callee2);
|
|
541
|
+
}));
|
|
542
|
+
|
|
543
|
+
return function (_x2) {
|
|
544
|
+
return _ref5.apply(this, arguments);
|
|
545
|
+
};
|
|
546
|
+
}());
|
|
547
|
+
|
|
548
|
+
_defineProperty(_assertThisInitialized(_this), "requestDeleteEdges", /*#__PURE__*/function () {
|
|
549
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(edges) {
|
|
550
|
+
var targetEdges;
|
|
551
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
552
|
+
while (1) {
|
|
553
|
+
switch (_context3.prev = _context3.next) {
|
|
554
|
+
case 0:
|
|
555
|
+
targetEdges = [].concat(edges);
|
|
556
|
+
console.log(targetEdges);
|
|
557
|
+
|
|
558
|
+
_this.deleteEdges(targetEdges);
|
|
559
|
+
|
|
560
|
+
_this.delExperimentGraphElement([], targetEdges.map(function (cell) {
|
|
561
|
+
return cell.getData();
|
|
562
|
+
}));
|
|
563
|
+
|
|
564
|
+
return _context3.abrupt("return", {
|
|
565
|
+
success: true
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
case 5:
|
|
569
|
+
case "end":
|
|
570
|
+
return _context3.stop();
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}, _callee3);
|
|
574
|
+
}));
|
|
575
|
+
|
|
576
|
+
return function (_x3) {
|
|
577
|
+
return _ref6.apply(this, arguments);
|
|
578
|
+
};
|
|
579
|
+
}());
|
|
580
|
+
|
|
581
|
+
_defineProperty(_assertThisInitialized(_this), "undoDeleteNode", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
582
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
583
|
+
while (1) {
|
|
584
|
+
switch (_context4.prev = _context4.next) {
|
|
585
|
+
case 0:
|
|
586
|
+
_this.undo();
|
|
587
|
+
|
|
588
|
+
case 1:
|
|
589
|
+
case "end":
|
|
590
|
+
return _context4.stop();
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}, _callee4);
|
|
594
|
+
})));
|
|
595
|
+
|
|
596
|
+
_defineProperty(_assertThisInitialized(_this), "updateNodeData", /*#__PURE__*/function () {
|
|
597
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(nodeInstanceId, nodeData) {
|
|
598
|
+
var cell, data, newData;
|
|
599
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
600
|
+
while (1) {
|
|
601
|
+
switch (_context5.prev = _context5.next) {
|
|
602
|
+
case 0:
|
|
603
|
+
cell = _this.getCellById(nodeInstanceId);
|
|
604
|
+
|
|
605
|
+
if (cell) {
|
|
606
|
+
data = cell.getData();
|
|
607
|
+
newData = _objectSpread(_objectSpread({}, data), {}, {
|
|
608
|
+
nodeData: JSON.stringify(nodeData)
|
|
609
|
+
});
|
|
610
|
+
cell.setData(newData);
|
|
611
|
+
|
|
612
|
+
_this.updateNodeById(nodeInstanceId, function (nodes) {
|
|
613
|
+
nodes.setData(newData);
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
case 2:
|
|
618
|
+
case "end":
|
|
619
|
+
return _context5.stop();
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}, _callee5);
|
|
623
|
+
}));
|
|
624
|
+
|
|
625
|
+
return function (_x4, _x5) {
|
|
626
|
+
return _ref8.apply(this, arguments);
|
|
627
|
+
};
|
|
628
|
+
}());
|
|
629
|
+
|
|
630
|
+
_defineProperty(_assertThisInitialized(_this), "zoomGraph", function (factor) {
|
|
631
|
+
_this.zoom(factor);
|
|
632
|
+
});
|
|
633
|
+
|
|
634
|
+
_defineProperty(_assertThisInitialized(_this), "zoomGraphToFit", function () {
|
|
635
|
+
_this.zoom('fit');
|
|
636
|
+
});
|
|
637
|
+
|
|
638
|
+
_defineProperty(_assertThisInitialized(_this), "zoomGraphRealSize", function () {
|
|
639
|
+
_this.zoom('real');
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
_defineProperty(_assertThisInitialized(_this), "deleteEdgeFromContextMenu", /*#__PURE__*/function () {
|
|
643
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(edge) {
|
|
644
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
645
|
+
while (1) {
|
|
646
|
+
switch (_context6.prev = _context6.next) {
|
|
647
|
+
case 0:
|
|
648
|
+
_context6.next = 2;
|
|
649
|
+
return _this.requestDeleteEdges(edge);
|
|
650
|
+
|
|
651
|
+
case 2:
|
|
652
|
+
_this.clearContextMenuInfo();
|
|
653
|
+
|
|
654
|
+
case 3:
|
|
655
|
+
case "end":
|
|
656
|
+
return _context6.stop();
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}, _callee6);
|
|
660
|
+
}));
|
|
661
|
+
|
|
662
|
+
return function (_x6) {
|
|
663
|
+
return _ref9.apply(this, arguments);
|
|
664
|
+
};
|
|
665
|
+
}());
|
|
666
|
+
|
|
667
|
+
_defineProperty(_assertThisInitialized(_this), "unSelectNode", function () {
|
|
668
|
+
var _assertThisInitialize2 = _assertThisInitialized(_this),
|
|
669
|
+
graph = _assertThisInitialize2.graph;
|
|
670
|
+
|
|
671
|
+
if (graph) {
|
|
672
|
+
graph.cleanSelection();
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
_this.selectedNodes$.next([]);
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
_this.experimentId = expId;
|
|
679
|
+
|
|
680
|
+
_this.initialize();
|
|
681
|
+
|
|
682
|
+
return _this;
|
|
683
|
+
} // 获取实验和图及执行状态信息
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
_createClass(ExperimentGraph, [{
|
|
687
|
+
key: "initialize",
|
|
688
|
+
value: function () {
|
|
689
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
690
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
691
|
+
while (1) {
|
|
692
|
+
switch (_context7.prev = _context7.next) {
|
|
693
|
+
case 0:
|
|
694
|
+
// eslint-disable-next-line: no-this-assignment
|
|
695
|
+
this.loading$.next(true);
|
|
696
|
+
_context7.prev = 1;
|
|
697
|
+
_context7.next = 4;
|
|
698
|
+
return this.loadExperimentGraph({
|
|
699
|
+
success: true,
|
|
700
|
+
data: {
|
|
701
|
+
nodes: [],
|
|
702
|
+
links: []
|
|
703
|
+
}
|
|
704
|
+
});
|
|
705
|
+
|
|
706
|
+
case 4:
|
|
707
|
+
this.loading$.next(false);
|
|
708
|
+
_context7.next = 11;
|
|
709
|
+
break;
|
|
710
|
+
|
|
711
|
+
case 7:
|
|
712
|
+
_context7.prev = 7;
|
|
713
|
+
_context7.t0 = _context7["catch"](1);
|
|
714
|
+
this.loading$.next(false);
|
|
715
|
+
console.error('加载错误', _context7.t0);
|
|
716
|
+
|
|
717
|
+
case 11:
|
|
718
|
+
case "end":
|
|
719
|
+
return _context7.stop();
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
}, _callee7, this, [[1, 7]]);
|
|
723
|
+
}));
|
|
724
|
+
|
|
725
|
+
function initialize() {
|
|
726
|
+
return _initialize.apply(this, arguments);
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
return initialize;
|
|
730
|
+
}()
|
|
731
|
+
}, {
|
|
732
|
+
key: "resetGraphData",
|
|
733
|
+
value: function () {
|
|
734
|
+
var _resetGraphData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
735
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
736
|
+
while (1) {
|
|
737
|
+
switch (_context8.prev = _context8.next) {
|
|
738
|
+
case 0:
|
|
739
|
+
this.experimentGraph$.next({
|
|
740
|
+
nodes: [],
|
|
741
|
+
links: []
|
|
742
|
+
});
|
|
743
|
+
|
|
744
|
+
case 1:
|
|
745
|
+
case "end":
|
|
746
|
+
return _context8.stop();
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}, _callee8, this);
|
|
750
|
+
}));
|
|
751
|
+
|
|
752
|
+
function resetGraphData() {
|
|
753
|
+
return _resetGraphData.apply(this, arguments);
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
return resetGraphData;
|
|
757
|
+
}()
|
|
758
|
+
}, {
|
|
759
|
+
key: "initPreviewData",
|
|
760
|
+
value: function () {
|
|
761
|
+
var _initPreviewData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(graphRes) {
|
|
762
|
+
var _this2 = this;
|
|
763
|
+
|
|
764
|
+
var nodes, links;
|
|
765
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
766
|
+
while (1) {
|
|
767
|
+
switch (_context9.prev = _context9.next) {
|
|
768
|
+
case 0:
|
|
769
|
+
// await this.resetGraphData()
|
|
770
|
+
console.log('initPreviewData', graphRes);
|
|
771
|
+
nodes = (graphRes === null || graphRes === void 0 ? void 0 : graphRes.nodes) || [];
|
|
772
|
+
links = (graphRes === null || graphRes === void 0 ? void 0 : graphRes.links) || [];
|
|
773
|
+
nodes === null || nodes === void 0 ? void 0 : nodes.forEach(function (item) {
|
|
774
|
+
_this2.updateExperimentGraph([item.data]);
|
|
775
|
+
|
|
776
|
+
_this2.addNode(item);
|
|
777
|
+
});
|
|
778
|
+
links === null || links === void 0 ? void 0 : links.forEach(function (item) {
|
|
779
|
+
_this2.updateExperimentGraph([], [item.data]);
|
|
780
|
+
|
|
781
|
+
_this2.addEdge(item);
|
|
782
|
+
}); // await this.updateExperimentGraph([nodeRes]);
|
|
783
|
+
// await this.experimentGraph$.next(graphRes)
|
|
784
|
+
|
|
785
|
+
case 5:
|
|
786
|
+
case "end":
|
|
787
|
+
return _context9.stop();
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}, _callee9);
|
|
791
|
+
}));
|
|
792
|
+
|
|
793
|
+
function initPreviewData(_x7) {
|
|
794
|
+
return _initPreviewData.apply(this, arguments);
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
return initPreviewData;
|
|
798
|
+
}() // 获取图
|
|
799
|
+
|
|
800
|
+
}, {
|
|
801
|
+
key: "loadExperimentGraph",
|
|
802
|
+
value: function () {
|
|
803
|
+
var _loadExperimentGraph = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(graphRes) {
|
|
804
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
805
|
+
while (1) {
|
|
806
|
+
switch (_context10.prev = _context10.next) {
|
|
807
|
+
case 0:
|
|
808
|
+
_context10.next = 2;
|
|
809
|
+
return this.experimentGraph$.next(graphRes.data);
|
|
810
|
+
|
|
811
|
+
case 2:
|
|
812
|
+
case "end":
|
|
813
|
+
return _context10.stop();
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
}, _callee10, this);
|
|
817
|
+
}));
|
|
818
|
+
|
|
819
|
+
function loadExperimentGraph(_x8) {
|
|
820
|
+
return _loadExperimentGraph.apply(this, arguments);
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
return loadExperimentGraph;
|
|
824
|
+
}() // 更新图元
|
|
825
|
+
|
|
826
|
+
}, {
|
|
827
|
+
key: "updateExperimentGraph",
|
|
828
|
+
value: function () {
|
|
829
|
+
var _updateExperimentGraph = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
830
|
+
var nodes,
|
|
831
|
+
links,
|
|
832
|
+
oldGraph,
|
|
833
|
+
newGraph,
|
|
834
|
+
_args11 = arguments;
|
|
835
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
836
|
+
while (1) {
|
|
837
|
+
switch (_context11.prev = _context11.next) {
|
|
838
|
+
case 0:
|
|
839
|
+
nodes = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : [];
|
|
840
|
+
links = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : [];
|
|
841
|
+
console.log('========================== updateExperimentGraph', links);
|
|
842
|
+
oldGraph = this.experimentGraph$.getValue();
|
|
843
|
+
newGraph = (0, _immer.default)(oldGraph, function (nextGraph) {
|
|
844
|
+
if (nodes.length) {
|
|
845
|
+
var _nextGraph$nodes;
|
|
846
|
+
|
|
847
|
+
(_nextGraph$nodes = nextGraph.nodes).push.apply(_nextGraph$nodes, _toConsumableArray(nodes));
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
if (links.length) {
|
|
851
|
+
var _nextGraph$links;
|
|
852
|
+
|
|
853
|
+
(_nextGraph$links = nextGraph.links).push.apply(_nextGraph$links, _toConsumableArray(links));
|
|
854
|
+
}
|
|
855
|
+
});
|
|
856
|
+
this.experimentGraph$.next(newGraph);
|
|
857
|
+
|
|
858
|
+
case 6:
|
|
859
|
+
case "end":
|
|
860
|
+
return _context11.stop();
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
}, _callee11, this);
|
|
864
|
+
}));
|
|
865
|
+
|
|
866
|
+
function updateExperimentGraph() {
|
|
867
|
+
return _updateExperimentGraph.apply(this, arguments);
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
return updateExperimentGraph;
|
|
871
|
+
}() // 删除图元
|
|
872
|
+
|
|
873
|
+
}, {
|
|
874
|
+
key: "delExperimentGraphElement",
|
|
875
|
+
value: function () {
|
|
876
|
+
var _delExperimentGraphElement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
877
|
+
var nodes,
|
|
878
|
+
links,
|
|
879
|
+
oldGraph,
|
|
880
|
+
newGraph,
|
|
881
|
+
_args12 = arguments;
|
|
882
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
883
|
+
while (1) {
|
|
884
|
+
switch (_context12.prev = _context12.next) {
|
|
885
|
+
case 0:
|
|
886
|
+
nodes = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : [];
|
|
887
|
+
links = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : [];
|
|
888
|
+
oldGraph = this.experimentGraph$.getValue();
|
|
889
|
+
newGraph = (0, _immer.default)(oldGraph, function (nextGraph) {
|
|
890
|
+
if (nodes.length) {
|
|
891
|
+
nextGraph.nodes = oldGraph.nodes.filter(function (node) {
|
|
892
|
+
return !nodes.includes(node.id.toString());
|
|
893
|
+
});
|
|
894
|
+
nextGraph.links = oldGraph.links.filter(function (link) {
|
|
895
|
+
return !nodes.find(function (node) {
|
|
896
|
+
return [link.source.toString(), link.target.toString()].includes(node);
|
|
897
|
+
});
|
|
898
|
+
});
|
|
899
|
+
} else {
|
|
900
|
+
nextGraph.links = oldGraph.links.filter(function (link) {
|
|
901
|
+
return !links.find(function (delLink) {
|
|
902
|
+
return delLink.inputPortId.toString() === link.inputPortId.toString() && delLink.outputPortId.toString() === link.outputPortId.toString();
|
|
903
|
+
});
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
console.log('newGraph', newGraph, oldGraph);
|
|
908
|
+
this.experimentGraph$.next(newGraph);
|
|
909
|
+
|
|
910
|
+
case 6:
|
|
911
|
+
case "end":
|
|
912
|
+
return _context12.stop();
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
}, _callee12, this);
|
|
916
|
+
}));
|
|
917
|
+
|
|
918
|
+
function delExperimentGraphElement() {
|
|
919
|
+
return _delExperimentGraphElement.apply(this, arguments);
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
return delExperimentGraphElement;
|
|
923
|
+
}() // 判断画布是否准备完成(主要用于 react 组件中)
|
|
924
|
+
|
|
925
|
+
}, {
|
|
926
|
+
key: "isGraphReady",
|
|
927
|
+
value: function isGraphReady() {
|
|
928
|
+
return !!this.graph;
|
|
929
|
+
} // 渲染画布
|
|
930
|
+
|
|
931
|
+
}, {
|
|
932
|
+
key: "renderNode",
|
|
933
|
+
value: function renderNode(nodeMeta) {
|
|
934
|
+
console.log('renderNode >>>>>>', nodeMeta);
|
|
935
|
+
var experimentId = this.experimentId;
|
|
936
|
+
var data = nodeMeta.data;
|
|
937
|
+
var _ref10 = data,
|
|
938
|
+
type = _ref10.type,
|
|
939
|
+
id = _ref10.id; // 节点
|
|
940
|
+
|
|
941
|
+
if (type === 'node') {
|
|
942
|
+
var _id$split;
|
|
943
|
+
|
|
944
|
+
var nodeType = id === null || id === void 0 ? void 0 : (_id$split = id.split('-')) === null || _id$split === void 0 ? void 0 : _id$split[0]; // 创建 node meta 元数据
|
|
945
|
+
|
|
946
|
+
var node = this.createTypeNodeMeta(nodeMeta, nodeType, experimentId);
|
|
947
|
+
if (!node) return undefined;
|
|
948
|
+
|
|
949
|
+
if (nodeMeta.data.hide) {
|
|
950
|
+
this.pendingNodes.push(node);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
return node;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
return undefined;
|
|
957
|
+
}
|
|
958
|
+
}, {
|
|
959
|
+
key: "afterLayout",
|
|
960
|
+
value: function afterLayout() {
|
|
961
|
+
_get(_getPrototypeOf(ExperimentGraph.prototype), "afterLayout", this).call(this);
|
|
962
|
+
|
|
963
|
+
this.pendingNodes.forEach(function (node) {
|
|
964
|
+
node.hide();
|
|
965
|
+
});
|
|
966
|
+
this.pendingNodes = [];
|
|
967
|
+
}
|
|
968
|
+
}, {
|
|
969
|
+
key: "renderEdge",
|
|
970
|
+
value: function renderEdge(edgeMeta) {
|
|
971
|
+
var _edgeMeta$source$port, _edgeMeta$source$port2;
|
|
972
|
+
|
|
973
|
+
// TODO 条件判断edge
|
|
974
|
+
var type = edgeMeta.type;
|
|
975
|
+
|
|
976
|
+
if (type === 'group') {
|
|
977
|
+
return this.graph.addEdge(new _edge2.GroupEdge(edgeMeta));
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
var edge = new _edge.default(edgeMeta);
|
|
981
|
+
console.log('renderEdge >>>>>>', edgeMeta); // 条件判断 是
|
|
982
|
+
|
|
983
|
+
if (edgeMeta !== null && edgeMeta !== void 0 && (_edgeMeta$source$port = edgeMeta.source.port) !== null && _edgeMeta$source$port !== void 0 && _edgeMeta$source$port.startsWith('SIGN_OPERATION_CONDITION-IS')) {
|
|
984
|
+
edge.setLabels(['是']);
|
|
985
|
+
} // 条件判断 否
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
if (edgeMeta !== null && edgeMeta !== void 0 && (_edgeMeta$source$port2 = edgeMeta.source.port) !== null && _edgeMeta$source$port2 !== void 0 && _edgeMeta$source$port2.startsWith('SIGN_OPERATION_CONDITION-NOT')) {
|
|
989
|
+
edge.setLabels(['否']);
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
return this.graph.addEdge(edge);
|
|
993
|
+
}
|
|
994
|
+
}, {
|
|
995
|
+
key: "onSelectNodes",
|
|
996
|
+
value: function onSelectNodes(nodes) {
|
|
997
|
+
var selectedNodes = nodes.filter(function (cell) {
|
|
998
|
+
return cell.isNode() && !(cell !== null && cell !== void 0 && cell.isGroup());
|
|
999
|
+
});
|
|
1000
|
+
|
|
1001
|
+
if (selectedNodes.length === 1) {
|
|
1002
|
+
// 当只选中了一个节点时,激活当前选中项
|
|
1003
|
+
var cell = selectedNodes[0];
|
|
1004
|
+
var nodeData = cell.getData();
|
|
1005
|
+
var currentActiveNode = this.activeNodeInstance$.getValue();
|
|
1006
|
+
|
|
1007
|
+
if ((currentActiveNode === null || currentActiveNode === void 0 ? void 0 : currentActiveNode.id) !== (nodeData === null || nodeData === void 0 ? void 0 : nodeData.id)) {
|
|
1008
|
+
this.activeNodeInstance$.next(nodeData);
|
|
1009
|
+
}
|
|
1010
|
+
} else {
|
|
1011
|
+
this.selectedNodes$.next(selectedNodes);
|
|
1012
|
+
this.activeNodeInstance$.next(null); // 当没选中任何东西时,清空选中的节点信息
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
}, {
|
|
1016
|
+
key: "onClearSelectNodes",
|
|
1017
|
+
value: function onClearSelectNodes() {
|
|
1018
|
+
this.activeNodeInstance$.next(null); // 当没选中任何东西时,清空选中的节点信息
|
|
1019
|
+
}
|
|
1020
|
+
}, {
|
|
1021
|
+
key: "onConnectNode",
|
|
1022
|
+
value: function () {
|
|
1023
|
+
var _onConnectNode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(args) {
|
|
1024
|
+
var _args$edge, edge, isNew, _ref11, source, target, node, portId, _source$port, _source$port2, _this$graph, _this$graph2, data, sourceCell, targetCell, sourceCellData, targetCellData;
|
|
1025
|
+
|
|
1026
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1027
|
+
while (1) {
|
|
1028
|
+
switch (_context13.prev = _context13.next) {
|
|
1029
|
+
case 0:
|
|
1030
|
+
console.log('<<< canvas >>> onConnectNode', args);
|
|
1031
|
+
_args$edge = args.edge, edge = _args$edge === void 0 ? {} : _args$edge, isNew = args.isNew;
|
|
1032
|
+
_ref11 = edge, source = _ref11.source, target = _ref11.target;
|
|
1033
|
+
|
|
1034
|
+
if (isNew) {
|
|
1035
|
+
// 处理边虚线样式更新的问题。
|
|
1036
|
+
node = args.currentCell;
|
|
1037
|
+
portId = edge.getTargetPortId();
|
|
1038
|
+
|
|
1039
|
+
if (node && portId) {
|
|
1040
|
+
// 触发 port 重新渲染
|
|
1041
|
+
node.setPortProp(portId, 'connected', true); // 更新连线样式
|
|
1042
|
+
|
|
1043
|
+
edge.attr({
|
|
1044
|
+
line: {
|
|
1045
|
+
targetMarker: '',
|
|
1046
|
+
stroke: '#00A6FF',
|
|
1047
|
+
strokeWidth: 1,
|
|
1048
|
+
strokeDasharray: 5
|
|
1049
|
+
}
|
|
1050
|
+
});
|
|
1051
|
+
data = {
|
|
1052
|
+
source: source.cell,
|
|
1053
|
+
target: target.cell,
|
|
1054
|
+
outputPortId: source.port,
|
|
1055
|
+
inputPortId: target.port
|
|
1056
|
+
}; // 条件判断 是
|
|
1057
|
+
|
|
1058
|
+
if ((_source$port = source.port) !== null && _source$port !== void 0 && _source$port.startsWith('SIGN_OPERATION_CONDITION-IS')) {
|
|
1059
|
+
edge.setLabels(['是']);
|
|
1060
|
+
} // 条件判断 否
|
|
1061
|
+
|
|
1062
|
+
|
|
1063
|
+
if ((_source$port2 = source.port) !== null && _source$port2 !== void 0 && _source$port2.startsWith('SIGN_OPERATION_CONDITION-NOT')) {
|
|
1064
|
+
edge.setLabels(['否']);
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
sourceCell = (_this$graph = this.graph) === null || _this$graph === void 0 ? void 0 : _this$graph.getCellById(source.cell);
|
|
1068
|
+
targetCell = (_this$graph2 = this.graph) === null || _this$graph2 === void 0 ? void 0 : _this$graph2.getCellById(target.cell);
|
|
1069
|
+
sourceCellData = sourceCell === null || sourceCell === void 0 ? void 0 : sourceCell.getData();
|
|
1070
|
+
targetCellData = targetCell === null || targetCell === void 0 ? void 0 : targetCell.getData();
|
|
1071
|
+
targetCellData.parentId = sourceCellData.id;
|
|
1072
|
+
targetCell === null || targetCell === void 0 ? void 0 : targetCell.setData(targetCellData); // if (sourceCell && targetCell) sourceCell.addChild(targetCell)
|
|
1073
|
+
|
|
1074
|
+
console.log('sourceCell', targetCell === null || targetCell === void 0 ? void 0 : targetCell.getData());
|
|
1075
|
+
edge.setData(data);
|
|
1076
|
+
this.updateExperimentGraph([], [data]);
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
return _context13.abrupt("return", {
|
|
1081
|
+
success: true
|
|
1082
|
+
});
|
|
1083
|
+
|
|
1084
|
+
case 5:
|
|
1085
|
+
case "end":
|
|
1086
|
+
return _context13.stop();
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
}, _callee13, this);
|
|
1090
|
+
}));
|
|
1091
|
+
|
|
1092
|
+
function onConnectNode(_x9) {
|
|
1093
|
+
return _onConnectNode.apply(this, arguments);
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
return onConnectNode;
|
|
1097
|
+
}() // eslint-disable-next-line class-methods-use-this
|
|
1098
|
+
|
|
1099
|
+
}, {
|
|
1100
|
+
key: "onConnectionRemoved",
|
|
1101
|
+
value: function onConnectionRemoved(args) {
|
|
1102
|
+
try {
|
|
1103
|
+
var edge = args.edge;
|
|
1104
|
+
var target = edge.target;
|
|
1105
|
+
var _ref12 = target,
|
|
1106
|
+
nodeId = _ref12.cell,
|
|
1107
|
+
portId = _ref12.port;
|
|
1108
|
+
|
|
1109
|
+
if (nodeId) {
|
|
1110
|
+
var targetCell = this.getNodeById(nodeId);
|
|
1111
|
+
|
|
1112
|
+
if (targetCell) {
|
|
1113
|
+
// 触发 port 重新渲染
|
|
1114
|
+
targetCell.setPortProp(portId, 'connected', false);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
} catch (error) {
|
|
1118
|
+
console.warn(error);
|
|
1119
|
+
}
|
|
1120
|
+
} // eslint-disable-next-line class-methods-use-this
|
|
1121
|
+
|
|
1122
|
+
}, {
|
|
1123
|
+
key: "onMoveNodeStart",
|
|
1124
|
+
value: function onMoveNodeStart(args) {
|
|
1125
|
+
var node = args.node;
|
|
1126
|
+
var parent = node.getParent();
|
|
1127
|
+
var parentData = parent === null || parent === void 0 ? void 0 : parent.getData();
|
|
1128
|
+
|
|
1129
|
+
if (parentData && !(parentData !== null && parentData !== void 0 && parentData.isCollapsed)) {
|
|
1130
|
+
(0, _graphUtil.expandGroupAccordingToNodes)({
|
|
1131
|
+
moveNodes: [node]
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
}, {
|
|
1136
|
+
key: "onMoveNodes",
|
|
1137
|
+
value: function () {
|
|
1138
|
+
var _onMoveNodes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(movedNodes) {
|
|
1139
|
+
var _this3 = this;
|
|
1140
|
+
|
|
1141
|
+
var targetNodes, newPos, oldGraph, newGraph;
|
|
1142
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1143
|
+
while (1) {
|
|
1144
|
+
switch (_context14.prev = _context14.next) {
|
|
1145
|
+
case 0:
|
|
1146
|
+
targetNodes = movedNodes.filter(function (arg) {
|
|
1147
|
+
var node = arg.node;
|
|
1148
|
+
return !node.isGroup();
|
|
1149
|
+
});
|
|
1150
|
+
|
|
1151
|
+
if (targetNodes !== null && targetNodes !== void 0 && targetNodes.length) {
|
|
1152
|
+
newPos = targetNodes.map(function (moveNode) {
|
|
1153
|
+
var current = moveNode.current,
|
|
1154
|
+
node = moveNode.node;
|
|
1155
|
+
var x = current.x,
|
|
1156
|
+
y = current.y;
|
|
1157
|
+
var id = node.id;
|
|
1158
|
+
|
|
1159
|
+
_this3.updateNodeById(id, function (nodes) {
|
|
1160
|
+
nodes.setData({
|
|
1161
|
+
x: x,
|
|
1162
|
+
y: y
|
|
1163
|
+
});
|
|
1164
|
+
});
|
|
1165
|
+
|
|
1166
|
+
return {
|
|
1167
|
+
nodeInstanceId: id,
|
|
1168
|
+
posX: (0, _lodashEs.round)(x),
|
|
1169
|
+
posY: (0, _lodashEs.round)(y)
|
|
1170
|
+
};
|
|
1171
|
+
});
|
|
1172
|
+
oldGraph = this.experimentGraph$.getValue();
|
|
1173
|
+
newGraph = (0, _immer.default)(oldGraph, function (nextGraph) {
|
|
1174
|
+
newPos.forEach(function (position) {
|
|
1175
|
+
var nodeInstanceId = position.nodeInstanceId,
|
|
1176
|
+
posX = position.posX,
|
|
1177
|
+
posY = position.posY;
|
|
1178
|
+
var matchNode = nextGraph.nodes.find(function (item) {
|
|
1179
|
+
return item.id.toString() === nodeInstanceId.toString();
|
|
1180
|
+
});
|
|
1181
|
+
|
|
1182
|
+
if (matchNode) {
|
|
1183
|
+
matchNode.positionX = posX;
|
|
1184
|
+
matchNode.positionY = posY;
|
|
1185
|
+
}
|
|
1186
|
+
});
|
|
1187
|
+
});
|
|
1188
|
+
this.experimentGraph$.next(newGraph);
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
case 2:
|
|
1192
|
+
case "end":
|
|
1193
|
+
return _context14.stop();
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
}, _callee14, this);
|
|
1197
|
+
}));
|
|
1198
|
+
|
|
1199
|
+
function onMoveNodes(_x10) {
|
|
1200
|
+
return _onMoveNodes.apply(this, arguments);
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
return onMoveNodes;
|
|
1204
|
+
}()
|
|
1205
|
+
}, {
|
|
1206
|
+
key: "onDeleteNodeOrEdge",
|
|
1207
|
+
value: function onDeleteNodeOrEdge(args) {
|
|
1208
|
+
var nodes = args.nodes,
|
|
1209
|
+
edges = args.edges;
|
|
1210
|
+
var normalNodes = nodes.filter(function (node) {
|
|
1211
|
+
return !node.isGroup();
|
|
1212
|
+
});
|
|
1213
|
+
|
|
1214
|
+
if (normalNodes !== null && normalNodes !== void 0 && normalNodes.length) {
|
|
1215
|
+
this.requestDeleteNodes(normalNodes.map(function (node) {
|
|
1216
|
+
return node.id;
|
|
1217
|
+
}));
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
if (edges !== null && edges !== void 0 && edges.length) {
|
|
1221
|
+
this.requestDeleteEdges(edges);
|
|
1222
|
+
}
|
|
1223
|
+
} // eslint-disable-next-line class-methods-use-this
|
|
1224
|
+
|
|
1225
|
+
}, {
|
|
1226
|
+
key: "validateNodeCopyable",
|
|
1227
|
+
value: function validateNodeCopyable(cell) {
|
|
1228
|
+
return (cell === null || cell === void 0 ? void 0 : cell.isNode()) && !cell.isGroup();
|
|
1229
|
+
} // eslint-disable-next-line consistent-return
|
|
1230
|
+
|
|
1231
|
+
}, {
|
|
1232
|
+
key: "onCopyNode",
|
|
1233
|
+
value: function onCopyNode(node) {
|
|
1234
|
+
try {
|
|
1235
|
+
var nodeData = node.getData();
|
|
1236
|
+
var res = (0, _graph2.copyNode)(nodeData);
|
|
1237
|
+
var newNode = (0, _graphUtil.formatNodeInfoToNodeMeta)(res);
|
|
1238
|
+
this.addNode(newNode);
|
|
1239
|
+
this.clearContextMenuInfo();
|
|
1240
|
+
} catch (error) {
|
|
1241
|
+
_antd.message.error('复制节点失败,请重试');
|
|
1242
|
+
}
|
|
1243
|
+
} // 设置自定义算法组件节点
|
|
1244
|
+
|
|
1245
|
+
}, {
|
|
1246
|
+
key: "dispose",
|
|
1247
|
+
value: function dispose() {
|
|
1248
|
+
var _this$experimentGraph, _this$executionStatus, _this$reRenderSub;
|
|
1249
|
+
|
|
1250
|
+
(_this$experimentGraph = this.experimentGraphSub) === null || _this$experimentGraph === void 0 ? void 0 : _this$experimentGraph.unsubscribe();
|
|
1251
|
+
(_this$executionStatus = this.executionStatusQuerySub) === null || _this$executionStatus === void 0 ? void 0 : _this$executionStatus.unsubscribe();
|
|
1252
|
+
(_this$reRenderSub = this.reRenderSub) === null || _this$reRenderSub === void 0 ? void 0 : _this$reRenderSub.unsubscribe();
|
|
1253
|
+
|
|
1254
|
+
_get(_getPrototypeOf(ExperimentGraph.prototype), "dispose", this).call(this);
|
|
1255
|
+
}
|
|
1256
|
+
}]);
|
|
1257
|
+
|
|
1258
|
+
return ExperimentGraph;
|
|
1259
|
+
}(_graphCore.GraphCore);
|
|
1260
|
+
|
|
1261
|
+
var gModelMap = new Map(); // 存储实验图的 model
|
|
1262
|
+
|
|
1263
|
+
exports.gModelMap = gModelMap;
|
|
1264
|
+
|
|
1265
|
+
var useExperimentGraph = function useExperimentGraph(experimentId) {
|
|
1266
|
+
var existedExperimentGraph = gModelMap.get(experimentId);
|
|
1267
|
+
|
|
1268
|
+
if (!existedExperimentGraph) {
|
|
1269
|
+
existedExperimentGraph = new ExperimentGraph(experimentId);
|
|
1270
|
+
gModelMap.set(experimentId, existedExperimentGraph);
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
return existedExperimentGraph;
|
|
1274
|
+
};
|
|
1275
|
+
|
|
1276
|
+
exports.useExperimentGraph = useExperimentGraph;
|
|
1277
|
+
|
|
1278
|
+
var useUnmountExperimentGraph = function useUnmountExperimentGraph(experimentId) {
|
|
1279
|
+
console.log('useUnmountExperimentGraph', experimentId);
|
|
1280
|
+
(0, _react.useEffect)(function () {
|
|
1281
|
+
return function () {
|
|
1282
|
+
var existedExperimentGraph = gModelMap.get(experimentId);
|
|
1283
|
+
|
|
1284
|
+
if (existedExperimentGraph) {
|
|
1285
|
+
existedExperimentGraph.dispose();
|
|
1286
|
+
gModelMap.delete(experimentId);
|
|
1287
|
+
}
|
|
1288
|
+
};
|
|
1289
|
+
}, [experimentId]);
|
|
1290
|
+
};
|
|
1291
|
+
|
|
1292
|
+
exports.useUnmountExperimentGraph = useUnmountExperimentGraph;
|