@blueking/bkflow-canvas-editor 1.1.0-beta.9 → 1.2.0-beta.0

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.
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),B=require("bkui-vue/lib"),N=require("bkui-vue/lib/message"),E=require("lodash"),r=require("./index-DY8COtuZ.cjs"),F={key:0,class:"mock-data-sideslider__title-sep"},M=["title"],q={class:"mock-data-sideslider"},j={class:"mock-data-sideslider__footer"},D=e.defineComponent({__name:"index",props:{show:{type:Boolean},node:{default:null},outputs:{default:()=>({})},pending:{type:Boolean,default:!1}},emits:["confirm","close","update:show"],setup(v,{emit:f}){const t=v,p=f,y=r.useFlowApiConfig(),m=e.ref(!1),d=e.shallowRef([]),u=e.ref({}),k=e.ref({}),h=async()=>{if(t.node){m.value=!0,k.value={};try{const n=await r.pluginDetailRequest(y,t.node.component);d.value=r.mergeOutputs(n.outputs??[]);const o=t.outputs??{},s={};d.value.forEach(l=>{const c=Object.prototype.hasOwnProperty.call(o,l.key)?o[l.key]:l.type==="object"?{}:void 0,a=r.resolveMockFormControl(l);s[l.key]=a==="json-editor"||a==="data-table"?r.formatJsonFieldValue(c):c}),u.value=s}catch(n){console.error(n),d.value=[],u.value={},N({theme:"error",message:"加载输出参数失败"})}finally{m.value=!1}}},b=()=>{const n={},o={};return d.value.forEach(s=>{const l=u.value[s.key],c=r.resolveMockFormControl(s);if(c==="json-editor"||c==="data-table"){const a=r.parseJsonFieldValue(l);if(!a.valid){n[s.key]=a.message;return}a.value!==void 0&&(o[s.key]=a.value);return}l!==void 0&&l!==""&&(o[s.key]=l)}),{errors:n,outputs:o}},w=n=>{B.InfoBox({title:"确认 Mock 输出?",content:"Mock 输出将覆盖当前输出参数,执行时跳过该节点并以 Mock 值替代实际输出",confirmText:"确定",cancelText:"取消",width:400,onConfirm:()=>{n()}})},C=()=>{const{errors:n,outputs:o}=b();k.value=n,!(Object.keys(n).length>0)&&w(()=>p("confirm",{outputs:o}))},_=()=>{p("close"),p("update:show",!1)};return e.watch(()=>[t.show,t.node?.id],([n])=>{n&&t.node&&(u.value=E.cloneDeep(t.outputs??{}),h())},{immediate:!0}),(n,o)=>{const s=e.resolveComponent("bk-form-item"),l=e.resolveComponent("bk-form"),c=e.resolveComponent("bk-exception"),a=e.resolveComponent("bk-button"),g=e.resolveComponent("bk-sideslider"),x=e.resolveDirective("bkloading");return e.openBlock(),e.createBlock(g,{"is-show":t.show,width:640,"quick-close":"","esc-close":!1,onClosed:_},{header:e.withCtx(()=>[o[0]||(o[0]=e.createElementVNode("span",{class:"mock-data-sideslider__title"},"Mock输出",-1)),t.node?.name?(e.openBlock(),e.createElementBlock("span",F,"-")):e.createCommentVNode("",!0),t.node?.name?(e.openBlock(),e.createElementBlock("span",{key:1,class:"mock-data-sideslider__title-node",title:t.node.name},e.toDisplayString(t.node.name),9,M)):e.createCommentVNode("",!0)]),footer:e.withCtx(()=>[e.createElementVNode("div",j,[e.createVNode(a,{theme:"primary","data-test":"mock-confirm",loading:t.pending,onClick:C},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode(" 确定 ",-1)])]),_:1},8,["loading"]),e.createVNode(a,{disabled:t.pending,onClick:_},{default:e.withCtx(()=>[...o[2]||(o[2]=[e.createTextVNode("取消",-1)])]),_:1},8,["disabled"])])]),default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createElementBlock("div",q,[d.value.length>0?(e.openBlock(),e.createBlock(l,{key:0,"form-type":"vertical","label-width":120,"data-test":"mock-outputs-form"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,i=>(e.openBlock(),e.createBlock(s,{key:i.key,label:i.name||i.key},{default:e.withCtx(()=>[e.createVNode(r.MockFieldRenderer,{modelValue:u.value[i.key],"onUpdate:modelValue":V=>u.value[i.key]=V,field:i,error:k.value[i.key]},null,8,["modelValue","onUpdate:modelValue","field","error"])]),_:2},1032,["label"]))),128))]),_:1})):m.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(c,{key:1,class:"mock-data-sideslider__exception",scene:"part",type:"empty",title:"暂无输出参数"}))])),[[x,{loading:m.value}]])]),_:1},8,["is-show"])}}}),O=r._export_sfc(D,[["__scopeId","data-v-bccecd7f"]]);exports.default=O;
@@ -1,159 +0,0 @@
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 k, withCtx as i, withDirectives as U, createElementBlock as _, 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-Dl8vD9_A.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, f = F, M = G(), p = y(!1), d = q([]), u = y({}), v = y({}), B = async () => {
20
- if (o.node) {
21
- p.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
- p.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();
60
- }
61
- });
62
- }, E = () => {
63
- const { errors: t, outputs: e } = D();
64
- v.value = t, !(Object.keys(t).length > 0) && j(() => f("confirm", { outputs: e }));
65
- }, g = () => {
66
- f("close"), f("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(), k(N, {
77
- "is-show": o.show,
78
- width: 640,
79
- "quick-close": "",
80
- "esc-close": !1,
81
- onClosed: g
82
- }, {
83
- header: i(() => [
84
- e[0] || (e[0] = w("span", { class: "mock-data-sideslider__title" }, "Mock输出", -1)),
85
- o.node?.name ? (l(), _("span", $, "-")) : h("", !0),
86
- o.node?.name ? (l(), _("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: i(() => [
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: i(() => [...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: i(() => [...e[2] || (e[2] = [
110
- V("取消", -1)
111
- ])]),
112
- _: 1
113
- }, 8, ["disabled"])
114
- ])
115
- ]),
116
- default: i(() => [
117
- U((l(), _("div", oe, [
118
- d.value.length > 0 ? (l(), k(s, {
119
- key: 0,
120
- "form-type": "vertical",
121
- "label-width": 120,
122
- "data-test": "mock-outputs-form"
123
- }, {
124
- default: i(() => [
125
- (l(!0), _(z, null, A(d.value, (c) => (l(), k(a, {
126
- key: c.key,
127
- label: c.name || c.key
128
- }, {
129
- default: i(() => [
130
- b(H, {
131
- modelValue: u.value[c.key],
132
- "onUpdate:modelValue": (R) => u.value[c.key] = R,
133
- field: c,
134
- error: v.value[c.key]
135
- }, null, 8, ["modelValue", "onUpdate:modelValue", "field", "error"])
136
- ]),
137
- _: 2
138
- }, 1032, ["label"]))), 128))
139
- ]),
140
- _: 1
141
- })) : p.value ? h("", !0) : (l(), k(r, {
142
- key: 1,
143
- class: "mock-data-sideslider__exception",
144
- scene: "part",
145
- type: "empty",
146
- title: "暂无输出参数"
147
- }))
148
- ])), [
149
- [O, { loading: p.value }]
150
- ])
151
- ]),
152
- _: 1
153
- }, 8, ["is-show"]);
154
- };
155
- }
156
- }), ie = /* @__PURE__ */ Z(se, [["__scopeId", "data-v-bccecd7f"]]);
157
- export {
158
- ie as default
159
- };