UNPKG

@javaguns/flow-ui

Version:

``` <template> <a-spin :spinning="loading"> <FlowDesigner ref="flowDesigner" top="50px"> </FlowDesigner> </a-spin> </template> <script lang="ts" setup> import { ref, provide, onMounted } from 'vue'; import { FlowDesigner, LoadingKey } from '@j

90 lines (89 loc) 2.83 kB
import { defineComponent as f, ref as V, watch as w, inject as I, openBlock as x, createElementBlock as B, createElementVNode as d, createVNode as o, unref as t, withCtx as a, createCommentVNode as D } from "vue"; import "./style/index.css"; import { deepClone as m, getId as O } from "@javaguns/utils"; import { GunsSpace as S, GunsButton as c } from "@javaguns/ui"; import { IconRankOutline as E, IconCopyOutline as G, IconCloseOutline as j } from "@javaguns/icon"; import { useNodeDrag as K } from "../../hooks/useNodeDrag.mjs"; import { useNode as M } from "../../hooks/useNode.mjs"; import { NodeKey as R } from "../../utils/injection-key.mjs"; const T = { key: 0, class: "guns-flow-drag-tool" }, b = { class: "drag-tool-content" }, q = /* @__PURE__ */ d("div", { class: "drag-tool-arrow" }, null, -1), z = { class: "drag-tool-inner" }, A = f({ name: "flow-node-drag-tool" }), Y = /* @__PURE__ */ f({ ...A, props: { modelValue: { type: Boolean } }, emits: ["update:modelValue", "close"], setup(_, { expose: v, emit: g }) { const N = _, { dragSourceNode: r, dragTargetNode: i } = K(), { addSimpleNode: u, delNode: C } = M(), l = V(!1); w( () => N.modelValue, (e) => { h(e); } ); const h = (e) => { e ? l.value = e : l.value = !1; }, s = I(R, null), p = g, y = () => { const e = m(r.value); C(s.value, e), u(s.value, i.value, e), n(); }, k = () => { const e = m(r.value); e.nodeId = O(), u(s.value, i.value, e), n(); }, n = () => { l.value = !1, p("update:modelValue", !1), p("close", !1); }; return v({ onClose: n }), (e, F) => l.value ? (x(), B("div", T, [ d("div", b, [ q, d("div", z, [ o(t(S), null, { default: a(() => [ o(t(c), { type: "primary", status: "danger", shape: "circle", title: "移动节点", onClick: y }, { icon: a(() => [ o(t(E)) ]), _: 1 }), o(t(c), { type: "primary", shape: "circle", title: "复制节点", onClick: k }, { icon: a(() => [ o(t(G)) ]), _: 1 }), o(t(c), { type: "outline", shape: "circle", title: "取消操作", onClick: n }, { icon: a(() => [ o(t(j)) ]), _: 1 }) ]), _: 1 }) ]) ]) ])) : D("", !0); } }); export { Y as default };