@blueking/bkflow-canvas-editor 1.1.0-beta.2 → 1.1.0-beta.21
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/README.md +171 -41
- package/dist/advanced.cjs.js +1 -1
- package/dist/advanced.d.ts +232 -34
- package/dist/advanced.esm.js +5 -3
- package/dist/bkflow-canvas-editor_false-B70uLuHL.cjs +1 -0
- package/dist/bkflow-canvas-editor_false-BlC281Zg.cjs +1 -0
- package/dist/bkflow-canvas-editor_false-Casww7p4.js +5 -0
- package/dist/bkflow-canvas-editor_false-i9G8sqQi.js +5 -0
- package/dist/{composable-gqC5C2k8.js → context-DFzO6khC.js} +409 -245
- package/dist/context-NG3ocAZ9.cjs +1 -0
- package/dist/index-02hL8tEC.cjs +1 -0
- package/dist/index-B8efFF5D.cjs +1 -0
- package/dist/index-BWndXizJ.js +512 -0
- package/dist/index-BhHHxbEL.js +235 -0
- package/dist/index-Bs2CwzmL.cjs +1 -0
- package/dist/index-DUOfuLCl.js +50713 -0
- package/dist/index-GYfLO_6L.js +163 -0
- package/dist/index-j9vPPW5D.cjs +70 -0
- package/dist/index.cjs.js +1 -70
- package/dist/index.d.ts +631 -91
- package/dist/index.esm.js +39 -46100
- package/dist/style.css +1 -1
- package/dist/style.d.ts +2 -0
- package/package.json +12 -7
- package/dist/composable-B_bR5Gic.cjs +0 -1
- package/dist/index.es.min-BBOgAuB2.js +0 -3214
- package/dist/index.es.min-DQIH7mAl.cjs +0 -2
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { defineComponent as q, ref as f, shallowRef as J, computed as x, watch as P, resolveComponent as p, resolveDirective as U, openBlock as l, createBlock as v, withCtx as i, withDirectives as z, createElementBlock as y, Fragment as A, renderList as W, createVNode as b, createCommentVNode as g, createElementVNode as V, createTextVNode as C, toDisplayString as M } from "vue";
|
|
2
|
+
import { InfoBox as X } from "bkui-vue/lib";
|
|
3
|
+
import G from "bkui-vue/lib/message";
|
|
4
|
+
import { cloneDeep as H } from "lodash";
|
|
5
|
+
import { u as K, M as Q, p as Z, m as $, h as ee, r as T, f as te, a as oe, _ as se } from "./index-DUOfuLCl.js";
|
|
6
|
+
const ae = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "mock-data-sideslider__title-sep"
|
|
9
|
+
}, ne = ["title"], le = { class: "mock-data-sideslider" }, re = { class: "mock-data-sideslider__footer" }, ce = "当前节点的输出不支持mock,如是否需要在调试时跳过当前节点?", ie = "跳过调试", ue = /* @__PURE__ */ q({
|
|
10
|
+
__name: "index",
|
|
11
|
+
props: {
|
|
12
|
+
show: { type: Boolean },
|
|
13
|
+
node: { default: null },
|
|
14
|
+
outputs: { default: () => ({}) },
|
|
15
|
+
pending: { type: Boolean, default: !1 }
|
|
16
|
+
},
|
|
17
|
+
emits: ["confirm", "close", "update:show"],
|
|
18
|
+
setup(O, { emit: E }) {
|
|
19
|
+
const t = O, _ = E, F = K(), k = f(!1), u = J([]), d = f({}), h = f({}), m = f(!1), B = x(() => m.value ? ce : "暂无输出结果"), N = x(() => m.value ? ie : "确定"), D = async () => {
|
|
20
|
+
if (t.node) {
|
|
21
|
+
k.value = !0, h.value = {}, m.value = !1;
|
|
22
|
+
try {
|
|
23
|
+
const e = await Z(F, t.node.component);
|
|
24
|
+
u.value = $(e.outputs ?? []), m.value = ee(e.outputs);
|
|
25
|
+
const o = t.outputs ?? {}, a = {};
|
|
26
|
+
u.value.forEach((s) => {
|
|
27
|
+
const r = Object.prototype.hasOwnProperty.call(o, s.key) ? o[s.key] : s.type === "object" ? {} : void 0, n = T(s);
|
|
28
|
+
a[s.key] = n === "json-editor" || n === "data-table" ? te(r) : r;
|
|
29
|
+
}), d.value = a;
|
|
30
|
+
} catch (e) {
|
|
31
|
+
console.error(e), u.value = [], d.value = {}, m.value = !1, G({ theme: "error", message: "加载输出结果失败" });
|
|
32
|
+
} finally {
|
|
33
|
+
k.value = !1;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}, S = () => {
|
|
37
|
+
const e = {}, o = {};
|
|
38
|
+
return u.value.forEach((a) => {
|
|
39
|
+
const s = d.value[a.key], r = T(a);
|
|
40
|
+
if (r === "json-editor" || r === "data-table") {
|
|
41
|
+
const n = oe(s);
|
|
42
|
+
if (!n.valid) {
|
|
43
|
+
e[a.key] = n.message;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
n.value !== void 0 && (o[a.key] = n.value);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
s !== void 0 && s !== "" && (o[a.key] = s);
|
|
50
|
+
}), { errors: e, outputs: o };
|
|
51
|
+
}, j = (e) => {
|
|
52
|
+
X({
|
|
53
|
+
title: "确认 Mock 输出?",
|
|
54
|
+
content: "Mock 输出将覆盖当前输出结果,执行时跳过该节点并以 Mock 值替代实际输出",
|
|
55
|
+
confirmText: "确定",
|
|
56
|
+
cancelText: "取消",
|
|
57
|
+
width: 400,
|
|
58
|
+
onConfirm: () => {
|
|
59
|
+
e();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}, Y = () => {
|
|
63
|
+
if (m.value) {
|
|
64
|
+
_("confirm", { outputs: {} });
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const { errors: e, outputs: o } = S();
|
|
68
|
+
h.value = e, !(Object.keys(e).length > 0) && j(() => _("confirm", { outputs: o }));
|
|
69
|
+
}, w = () => {
|
|
70
|
+
_("close"), _("update:show", !1);
|
|
71
|
+
};
|
|
72
|
+
return P(
|
|
73
|
+
() => [t.show, t.node?.id],
|
|
74
|
+
([e]) => {
|
|
75
|
+
e && t.node && (d.value = H(t.outputs ?? {}), D());
|
|
76
|
+
},
|
|
77
|
+
{ immediate: !0 }
|
|
78
|
+
), (e, o) => {
|
|
79
|
+
const a = p("bk-form-item"), s = p("bk-form"), r = p("bk-exception"), n = p("bk-button"), I = p("bk-sideslider"), L = U("bkloading");
|
|
80
|
+
return l(), v(I, {
|
|
81
|
+
"is-show": t.show,
|
|
82
|
+
width: 960,
|
|
83
|
+
"quick-close": "",
|
|
84
|
+
"esc-close": !1,
|
|
85
|
+
onClosed: w
|
|
86
|
+
}, {
|
|
87
|
+
header: i(() => [
|
|
88
|
+
o[0] || (o[0] = V("span", { class: "mock-data-sideslider__title" }, "Mock输出", -1)),
|
|
89
|
+
t.node?.name ? (l(), y("span", ae, "-")) : g("", !0),
|
|
90
|
+
t.node?.name ? (l(), y("span", {
|
|
91
|
+
key: 1,
|
|
92
|
+
class: "mock-data-sideslider__title-node",
|
|
93
|
+
title: t.node.name
|
|
94
|
+
}, M(t.node.name), 9, ne)) : g("", !0)
|
|
95
|
+
]),
|
|
96
|
+
footer: i(() => [
|
|
97
|
+
V("div", re, [
|
|
98
|
+
b(n, {
|
|
99
|
+
theme: "primary",
|
|
100
|
+
"data-test": "mock-confirm",
|
|
101
|
+
loading: t.pending,
|
|
102
|
+
onClick: Y
|
|
103
|
+
}, {
|
|
104
|
+
default: i(() => [
|
|
105
|
+
C(M(N.value), 1)
|
|
106
|
+
]),
|
|
107
|
+
_: 1
|
|
108
|
+
}, 8, ["loading"]),
|
|
109
|
+
b(n, {
|
|
110
|
+
disabled: t.pending,
|
|
111
|
+
onClick: w
|
|
112
|
+
}, {
|
|
113
|
+
default: i(() => [...o[1] || (o[1] = [
|
|
114
|
+
C("取消", -1)
|
|
115
|
+
])]),
|
|
116
|
+
_: 1
|
|
117
|
+
}, 8, ["disabled"])
|
|
118
|
+
])
|
|
119
|
+
]),
|
|
120
|
+
default: i(() => [
|
|
121
|
+
z((l(), y("div", le, [
|
|
122
|
+
u.value.length > 0 ? (l(), v(s, {
|
|
123
|
+
key: 0,
|
|
124
|
+
"form-type": "vertical",
|
|
125
|
+
"label-width": 120,
|
|
126
|
+
"data-test": "mock-outputs-form"
|
|
127
|
+
}, {
|
|
128
|
+
default: i(() => [
|
|
129
|
+
(l(!0), y(A, null, W(u.value, (c) => (l(), v(a, {
|
|
130
|
+
key: c.key,
|
|
131
|
+
label: c.name || c.key
|
|
132
|
+
}, {
|
|
133
|
+
default: i(() => [
|
|
134
|
+
b(Q, {
|
|
135
|
+
modelValue: d.value[c.key],
|
|
136
|
+
"onUpdate:modelValue": (R) => d.value[c.key] = R,
|
|
137
|
+
field: c,
|
|
138
|
+
error: h.value[c.key]
|
|
139
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "field", "error"])
|
|
140
|
+
]),
|
|
141
|
+
_: 2
|
|
142
|
+
}, 1032, ["label"]))), 128))
|
|
143
|
+
]),
|
|
144
|
+
_: 1
|
|
145
|
+
})) : k.value ? g("", !0) : (l(), v(r, {
|
|
146
|
+
key: 1,
|
|
147
|
+
class: "mock-data-sideslider__exception",
|
|
148
|
+
scene: "part",
|
|
149
|
+
type: "empty",
|
|
150
|
+
title: B.value
|
|
151
|
+
}, null, 8, ["title"]))
|
|
152
|
+
])), [
|
|
153
|
+
[L, { loading: k.value }]
|
|
154
|
+
])
|
|
155
|
+
]),
|
|
156
|
+
_: 1
|
|
157
|
+
}, 8, ["is-show"]);
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
}), fe = /* @__PURE__ */ se(ue, [["__scopeId", "data-v-d9a03d9c"]]);
|
|
161
|
+
export {
|
|
162
|
+
fe as default
|
|
163
|
+
};
|