@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
78 lines (77 loc) • 2.98 kB
JavaScript
import { defineComponent as f, inject as w, computed as d, openBlock as n, createElementBlock as u, createVNode as l, unref as e, withCtx as t, Fragment as x, renderList as I, createBlock as m, resolveDynamicComponent as M, createElementVNode as S, toDisplayString as B, createCommentVNode as E } from "vue";
import "./style/index.css";
import { pluginManager as c, loadAsyncComponent as T } from "@javaguns/utils";
import V from "../../hooks/useData.mjs";
import { NodeType as p } from "../../types/node.mjs";
import { AddNodeKey as z } from "../../utils/injection-key.mjs";
import { GunsPopover as A } from "@javaguns/ui";
import { IconZengjiaCuxiantiaoOutline as D } from "@javaguns/icon";
const G = { class: "guns-node-addbutton" }, P = {
key: 0,
class: "is-circle add-flow-btn"
}, j = { style: { "margin-left": "10px" } }, F = f({ name: "guns-node-addbutton" }), J = /* @__PURE__ */ f({
...F,
props: {
type: {},
size: {},
node: {},
readonly: { type: Boolean, default: !1 }
},
setup(_) {
const g = c.getComponent("Menu"), y = c.getComponent("Submenu"), C = c.getComponent("MenuItem"), o = _, { nodeItems: h } = V(), b = w(z, () => {
}), k = d(() => h.filter((r) => {
var s;
return r.nodeType == p.SUGGEST ? ((s = o.node) == null ? void 0 : s.nodeType) == p.APPROVER : !0;
})), v = d(() => o.node && !o.node.addable ? !1 : !o.readonly), N = d(() => (r) => T(async () => (await import("@javaguns/icon"))["Icon" + r.icon + "Flow"]));
return (r, s) => (n(), u("footer", G, [
v.value ? (n(), u("div", P, [
l(e(A), {
placement: "right",
width: "200",
trigger: "click"
}, {
default: t(() => [
l(e(D), { size: "16" })
]),
content: t(() => [
l(e(g), {
class: "guns-node-addbutton-menu",
mode: "vertical",
style: { "border-right": "solid 0px #e6e6e6" }
}, {
default: t(() => [
l(e(y), null, {
default: t(() => [
(n(!0), u(x, null, I(k.value, (a, i) => (n(), m(e(C), {
key: i,
name: i,
onClick: (O) => e(b)({
currNode: o.node,
item: a
})
}, {
default: t(() => [
(n(), m(M(N.value(a)), {
size: "15",
color: a.color
}, null, 8, ["color"])),
S("span", j, B(a.nodeName), 1)
]),
_: 2
}, 1032, ["name", "onClick"]))), 128))
]),
_: 1
})
]),
_: 1
})
]),
_: 1
})
])) : E("", !0)
]));
}
});
export {
J as default
};