@blueking/bkflow-canvas-editor 1.1.0-beta.1 → 1.1.0-beta.11
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 +242 -44
- package/dist/advanced.cjs.js +1 -1
- package/dist/advanced.d.ts +366 -39
- package/dist/advanced.esm.js +1 -1
- 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-CxeoRvet.cjs +1 -0
- package/dist/{composable-QLQKeBKC.js → composable-kbjnTzFy.js} +377 -144
- package/dist/index-BAyKjume.js +184 -0
- package/dist/index-BDjgQxXH.cjs +1 -0
- package/dist/index-CCwVVpg5.js +47175 -0
- package/dist/index-DNOsjdMW.js +517 -0
- package/dist/index-DTNdhHD2.cjs +1 -0
- package/dist/index-DcCa3dC3.cjs +70 -0
- package/dist/index-DtEEErOZ.js +159 -0
- package/dist/index-Dw82RceW.cjs +1 -0
- package/dist/index.cjs.js +1 -70
- package/dist/index.d.ts +792 -152
- package/dist/index.esm.js +38 -43048
- package/dist/style.css +1 -1
- package/dist/style.d.ts +2 -0
- package/package.json +18 -7
- package/dist/composable-CNiwlaFl.cjs +0 -1
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { defineComponent as $, ref as _, shallowRef as h, computed as V, watch as A, resolveComponent as C, resolveDirective as O, openBlock as c, createBlock as d, createSlots as P, withCtx as m, withDirectives as U, createElementBlock as K, createElementVNode as F, unref as G, createCommentVNode as g, createVNode as x, createTextVNode as B } from "vue";
|
|
2
|
+
import { cloneDeep as p } from "lodash";
|
|
3
|
+
import { u as H, i as S, g as Y, B as z, R as J, E as M, _ as Q } from "./index-CCwVVpg5.js";
|
|
4
|
+
import "bkui-vue/lib/message";
|
|
5
|
+
import "bkui-vue/lib/icon";
|
|
6
|
+
import "monaco-editor";
|
|
7
|
+
const W = {
|
|
8
|
+
string: "input",
|
|
9
|
+
text: "input",
|
|
10
|
+
textarea: "textarea",
|
|
11
|
+
int: "input",
|
|
12
|
+
integer: "input",
|
|
13
|
+
number: "input",
|
|
14
|
+
float: "input",
|
|
15
|
+
json: "json",
|
|
16
|
+
object: "json",
|
|
17
|
+
array: "array",
|
|
18
|
+
list: "array",
|
|
19
|
+
select: "select",
|
|
20
|
+
time: "timepicker",
|
|
21
|
+
datetime: "timepicker"
|
|
22
|
+
}, j = (e) => e.replace(/^\$\{(.+)\}$/, "$1"), E = (e) => `\${${j(e)}}`;
|
|
23
|
+
function X(e, r) {
|
|
24
|
+
const o = E(e.key), t = r ? p(r) : {}, i = e.custom_type ?? t.custom_type ?? W[e.type] ?? "input";
|
|
25
|
+
return {
|
|
26
|
+
...t,
|
|
27
|
+
key: o,
|
|
28
|
+
name: e.name ?? t.name ?? j(e.key),
|
|
29
|
+
custom_type: i,
|
|
30
|
+
desc: t.desc ?? "",
|
|
31
|
+
index: t.index ?? 0,
|
|
32
|
+
show_type: "show",
|
|
33
|
+
source_info: t.source_info ?? {},
|
|
34
|
+
source_tag: t.source_tag ?? "",
|
|
35
|
+
source_type: t.source_type ?? "custom",
|
|
36
|
+
validation: t.validation ?? "",
|
|
37
|
+
value: e.default ?? t.value,
|
|
38
|
+
meta: {
|
|
39
|
+
...t.meta ?? {},
|
|
40
|
+
required: e.required ?? t.meta?.required ?? !1
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function Z(e, r = {}) {
|
|
45
|
+
if (!e) return {};
|
|
46
|
+
const o = e.constants;
|
|
47
|
+
return o && Object.keys(o).length > 0 ? { ...o } : Array.isArray(e.fields) && e.fields.length > 0 ? e.fields.reduce((t, i) => {
|
|
48
|
+
const n = E(i.key);
|
|
49
|
+
return t[n] = X(i, r[n]), t;
|
|
50
|
+
}, {}) : {};
|
|
51
|
+
}
|
|
52
|
+
const ee = { class: "global-debug-input" }, te = { class: "form-params-wrapper" }, oe = { class: "sideslider-footer-buttons" }, ae = /* @__PURE__ */ $({
|
|
53
|
+
__name: "index",
|
|
54
|
+
props: {
|
|
55
|
+
show: { type: Boolean },
|
|
56
|
+
schema: {},
|
|
57
|
+
pipelineConstants: { default: () => ({}) },
|
|
58
|
+
initialValues: { default: () => ({}) },
|
|
59
|
+
pending: { type: Boolean, default: !1 },
|
|
60
|
+
readonly: { type: Boolean, default: !1 }
|
|
61
|
+
},
|
|
62
|
+
emits: ["confirm", "close", "update:show"],
|
|
63
|
+
setup(e, { emit: r }) {
|
|
64
|
+
const o = e, t = r, i = H(), n = _({}), k = h([]), u = h([]), f = h(!1), v = _(), y = _(), b = V(() => k.value.filter((a) => S(a))), R = V(() => b.value.length > 0 || u.value.length > 0);
|
|
65
|
+
A(
|
|
66
|
+
() => o.show,
|
|
67
|
+
(a) => {
|
|
68
|
+
a && (n.value = p(o.initialValues ?? {}), D());
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
const D = async () => {
|
|
72
|
+
const a = Z(o.schema, o.pipelineConstants), s = Object.values(a).filter(
|
|
73
|
+
(l) => typeof l == "object" && l !== null && l.show_type === "show"
|
|
74
|
+
);
|
|
75
|
+
if (k.value = s, Object.keys(a).length < 1) {
|
|
76
|
+
u.value = [];
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
f.value = !0;
|
|
80
|
+
try {
|
|
81
|
+
u.value = await Y(i, a);
|
|
82
|
+
} catch (l) {
|
|
83
|
+
console.error("Failed to build debug input forms from schema:", l), u.value = [];
|
|
84
|
+
} finally {
|
|
85
|
+
f.value = !1;
|
|
86
|
+
}
|
|
87
|
+
}, I = (a) => {
|
|
88
|
+
n.value = { ...n.value, ...p(a) };
|
|
89
|
+
}, L = async () => {
|
|
90
|
+
const [a, s] = await Promise.all([
|
|
91
|
+
Promise.resolve(
|
|
92
|
+
typeof y.value?.validate == "function" ? y.value.validate() : !0
|
|
93
|
+
),
|
|
94
|
+
Promise.resolve(typeof v.value?.validate == "function" ? v.value.validate() : !0)
|
|
95
|
+
]);
|
|
96
|
+
!a || !s || t("confirm", p(n.value));
|
|
97
|
+
}, w = () => {
|
|
98
|
+
t("close"), t("update:show", !1);
|
|
99
|
+
};
|
|
100
|
+
return (a, s) => {
|
|
101
|
+
const l = C("bk-button"), q = C("bk-sideslider"), N = O("bkloading");
|
|
102
|
+
return c(), d(q, {
|
|
103
|
+
title: "调试参数",
|
|
104
|
+
"is-show": o.show,
|
|
105
|
+
width: 700,
|
|
106
|
+
"quick-close": !0,
|
|
107
|
+
"esc-close": !1,
|
|
108
|
+
onClosed: w
|
|
109
|
+
}, P({
|
|
110
|
+
default: m(() => [
|
|
111
|
+
U((c(), K("div", ee, [
|
|
112
|
+
F("div", te, [
|
|
113
|
+
b.value.length > 0 ? (c(), d(G(z), {
|
|
114
|
+
key: 0,
|
|
115
|
+
ref_key: "builtinVariableFormRef",
|
|
116
|
+
ref: y,
|
|
117
|
+
modelValue: n.value,
|
|
118
|
+
"onUpdate:modelValue": s[0] || (s[0] = (T) => n.value = T),
|
|
119
|
+
variables: b.value,
|
|
120
|
+
editable: !o.readonly
|
|
121
|
+
}, null, 8, ["modelValue", "variables", "editable"])) : g("", !0),
|
|
122
|
+
u.value.length > 0 ? (c(), d(J, {
|
|
123
|
+
key: 1,
|
|
124
|
+
ref_key: "renderFormRef",
|
|
125
|
+
ref: v,
|
|
126
|
+
scheme: u.value,
|
|
127
|
+
editable: !o.readonly,
|
|
128
|
+
"form-option": {
|
|
129
|
+
showRequired: !0,
|
|
130
|
+
showGroup: !0,
|
|
131
|
+
showLabel: !1,
|
|
132
|
+
showHook: !1,
|
|
133
|
+
showDesc: !0,
|
|
134
|
+
formEdit: !o.readonly
|
|
135
|
+
},
|
|
136
|
+
"form-data": n.value,
|
|
137
|
+
onChange: I
|
|
138
|
+
}, null, 8, ["scheme", "editable", "form-option", "form-data"])) : g("", !0),
|
|
139
|
+
R.value ? g("", !0) : (c(), d(M, {
|
|
140
|
+
key: 2,
|
|
141
|
+
title: "暂无参数"
|
|
142
|
+
}))
|
|
143
|
+
])
|
|
144
|
+
])), [
|
|
145
|
+
[N, { loading: f.value }]
|
|
146
|
+
])
|
|
147
|
+
]),
|
|
148
|
+
_: 2
|
|
149
|
+
}, [
|
|
150
|
+
o.readonly ? void 0 : {
|
|
151
|
+
name: "footer",
|
|
152
|
+
fn: m(() => [
|
|
153
|
+
F("div", oe, [
|
|
154
|
+
x(l, {
|
|
155
|
+
theme: "primary",
|
|
156
|
+
"data-test": "save-and-run",
|
|
157
|
+
loading: o.pending,
|
|
158
|
+
onClick: L
|
|
159
|
+
}, {
|
|
160
|
+
default: m(() => [...s[1] || (s[1] = [
|
|
161
|
+
B(" 保存并执行 ", -1)
|
|
162
|
+
])]),
|
|
163
|
+
_: 1
|
|
164
|
+
}, 8, ["loading"]),
|
|
165
|
+
x(l, {
|
|
166
|
+
disabled: o.pending,
|
|
167
|
+
onClick: w
|
|
168
|
+
}, {
|
|
169
|
+
default: m(() => [...s[2] || (s[2] = [
|
|
170
|
+
B("取消", -1)
|
|
171
|
+
])]),
|
|
172
|
+
_: 1
|
|
173
|
+
}, 8, ["disabled"])
|
|
174
|
+
])
|
|
175
|
+
]),
|
|
176
|
+
key: "0"
|
|
177
|
+
}
|
|
178
|
+
]), 1032, ["is-show"]);
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}), ce = /* @__PURE__ */ Q(ae, [["__scopeId", "data-v-767dae0e"]]);
|
|
182
|
+
export {
|
|
183
|
+
ce as default
|
|
184
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),p=require("lodash"),i=require("./index-DcCa3dC3.cjs");require("bkui-vue/lib/message");require("bkui-vue/lib/icon");require("monaco-editor");const q={string:"input",text:"input",textarea:"textarea",int:"input",integer:"input",number:"input",float:"input",json:"json",object:"json",array:"array",list:"array",select:"select",time:"timepicker",datetime:"timepicker"},_=t=>t.replace(/^\$\{(.+)\}$/,"$1"),k=t=>`\${${_(t)}}`;function D(t,u){const a=k(t.key),o=u?p.cloneDeep(u):{},c=t.custom_type??o.custom_type??q[t.type]??"input";return{...o,key:a,name:t.name??o.name??_(t.key),custom_type:c,desc:o.desc??"",index:o.index??0,show_type:"show",source_info:o.source_info??{},source_tag:o.source_tag??"",source_type:o.source_type??"custom",validation:o.validation??"",value:t.default??o.value,meta:{...o.meta??{},required:t.required??o.meta?.required??!1}}}function N(t,u={}){if(!t)return{};const a=t.constants;return a&&Object.keys(a).length>0?{...a}:Array.isArray(t.fields)&&t.fields.length>0?t.fields.reduce((o,c)=>{const l=k(c.key);return o[l]=D(c,u[l]),o},{}):{}}const j={class:"global-debug-input"},R={class:"form-params-wrapper"},E={class:"sideslider-footer-buttons"},T=e.defineComponent({__name:"index",props:{show:{type:Boolean},schema:{},pipelineConstants:{default:()=>({})},initialValues:{default:()=>({})},pending:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1}},emits:["confirm","close","update:show"],setup(t,{emit:u}){const a=t,o=u,c=i.useFlowApiConfig(),l=e.ref({}),b=e.shallowRef([]),d=e.shallowRef([]),m=e.shallowRef(!1),f=e.ref(),v=e.ref(),y=e.computed(()=>b.value.filter(n=>i.isBuiltinUsageVariable(n))),g=e.computed(()=>y.value.length>0||d.value.length>0);e.watch(()=>a.show,n=>{n&&(l.value=p.cloneDeep(a.initialValues??{}),w())});const w=async()=>{const n=N(a.schema,a.pipelineConstants),s=Object.values(n).filter(r=>typeof r=="object"&&r!==null&&r.show_type==="show");if(b.value=s,Object.keys(n).length<1){d.value=[];return}m.value=!0;try{d.value=await i.getInputFormsFromConstants(c,n)}catch(r){console.error("Failed to build debug input forms from schema:",r),d.value=[]}finally{m.value=!1}},V=n=>{l.value={...l.value,...p.cloneDeep(n)}},C=async()=>{const[n,s]=await Promise.all([Promise.resolve(typeof v.value?.validate=="function"?v.value.validate():!0),Promise.resolve(typeof f.value?.validate=="function"?f.value.validate():!0)]);!n||!s||o("confirm",p.cloneDeep(l.value))},h=()=>{o("close"),o("update:show",!1)};return(n,s)=>{const r=e.resolveComponent("bk-button"),x=e.resolveComponent("bk-sideslider"),B=e.resolveDirective("bkloading");return e.openBlock(),e.createBlock(x,{title:"调试参数","is-show":a.show,width:700,"quick-close":!0,"esc-close":!1,onClosed:h},e.createSlots({default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createElementBlock("div",j,[e.createElementVNode("div",R,[y.value.length>0?(e.openBlock(),e.createBlock(e.unref(i.BuiltinVariableUsageForm),{key:0,ref_key:"builtinVariableFormRef",ref:v,modelValue:l.value,"onUpdate:modelValue":s[0]||(s[0]=F=>l.value=F),variables:y.value,editable:!a.readonly},null,8,["modelValue","variables","editable"])):e.createCommentVNode("",!0),d.value.length>0?(e.openBlock(),e.createBlock(i.RenderForm,{key:1,ref_key:"renderFormRef",ref:f,scheme:d.value,editable:!a.readonly,"form-option":{showRequired:!0,showGroup:!0,showLabel:!1,showHook:!1,showDesc:!0,formEdit:!a.readonly},"form-data":l.value,onChange:V},null,8,["scheme","editable","form-option","form-data"])):e.createCommentVNode("",!0),g.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(i.EmptyException,{key:2,title:"暂无参数"}))])])),[[B,{loading:m.value}]])]),_:2},[a.readonly?void 0:{name:"footer",fn:e.withCtx(()=>[e.createElementVNode("div",E,[e.createVNode(r,{theme:"primary","data-test":"save-and-run",loading:a.pending,onClick:C},{default:e.withCtx(()=>[...s[1]||(s[1]=[e.createTextVNode(" 保存并执行 ",-1)])]),_:1},8,["loading"]),e.createVNode(r,{disabled:a.pending,onClick:h},{default:e.withCtx(()=>[...s[2]||(s[2]=[e.createTextVNode("取消",-1)])]),_:1},8,["disabled"])])]),key:"0"}]),1032,["is-show"])}}}),I=i._export_sfc(T,[["__scopeId","data-v-767dae0e"]]);exports.default=I;
|