@duxweb/dvha-pro 1.0.45 → 1.0.46
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/dist/cjs/component.cjs +1 -1
- package/dist/cjs/components/chart/echart.cjs +1 -1
- package/dist/cjs/components/crop/imageCrop.cjs +1 -1
- package/dist/cjs/components/data/dynamicSelect.cjs +1 -1
- package/dist/cjs/components/data/selectModal.cjs +1 -1
- package/dist/cjs/components/designEditor/components/grid.cjs +1 -1
- package/dist/cjs/components/designEditor/editor/setting.cjs +1 -1
- package/dist/cjs/components/flowEditor/components/jsonEditor.cjs +1 -0
- package/dist/cjs/components/flowEditor/components/nodeCard.cjs +1 -0
- package/dist/cjs/components/flowEditor/components/setting.cjs +1 -0
- package/dist/cjs/components/flowEditor/components/toolbar.cjs +1 -0
- package/dist/cjs/components/flowEditor/flowEditor.cjs +1 -0
- package/dist/cjs/components/flowEditor/nodes/endNode.cjs +1 -0
- package/dist/cjs/components/flowEditor/nodes/index.cjs +1 -0
- package/dist/cjs/components/flowEditor/nodes/processNode.cjs +1 -0
- package/dist/cjs/components/flowEditor/nodes/startNode.cjs +1 -0
- package/dist/cjs/components/flowEditor/utils/nodeDataUtils.cjs +1 -0
- package/dist/cjs/components/form/drawerForm.cjs +1 -1
- package/dist/cjs/components/form/modalForm.cjs +1 -1
- package/dist/cjs/components/form/pageForm.cjs +1 -1
- package/dist/cjs/components/form/pageTabForm.cjs +1 -1
- package/dist/cjs/components/form/settingForm.cjs +1 -1
- package/dist/cjs/components/formEditor/base/base.cjs +1 -1
- package/dist/cjs/components/formEditor/base/setting.cjs +1 -1
- package/dist/cjs/components/formEditor/components/cascader.cjs +1 -1
- package/dist/cjs/components/formEditor/components/cascaderAsync.cjs +1 -1
- package/dist/cjs/components/formEditor/components/checkbox.cjs +1 -1
- package/dist/cjs/components/formEditor/components/color.cjs +1 -1
- package/dist/cjs/components/formEditor/components/date.cjs +1 -1
- package/dist/cjs/components/formEditor/components/dynamicInput.cjs +1 -1
- package/dist/cjs/components/formEditor/components/dynamicTags.cjs +1 -1
- package/dist/cjs/components/formEditor/components/editor.cjs +1 -1
- package/dist/cjs/components/formEditor/components/fileUpload.cjs +1 -1
- package/dist/cjs/components/formEditor/components/imageUpload.cjs +1 -1
- package/dist/cjs/components/formEditor/components/input.cjs +1 -1
- package/dist/cjs/components/formEditor/components/inputNumber.cjs +1 -1
- package/dist/cjs/components/formEditor/components/mentionAsync.cjs +1 -1
- package/dist/cjs/components/formEditor/components/radio.cjs +1 -1
- package/dist/cjs/components/formEditor/components/region.cjs +1 -1
- package/dist/cjs/components/formEditor/components/select.cjs +1 -1
- package/dist/cjs/components/formEditor/components/selectAsync.cjs +1 -1
- package/dist/cjs/components/formEditor/components/sider.cjs +1 -1
- package/dist/cjs/components/formEditor/components/switch.cjs +1 -1
- package/dist/cjs/components/formEditor/components/time.cjs +1 -1
- package/dist/cjs/components/formEditor/components/transferAsync.cjs +1 -1
- package/dist/cjs/components/formEditor/components/treeSelect.cjs +1 -1
- package/dist/cjs/components/formEditor/components/treeSelectAsync.cjs +1 -1
- package/dist/cjs/components/formEditor/editor.cjs +1 -1
- package/dist/cjs/components/formEditor/renderer.cjs +1 -1
- package/dist/cjs/components/icon/icon.cjs +1 -1
- package/dist/cjs/components/layout/list.cjs +1 -1
- package/dist/cjs/components/layout/table.cjs +1 -1
- package/dist/cjs/components/level/level.cjs +1 -1
- package/dist/cjs/components/posterEditor/pages/RightPanel.cjs +1 -1
- package/dist/cjs/components/posterEditor/posterEditor.cjs +1 -1
- package/dist/cjs/components/table/table.cjs +1 -1
- package/dist/cjs/components/upload/file.cjs +1 -1
- package/dist/cjs/components/upload/image.cjs +1 -1
- package/dist/cjs/components/upload/manage/item.cjs +1 -1
- package/dist/cjs/components/upload/manager.cjs +1 -1
- package/dist/cjs/dvha-pro.css +1 -1
- package/dist/cjs/hooks/dialog.cjs +1 -1
- package/dist/cjs/hooks/drawer.cjs +1 -1
- package/dist/cjs/hooks/modal.cjs +1 -1
- package/dist/cjs/hooks/table/image.cjs +1 -1
- package/dist/cjs/hooks/table/media.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/langs/en-US.json.cjs +1 -1
- package/dist/cjs/langs/zh-CN.json.cjs +1 -1
- package/dist/cjs/main.cjs +1 -1
- package/dist/cjs/pages/authLayout.cjs +1 -1
- package/dist/cjs/pages/layout/page.cjs +1 -1
- package/dist/cjs/pages/login.cjs +1 -1
- package/dist/cjs/pages/menu/avatar.cjs +1 -1
- package/dist/cjs/pages/menu/button.cjs +1 -1
- package/dist/cjs/pages/menu/cmd.cjs +1 -1
- package/dist/cjs/pages/menu/main.cjs +1 -1
- package/dist/cjs/pages/menu/mobile.cjs +1 -1
- package/dist/cjs/pages/page404.cjs +1 -1
- package/dist/cjs/pages/pageStatus.cjs +1 -1
- package/dist/cjs/theme/uno.css.cjs +75 -3
- package/dist/esm/component.js +5 -2
- package/dist/esm/components/chart/echart.js +5 -2
- package/dist/esm/components/crop/imageCrop.js +13 -10
- package/dist/esm/components/data/dynamicSelect.js +5 -2
- package/dist/esm/components/data/selectModal.js +5 -2
- package/dist/esm/components/designEditor/components/grid.js +5 -2
- package/dist/esm/components/designEditor/editor/setting.js +7 -4
- package/dist/esm/components/flowEditor/components/jsonEditor.js +53 -0
- package/dist/esm/components/flowEditor/components/nodeCard.js +160 -0
- package/dist/esm/components/flowEditor/components/setting.js +319 -0
- package/dist/esm/components/flowEditor/components/toolbar.js +120 -0
- package/dist/esm/components/flowEditor/flowEditor.js +287 -0
- package/dist/esm/components/flowEditor/nodes/endNode.js +144 -0
- package/dist/esm/components/flowEditor/nodes/index.js +66 -0
- package/dist/esm/components/flowEditor/nodes/processNode.js +142 -0
- package/dist/esm/components/flowEditor/nodes/startNode.js +144 -0
- package/dist/esm/components/flowEditor/utils/nodeDataUtils.js +82 -0
- package/dist/esm/components/form/drawerForm.js +5 -2
- package/dist/esm/components/form/modalForm.js +12 -9
- package/dist/esm/components/form/pageForm.js +21 -18
- package/dist/esm/components/form/pageTabForm.js +5 -2
- package/dist/esm/components/form/settingForm.js +11 -8
- package/dist/esm/components/formEditor/base/base.js +8 -5
- package/dist/esm/components/formEditor/base/setting.js +5 -2
- package/dist/esm/components/formEditor/components/cascader.js +6 -3
- package/dist/esm/components/formEditor/components/cascaderAsync.js +6 -3
- package/dist/esm/components/formEditor/components/checkbox.js +17 -14
- package/dist/esm/components/formEditor/components/color.js +6 -3
- package/dist/esm/components/formEditor/components/date.js +6 -3
- package/dist/esm/components/formEditor/components/dynamicInput.js +6 -3
- package/dist/esm/components/formEditor/components/dynamicTags.js +13 -10
- package/dist/esm/components/formEditor/components/editor.js +6 -3
- package/dist/esm/components/formEditor/components/fileUpload.js +6 -3
- package/dist/esm/components/formEditor/components/imageUpload.js +6 -3
- package/dist/esm/components/formEditor/components/input.js +6 -3
- package/dist/esm/components/formEditor/components/inputNumber.js +29 -26
- package/dist/esm/components/formEditor/components/mentionAsync.js +17 -14
- package/dist/esm/components/formEditor/components/radio.js +17 -14
- package/dist/esm/components/formEditor/components/region.js +19 -16
- package/dist/esm/components/formEditor/components/select.js +6 -3
- package/dist/esm/components/formEditor/components/selectAsync.js +12 -9
- package/dist/esm/components/formEditor/components/sider.js +6 -3
- package/dist/esm/components/formEditor/components/switch.js +22 -19
- package/dist/esm/components/formEditor/components/time.js +6 -3
- package/dist/esm/components/formEditor/components/transferAsync.js +26 -23
- package/dist/esm/components/formEditor/components/treeSelect.js +6 -3
- package/dist/esm/components/formEditor/components/treeSelectAsync.js +26 -23
- package/dist/esm/components/formEditor/editor.js +5 -2
- package/dist/esm/components/formEditor/renderer.js +5 -2
- package/dist/esm/components/icon/icon.js +5 -2
- package/dist/esm/components/layout/list.js +5 -2
- package/dist/esm/components/layout/table.js +5 -2
- package/dist/esm/components/level/level.js +5 -2
- package/dist/esm/components/posterEditor/pages/RightPanel.js +5 -2
- package/dist/esm/components/posterEditor/posterEditor.js +5 -2
- package/dist/esm/components/table/table.js +9 -6
- package/dist/esm/components/upload/file.js +5 -2
- package/dist/esm/components/upload/image.js +18 -15
- package/dist/esm/components/upload/manage/item.js +5 -2
- package/dist/esm/components/upload/manager.js +5 -2
- package/dist/esm/dvha-pro.css +1 -1
- package/dist/esm/hooks/dialog.js +5 -2
- package/dist/esm/hooks/drawer.js +5 -2
- package/dist/esm/hooks/modal.js +5 -2
- package/dist/esm/hooks/table/image.js +5 -2
- package/dist/esm/hooks/table/media.js +5 -2
- package/dist/esm/index.js +252 -226
- package/dist/esm/langs/en-US.json.js +5 -5
- package/dist/esm/langs/zh-CN.json.js +6 -6
- package/dist/esm/main.js +4 -2
- package/dist/esm/pages/authLayout.js +5 -2
- package/dist/esm/pages/layout/page.js +9 -6
- package/dist/esm/pages/login.js +10 -7
- package/dist/esm/pages/menu/avatar.js +18 -15
- package/dist/esm/pages/menu/button.js +8 -5
- package/dist/esm/pages/menu/cmd.js +13 -10
- package/dist/esm/pages/menu/main.js +29 -26
- package/dist/esm/pages/menu/mobile.js +5 -2
- package/dist/esm/pages/page404.js +3 -0
- package/dist/esm/pages/pageStatus.js +5 -2
- package/dist/esm/theme/uno.css.js +75 -3
- package/dist/types/components/flowEditor/components/index.d.ts +3 -0
- package/dist/types/components/flowEditor/components/jsonEditor.d.ts +22 -0
- package/dist/types/components/flowEditor/components/nodeCard.d.ts +112 -0
- package/dist/types/components/flowEditor/components/setting.d.ts +16 -0
- package/dist/types/components/flowEditor/components/toolbar.d.ts +11 -0
- package/dist/types/components/flowEditor/flowEditor.d.ts +68 -0
- package/dist/types/components/flowEditor/index.d.ts +5 -0
- package/dist/types/components/flowEditor/nodes/endNode.d.ts +19 -0
- package/dist/types/components/flowEditor/nodes/index.d.ts +8 -0
- package/dist/types/components/flowEditor/nodes/processNode.d.ts +19 -0
- package/dist/types/components/flowEditor/nodes/startNode.d.ts +19 -0
- package/dist/types/components/flowEditor/types/index.d.ts +62 -0
- package/dist/types/components/flowEditor/utils/nodeDataUtils.d.ts +59 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/main.d.ts +2 -0
- package/package.json +9 -3
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { defineComponent as y, computed as n, createVNode as o } from "vue";
|
|
2
|
+
import { useI18n as b } from "@duxweb/dvha-core";
|
|
3
|
+
import s from "clsx";
|
|
4
|
+
import { NScrollbar as x } from "naive-ui";
|
|
5
|
+
import v from "short-unique-id";
|
|
6
|
+
const N = /* @__PURE__ */ y({
|
|
7
|
+
name: "FlowToolbar",
|
|
8
|
+
props: {
|
|
9
|
+
nodes: {
|
|
10
|
+
type: Object,
|
|
11
|
+
default: () => ({})
|
|
12
|
+
},
|
|
13
|
+
categories: {
|
|
14
|
+
type: Array,
|
|
15
|
+
default: () => []
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
setup(i) {
|
|
19
|
+
const {
|
|
20
|
+
t: l
|
|
21
|
+
} = b(), {
|
|
22
|
+
randomUUID: c
|
|
23
|
+
} = new v({
|
|
24
|
+
length: 10
|
|
25
|
+
}), d = [{
|
|
26
|
+
key: "start",
|
|
27
|
+
label: l("components.flowEditor.categories.start") || "",
|
|
28
|
+
icon: "i-tabler:flag",
|
|
29
|
+
order: 1
|
|
30
|
+
}, {
|
|
31
|
+
key: "process",
|
|
32
|
+
label: l("components.flowEditor.categories.process") || "",
|
|
33
|
+
icon: "i-tabler:box",
|
|
34
|
+
order: 2
|
|
35
|
+
}, {
|
|
36
|
+
key: "condition",
|
|
37
|
+
label: l("components.flowEditor.categories.condition") || "",
|
|
38
|
+
icon: "i-tabler:git-branch",
|
|
39
|
+
order: 3
|
|
40
|
+
}, {
|
|
41
|
+
key: "end",
|
|
42
|
+
label: l("components.flowEditor.categories.end") || "",
|
|
43
|
+
icon: "i-tabler:flag-check",
|
|
44
|
+
order: 4
|
|
45
|
+
}], m = n(() => {
|
|
46
|
+
const e = /* @__PURE__ */ new Map();
|
|
47
|
+
return d.forEach((t) => e.set(t.key, t)), i.categories?.forEach((t) => e.set(t.key, t)), Array.from(e.values()).sort((t, a) => (t.order || 999) - (a.order || 999));
|
|
48
|
+
}), p = n(() => {
|
|
49
|
+
const e = /* @__PURE__ */ new Map();
|
|
50
|
+
return Object.entries(i.nodes).forEach(([t, a]) => {
|
|
51
|
+
const r = a.meta.category;
|
|
52
|
+
e.has(r) || e.set(r, []), e.get(r).push(a);
|
|
53
|
+
}), e;
|
|
54
|
+
}), f = (e, t) => {
|
|
55
|
+
const a = {
|
|
56
|
+
id: c(),
|
|
57
|
+
type: t.meta.name,
|
|
58
|
+
position: {
|
|
59
|
+
x: 0,
|
|
60
|
+
y: 0
|
|
61
|
+
},
|
|
62
|
+
data: {
|
|
63
|
+
label: t.meta.label,
|
|
64
|
+
description: t.meta.description,
|
|
65
|
+
icon: t.meta.icon,
|
|
66
|
+
color: t.meta.color,
|
|
67
|
+
config: {
|
|
68
|
+
...t.meta.defaultConfig
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
e.dataTransfer.setData("application/vueflow", JSON.stringify(a)), e.dataTransfer.effectAllowed = "move";
|
|
73
|
+
}, g = (e) => ({
|
|
74
|
+
bg: "bg-default dark:bg-muted hover:bg-elevated",
|
|
75
|
+
iconBg: e.meta.style?.iconBgClass || "bg-gray-100",
|
|
76
|
+
icon: "text-white",
|
|
77
|
+
text: "text-default"
|
|
78
|
+
});
|
|
79
|
+
return () => o("div", {
|
|
80
|
+
class: "w-220px h-full"
|
|
81
|
+
}, [o(x, null, {
|
|
82
|
+
default: () => [o("div", {
|
|
83
|
+
class: "p-4 space-y-4"
|
|
84
|
+
}, [m.value.map((e) => {
|
|
85
|
+
const t = p.value.get(e.key) || [];
|
|
86
|
+
return t.length === 0 ? null : o("div", {
|
|
87
|
+
key: e.key,
|
|
88
|
+
class: "space-y-4"
|
|
89
|
+
}, [o("div", {
|
|
90
|
+
class: "flex items-center gap-2 text-sm "
|
|
91
|
+
}, [o("div", {
|
|
92
|
+
class: s(["size-4", e.icon])
|
|
93
|
+
}, null), o("span", null, [e.label])]), o("div", {
|
|
94
|
+
class: "space-y-2"
|
|
95
|
+
}, [t.map((a) => {
|
|
96
|
+
const r = g(a);
|
|
97
|
+
return o("div", {
|
|
98
|
+
key: a.meta.name,
|
|
99
|
+
draggable: !0,
|
|
100
|
+
onDragstart: (u) => f(u, a),
|
|
101
|
+
class: s(["rounded-lg px-3 py-2 cursor-move transition-all", r.bg, "flex items-center gap-3"])
|
|
102
|
+
}, [o("div", {
|
|
103
|
+
class: s(["size-8 rounded-lg flex items-center justify-center flex-shrink-0", r.iconBg])
|
|
104
|
+
}, [o("div", {
|
|
105
|
+
class: s(["size-4", a.meta.icon, r.icon])
|
|
106
|
+
}, null)]), o("div", {
|
|
107
|
+
class: "flex-1 min-w-0"
|
|
108
|
+
}, [o("div", {
|
|
109
|
+
class: s(["text-sm font-medium truncate", r.text])
|
|
110
|
+
}, [a.meta.label]), a.meta.description && o("div", {
|
|
111
|
+
class: s(["text-xs truncate opacity-80", r.text])
|
|
112
|
+
}, [a.meta.description])])]);
|
|
113
|
+
})])]);
|
|
114
|
+
})])]
|
|
115
|
+
})]);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
export {
|
|
119
|
+
N as FlowToolbar
|
|
120
|
+
};
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { defineComponent as R, ref as m, computed as h, watch as Z, provide as $, createVNode as t } from "vue";
|
|
2
|
+
import { useTheme as L, useI18n as U } from "@duxweb/dvha-core";
|
|
3
|
+
import { Background as W } from "@vue-flow/background";
|
|
4
|
+
import { useVueFlow as J, MarkerType as w, VueFlow as X, ConnectionMode as Y } from "@vue-flow/core";
|
|
5
|
+
import { NButton as v } from "naive-ui";
|
|
6
|
+
import "clsx";
|
|
7
|
+
import { defaultNodes as q } from "./nodes/index.js";
|
|
8
|
+
import { FlowSetting as K } from "./components/setting.js";
|
|
9
|
+
import { FlowToolbar as P } from "./components/toolbar.js";
|
|
10
|
+
/* empty css */
|
|
11
|
+
const de = /* @__PURE__ */ R({
|
|
12
|
+
name: "DuxFlowEditor",
|
|
13
|
+
props: {
|
|
14
|
+
modelValue: {
|
|
15
|
+
type: Object,
|
|
16
|
+
default: () => ({
|
|
17
|
+
nodes: [],
|
|
18
|
+
edges: []
|
|
19
|
+
})
|
|
20
|
+
},
|
|
21
|
+
// 自定义节点
|
|
22
|
+
customNodes: {
|
|
23
|
+
type: Object,
|
|
24
|
+
default: () => ({})
|
|
25
|
+
},
|
|
26
|
+
// 节点分类
|
|
27
|
+
categories: {
|
|
28
|
+
type: Array,
|
|
29
|
+
default: () => []
|
|
30
|
+
},
|
|
31
|
+
// 编辑器配置
|
|
32
|
+
config: {
|
|
33
|
+
type: Object,
|
|
34
|
+
default: () => ({
|
|
35
|
+
readonly: !1,
|
|
36
|
+
showGrid: !0,
|
|
37
|
+
showControls: !0
|
|
38
|
+
})
|
|
39
|
+
},
|
|
40
|
+
// 保存回调
|
|
41
|
+
onSave: {
|
|
42
|
+
type: Function,
|
|
43
|
+
default: void 0
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
emits: ["update:modelValue"],
|
|
47
|
+
setup(o, {
|
|
48
|
+
emit: r,
|
|
49
|
+
slots: d
|
|
50
|
+
}) {
|
|
51
|
+
const C = m(), {
|
|
52
|
+
isDark: S
|
|
53
|
+
} = L(), {
|
|
54
|
+
t: V
|
|
55
|
+
} = U(), {
|
|
56
|
+
project: k,
|
|
57
|
+
vueFlowRef: b,
|
|
58
|
+
getNodes: u,
|
|
59
|
+
getEdges: i,
|
|
60
|
+
setNodes: D,
|
|
61
|
+
setEdges: z,
|
|
62
|
+
onNodesChange: E,
|
|
63
|
+
onEdgesChange: x,
|
|
64
|
+
onConnect: N,
|
|
65
|
+
addNodes: A,
|
|
66
|
+
addEdges: O,
|
|
67
|
+
fitView: p,
|
|
68
|
+
zoomIn: F,
|
|
69
|
+
zoomOut: T
|
|
70
|
+
} = J(), c = h(() => ({
|
|
71
|
+
...q,
|
|
72
|
+
...o.customNodes
|
|
73
|
+
})), j = h(() => {
|
|
74
|
+
const e = {};
|
|
75
|
+
return Object.entries(c.value).forEach(([l, s]) => {
|
|
76
|
+
e[l] = s.component;
|
|
77
|
+
}), e;
|
|
78
|
+
}), n = m(!1), a = m(o.modelValue?.globalSettings || {});
|
|
79
|
+
E((e) => {
|
|
80
|
+
!Array.isArray(e) || e.length === 0 || (n.value = !0, r("update:modelValue", {
|
|
81
|
+
nodes: u.value,
|
|
82
|
+
edges: i.value,
|
|
83
|
+
globalSettings: a.value
|
|
84
|
+
}));
|
|
85
|
+
}), x((e) => {
|
|
86
|
+
!Array.isArray(e) || e.length === 0 || (n.value = !0, r("update:modelValue", {
|
|
87
|
+
nodes: u.value,
|
|
88
|
+
edges: i.value,
|
|
89
|
+
globalSettings: a.value
|
|
90
|
+
}));
|
|
91
|
+
}), N((e) => {
|
|
92
|
+
if (!e) return;
|
|
93
|
+
const l = {
|
|
94
|
+
id: `edge-${e.source}-${e.target}-${Date.now()}`,
|
|
95
|
+
source: e.source,
|
|
96
|
+
target: e.target,
|
|
97
|
+
sourceHandle: e.sourceHandle,
|
|
98
|
+
targetHandle: e.targetHandle,
|
|
99
|
+
data: {
|
|
100
|
+
type: "success"
|
|
101
|
+
},
|
|
102
|
+
type: "default"
|
|
103
|
+
// 使用默认贝塞尔曲线
|
|
104
|
+
}, s = y(l);
|
|
105
|
+
O([s]), n.value = !0, r("update:modelValue", {
|
|
106
|
+
nodes: u.value,
|
|
107
|
+
edges: i.value,
|
|
108
|
+
globalSettings: a.value
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
const y = (e) => {
|
|
112
|
+
const l = e.data?.type || "success", s = {
|
|
113
|
+
success: {
|
|
114
|
+
stroke: "#10b981",
|
|
115
|
+
markerColor: "#10b981"
|
|
116
|
+
},
|
|
117
|
+
// 绿色 - 通过
|
|
118
|
+
error: {
|
|
119
|
+
stroke: "#ef4444",
|
|
120
|
+
markerColor: "#ef4444"
|
|
121
|
+
}
|
|
122
|
+
// 红色 - 退回
|
|
123
|
+
}, f = s[l] || s.success;
|
|
124
|
+
return {
|
|
125
|
+
...e,
|
|
126
|
+
style: {
|
|
127
|
+
stroke: f.stroke,
|
|
128
|
+
strokeWidth: 2,
|
|
129
|
+
...e.style
|
|
130
|
+
},
|
|
131
|
+
markerEnd: {
|
|
132
|
+
type: w.ArrowClosed,
|
|
133
|
+
width: 12,
|
|
134
|
+
height: 12,
|
|
135
|
+
color: f.markerColor,
|
|
136
|
+
...e.markerEnd
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
Z(() => o.modelValue, (e) => {
|
|
141
|
+
if (n.value) {
|
|
142
|
+
n.value = !1;
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (e.nodes && Array.isArray(e.nodes) && D([...e.nodes]), e.edges && Array.isArray(e.edges)) {
|
|
146
|
+
const l = e.edges.map(y);
|
|
147
|
+
z(l);
|
|
148
|
+
}
|
|
149
|
+
e.globalSettings && (a.value = {
|
|
150
|
+
...e.globalSettings
|
|
151
|
+
}), (e.nodes && e.nodes.length > 0 || e.edges && e.edges.length > 0) && setTimeout(() => {
|
|
152
|
+
p();
|
|
153
|
+
}, 100);
|
|
154
|
+
}, {
|
|
155
|
+
immediate: !0,
|
|
156
|
+
deep: !0
|
|
157
|
+
});
|
|
158
|
+
const g = m(!1), B = (e) => e.source !== e.target, H = (e) => {
|
|
159
|
+
e.preventDefault(), g.value = !1;
|
|
160
|
+
const l = e.dataTransfer?.getData("application/vueflow");
|
|
161
|
+
if (!l) return;
|
|
162
|
+
const s = JSON.parse(l), f = k({
|
|
163
|
+
x: e.clientX - (b.value?.getBoundingClientRect().left || 0),
|
|
164
|
+
y: e.clientY - (b.value?.getBoundingClientRect().top || 0)
|
|
165
|
+
}), G = {
|
|
166
|
+
...s,
|
|
167
|
+
position: f
|
|
168
|
+
};
|
|
169
|
+
A([G]);
|
|
170
|
+
}, I = (e) => {
|
|
171
|
+
e.preventDefault(), g.value = !0;
|
|
172
|
+
}, M = (e) => {
|
|
173
|
+
e.preventDefault(), g.value = !1;
|
|
174
|
+
};
|
|
175
|
+
return $("flowNodes", c), () => t("div", {
|
|
176
|
+
class: "h-full w-full relative bg-muted rounded-md"
|
|
177
|
+
}, [t("div", {
|
|
178
|
+
ref: C,
|
|
179
|
+
class: "absolute inset-0 w-full h-full",
|
|
180
|
+
onDrop: H,
|
|
181
|
+
onDragover: I,
|
|
182
|
+
onDragleave: M
|
|
183
|
+
}, [t(X, {
|
|
184
|
+
class: "w-full h-full",
|
|
185
|
+
nodeTypes: j.value,
|
|
186
|
+
fitViewOnInit: !0,
|
|
187
|
+
defaultEdgeOptions: {
|
|
188
|
+
type: "default",
|
|
189
|
+
style: {
|
|
190
|
+
strokeWidth: 2
|
|
191
|
+
},
|
|
192
|
+
markerEnd: {
|
|
193
|
+
type: w.ArrowClosed,
|
|
194
|
+
width: 12,
|
|
195
|
+
height: 12
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
nodesDraggable: !o.config.readonly,
|
|
199
|
+
nodesConnectable: !o.config.readonly,
|
|
200
|
+
elementsSelectable: !o.config.readonly,
|
|
201
|
+
connectionMode: Y.Loose,
|
|
202
|
+
isValidConnection: B,
|
|
203
|
+
minZoom: 0.1,
|
|
204
|
+
maxZoom: 1
|
|
205
|
+
}, {
|
|
206
|
+
default: () => [o.config.showGrid && t(W, {
|
|
207
|
+
variant: "dots",
|
|
208
|
+
gap: 20,
|
|
209
|
+
size: 1.5,
|
|
210
|
+
patternColor: S.value ? "rgba(255,255,255, 0.2)" : "rgba(0,0,0, 0.2)"
|
|
211
|
+
}, null), o.config.showControls && t("div", {
|
|
212
|
+
class: "absolute bottom-4 left-1/2 transform -translate-x-1/2 flex gap-2 z-10"
|
|
213
|
+
}, [t(v, {
|
|
214
|
+
onClick: () => T(),
|
|
215
|
+
size: "small",
|
|
216
|
+
class: "!size-8",
|
|
217
|
+
secondary: !0
|
|
218
|
+
}, {
|
|
219
|
+
icon: () => t("div", {
|
|
220
|
+
class: "i-tabler:minus size-4"
|
|
221
|
+
}, null)
|
|
222
|
+
}), t(v, {
|
|
223
|
+
onClick: () => p(),
|
|
224
|
+
size: "small",
|
|
225
|
+
class: "!size-8",
|
|
226
|
+
secondary: !0
|
|
227
|
+
}, {
|
|
228
|
+
icon: () => t("div", {
|
|
229
|
+
class: "i-tabler:focus-2 size-4"
|
|
230
|
+
}, null)
|
|
231
|
+
}), t(v, {
|
|
232
|
+
onClick: () => F(),
|
|
233
|
+
size: "small",
|
|
234
|
+
class: "!size-8",
|
|
235
|
+
secondary: !0
|
|
236
|
+
}, {
|
|
237
|
+
icon: () => t("div", {
|
|
238
|
+
class: "i-tabler:plus size-4"
|
|
239
|
+
}, null)
|
|
240
|
+
})]), d.toolbar && t("div", {
|
|
241
|
+
class: "absolute top-4 left-1/2 -translate-x-1/2 z-10"
|
|
242
|
+
}, [d.toolbar()])]
|
|
243
|
+
}), g.value && t("div", {
|
|
244
|
+
class: "absolute inset-0 bg-blue-50/80 border-2 border-dashed border-blue-400 pointer-events-none flex items-center justify-center z-10"
|
|
245
|
+
}, [t("div", {
|
|
246
|
+
class: "bg-white px-6 py-3 rounded-lg shadow-xl border border-blue-200"
|
|
247
|
+
}, [t("div", {
|
|
248
|
+
class: "flex items-center gap-2 text-blue-600"
|
|
249
|
+
}, [t("div", {
|
|
250
|
+
class: "i-tabler:plus"
|
|
251
|
+
}, null), t("span", {
|
|
252
|
+
class: "font-medium"
|
|
253
|
+
}, [V("components.flowEditor.toolbar.releaseToAdd") || ""])])])])]), t("div", {
|
|
254
|
+
class: "absolute top-4 left-4 z-1 bottom-4"
|
|
255
|
+
}, [t("div", {
|
|
256
|
+
class: "h-full bg-default shadow rounded"
|
|
257
|
+
}, [t(P, {
|
|
258
|
+
nodes: c.value,
|
|
259
|
+
categories: o.categories
|
|
260
|
+
}, null)])]), t("div", {
|
|
261
|
+
class: "absolute top-4 right-4 bottom-4 z-1"
|
|
262
|
+
}, [t("div", {
|
|
263
|
+
class: "h-full bg-default shadow rounded"
|
|
264
|
+
}, [t(K, {
|
|
265
|
+
nodes: c.value,
|
|
266
|
+
modelValue: o.modelValue,
|
|
267
|
+
"onUpdate:modelValue": (e) => r("update:modelValue", e),
|
|
268
|
+
onSave: o.onSave
|
|
269
|
+
}, {
|
|
270
|
+
globalSettings: d.globalSettings ? () => d.globalSettings?.({
|
|
271
|
+
globalSettings: a.value,
|
|
272
|
+
updateGlobalSettings: (e) => {
|
|
273
|
+
a.value = {
|
|
274
|
+
...e
|
|
275
|
+
}, r("update:modelValue", {
|
|
276
|
+
nodes: u.value,
|
|
277
|
+
edges: i.value,
|
|
278
|
+
globalSettings: a.value
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}) : void 0
|
|
282
|
+
})])])]);
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
export {
|
|
286
|
+
de as DuxFlowEditor
|
|
287
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { defineComponent as d, createVNode as e } from "vue";
|
|
2
|
+
import { useI18n as l } from "@duxweb/dvha-core";
|
|
3
|
+
import { Position as a } from "@vue-flow/core";
|
|
4
|
+
import { useVModel as s } from "@vueuse/core";
|
|
5
|
+
import { NInput as m } from "naive-ui";
|
|
6
|
+
import "clsx";
|
|
7
|
+
import "vue-echarts";
|
|
8
|
+
import "vue-router";
|
|
9
|
+
import "@overlastic/vue";
|
|
10
|
+
import "dayjs";
|
|
11
|
+
import "mime";
|
|
12
|
+
import "lodash-es";
|
|
13
|
+
import "@tanstack/vue-query";
|
|
14
|
+
import "@duxweb/dvha-naiveui";
|
|
15
|
+
import "pinia";
|
|
16
|
+
import "vue3-ace-editor";
|
|
17
|
+
import "ace-builds/src-noconflict/mode-vue";
|
|
18
|
+
import "ace-builds/src-noconflict/mode-javascript";
|
|
19
|
+
import "ace-builds/src-noconflict/mode-html";
|
|
20
|
+
import "ace-builds/src-noconflict/mode-json";
|
|
21
|
+
import "ace-builds/src-noconflict/mode-json5";
|
|
22
|
+
import "ace-builds/src-noconflict/theme-tomorrow_night";
|
|
23
|
+
import "ace-builds/src-noconflict/theme-tomorrow";
|
|
24
|
+
import "ace-builds/src-noconflict/ext-searchbox";
|
|
25
|
+
import "ace-builds/src-noconflict/ext-language_tools";
|
|
26
|
+
import "ace-builds/src-noconflict/mode-snippets";
|
|
27
|
+
import "vue-cropper";
|
|
28
|
+
import "jinrishici";
|
|
29
|
+
import "vue-draggable-plus";
|
|
30
|
+
import "@vee-validate/i18n";
|
|
31
|
+
import "colorizr";
|
|
32
|
+
import "echarts";
|
|
33
|
+
import "highlight.js/lib/core";
|
|
34
|
+
import "highlight.js/lib/languages/bash";
|
|
35
|
+
import "highlight.js/lib/languages/css";
|
|
36
|
+
import "highlight.js/lib/languages/go";
|
|
37
|
+
import "highlight.js/lib/languages/java";
|
|
38
|
+
import "highlight.js/lib/languages/javascript";
|
|
39
|
+
import "highlight.js/lib/languages/json";
|
|
40
|
+
import "highlight.js/lib/languages/markdown";
|
|
41
|
+
import "highlight.js/lib/languages/php";
|
|
42
|
+
import "highlight.js/lib/languages/python";
|
|
43
|
+
import "highlight.js/lib/languages/shell";
|
|
44
|
+
import "highlight.js/lib/languages/sql";
|
|
45
|
+
import "highlight.js/lib/languages/typescript";
|
|
46
|
+
import "highlight.js/lib/languages/xml";
|
|
47
|
+
import "@ant-design/colors";
|
|
48
|
+
import "@unocss/preset-icons/browser";
|
|
49
|
+
import "@unocss/preset-typography";
|
|
50
|
+
import "unocss/preset-wind4";
|
|
51
|
+
import "@vee-validate/i18n/dist/locale/en.json";
|
|
52
|
+
import "@vee-validate/i18n/dist/locale/zh_CN.json";
|
|
53
|
+
import "vee-validate";
|
|
54
|
+
import "vue-command-palette";
|
|
55
|
+
import "../../../pages/page404.js";
|
|
56
|
+
import "short-unique-id";
|
|
57
|
+
import "aieditor";
|
|
58
|
+
import { FlowNodeCard as u } from "../components/nodeCard.js";
|
|
59
|
+
import "@vue-flow/background";
|
|
60
|
+
/* empty css */
|
|
61
|
+
import "@iconify-json/tabler/icons.json";
|
|
62
|
+
import "../../posterEditor/elements/index.js";
|
|
63
|
+
import "fabric";
|
|
64
|
+
import { DuxFormItem as n } from "../../form/formItem.js";
|
|
65
|
+
function c(o) {
|
|
66
|
+
const i = (t) => {
|
|
67
|
+
}, r = (t) => {
|
|
68
|
+
};
|
|
69
|
+
return e(u, {
|
|
70
|
+
nodeProps: o,
|
|
71
|
+
showSourceHandle: !1,
|
|
72
|
+
color: "danger",
|
|
73
|
+
handlePosition: {
|
|
74
|
+
target: a.Left
|
|
75
|
+
},
|
|
76
|
+
onClick: i,
|
|
77
|
+
onDoubleClick: r
|
|
78
|
+
}, null);
|
|
79
|
+
}
|
|
80
|
+
const f = /* @__PURE__ */ d({
|
|
81
|
+
name: "EndNodeSetting",
|
|
82
|
+
props: {
|
|
83
|
+
modelValue: {
|
|
84
|
+
type: Object,
|
|
85
|
+
default: () => ({})
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
emits: ["update:modelValue"],
|
|
89
|
+
setup(o, {
|
|
90
|
+
emit: i
|
|
91
|
+
}) {
|
|
92
|
+
const {
|
|
93
|
+
t: r
|
|
94
|
+
} = l(), t = s(o, "modelValue", i);
|
|
95
|
+
return () => e("div", {
|
|
96
|
+
class: "space-y-4"
|
|
97
|
+
}, [e(n, {
|
|
98
|
+
label: r("components.flowEditor.label") || ""
|
|
99
|
+
}, {
|
|
100
|
+
default: () => [e(m, {
|
|
101
|
+
value: t.value.label,
|
|
102
|
+
"onUpdate:value": (p) => t.value.label = p
|
|
103
|
+
}, null)]
|
|
104
|
+
}), e(n, {
|
|
105
|
+
label: r("components.flowEditor.description") || ""
|
|
106
|
+
}, {
|
|
107
|
+
default: () => [e(m, {
|
|
108
|
+
value: t.value.description,
|
|
109
|
+
"onUpdate:value": (p) => t.value.description = p,
|
|
110
|
+
type: "textarea",
|
|
111
|
+
rows: 3,
|
|
112
|
+
placeholder: r("components.flowEditor.descriptionPlaceholder") || ""
|
|
113
|
+
}, null)]
|
|
114
|
+
})]);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
function Io() {
|
|
118
|
+
const {
|
|
119
|
+
t: o
|
|
120
|
+
} = l();
|
|
121
|
+
return {
|
|
122
|
+
meta: {
|
|
123
|
+
name: "end",
|
|
124
|
+
label: o("components.flowEditor.nodes.end.label") || "",
|
|
125
|
+
description: o("components.flowEditor.nodes.end.description") || "",
|
|
126
|
+
category: "end",
|
|
127
|
+
nodeType: "end",
|
|
128
|
+
icon: "i-tabler:player-stop",
|
|
129
|
+
color: "danger",
|
|
130
|
+
style: {
|
|
131
|
+
iconBgClass: "bg-red"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
component: c,
|
|
135
|
+
settingComponent: f,
|
|
136
|
+
multiInput: !0,
|
|
137
|
+
multiOutput: !1
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
export {
|
|
141
|
+
c as EndNode,
|
|
142
|
+
f as EndNodeSetting,
|
|
143
|
+
Io as getEndNodeRegistry
|
|
144
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import "vue";
|
|
2
|
+
import "@duxweb/dvha-core";
|
|
3
|
+
import "@vue-flow/core";
|
|
4
|
+
import "@vueuse/core";
|
|
5
|
+
import "naive-ui";
|
|
6
|
+
import "clsx";
|
|
7
|
+
import "vue-echarts";
|
|
8
|
+
import "vue-router";
|
|
9
|
+
import "@overlastic/vue";
|
|
10
|
+
import "dayjs";
|
|
11
|
+
import "mime";
|
|
12
|
+
import "lodash-es";
|
|
13
|
+
import "@tanstack/vue-query";
|
|
14
|
+
import "@duxweb/dvha-naiveui";
|
|
15
|
+
import "pinia";
|
|
16
|
+
import "vue3-ace-editor";
|
|
17
|
+
import "ace-builds/src-noconflict/mode-vue";
|
|
18
|
+
import "ace-builds/src-noconflict/mode-javascript";
|
|
19
|
+
import "ace-builds/src-noconflict/mode-html";
|
|
20
|
+
import "ace-builds/src-noconflict/mode-json";
|
|
21
|
+
import "ace-builds/src-noconflict/mode-json5";
|
|
22
|
+
import "ace-builds/src-noconflict/theme-tomorrow_night";
|
|
23
|
+
import "ace-builds/src-noconflict/theme-tomorrow";
|
|
24
|
+
import "ace-builds/src-noconflict/ext-searchbox";
|
|
25
|
+
import "ace-builds/src-noconflict/ext-language_tools";
|
|
26
|
+
import "ace-builds/src-noconflict/mode-snippets";
|
|
27
|
+
import "vue-cropper";
|
|
28
|
+
import "jinrishici";
|
|
29
|
+
import "vue-draggable-plus";
|
|
30
|
+
import "@vee-validate/i18n";
|
|
31
|
+
import "colorizr";
|
|
32
|
+
import "echarts";
|
|
33
|
+
import "highlight.js/lib/core";
|
|
34
|
+
import "highlight.js/lib/languages/bash";
|
|
35
|
+
import "highlight.js/lib/languages/css";
|
|
36
|
+
import "highlight.js/lib/languages/go";
|
|
37
|
+
import "highlight.js/lib/languages/java";
|
|
38
|
+
import "highlight.js/lib/languages/javascript";
|
|
39
|
+
import "highlight.js/lib/languages/json";
|
|
40
|
+
import "highlight.js/lib/languages/markdown";
|
|
41
|
+
import "highlight.js/lib/languages/php";
|
|
42
|
+
import "highlight.js/lib/languages/python";
|
|
43
|
+
import "highlight.js/lib/languages/shell";
|
|
44
|
+
import "highlight.js/lib/languages/sql";
|
|
45
|
+
import "highlight.js/lib/languages/typescript";
|
|
46
|
+
import "highlight.js/lib/languages/xml";
|
|
47
|
+
import "@ant-design/colors";
|
|
48
|
+
import "@unocss/preset-icons/browser";
|
|
49
|
+
import "@unocss/preset-typography";
|
|
50
|
+
import "unocss/preset-wind4";
|
|
51
|
+
import "@vee-validate/i18n/dist/locale/en.json";
|
|
52
|
+
import "@vee-validate/i18n/dist/locale/zh_CN.json";
|
|
53
|
+
import "vee-validate";
|
|
54
|
+
import "vue-command-palette";
|
|
55
|
+
import "../../../pages/page404.js";
|
|
56
|
+
import "short-unique-id";
|
|
57
|
+
import "aieditor";
|
|
58
|
+
import "@vue-flow/background";
|
|
59
|
+
/* empty css */
|
|
60
|
+
import "@iconify-json/tabler/icons.json";
|
|
61
|
+
import "../../posterEditor/elements/index.js";
|
|
62
|
+
import "fabric";
|
|
63
|
+
const ao = {};
|
|
64
|
+
export {
|
|
65
|
+
ao as defaultNodes
|
|
66
|
+
};
|