@blueking/bkflow-canvas-editor 1.1.0-beta.5 → 1.1.0-beta.6

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.
@@ -0,0 +1,159 @@
1
+ import { defineComponent as T, ref as y, shallowRef as q, watch as I, resolveComponent as m, resolveDirective as J, openBlock as l, createBlock as _, withCtx as c, withDirectives as U, createElementBlock as f, Fragment as z, renderList as A, createVNode as b, createCommentVNode as h, createElementVNode as w, createTextVNode as V, toDisplayString as L } from "vue";
2
+ import { InfoBox as P } from "bkui-vue/lib";
3
+ import S from "bkui-vue/lib/message";
4
+ import { cloneDeep as W } from "lodash";
5
+ import { u as G, M as H, p as K, m as Q, r as x, f as X, a as Y, _ as Z } from "./index-C5lTl48-.js";
6
+ const $ = {
7
+ key: 0,
8
+ class: "mock-data-sideslider__title-sep"
9
+ }, ee = ["title"], oe = { class: "mock-data-sideslider" }, te = { class: "mock-data-sideslider__footer" }, se = /* @__PURE__ */ T({
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(C, { emit: F }) {
19
+ const o = C, p = F, M = G(), k = y(!1), d = q([]), u = y({}), v = y({}), B = async () => {
20
+ if (o.node) {
21
+ k.value = !0, v.value = {};
22
+ try {
23
+ const t = await K(M, o.node.component);
24
+ d.value = Q(t.outputs ?? []);
25
+ const e = o.outputs ?? {}, a = {};
26
+ d.value.forEach((s) => {
27
+ const r = Object.prototype.hasOwnProperty.call(e, s.key) ? e[s.key] : s.type === "object" ? {} : void 0, n = x(s);
28
+ a[s.key] = n === "json-editor" || n === "data-table" ? X(r) : r;
29
+ }), u.value = a;
30
+ } catch (t) {
31
+ console.error(t), d.value = [], u.value = {}, S({ theme: "error", message: "加载输出参数失败" });
32
+ } finally {
33
+ k.value = !1;
34
+ }
35
+ }
36
+ }, D = () => {
37
+ const t = {}, e = {};
38
+ return d.value.forEach((a) => {
39
+ const s = u.value[a.key], r = x(a);
40
+ if (r === "json-editor" || r === "data-table") {
41
+ const n = Y(s);
42
+ if (!n.valid) {
43
+ t[a.key] = n.message;
44
+ return;
45
+ }
46
+ n.value !== void 0 && (e[a.key] = n.value);
47
+ return;
48
+ }
49
+ s !== void 0 && s !== "" && (e[a.key] = s);
50
+ }), { errors: t, outputs: e };
51
+ }, j = (t) => {
52
+ P({
53
+ title: "确认 Mock 输出?",
54
+ content: "Mock 输出将覆盖当前输出参数,执行时跳过该节点并以 Mock 值替代实际输出",
55
+ confirmText: "确定",
56
+ cancelText: "取消",
57
+ width: 400,
58
+ onConfirm: () => {
59
+ t(), p("update:show", !1);
60
+ }
61
+ });
62
+ }, E = () => {
63
+ const { errors: t, outputs: e } = D();
64
+ v.value = t, !(Object.keys(t).length > 0) && j(() => p("confirm", { outputs: e }));
65
+ }, g = () => {
66
+ p("close"), p("update:show", !1);
67
+ };
68
+ return I(
69
+ () => [o.show, o.node?.id],
70
+ ([t]) => {
71
+ t && o.node && (u.value = W(o.outputs ?? {}), B());
72
+ },
73
+ { immediate: !0 }
74
+ ), (t, e) => {
75
+ const a = m("bk-form-item"), s = m("bk-form"), r = m("bk-exception"), n = m("bk-button"), N = m("bk-sideslider"), O = J("bkloading");
76
+ return l(), _(N, {
77
+ "is-show": o.show,
78
+ width: 640,
79
+ "quick-close": "",
80
+ "esc-close": !1,
81
+ onClosed: g
82
+ }, {
83
+ header: c(() => [
84
+ e[0] || (e[0] = w("span", { class: "mock-data-sideslider__title" }, "Mock 输出", -1)),
85
+ o.node?.name ? (l(), f("span", $, "-")) : h("", !0),
86
+ o.node?.name ? (l(), f("span", {
87
+ key: 1,
88
+ class: "mock-data-sideslider__title-node",
89
+ title: o.node.name
90
+ }, L(o.node.name), 9, ee)) : h("", !0)
91
+ ]),
92
+ footer: c(() => [
93
+ w("div", te, [
94
+ b(n, {
95
+ theme: "primary",
96
+ "data-test": "mock-confirm",
97
+ loading: o.pending,
98
+ onClick: E
99
+ }, {
100
+ default: c(() => [...e[1] || (e[1] = [
101
+ V(" 确定 ", -1)
102
+ ])]),
103
+ _: 1
104
+ }, 8, ["loading"]),
105
+ b(n, {
106
+ disabled: o.pending,
107
+ onClick: g
108
+ }, {
109
+ default: c(() => [...e[2] || (e[2] = [
110
+ V("取消", -1)
111
+ ])]),
112
+ _: 1
113
+ }, 8, ["disabled"])
114
+ ])
115
+ ]),
116
+ default: c(() => [
117
+ U((l(), f("div", oe, [
118
+ d.value.length > 0 ? (l(), _(s, {
119
+ key: 0,
120
+ "form-type": "vertical",
121
+ "label-width": 120,
122
+ "data-test": "mock-outputs-form"
123
+ }, {
124
+ default: c(() => [
125
+ (l(!0), f(z, null, A(d.value, (i) => (l(), _(a, {
126
+ key: i.key,
127
+ label: i.name || i.key
128
+ }, {
129
+ default: c(() => [
130
+ b(H, {
131
+ modelValue: u.value[i.key],
132
+ "onUpdate:modelValue": (R) => u.value[i.key] = R,
133
+ field: i,
134
+ error: v.value[i.key]
135
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "field", "error"])
136
+ ]),
137
+ _: 2
138
+ }, 1032, ["label"]))), 128))
139
+ ]),
140
+ _: 1
141
+ })) : k.value ? h("", !0) : (l(), _(r, {
142
+ key: 1,
143
+ class: "mock-data-sideslider__exception",
144
+ scene: "part",
145
+ type: "empty",
146
+ title: "暂无输出参数"
147
+ }))
148
+ ])), [
149
+ [O, { loading: k.value }]
150
+ ])
151
+ ]),
152
+ _: 1
153
+ }, 8, ["is-show"]);
154
+ };
155
+ }
156
+ }), ce = /* @__PURE__ */ Z(se, [["__scopeId", "data-v-8b63ba90"]]);
157
+ export {
158
+ ce as default
159
+ };
@@ -0,0 +1,501 @@
1
+ import { defineComponent as B, ref as C, computed as _, watch as q, nextTick as J, resolveComponent as N, openBlock as c, createElementBlock as p, createVNode as m, Fragment as W, renderList as Q, withKeys as X, withModifiers as Z, normalizeClass as R, createElementVNode as l, createBlock as D, createCommentVNode as E, toDisplayString as M, withCtx as y, createTextVNode as T, onBeforeUnmount as ee, resolveDirective as te, normalizeStyle as se, withDirectives as ae, unref as ne } from "vue";
2
+ import { L as z, S as le, E as oe, _ as P, n as ue, D as U, C as ie, b as re } from "./index-C5lTl48-.js";
3
+ import { a as G } from "./composable-DQzX4bmX.js";
4
+ const de = { class: "debug-result-node-list" }, ce = ["data-node-id", "aria-selected", "onClick", "onKeydown"], me = ["title"], pe = {
5
+ key: 0,
6
+ class: "debug-result-node-list__mock",
7
+ "data-test": "node-mock-flag"
8
+ }, _e = {
9
+ key: 1,
10
+ class: "debug-result-node-list__empty"
11
+ }, ve = /* @__PURE__ */ B({
12
+ __name: "node-list",
13
+ props: {
14
+ nodes: {},
15
+ modelValue: { default: "" }
16
+ },
17
+ emits: ["update:modelValue"],
18
+ setup(a, { emit: u }) {
19
+ const e = a, o = u, i = C(""), n = C("all"), v = C(null), b = [
20
+ { value: "all", label: "全部" },
21
+ { value: "finished", icon: "bkflow-canvas-dark-circle-checkbox", iconColor: "#2dcb56" },
22
+ { value: "failed", icon: "bkflow-canvas-circle-alert-filled", iconColor: "#ea3636" },
23
+ { value: "running", iconComponent: z, iconColor: "#3a84ff" },
24
+ { value: "suspended", icon: "bkflow-canvas-guaqi", iconColor: "#ff9c01" },
25
+ { value: "skipped", icon: "bkflow-canvas-tiaoguo", iconColor: "#6e89af" }
26
+ ], f = _(
27
+ () => b.map((d) => ({
28
+ ...d,
29
+ count: d.value === "all" ? e.nodes.length : e.nodes.filter((r) => r.status === d.value).length
30
+ }))
31
+ ), k = _(() => {
32
+ const d = i.value.trim().toLowerCase();
33
+ return e.nodes.filter((r) => n.value !== "all" && r.status !== n.value ? !1 : d ? r.name.toLowerCase().includes(d) || r.type.toLowerCase().includes(d) || (r.typeName ?? "").toLowerCase().includes(d) : !0);
34
+ }), x = {
35
+ finished: "成功",
36
+ failed: "失败",
37
+ running: "正在调试",
38
+ suspended: "挂起",
39
+ skipped: "跳过"
40
+ }, V = _(() => i.value.trim() ? "搜索结果为空" : n.value !== "all" ? `暂无${x[n.value]}状态节点` : "暂无节点"), $ = () => {
41
+ i.value = "", n.value = "all";
42
+ };
43
+ return q(
44
+ () => e.modelValue,
45
+ async (d) => {
46
+ if (!d) return;
47
+ !k.value.some((t) => t.id === d) && e.nodes.some((t) => t.id === d) && (i.value = "", n.value = "all", await J()), v.value?.querySelector(`[data-node-id="${CSS.escape(d)}"]`)?.scrollIntoView({ block: "nearest" });
48
+ }
49
+ ), (d, r) => {
50
+ const s = N("bk-input");
51
+ return c(), p("aside", de, [
52
+ m(s, {
53
+ modelValue: i.value,
54
+ "onUpdate:modelValue": r[0] || (r[0] = (t) => i.value = t),
55
+ class: "debug-result-node-list__search",
56
+ placeholder: "搜索节点名称 / 类型",
57
+ type: "search",
58
+ clearable: "",
59
+ "data-test": "node-search"
60
+ }, null, 8, ["modelValue"]),
61
+ m(le, {
62
+ modelValue: n.value,
63
+ "onUpdate:modelValue": r[1] || (r[1] = (t) => n.value = t),
64
+ class: "debug-result-node-list__filters",
65
+ "data-test": "status-filters",
66
+ items: f.value
67
+ }, null, 8, ["modelValue", "items"]),
68
+ k.value.length > 0 ? (c(), p("div", {
69
+ key: 0,
70
+ ref_key: "itemsRef",
71
+ ref: v,
72
+ class: "debug-result-node-list__items",
73
+ role: "listbox"
74
+ }, [
75
+ (c(!0), p(W, null, Q(k.value, (t) => (c(), p("div", {
76
+ key: t.id,
77
+ class: R([
78
+ "debug-result-node-list__item",
79
+ `is-${t.status}`,
80
+ {
81
+ "is-active": t.id === e.modelValue,
82
+ "is-unconfigured": !t.isConfigured
83
+ }
84
+ ]),
85
+ role: "option",
86
+ "data-test": "node-item",
87
+ "data-node-id": t.id,
88
+ "aria-selected": t.id === e.modelValue,
89
+ tabindex: "0",
90
+ onClick: (w) => o("update:modelValue", t.id),
91
+ onKeydown: X(Z((w) => o("update:modelValue", t.id), ["prevent"]), ["enter", "space"])
92
+ }, [
93
+ l("span", {
94
+ class: R([
95
+ "debug-result-node-list__status",
96
+ `is-${t.status}`,
97
+ { "is-placeholder": !t.isConfigured }
98
+ ])
99
+ }, [
100
+ t.isConfigured && t.status === "running" ? (c(), D(z, {
101
+ key: 0,
102
+ size: 12
103
+ })) : t.icon ? (c(), p("i", {
104
+ key: 1,
105
+ class: R(t.icon),
106
+ "data-test": "node-icon"
107
+ }, null, 2)) : E("", !0)
108
+ ], 2),
109
+ l("span", {
110
+ class: "debug-result-node-list__name",
111
+ title: t.isConfigured ? `${t.name} ${t.typeName || t.type}` : t.name
112
+ }, M(t.name), 9, me),
113
+ t.isMock ? (c(), p("span", pe, "MOCK")) : E("", !0)
114
+ ], 42, ce))), 128))
115
+ ], 512)) : (c(), p("div", _e, [
116
+ m(oe, {
117
+ "is-search": !1,
118
+ title: V.value,
119
+ onClear: $
120
+ }, null, 8, ["title"])
121
+ ]))
122
+ ]);
123
+ };
124
+ }
125
+ }), be = /* @__PURE__ */ P(ve, [["__scopeId", "data-v-7088d550"]]);
126
+ function ge(a) {
127
+ if (a == null) return "";
128
+ if (typeof a == "string") return a;
129
+ if (typeof a == "object") {
130
+ const u = a, e = u.message;
131
+ if (typeof e == "string" && e) {
132
+ const o = u.type;
133
+ return typeof o == "string" && o ? `${o}: ${e}` : e;
134
+ }
135
+ try {
136
+ return JSON.stringify(a);
137
+ } catch {
138
+ return String(a);
139
+ }
140
+ }
141
+ return String(a);
142
+ }
143
+ const fe = { class: "debug-result-tabs" }, ye = {
144
+ class: "debug-result-tabs__execution",
145
+ "data-test": "tab-execution"
146
+ }, ke = { class: "debug-result-tabs__row" }, we = { class: "value" }, xe = { class: "debug-result-tabs__row" }, he = { class: "value" }, Ce = {
147
+ key: 0,
148
+ class: "debug-result-tabs__row is-error"
149
+ }, Ee = { class: "value" }, Ve = {
150
+ key: 0,
151
+ class: "debug-result-tabs__mock-banner",
152
+ "data-test": "mock-banner"
153
+ }, Se = {
154
+ key: 1,
155
+ class: "debug-result-tabs__error-banner",
156
+ "data-test": "output-error"
157
+ }, Me = {
158
+ key: 0,
159
+ class: "debug-result-tabs__error-text"
160
+ }, Re = { class: "debug-result-tabs__error-guide" }, $e = {
161
+ class: "debug-result-tabs__logs",
162
+ "data-test": "tab-logs"
163
+ }, Ne = /* @__PURE__ */ B({
164
+ __name: "result-tabs",
165
+ props: {
166
+ result: {},
167
+ isMock: { type: Boolean, default: !1 }
168
+ },
169
+ emits: ["reEditMock", "runReal", "runMock"],
170
+ setup(a, { emit: u }) {
171
+ const e = a, o = u, i = C("execution"), n = {
172
+ not_run: "未调试",
173
+ running: "正在调试",
174
+ finished: "成功",
175
+ failed: "失败",
176
+ suspended: "挂起",
177
+ skipped: "跳过"
178
+ }, v = _(() => n[e.result.execution.status] ?? e.result.execution.status), b = _(() => {
179
+ const r = e.result.execution.durationMs;
180
+ return r == null ? "--" : `${(r / 1e3).toFixed(1)}s`;
181
+ }), f = _(() => ge(e.result.error || e.result.execution.errorDetail)), k = _(() => e.result.execution.status === "failed"), x = (r) => Object.entries(r ?? {}).map(([s, t]) => ({ key: s, name: s, value: t })), V = _(() => x(e.result.inputs)), $ = _(() => x(e.result.outputs)), d = _(() => e.result.logs == null ? "" : ue(e.result.logs));
182
+ return (r, s) => {
183
+ const t = N("bk-tab-panel"), w = N("bk-button"), L = N("bk-tab");
184
+ return c(), p("div", fe, [
185
+ m(L, {
186
+ active: i.value,
187
+ "onUpdate:active": s[3] || (s[3] = (S) => i.value = S),
188
+ type: "card-grid"
189
+ }, {
190
+ default: y(() => [
191
+ m(t, {
192
+ name: "execution",
193
+ label: "执行信息"
194
+ }, {
195
+ default: y(() => [
196
+ l("div", ye, [
197
+ l("div", ke, [
198
+ s[4] || (s[4] = l("span", { class: "label" }, "执行状态", -1)),
199
+ l("span", we, M(v.value), 1)
200
+ ]),
201
+ l("div", xe, [
202
+ s[5] || (s[5] = l("span", { class: "label" }, "调试用时", -1)),
203
+ l("span", he, M(b.value), 1)
204
+ ]),
205
+ f.value ? (c(), p("div", Ce, [
206
+ s[6] || (s[6] = l("span", { class: "label" }, "错误信息", -1)),
207
+ l("span", Ee, M(f.value), 1)
208
+ ])) : E("", !0)
209
+ ])
210
+ ]),
211
+ _: 1
212
+ }),
213
+ m(t, {
214
+ name: "inputs",
215
+ label: "输入参数"
216
+ }, {
217
+ default: y(() => [
218
+ m(U, {
219
+ rows: V.value,
220
+ loading: e.result.loading,
221
+ error: e.result.error,
222
+ "empty-text": "暂无输入参数"
223
+ }, null, 8, ["rows", "loading", "error"])
224
+ ]),
225
+ _: 1
226
+ }),
227
+ m(t, {
228
+ name: "outputs",
229
+ label: "输出结果"
230
+ }, {
231
+ default: y(() => [
232
+ e.isMock ? (c(), p("div", Ve, [
233
+ s[8] || (s[8] = l("span", null, "当前为 Mock 数据", -1)),
234
+ m(w, {
235
+ text: "",
236
+ theme: "primary",
237
+ size: "small",
238
+ "data-test": "re-edit-mock",
239
+ onClick: s[0] || (s[0] = (S) => o("reEditMock"))
240
+ }, {
241
+ default: y(() => [...s[7] || (s[7] = [
242
+ T(" 重新编辑 ", -1)
243
+ ])]),
244
+ _: 1
245
+ })
246
+ ])) : E("", !0),
247
+ k.value ? (c(), p("div", Se, [
248
+ f.value ? (c(), p("p", Me, M(f.value), 1)) : E("", !0),
249
+ l("p", Re, [
250
+ s[11] || (s[11] = l("span", null, "该节点调试失败,可", -1)),
251
+ m(w, {
252
+ text: "",
253
+ theme: "primary",
254
+ "data-test": "rerun-real",
255
+ onClick: s[1] || (s[1] = (S) => o("runReal"))
256
+ }, {
257
+ default: y(() => [...s[9] || (s[9] = [
258
+ T("重新调试", -1)
259
+ ])]),
260
+ _: 1
261
+ }),
262
+ s[12] || (s[12] = l("span", null, "或直接", -1)),
263
+ m(w, {
264
+ text: "",
265
+ theme: "primary",
266
+ "data-test": "run-mock",
267
+ onClick: s[2] || (s[2] = (S) => o("runMock"))
268
+ }, {
269
+ default: y(() => [...s[10] || (s[10] = [
270
+ T("Mock 输出", -1)
271
+ ])]),
272
+ _: 1
273
+ })
274
+ ])
275
+ ])) : (c(), D(U, {
276
+ key: 2,
277
+ rows: $.value,
278
+ loading: e.result.loading,
279
+ "empty-text": "暂无输出结果"
280
+ }, null, 8, ["rows", "loading"]))
281
+ ]),
282
+ _: 1
283
+ }),
284
+ m(t, {
285
+ name: "logs",
286
+ label: "调用日志"
287
+ }, {
288
+ default: y(() => [
289
+ l("div", $e, [
290
+ m(ie, {
291
+ "log-text": d.value,
292
+ loading: e.result.loading,
293
+ error: e.result.error
294
+ }, null, 8, ["log-text", "loading", "error"])
295
+ ])
296
+ ]),
297
+ _: 1
298
+ })
299
+ ]),
300
+ _: 1
301
+ }, 8, ["active"])
302
+ ]);
303
+ };
304
+ }
305
+ }), Te = /* @__PURE__ */ P(Ne, [["__scopeId", "data-v-16a27efa"]]), Le = {
306
+ ExclusiveGateway: "bkflow-canvas-fenzhiwangguan",
307
+ ParallelGateway: "bkflow-canvas-bingxingwangguan",
308
+ ConditionalParallelGateway: "bkflow-canvas-tiaojianbingxingwangguan",
309
+ ConvergeGateway: "bkflow-canvas-huijuwangguan"
310
+ }, A = {
311
+ ServiceActivity: "任务节点",
312
+ EmptyStartEvent: "开始节点",
313
+ EmptyEndEvent: "结束节点",
314
+ ExclusiveGateway: "分支网关",
315
+ ParallelGateway: "并行网关",
316
+ ConditionalParallelGateway: "条件并行网关",
317
+ ConvergeGateway: "汇聚网关"
318
+ };
319
+ function Ge(a) {
320
+ if (!a.component?.code) return "";
321
+ if (a.component.code === "uniform_api") {
322
+ const u = a.component.api_meta?.category?.name ?? "";
323
+ return G[u] ?? G.bkflow;
324
+ }
325
+ return G.bkflow;
326
+ }
327
+ function Ae(a, u) {
328
+ const e = a?.location?.find((v) => v.id === u), o = e?.icon ?? "", i = a?.activities?.[u];
329
+ if (i)
330
+ return {
331
+ name: !!i.component?.code ? i.name || e?.name || u : "节点未配置",
332
+ type: i.type || "ServiceActivity",
333
+ typeName: A[i.type] ?? "任务节点",
334
+ icon: Ge(i)
335
+ };
336
+ const n = a?.gateways?.[u];
337
+ return n ? {
338
+ name: n.name || e?.name || A[n.type] || u,
339
+ type: n.type,
340
+ typeName: A[n.type] ?? "网关",
341
+ icon: o || Le[n.type] || ""
342
+ } : a?.start_event?.id === u ? {
343
+ name: a.start_event.name || "开始",
344
+ type: "EmptyStartEvent",
345
+ typeName: "开始节点",
346
+ icon: o || "bkflow-canvas-kaishi"
347
+ } : a?.end_event?.id === u ? {
348
+ name: a.end_event.name || "结束",
349
+ type: "EmptyEndEvent",
350
+ typeName: "结束节点",
351
+ icon: o || "bkflow-canvas-stop"
352
+ } : e ? {
353
+ name: e.name || u,
354
+ type: e.type || "",
355
+ typeName: "",
356
+ icon: o
357
+ } : { name: u, type: "", typeName: "", icon: "" };
358
+ }
359
+ function Be(a, u, e = /* @__PURE__ */ new Set()) {
360
+ const o = a?.activities;
361
+ if (!o) return [];
362
+ const i = new Map((u ?? []).map((n) => [n.node_id, n.status]));
363
+ return Object.values(o).map((n) => {
364
+ const v = !!n.component?.code, b = Ae(a, n.id);
365
+ return {
366
+ id: n.id,
367
+ name: b.name,
368
+ type: b.type || n.type,
369
+ typeName: b.typeName,
370
+ icon: b.icon,
371
+ status: i.get(n.id) ?? "not_run",
372
+ isMock: e.has(n.id),
373
+ isConfigured: v
374
+ };
375
+ });
376
+ }
377
+ const De = { class: "debug-result-drawer__header" }, Pe = { class: "debug-result-drawer__header-left" }, ze = { class: "debug-result-drawer__body" }, Ue = {
378
+ key: 0,
379
+ class: "debug-result-drawer__params",
380
+ "data-test": "params-panel"
381
+ }, Ie = { class: "debug-result-drawer__params-body" }, Fe = { class: "debug-result-drawer__content" }, Oe = { class: "debug-result-drawer__result" }, je = 44, He = /* @__PURE__ */ B({
382
+ __name: "index",
383
+ props: {
384
+ open: { type: Boolean },
385
+ context: {},
386
+ pipelineTree: {},
387
+ mockNodeIds: {},
388
+ modelValue: { default: "" },
389
+ result: {},
390
+ hasGlobalRun: { type: Boolean, default: !1 },
391
+ globalInputs: { default: () => ({}) }
392
+ },
393
+ emits: ["update:open", "update:modelValue", "reEditMock", "runReal", "runMock"],
394
+ setup(a, { emit: u }) {
395
+ const e = a, o = u, i = C(!1), n = i, v = C(420), b = C(!1);
396
+ let f = 0, k = 0, x = "", V = "";
397
+ const $ = _(() => ({
398
+ height: `${e.open ? v.value : je}px`
399
+ })), d = () => {
400
+ o("update:open", !e.open);
401
+ }, r = (h) => {
402
+ const g = k - (h.clientY - f);
403
+ v.value = Math.max(200, Math.min(window.innerHeight * 0.8, g));
404
+ }, s = () => {
405
+ document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", s), document.body.style.cursor = x, document.body.style.userSelect = V, b.value = !1;
406
+ }, t = (h) => {
407
+ h.preventDefault(), b.value = !0, f = h.clientY, k = v.value, x = document.body.style.cursor, V = document.body.style.userSelect, document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", r), document.addEventListener("mouseup", s);
408
+ };
409
+ ee(s);
410
+ const w = _({
411
+ get: () => e.modelValue,
412
+ set: (h) => o("update:modelValue", h)
413
+ }), L = _(
414
+ () => Be(e.pipelineTree, e.context?.nodes, e.mockNodeIds)
415
+ ), S = _(() => e.mockNodeIds.has(e.modelValue)), I = () => {
416
+ e.hasGlobalRun && (i.value = !i.value);
417
+ }, F = () => {
418
+ e.modelValue && o("reEditMock", e.modelValue);
419
+ }, O = () => {
420
+ e.modelValue && o("runReal", e.modelValue);
421
+ }, j = () => {
422
+ e.modelValue && o("runMock", e.modelValue);
423
+ };
424
+ return (h, g) => {
425
+ const H = N("bk-button"), Y = te("bk-tooltips");
426
+ return c(), p("div", {
427
+ class: R(["debug-result-drawer-wrapper", { "is-resizing": b.value }]),
428
+ style: se($.value)
429
+ }, [
430
+ e.open ? (c(), p("div", {
431
+ key: 0,
432
+ class: "debug-result-drawer__resize",
433
+ onMousedown: t
434
+ }, null, 32)) : E("", !0),
435
+ l("section", {
436
+ class: R(["debug-result-drawer", { "is-collapsed": !e.open }])
437
+ }, [
438
+ l("header", De, [
439
+ l("div", Pe, [
440
+ g[2] || (g[2] = l("span", { class: "debug-result-drawer__title" }, "调试结果", -1)),
441
+ g[3] || (g[3] = l("span", { class: "debug-result-drawer__divider" }, null, -1)),
442
+ ae((c(), D(H, {
443
+ text: "",
444
+ theme: "primary",
445
+ "data-test": "view-params",
446
+ disabled: !e.hasGlobalRun,
447
+ onClick: I
448
+ }, {
449
+ default: y(() => [...g[1] || (g[1] = [
450
+ T(" 查看参数 ", -1)
451
+ ])]),
452
+ _: 1
453
+ }, 8, ["disabled"])), [
454
+ [Y, { content: "请先进行调试", disabled: e.hasGlobalRun }]
455
+ ])
456
+ ]),
457
+ l("span", {
458
+ class: "debug-result-drawer__collapse",
459
+ onClick: d
460
+ }, [
461
+ l("span", null, M(e.open ? "收起" : "展开"), 1),
462
+ l("i", {
463
+ class: R(["bkflow-canvas-icon bkflow-canvas-arrows-down debug-result-drawer__collapse-icon", { "is-expanded": e.open }])
464
+ }, null, 2)
465
+ ])
466
+ ]),
467
+ l("div", ze, [
468
+ ne(n) ? (c(), p("div", Ue, [
469
+ g[4] || (g[4] = l("div", { class: "debug-result-drawer__params-title" }, "本次调试输入参数", -1)),
470
+ l("div", Ie, [
471
+ m(re, {
472
+ value: e.globalInputs ?? {},
473
+ "default-expanded": !0
474
+ }, null, 8, ["value"])
475
+ ])
476
+ ])) : E("", !0),
477
+ l("div", Fe, [
478
+ m(be, {
479
+ modelValue: w.value,
480
+ "onUpdate:modelValue": g[0] || (g[0] = (K) => w.value = K),
481
+ nodes: L.value
482
+ }, null, 8, ["modelValue", "nodes"]),
483
+ l("div", Oe, [
484
+ m(Te, {
485
+ result: e.result,
486
+ "is-mock": S.value,
487
+ onReEditMock: F,
488
+ onRunReal: O,
489
+ onRunMock: j
490
+ }, null, 8, ["result", "is-mock"])
491
+ ])
492
+ ])
493
+ ])
494
+ ], 2)
495
+ ], 6);
496
+ };
497
+ }
498
+ }), Je = /* @__PURE__ */ P(He, [["__scopeId", "data-v-a977e91c"]]);
499
+ export {
500
+ Je as default
501
+ };