@opentiny/tiny-engine-plugin-bridge 1.0.1
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/index.js +643 -0
- package/dist/style.css +1 -0
- package/package.json +27 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,643 @@
|
|
|
1
|
+
import "./style.css";
|
|
2
|
+
import { reactive as z, ref as C, watchEffect as Q, resolveComponent as l, openBlock as v, createElementBlock as U, createElementVNode as h, createVNode as o, Fragment as se, renderList as re, normalizeClass as ce, withModifiers as j, toDisplayString as B, createCommentVNode as b, pushScopeId as X, popScopeId as Z, computed as V, watch as le, onMounted as ie, createBlock as R, withCtx as c, withDirectives as de, vShow as pe, createTextVNode as F, nextTick as ue } from "vue";
|
|
3
|
+
import { Search as me, Form as _e, Input as ge, Button as ye, FormItem as fe, Checkbox as ve, Switch as he, Tooltip as Ee, RadioGroup as Re, Radio as be, Tabs as Ce, TabItem as Te } from "@opentiny/vue";
|
|
4
|
+
import { PluginSetting as Ve, VueMonaco as Se, SvgButton as $, PluginPanel as Ue } from "@opentiny/tiny-engine-common";
|
|
5
|
+
import { isVsCodeEnv as ee } from "@opentiny/tiny-engine-common/js/environments";
|
|
6
|
+
import { useApp as T, useResource as k, useNotify as I, useModal as ke, getGlobalConfig as Ie } from "@opentiny/tiny-engine-controller";
|
|
7
|
+
import { setUtils as xe } from "@opentiny/tiny-engine-canvas";
|
|
8
|
+
import { useHttp as we } from "@opentiny/tiny-engine-http";
|
|
9
|
+
import { generateBridge as Ne, generateUtil as Oe } from "@opentiny/tiny-engine-common/js/vscodeGenerateFile";
|
|
10
|
+
import { iconUnknow as Be } from "@opentiny/vue-icon";
|
|
11
|
+
import { theme as Le } from "@opentiny/tiny-engine-controller/adapter";
|
|
12
|
+
const w = we(), Pe = (t, n) => w.get(`/app-center/api/apps/extension/list?app=${t}&category=${n}`), Fe = (t) => w.post("/app-center/api/apps/extension/create", t), Ae = (t) => w.post("/app-center/api/apps/extension/update", t), Ye = (t) => w.get(`/app-center/api/apps/extension/delete?${t}`), De = (t) => {
|
|
13
|
+
w.get(`/app-center/api/apps/schema/${t}`).then((n) => {
|
|
14
|
+
Ne(n.bridge), Oe(n.utils);
|
|
15
|
+
});
|
|
16
|
+
}, i = z({
|
|
17
|
+
actionType: "",
|
|
18
|
+
type: "",
|
|
19
|
+
category: "",
|
|
20
|
+
resource: {},
|
|
21
|
+
resources: [],
|
|
22
|
+
resourceNames: {},
|
|
23
|
+
refresh: !1,
|
|
24
|
+
id: T().appInfoState.selectedId
|
|
25
|
+
}), W = {
|
|
26
|
+
name: "",
|
|
27
|
+
type: "npm",
|
|
28
|
+
content: {
|
|
29
|
+
package: "",
|
|
30
|
+
version: "",
|
|
31
|
+
exportName: "",
|
|
32
|
+
subName: "",
|
|
33
|
+
destructuring: !0,
|
|
34
|
+
main: ""
|
|
35
|
+
}
|
|
36
|
+
}, Ge = {
|
|
37
|
+
name: "",
|
|
38
|
+
type: "function",
|
|
39
|
+
content: {
|
|
40
|
+
type: "JSFunction",
|
|
41
|
+
value: ""
|
|
42
|
+
}
|
|
43
|
+
}, E = {
|
|
44
|
+
Util: "utils",
|
|
45
|
+
Bridge: "bridge"
|
|
46
|
+
}, L = {
|
|
47
|
+
Npm: "npm",
|
|
48
|
+
Function: "function"
|
|
49
|
+
}, Me = {
|
|
50
|
+
[E.Util]: "新建工具类",
|
|
51
|
+
[E.Bridge]: "新建桥接源"
|
|
52
|
+
}, x = {
|
|
53
|
+
Read: "read",
|
|
54
|
+
Edit: "edit"
|
|
55
|
+
}, qe = (t) => i.resourceNames[t], ze = (t, n) => {
|
|
56
|
+
i.resourceNames[t] = n;
|
|
57
|
+
}, He = (t) => {
|
|
58
|
+
const n = T().appInfoState.selectedId;
|
|
59
|
+
return Pe(n, t);
|
|
60
|
+
}, D = () => i.actionType, A = (t) => {
|
|
61
|
+
i.actionType = t;
|
|
62
|
+
}, Je = () => i.resource, Y = (t = W) => {
|
|
63
|
+
t || (t = i.category === L.Function ? Ge : W), i.resource = t;
|
|
64
|
+
}, P = () => i.type, G = (t) => {
|
|
65
|
+
i.type = t;
|
|
66
|
+
}, M = (t) => {
|
|
67
|
+
i.category = t;
|
|
68
|
+
}, K = () => i.category, q = (...t) => {
|
|
69
|
+
ee && De(...t);
|
|
70
|
+
}, je = (t, n, d) => {
|
|
71
|
+
D() === x.Edit ? (t.id = i.resource.id, Ae(t).then((e) => {
|
|
72
|
+
if (e) {
|
|
73
|
+
const r = k().resState[t.category].findIndex((m) => m.name === e.name);
|
|
74
|
+
k().resState[t.category][r] = e, xe([e], !1, !0), q(T().appInfoState.selectedId), I({
|
|
75
|
+
type: "success",
|
|
76
|
+
message: "修改成功"
|
|
77
|
+
}), d("refresh", i.type), i.refresh = !0, n();
|
|
78
|
+
}
|
|
79
|
+
})) : Fe(t).then((e) => {
|
|
80
|
+
e && (k().resState[t.category].push(e), q(T().appInfoState.selectedId), I({
|
|
81
|
+
type: "success",
|
|
82
|
+
message: "创建成功"
|
|
83
|
+
}), d("refresh", i.type), i.refresh = !0, n());
|
|
84
|
+
});
|
|
85
|
+
}, We = (t, n, d) => {
|
|
86
|
+
var r;
|
|
87
|
+
const e = `app=${T().appInfoState.selectedId}&id=${(r = i.resource) == null ? void 0 : r.id}`;
|
|
88
|
+
Ye(e).then((m) => {
|
|
89
|
+
if (m) {
|
|
90
|
+
const y = k().resState[i.type].findIndex((f) => f.name === m.name);
|
|
91
|
+
k().resState[i.type].splice(y, 1), q(T().appInfoState.selectedId), I({
|
|
92
|
+
type: "success",
|
|
93
|
+
message: "删除成功"
|
|
94
|
+
}), d("refresh", i.type), i.refresh = !0, n();
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
const H = (t, n) => {
|
|
99
|
+
const d = t.__vccOpts || t;
|
|
100
|
+
for (const [e, r] of n)
|
|
101
|
+
d[e] = r;
|
|
102
|
+
return d;
|
|
103
|
+
}, Ke = {
|
|
104
|
+
components: {
|
|
105
|
+
TinySearch: me
|
|
106
|
+
},
|
|
107
|
+
props: {
|
|
108
|
+
name: {
|
|
109
|
+
type: String,
|
|
110
|
+
default: E.Util
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
emits: ["open"],
|
|
114
|
+
setup(t, { emit: n }) {
|
|
115
|
+
const d = C([]), e = z({
|
|
116
|
+
resourceList: [],
|
|
117
|
+
activeIndex: -1,
|
|
118
|
+
searchValue: ""
|
|
119
|
+
}), r = (s = e.resourceList, a = e.searchValue) => s.filter((g) => g.name.toLowerCase().indexOf(a.toLowerCase()) > -1), m = async (s) => {
|
|
120
|
+
e.resourceList = await He(s), ze(
|
|
121
|
+
s,
|
|
122
|
+
Array.isArray(e.resourceList) ? e.resourceList.map((a) => a.name) : []
|
|
123
|
+
), d.value = r(e.resourceList);
|
|
124
|
+
};
|
|
125
|
+
return Q(async () => {
|
|
126
|
+
m(t.name);
|
|
127
|
+
}), {
|
|
128
|
+
state: e,
|
|
129
|
+
list: d,
|
|
130
|
+
add: (s) => {
|
|
131
|
+
A(""), G(t.name), Y(""), M(s), n("open");
|
|
132
|
+
},
|
|
133
|
+
openRead: (s, a) => {
|
|
134
|
+
e.activeIndex = a, Y(s), A(x.Edit), n("open");
|
|
135
|
+
},
|
|
136
|
+
openEdit: (s, a) => {
|
|
137
|
+
e.activeIndex = a, Y(s), A(x.Edit), G(t.name), M(s.type), n("open");
|
|
138
|
+
},
|
|
139
|
+
refresh: m,
|
|
140
|
+
getType: P,
|
|
141
|
+
RESOURCE_TYPE: E,
|
|
142
|
+
searchBridgeData: (s) => {
|
|
143
|
+
d.value = r(e.resourceList, s);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
}, Qe = (t) => (X("data-v-70da6acf"), t = t(), Z(), t), Xe = { class: "manage-panel" }, Ze = { class: "manage-panel-search" }, $e = { class: "list" }, et = ["onClick"], tt = { class: "item-label" }, nt = {
|
|
148
|
+
key: 0,
|
|
149
|
+
class: "empty-wrap"
|
|
150
|
+
}, ot = /* @__PURE__ */ Qe(() => /* @__PURE__ */ h("p", { class: "empty-text" }, "暂无数据", -1));
|
|
151
|
+
function at(t, n, d, e, r, m) {
|
|
152
|
+
const y = l("tiny-search"), f = l("svg-icon");
|
|
153
|
+
return v(), U("div", Xe, [
|
|
154
|
+
h("div", Ze, [
|
|
155
|
+
o(y, {
|
|
156
|
+
modelValue: e.state.searchValue,
|
|
157
|
+
"onUpdate:modelValue": [
|
|
158
|
+
n[0] || (n[0] = (_) => e.state.searchValue = _),
|
|
159
|
+
e.searchBridgeData
|
|
160
|
+
],
|
|
161
|
+
clearable: "",
|
|
162
|
+
placeholder: "请输入关键字搜索"
|
|
163
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
164
|
+
]),
|
|
165
|
+
h("div", $e, [
|
|
166
|
+
(v(!0), U(se, null, re(e.list, (_, u) => (v(), U("div", {
|
|
167
|
+
key: _.name,
|
|
168
|
+
class: ce(["list-item", u === e.state.activeIndex ? "active" : ""]),
|
|
169
|
+
onClick: j((s) => e.openEdit(_, u), ["stop"])
|
|
170
|
+
}, [
|
|
171
|
+
o(f, { name: "resources" }),
|
|
172
|
+
h("div", tt, B(_.name), 1),
|
|
173
|
+
o(f, {
|
|
174
|
+
class: "setting-icon",
|
|
175
|
+
name: "setting",
|
|
176
|
+
onClick: j((s) => e.openEdit(_, u), ["stop"])
|
|
177
|
+
}, null, 8, ["onClick"])
|
|
178
|
+
], 10, et))), 128)),
|
|
179
|
+
e.list.length ? b("", !0) : (v(), U("div", nt, [
|
|
180
|
+
o(f, {
|
|
181
|
+
class: "empty-icon",
|
|
182
|
+
name: "empty"
|
|
183
|
+
}),
|
|
184
|
+
ot
|
|
185
|
+
]))
|
|
186
|
+
])
|
|
187
|
+
]);
|
|
188
|
+
}
|
|
189
|
+
const st = /* @__PURE__ */ H(Ke, [["render", at], ["__scopeId", "data-v-70da6acf"]]);
|
|
190
|
+
const J = C(!1), rt = () => {
|
|
191
|
+
J.value = !0, ue(() => window.dispatchEvent(new Event("resize")));
|
|
192
|
+
}, S = () => {
|
|
193
|
+
J.value = !1;
|
|
194
|
+
}, ct = {
|
|
195
|
+
components: {
|
|
196
|
+
TinyForm: _e,
|
|
197
|
+
TinyInput: ge,
|
|
198
|
+
TinyButton: ye,
|
|
199
|
+
TinyFormItem: fe,
|
|
200
|
+
TinyCheckbox: ve,
|
|
201
|
+
PluginSetting: Ve,
|
|
202
|
+
TinySwitch: he,
|
|
203
|
+
MonacoEditor: Se,
|
|
204
|
+
IconUnknow: Be(),
|
|
205
|
+
TinyTooltip: Ee,
|
|
206
|
+
TinyRadioGroup: Re,
|
|
207
|
+
TinyRadio: be,
|
|
208
|
+
SvgButton: $
|
|
209
|
+
},
|
|
210
|
+
setup(t, { emit: n }) {
|
|
211
|
+
const d = {
|
|
212
|
+
theme: Le(),
|
|
213
|
+
roundedSelection: !0,
|
|
214
|
+
automaticLayout: !0,
|
|
215
|
+
autoIndent: !0,
|
|
216
|
+
formatOnPaste: !0,
|
|
217
|
+
language: "javascript",
|
|
218
|
+
mouseStyle: "default",
|
|
219
|
+
minimap: { enabled: !1 },
|
|
220
|
+
// 禁用滚动条边边一直显示的边框
|
|
221
|
+
overviewRulerBorder: !1,
|
|
222
|
+
renderLineHighlightOnlyWhenFocus: !0
|
|
223
|
+
}, { confirm: e } = ke(), r = z({
|
|
224
|
+
resource: V(() => Je()),
|
|
225
|
+
name: "",
|
|
226
|
+
value: "",
|
|
227
|
+
content: {},
|
|
228
|
+
status: V(() => D() === x.Edit),
|
|
229
|
+
category: V(() => K() === L.Npm),
|
|
230
|
+
mode: V(() => {
|
|
231
|
+
var a;
|
|
232
|
+
return ((a = Ie()) == null ? void 0 : a.dslMode) !== "Vue";
|
|
233
|
+
}),
|
|
234
|
+
isInstance: !1,
|
|
235
|
+
title: V(() => {
|
|
236
|
+
const a = D() === x.Edit ? "编辑" : "添加", g = P() === E.Bridge ? "桥接源" : "工具类";
|
|
237
|
+
return a + g;
|
|
238
|
+
}),
|
|
239
|
+
type: L.Npm
|
|
240
|
+
});
|
|
241
|
+
Q(() => {
|
|
242
|
+
var a, g;
|
|
243
|
+
r.name = r.resource.name, r.content = r.resource.content || {}, r.value = ((g = (a = r.resource) == null ? void 0 : a.content) == null ? void 0 : g.value) || "";
|
|
244
|
+
}), le(
|
|
245
|
+
() => r.isInstance,
|
|
246
|
+
(a) => {
|
|
247
|
+
a || (r.content.instance = "");
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
const m = C(null), y = C(null);
|
|
251
|
+
return ie(() => window.dispatchEvent(new Event("resize"))), {
|
|
252
|
+
rules: {
|
|
253
|
+
name: [
|
|
254
|
+
{ required: !0, message: "必填", trigger: "change" },
|
|
255
|
+
{
|
|
256
|
+
validator: (a, g, N) => {
|
|
257
|
+
const O = qe(P());
|
|
258
|
+
Array.isArray(O) && O.includes(g) ? N(new Error("资源名称已存在")) : N();
|
|
259
|
+
},
|
|
260
|
+
trigger: "change"
|
|
261
|
+
}
|
|
262
|
+
],
|
|
263
|
+
"content.package": [{ required: !0, message: "必填", trigger: "change" }],
|
|
264
|
+
"content.exportName": [{ required: !0, message: "必填", trigger: "change" }],
|
|
265
|
+
"content.instanceName": { required: !0, message: "必填", trigger: "change" }
|
|
266
|
+
},
|
|
267
|
+
resourceForm: y,
|
|
268
|
+
editor: m,
|
|
269
|
+
state: r,
|
|
270
|
+
isOpen: J,
|
|
271
|
+
closePanel: S,
|
|
272
|
+
save: () => {
|
|
273
|
+
const a = {
|
|
274
|
+
category: P(),
|
|
275
|
+
type: K(),
|
|
276
|
+
name: r.name,
|
|
277
|
+
app: T().appInfoState.selectedId,
|
|
278
|
+
content: r.category ? r.content : {
|
|
279
|
+
type: "JSFunction",
|
|
280
|
+
value: m.value.getEditor().getValue()
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
y.value.validate((g) => {
|
|
284
|
+
if (!g) {
|
|
285
|
+
I({
|
|
286
|
+
type: "error",
|
|
287
|
+
message: "请检查必填项"
|
|
288
|
+
});
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
if (!r.category && !m.value.getEditor().getValue()) {
|
|
292
|
+
I({
|
|
293
|
+
type: "error",
|
|
294
|
+
message: "function 内容必填"
|
|
295
|
+
});
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
je(a, S, n);
|
|
299
|
+
});
|
|
300
|
+
},
|
|
301
|
+
deleteReSource: () => {
|
|
302
|
+
e({
|
|
303
|
+
title: "删除资源",
|
|
304
|
+
message: "您确认删除该资源吗?",
|
|
305
|
+
exec: () => {
|
|
306
|
+
We(r.name, S, n);
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
},
|
|
310
|
+
options: d,
|
|
311
|
+
handleChangeType: (a) => {
|
|
312
|
+
M(a);
|
|
313
|
+
},
|
|
314
|
+
RESOURCE_CATEGORY: L
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
}, lt = (t) => (X("data-v-a65a6161"), t = t(), Z(), t), it = { class: "title-wrap" }, dt = { class: "header-wrap" }, pt = { class: "right-item" }, ut = { key: 2 }, mt = { class: "cdn-label-wrap" }, _t = /* @__PURE__ */ lt(() => /* @__PURE__ */ h("span", null, "CDN", -1));
|
|
318
|
+
function gt(t, n, d, e, r, m) {
|
|
319
|
+
const y = l("svg-button"), f = l("tiny-button"), _ = l("tiny-radio"), u = l("tiny-radio-group"), s = l("tiny-form-item"), a = l("tiny-input"), g = l("tiny-switch"), N = l("tiny-checkbox"), O = l("icon-unknow"), te = l("tiny-tooltip"), ne = l("monaco-editor"), oe = l("tiny-form"), ae = l("plugin-setting");
|
|
320
|
+
return e.isOpen ? (v(), R(ae, { key: 0 }, {
|
|
321
|
+
title: c(() => [
|
|
322
|
+
h("div", it, [
|
|
323
|
+
h("span", null, B(e.state.title), 1)
|
|
324
|
+
])
|
|
325
|
+
]),
|
|
326
|
+
header: c(() => [
|
|
327
|
+
h("div", dt, [
|
|
328
|
+
de(o(y, {
|
|
329
|
+
class: "delete-btn",
|
|
330
|
+
name: "delete",
|
|
331
|
+
onClick: e.deleteReSource
|
|
332
|
+
}, null, 8, ["onClick"]), [
|
|
333
|
+
[pe, e.state.status]
|
|
334
|
+
]),
|
|
335
|
+
o(f, {
|
|
336
|
+
class: "save-btn",
|
|
337
|
+
type: "primary",
|
|
338
|
+
onClick: e.save
|
|
339
|
+
}, {
|
|
340
|
+
default: c(() => [
|
|
341
|
+
F("保存")
|
|
342
|
+
]),
|
|
343
|
+
_: 1
|
|
344
|
+
}, 8, ["onClick"]),
|
|
345
|
+
o(y, {
|
|
346
|
+
class: "close-btn",
|
|
347
|
+
name: "close",
|
|
348
|
+
onClick: e.closePanel
|
|
349
|
+
}, null, 8, ["onClick"])
|
|
350
|
+
])
|
|
351
|
+
]),
|
|
352
|
+
content: c(() => [
|
|
353
|
+
o(oe, {
|
|
354
|
+
ref: "resourceForm",
|
|
355
|
+
class: "resource-form",
|
|
356
|
+
rules: e.rules,
|
|
357
|
+
model: e.state,
|
|
358
|
+
"validate-type": "text",
|
|
359
|
+
"inline-message": !0,
|
|
360
|
+
"label-position": "left",
|
|
361
|
+
"label-align": !0
|
|
362
|
+
}, {
|
|
363
|
+
default: c(() => [
|
|
364
|
+
h("div", pt, [
|
|
365
|
+
e.state.status ? b("", !0) : (v(), R(s, {
|
|
366
|
+
key: 0,
|
|
367
|
+
label: "工具类型",
|
|
368
|
+
prop: "type"
|
|
369
|
+
}, {
|
|
370
|
+
default: c(() => [
|
|
371
|
+
o(u, {
|
|
372
|
+
modelValue: e.state.type,
|
|
373
|
+
"onUpdate:modelValue": n[0] || (n[0] = (p) => e.state.type = p),
|
|
374
|
+
class: "resource-type-radio-group",
|
|
375
|
+
onChange: e.handleChangeType
|
|
376
|
+
}, {
|
|
377
|
+
default: c(() => [
|
|
378
|
+
o(_, {
|
|
379
|
+
label: e.RESOURCE_CATEGORY.Npm,
|
|
380
|
+
class: "resource-type-radio-item"
|
|
381
|
+
}, {
|
|
382
|
+
default: c(() => [
|
|
383
|
+
F(B(e.RESOURCE_CATEGORY.Npm), 1)
|
|
384
|
+
]),
|
|
385
|
+
_: 1
|
|
386
|
+
}, 8, ["label"]),
|
|
387
|
+
o(_, {
|
|
388
|
+
label: e.RESOURCE_CATEGORY.Function,
|
|
389
|
+
class: "resource-type-radio-item"
|
|
390
|
+
}, {
|
|
391
|
+
default: c(() => [
|
|
392
|
+
F(B(e.RESOURCE_CATEGORY.Function), 1)
|
|
393
|
+
]),
|
|
394
|
+
_: 1
|
|
395
|
+
}, 8, ["label"])
|
|
396
|
+
]),
|
|
397
|
+
_: 1
|
|
398
|
+
}, 8, ["modelValue", "onChange"])
|
|
399
|
+
]),
|
|
400
|
+
_: 1
|
|
401
|
+
})),
|
|
402
|
+
e.state.status ? b("", !0) : (v(), R(s, {
|
|
403
|
+
key: 1,
|
|
404
|
+
label: "名称",
|
|
405
|
+
prop: "name"
|
|
406
|
+
}, {
|
|
407
|
+
default: c(() => [
|
|
408
|
+
o(a, {
|
|
409
|
+
modelValue: e.state.name,
|
|
410
|
+
"onUpdate:modelValue": n[1] || (n[1] = (p) => e.state.name = p),
|
|
411
|
+
placeholder: "请输入名称"
|
|
412
|
+
}, null, 8, ["modelValue"])
|
|
413
|
+
]),
|
|
414
|
+
_: 1
|
|
415
|
+
})),
|
|
416
|
+
e.state.category ? (v(), U("div", ut, [
|
|
417
|
+
o(s, {
|
|
418
|
+
label: "包名",
|
|
419
|
+
prop: "content.package"
|
|
420
|
+
}, {
|
|
421
|
+
default: c(() => [
|
|
422
|
+
o(a, {
|
|
423
|
+
modelValue: e.state.content.package,
|
|
424
|
+
"onUpdate:modelValue": n[2] || (n[2] = (p) => e.state.content.package = p),
|
|
425
|
+
placeholder: "package"
|
|
426
|
+
}, null, 8, ["modelValue"])
|
|
427
|
+
]),
|
|
428
|
+
_: 1
|
|
429
|
+
}),
|
|
430
|
+
o(s, {
|
|
431
|
+
label: "导出名称",
|
|
432
|
+
prop: "content.exportName"
|
|
433
|
+
}, {
|
|
434
|
+
default: c(() => [
|
|
435
|
+
o(a, {
|
|
436
|
+
modelValue: e.state.content.exportName,
|
|
437
|
+
"onUpdate:modelValue": n[3] || (n[3] = (p) => e.state.content.exportName = p),
|
|
438
|
+
placeholder: "exportName"
|
|
439
|
+
}, null, 8, ["modelValue"])
|
|
440
|
+
]),
|
|
441
|
+
_: 1
|
|
442
|
+
}),
|
|
443
|
+
o(s, { label: "是否解构" }, {
|
|
444
|
+
default: c(() => [
|
|
445
|
+
o(g, {
|
|
446
|
+
modelValue: e.state.content.destructuring,
|
|
447
|
+
"onUpdate:modelValue": n[4] || (n[4] = (p) => e.state.content.destructuring = p)
|
|
448
|
+
}, null, 8, ["modelValue"])
|
|
449
|
+
]),
|
|
450
|
+
_: 1
|
|
451
|
+
}),
|
|
452
|
+
e.state.mode ? (v(), R(s, {
|
|
453
|
+
key: 0,
|
|
454
|
+
label: "是否作为实例"
|
|
455
|
+
}, {
|
|
456
|
+
default: c(() => [
|
|
457
|
+
o(N, {
|
|
458
|
+
modelValue: e.state.isInstance,
|
|
459
|
+
"onUpdate:modelValue": n[5] || (n[5] = (p) => e.state.isInstance = p)
|
|
460
|
+
}, null, 8, ["modelValue"])
|
|
461
|
+
]),
|
|
462
|
+
_: 1
|
|
463
|
+
})) : b("", !0),
|
|
464
|
+
e.state.isInstance ? (v(), R(s, {
|
|
465
|
+
key: 1,
|
|
466
|
+
label: "实例名称",
|
|
467
|
+
prop: "content.instanceName"
|
|
468
|
+
}, {
|
|
469
|
+
default: c(() => [
|
|
470
|
+
o(a, {
|
|
471
|
+
modelValue: e.state.content.instance,
|
|
472
|
+
"onUpdate:modelValue": n[6] || (n[6] = (p) => e.state.content.instance = p)
|
|
473
|
+
}, null, 8, ["modelValue"])
|
|
474
|
+
]),
|
|
475
|
+
_: 1
|
|
476
|
+
})) : b("", !0),
|
|
477
|
+
o(s, { label: "入口路径" }, {
|
|
478
|
+
default: c(() => [
|
|
479
|
+
o(a, {
|
|
480
|
+
modelValue: e.state.content.main,
|
|
481
|
+
"onUpdate:modelValue": n[7] || (n[7] = (p) => e.state.content.main = p),
|
|
482
|
+
placeholder: "main"
|
|
483
|
+
}, null, 8, ["modelValue"])
|
|
484
|
+
]),
|
|
485
|
+
_: 1
|
|
486
|
+
}),
|
|
487
|
+
o(s, { label: "版本号" }, {
|
|
488
|
+
default: c(() => [
|
|
489
|
+
o(a, {
|
|
490
|
+
modelValue: e.state.content.version,
|
|
491
|
+
"onUpdate:modelValue": n[8] || (n[8] = (p) => e.state.content.version = p),
|
|
492
|
+
placeholder: "latest"
|
|
493
|
+
}, null, 8, ["modelValue"])
|
|
494
|
+
]),
|
|
495
|
+
_: 1
|
|
496
|
+
}),
|
|
497
|
+
o(s, null, {
|
|
498
|
+
label: c(() => [
|
|
499
|
+
h("div", mt, [
|
|
500
|
+
_t,
|
|
501
|
+
o(te, {
|
|
502
|
+
effect: "dark",
|
|
503
|
+
content: "浏览器直接可用的生产包链接,请确保可用,否则可能会造成页面预览失败",
|
|
504
|
+
placement: "top"
|
|
505
|
+
}, {
|
|
506
|
+
default: c(() => [
|
|
507
|
+
o(O, { class: "cdn-tips-icon" })
|
|
508
|
+
]),
|
|
509
|
+
_: 1
|
|
510
|
+
})
|
|
511
|
+
])
|
|
512
|
+
]),
|
|
513
|
+
default: c(() => [
|
|
514
|
+
o(a, {
|
|
515
|
+
modelValue: e.state.content.cdnLink,
|
|
516
|
+
"onUpdate:modelValue": n[9] || (n[9] = (p) => e.state.content.cdnLink = p),
|
|
517
|
+
placeholder: "浏览器直接可用的生产包链接,请确保可用,否则可能会造成页面预览失败"
|
|
518
|
+
}, null, 8, ["modelValue"])
|
|
519
|
+
]),
|
|
520
|
+
_: 1
|
|
521
|
+
})
|
|
522
|
+
])) : (v(), R(ne, {
|
|
523
|
+
key: 3,
|
|
524
|
+
ref: "editor",
|
|
525
|
+
value: e.state.value,
|
|
526
|
+
class: "monaco-editor",
|
|
527
|
+
options: e.options
|
|
528
|
+
}, null, 8, ["value", "options"]))
|
|
529
|
+
])
|
|
530
|
+
]),
|
|
531
|
+
_: 1
|
|
532
|
+
}, 8, ["rules", "model"])
|
|
533
|
+
]),
|
|
534
|
+
_: 1
|
|
535
|
+
})) : b("", !0);
|
|
536
|
+
}
|
|
537
|
+
const yt = /* @__PURE__ */ H(ct, [["render", gt], ["__scopeId", "data-v-a65a6161"]]);
|
|
538
|
+
const ft = {
|
|
539
|
+
components: {
|
|
540
|
+
TinyTabs: Ce,
|
|
541
|
+
TinyTabItem: Te,
|
|
542
|
+
PluginPanel: Ue,
|
|
543
|
+
SvgButton: $,
|
|
544
|
+
BridgeManage: st,
|
|
545
|
+
BridgeSetting: yt
|
|
546
|
+
},
|
|
547
|
+
setup() {
|
|
548
|
+
const t = C(E.Util), n = C(null), d = C(null), e = V(() => Me[t.value]);
|
|
549
|
+
return {
|
|
550
|
+
addResource: (u) => {
|
|
551
|
+
t.value === E.Util ? d.value.add(u) : n.value.add(u);
|
|
552
|
+
},
|
|
553
|
+
RESOURCE_TYPE: E,
|
|
554
|
+
activedName: t,
|
|
555
|
+
switchTab: (u) => {
|
|
556
|
+
S(), G(u.name);
|
|
557
|
+
},
|
|
558
|
+
openBridgePanel: () => {
|
|
559
|
+
rt();
|
|
560
|
+
},
|
|
561
|
+
closePanel: S,
|
|
562
|
+
openUtilPanel: () => {
|
|
563
|
+
S();
|
|
564
|
+
},
|
|
565
|
+
refreshList: (u) => {
|
|
566
|
+
u === E.Util ? d.value.refresh(u) : n.value.refresh(u);
|
|
567
|
+
},
|
|
568
|
+
bridge: n,
|
|
569
|
+
utils: d,
|
|
570
|
+
tips: e,
|
|
571
|
+
isVsCodeEnv: ee
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
};
|
|
575
|
+
function vt(t, n, d, e, r, m) {
|
|
576
|
+
const y = l("svg-button"), f = l("bridge-manage"), _ = l("tiny-tab-item"), u = l("tiny-tabs"), s = l("bridge-setting"), a = l("plugin-panel");
|
|
577
|
+
return v(), R(a, {
|
|
578
|
+
title: "资源管理",
|
|
579
|
+
isCloseLeft: !1,
|
|
580
|
+
onClose: e.closePanel
|
|
581
|
+
}, {
|
|
582
|
+
header: c(() => [
|
|
583
|
+
o(y, {
|
|
584
|
+
name: "add-utils",
|
|
585
|
+
placement: "left",
|
|
586
|
+
tips: e.tips,
|
|
587
|
+
onClick: n[0] || (n[0] = (g) => e.addResource("npm"))
|
|
588
|
+
}, null, 8, ["tips"])
|
|
589
|
+
]),
|
|
590
|
+
content: c(() => [
|
|
591
|
+
o(u, {
|
|
592
|
+
modelValue: e.activedName,
|
|
593
|
+
"onUpdate:modelValue": n[1] || (n[1] = (g) => e.activedName = g),
|
|
594
|
+
class: "tabs full-width-tabs",
|
|
595
|
+
"tab-style": "button-card",
|
|
596
|
+
onClick: e.switchTab
|
|
597
|
+
}, {
|
|
598
|
+
default: c(() => [
|
|
599
|
+
o(_, {
|
|
600
|
+
name: e.RESOURCE_TYPE.Util,
|
|
601
|
+
title: "工具类"
|
|
602
|
+
}, {
|
|
603
|
+
default: c(() => [
|
|
604
|
+
o(f, {
|
|
605
|
+
ref: "utils",
|
|
606
|
+
name: e.RESOURCE_TYPE.Util,
|
|
607
|
+
onOpen: e.openBridgePanel
|
|
608
|
+
}, null, 8, ["name", "onOpen"])
|
|
609
|
+
]),
|
|
610
|
+
_: 1
|
|
611
|
+
}, 8, ["name"]),
|
|
612
|
+
e.isVsCodeEnv ? (v(), R(_, {
|
|
613
|
+
key: 0,
|
|
614
|
+
name: e.RESOURCE_TYPE.Bridge,
|
|
615
|
+
title: "桥接源"
|
|
616
|
+
}, {
|
|
617
|
+
default: c(() => [
|
|
618
|
+
o(f, {
|
|
619
|
+
ref: "bridge",
|
|
620
|
+
name: e.RESOURCE_TYPE.Bridge,
|
|
621
|
+
onOpen: e.openBridgePanel
|
|
622
|
+
}, null, 8, ["name", "onOpen"])
|
|
623
|
+
]),
|
|
624
|
+
_: 1
|
|
625
|
+
}, 8, ["name"])) : b("", !0)
|
|
626
|
+
]),
|
|
627
|
+
_: 1
|
|
628
|
+
}, 8, ["modelValue", "onClick"]),
|
|
629
|
+
o(s, { onRefresh: e.refreshList }, null, 8, ["onRefresh"])
|
|
630
|
+
]),
|
|
631
|
+
_: 1
|
|
632
|
+
}, 8, ["onClose"]);
|
|
633
|
+
}
|
|
634
|
+
const ht = /* @__PURE__ */ H(ft, [["render", vt], ["__scopeId", "data-v-c5fc42c1"]]), wt = {
|
|
635
|
+
id: "Bridge",
|
|
636
|
+
title: "资源管理",
|
|
637
|
+
icon: "plugin-icon-sresources",
|
|
638
|
+
align: "top",
|
|
639
|
+
component: ht
|
|
640
|
+
};
|
|
641
|
+
export {
|
|
642
|
+
wt as default
|
|
643
|
+
};
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.manage-panel[data-v-70da6acf]{height:100%;display:flex;flex-direction:column;position:relative}.manage-panel .manage-panel-search[data-v-70da6acf]{padding:8px}.manage-panel .add-button[data-v-70da6acf]{align-self:flex-end;margin:6px}.manage-panel .list[data-v-70da6acf]{flex:1;border-top:1px solid var(--ti-lowcode-tabs-border-color);overflow:auto}.manage-panel .list-item[data-v-70da6acf]{height:28px;display:grid;grid-template-columns:16px 1fr auto;column-gap:8px;align-items:center;padding:0 12px;position:relative;color:var(--ti-lowcode-bridge-list-color);cursor:pointer;font-size:12px}.manage-panel .list-item[data-v-70da6acf]:hover,.manage-panel .list-item.active[data-v-70da6acf]{background:var(--ti-lowcode-bridge-list-bg)}.manage-panel .list-item svg[data-v-70da6acf]{color:var(--ti-lowcode-toolbar-more-hover-color)}.plugin-setting[data-v-a65a6161] .icon-wrap{margin-right:8px}.plugin-setting .resource-form[data-v-a65a6161] .tiny-form-item__label .cdn-tips-icon{margin-left:4px}.plugin-setting .title-wrap .help-link[data-v-a65a6161]{display:inline-block;color:var(--ti-lowcode-common-primary-color);font-size:12px;margin-left:16px}.plugin-setting .title-wrap .help-link[data-v-a65a6161]:hover{text-decoration:underline}.plugin-setting .header-wrap[data-v-a65a6161]{display:flex;align-items:center;column-gap:16px}.plugin-setting .header-wrap .delete-btn[data-v-a65a6161]{color:var(--ti-lowcode-common-text-color-5)}.plugin-setting .header-wrap .delete-btn[data-v-a65a6161]:hover{color:var(--ti-lowcode-common-primary-text-color)}.plugin-setting .resource-type-radio-item[data-v-a65a6161]{--ti-radio-text-color: var(--ti-lowcode-common-secondary-text-color)}.plugin-setting .monaco-editor[data-v-a65a6161]{height:500px;margin-top:8px;border:1px solid var(--ti-lowcode-birdge-editor-border-color)}.plugin-setting .resource-form-footer[data-v-a65a6161]{padding:12px 0 12px 80px}.plugin-setting .resource-form-footer .tiny-svg[data-v-a65a6161]{margin-right:6px}.plugin-setting .resource-form-footer .del[data-v-a65a6161]:hover{background-color:var(--ti-lowcode-delete-button-hover-bg)}.plugin-setting .cdn-label-wrap[data-v-a65a6161]{display:flex;align-items:center}.tabs[data-v-c5fc42c1]{height:calc(100% - 46px)}[data-v-c5fc42c1] .tiny-tabs__header{padding:8px;border-bottom:1px solid var(--ti-lowcode-tabs-border-color)}[data-v-c5fc42c1] .tiny-tabs__content{height:calc(100% - 45px);padding:0}[data-v-c5fc42c1] .tiny-tabs__content>div{height:100%}
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opentiny/tiny-engine-plugin-bridge",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "vite build"
|
|
9
|
+
},
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"module": "dist/index.js",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@opentiny/tiny-engine-common": "^1.0.0",
|
|
17
|
+
"@opentiny/tiny-engine-controller": "^1.0.0",
|
|
18
|
+
"@opentiny/tiny-engine-http": "^1.0.0",
|
|
19
|
+
"@opentiny/vue": "^3.8.0",
|
|
20
|
+
"vue": "3.2.45"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@vitejs/plugin-vue": "^4.2.3",
|
|
24
|
+
"@vitejs/plugin-vue-jsx": "^1.3.10",
|
|
25
|
+
"vite": "^4.3.7"
|
|
26
|
+
}
|
|
27
|
+
}
|