@opentiny/tiny-engine-plugin-bridge 2.5.0-rc.6 → 2.6.0-alpha.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.
- package/dist/index.js +50 -47
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
2
|
import { reactive as M, ref as U, watchEffect as ee, resolveComponent as p, createElementBlock as O, openBlock as h, createElementVNode as E, createVNode as a, withCtx as l, Fragment as oe, renderList as ae, withModifiers as X, normalizeClass as se, toDisplayString as B, computed as b, watch as re, onMounted as le, nextTick as ie, createBlock as C, createCommentVNode as N, createTextVNode as L, provide as ce } from "vue";
|
|
3
3
|
import { SvgButton as j, SearchEmpty as de, ButtonGroup as pe, VueMonaco as ue, PluginSetting as me, PluginPanel as ge } from "@opentiny/tiny-engine-common";
|
|
4
|
-
import { getMetaApi as S, META_SERVICE as x, useResource as I, useNotify as T, useModal as
|
|
5
|
-
import { isVsCodeEnv as
|
|
4
|
+
import { getMetaApi as S, META_SERVICE as x, useResource as I, useNotify as T, useModal as _e, useLayout as te, getMergeMeta as ye } from "@opentiny/tiny-engine-meta-register";
|
|
5
|
+
import { isVsCodeEnv as fe } from "@opentiny/tiny-engine-common/js/environments";
|
|
6
6
|
import { generateBridge as ve, generateUtil as he } from "@opentiny/tiny-engine-common/js/vscodeGenerateFile";
|
|
7
7
|
import { Search as Ee, Radio as Re, RadioGroup as be, Checkbox as Ce, FormItem as Ve, Button as Se, Input as xe, Form as Ne } from "@opentiny/vue";
|
|
8
8
|
import { iconSearch as Te } from "@opentiny/vue-icon";
|
|
@@ -62,7 +62,7 @@ const Ue = (n, t) => S(x.Http).get(`/app-center/api/apps/extension/list?app=${n}
|
|
|
62
62
|
}, z = (n) => {
|
|
63
63
|
m.category = n;
|
|
64
64
|
}, Y = () => m.category, ne = (...n) => {
|
|
65
|
-
|
|
65
|
+
fe && we(...n);
|
|
66
66
|
}, Me = async (n, t, u) => {
|
|
67
67
|
const e = H() === w.Edit;
|
|
68
68
|
try {
|
|
@@ -70,7 +70,7 @@ const Ue = (n, t) => S(x.Http).get(`/app-center/api/apps/extension/list?app=${n}
|
|
|
70
70
|
n.id = m.resource.id;
|
|
71
71
|
const i = await Be(n);
|
|
72
72
|
if (i) {
|
|
73
|
-
const g = I().appSchemaState[n.category].findIndex((
|
|
73
|
+
const g = I().appSchemaState[n.category].findIndex((_) => _.name === i.name);
|
|
74
74
|
if (g === -1) {
|
|
75
75
|
T({
|
|
76
76
|
type: "error",
|
|
@@ -99,15 +99,15 @@ const Ue = (n, t) => S(x.Http).get(`/app-center/api/apps/extension/list?app=${n}
|
|
|
99
99
|
const e = `app=${G()}&id=${(i = m.resource) == null ? void 0 : i.id}`;
|
|
100
100
|
Ie(e).then((g) => {
|
|
101
101
|
if (g) {
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
102
|
+
const _ = I().appSchemaState[m.type].findIndex((o) => o.name === g.name);
|
|
103
|
+
if (_ === -1) {
|
|
104
104
|
T({
|
|
105
105
|
type: "error",
|
|
106
106
|
message: "删除失败"
|
|
107
107
|
});
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
|
-
I().appSchemaState[m.type].splice(
|
|
110
|
+
I().appSchemaState[m.type].splice(_, 1), ne(G()), T({
|
|
111
111
|
type: "success",
|
|
112
112
|
message: "删除成功"
|
|
113
113
|
}), u("refresh", m.type), m.refresh = !0, t();
|
|
@@ -132,7 +132,7 @@ const Ue = (n, t) => S(x.Http).get(`/app-center/api/apps/extension/list?app=${n}
|
|
|
132
132
|
resourceList: [],
|
|
133
133
|
activeIndex: -1,
|
|
134
134
|
searchValue: ""
|
|
135
|
-
}), i = (r = e.resourceList, s = e.searchValue) => r.filter((
|
|
135
|
+
}), i = (r = e.resourceList, s = e.searchValue) => r.filter((y) => y.name.toLowerCase().indexOf(s.toLowerCase()) > -1), g = async (r) => {
|
|
136
136
|
e.resourceList = await Fe(r), Ae(
|
|
137
137
|
r,
|
|
138
138
|
Array.isArray(e.resourceList) ? e.resourceList.map((s) => s.name) : []
|
|
@@ -167,7 +167,7 @@ const Ue = (n, t) => S(x.Http).get(`/app-center/api/apps/extension/list?app=${n}
|
|
|
167
167
|
return u;
|
|
168
168
|
}, Ye = { class: "manage-panel" }, He = { class: "manage-panel-search" }, ze = { class: "list lowcode-scrollbar" }, je = ["onClick"], Je = { class: "item-label" };
|
|
169
169
|
function We(n, t, u, e, i, g) {
|
|
170
|
-
const
|
|
170
|
+
const _ = p("tiny-icon-search"), o = p("tiny-search"), R = p("svg-icon"), v = p("svg-button"), r = p("search-empty");
|
|
171
171
|
return h(), O("div", Ye, [
|
|
172
172
|
E("div", He, [
|
|
173
173
|
a(o, {
|
|
@@ -180,16 +180,16 @@ function We(n, t, u, e, i, g) {
|
|
|
180
180
|
placeholder: "搜索"
|
|
181
181
|
}, {
|
|
182
182
|
prefix: l(() => [
|
|
183
|
-
a(
|
|
183
|
+
a(_)
|
|
184
184
|
]),
|
|
185
185
|
_: 1
|
|
186
186
|
}, 8, ["modelValue", "onUpdate:modelValue"])
|
|
187
187
|
]),
|
|
188
188
|
E("div", ze, [
|
|
189
|
-
(h(!0), O(oe, null, ae(e.list, (s,
|
|
189
|
+
(h(!0), O(oe, null, ae(e.list, (s, y) => (h(), O("div", {
|
|
190
190
|
key: s.name,
|
|
191
|
-
class: se(["list-item",
|
|
192
|
-
onClick: X((k) => e.openEdit(s,
|
|
191
|
+
class: se(["list-item", y === e.state.activeIndex ? "active" : ""]),
|
|
192
|
+
onClick: X((k) => e.openEdit(s, y), ["stop"])
|
|
193
193
|
}, [
|
|
194
194
|
a(R, {
|
|
195
195
|
name: "plugin-icon-sresources",
|
|
@@ -200,7 +200,7 @@ function We(n, t, u, e, i, g) {
|
|
|
200
200
|
class: "setting-icon",
|
|
201
201
|
hoverBgColor: !1,
|
|
202
202
|
name: "setting",
|
|
203
|
-
onClick: X((k) => e.openEdit(s,
|
|
203
|
+
onClick: X((k) => e.openEdit(s, y), ["stop"])
|
|
204
204
|
}, null, 8, ["onClick"])
|
|
205
205
|
], 10, je))), 128)),
|
|
206
206
|
a(r, {
|
|
@@ -235,7 +235,7 @@ const Ke = /* @__PURE__ */ J(qe, [["render", We], ["__scopeId", "data-v-accaf761
|
|
|
235
235
|
// 禁用滚动条边边一直显示的边框
|
|
236
236
|
overviewRulerBorder: !1,
|
|
237
237
|
renderLineHighlightOnlyWhenFocus: !0
|
|
238
|
-
}, { confirm: e } =
|
|
238
|
+
}, { confirm: e } = _e(), { PLUGIN_NAME: i, getPluginByLayout: g } = te(), _ = b(() => g(i.Bridge)), o = M({
|
|
239
239
|
resource: b(() => Ge()),
|
|
240
240
|
name: "",
|
|
241
241
|
value: "",
|
|
@@ -244,25 +244,25 @@ const Ke = /* @__PURE__ */ J(qe, [["render", We], ["__scopeId", "data-v-accaf761
|
|
|
244
244
|
category: b(() => Y() === P.Npm),
|
|
245
245
|
mode: b(() => {
|
|
246
246
|
var d;
|
|
247
|
-
return ((d =
|
|
247
|
+
return ((d = ye("engine.config")) == null ? void 0 : d.dslMode) !== "Vue";
|
|
248
248
|
}),
|
|
249
249
|
isInstance: !1,
|
|
250
250
|
title: b(() => {
|
|
251
|
-
const d = H() === w.Edit ? "编辑" : "添加",
|
|
252
|
-
return d +
|
|
251
|
+
const d = H() === w.Edit ? "编辑" : "添加", f = A() === V.Bridge ? "桥接源" : "工具类";
|
|
252
|
+
return d + f;
|
|
253
253
|
}),
|
|
254
254
|
type: P.Npm
|
|
255
255
|
}), R = b(() => {
|
|
256
256
|
const d = o.name || "name";
|
|
257
|
-
let
|
|
258
|
-
o.content.destructuring && (o.name && o.name === o.content.exportName ?
|
|
257
|
+
let f = d;
|
|
258
|
+
o.content.destructuring && (o.name && o.name === o.content.exportName ? f = `{ ${o.content.exportName || "exportName"} }` : f = `{ ${o.content.exportName || "exportName"} as ${d} }`);
|
|
259
259
|
const c = `${o.content.package || "package"}${o.content.main || ""}`;
|
|
260
|
-
return `import ${
|
|
260
|
+
return `import ${f} from '${c}'
|
|
261
261
|
export { ${d} }`;
|
|
262
262
|
});
|
|
263
263
|
ee(() => {
|
|
264
|
-
var d,
|
|
265
|
-
o.name = o.resource.name, o.content = o.resource.content || {}, o.value = ((
|
|
264
|
+
var d, f;
|
|
265
|
+
o.name = o.resource.name, o.content = o.resource.content || {}, o.value = ((f = (d = o.resource) == null ? void 0 : d.content) == null ? void 0 : f.value) || "", o.type = Y();
|
|
266
266
|
}), re(
|
|
267
267
|
() => o.isInstance,
|
|
268
268
|
(d) => {
|
|
@@ -271,15 +271,15 @@ export { ${d} }`;
|
|
|
271
271
|
);
|
|
272
272
|
const v = U(null), r = U(null);
|
|
273
273
|
return le(() => window.dispatchEvent(new Event("resize"))), {
|
|
274
|
-
align:
|
|
274
|
+
align: _,
|
|
275
275
|
PLUGIN_NAME: i,
|
|
276
276
|
rules: {
|
|
277
277
|
name: [
|
|
278
278
|
{ required: !0, message: "必填", trigger: "change" },
|
|
279
279
|
{
|
|
280
|
-
validator: (d,
|
|
280
|
+
validator: (d, f, c) => {
|
|
281
281
|
const Q = Pe(A());
|
|
282
|
-
Array.isArray(Q) && Q.includes(
|
|
282
|
+
Array.isArray(Q) && Q.includes(f) ? c(new Error("资源名称已存在")) : c();
|
|
283
283
|
},
|
|
284
284
|
trigger: "change"
|
|
285
285
|
}
|
|
@@ -305,8 +305,8 @@ export { ${d} }`;
|
|
|
305
305
|
value: v.value.getEditor().getValue()
|
|
306
306
|
}
|
|
307
307
|
};
|
|
308
|
-
r.value.validate((
|
|
309
|
-
if (
|
|
308
|
+
r.value.validate((f) => {
|
|
309
|
+
if (f) {
|
|
310
310
|
if (!o.category && !v.value.getEditor().getValue()) {
|
|
311
311
|
T({
|
|
312
312
|
type: "error",
|
|
@@ -336,8 +336,8 @@ export { ${d} }`;
|
|
|
336
336
|
}
|
|
337
337
|
}, Ze = { class: "title-wrap" }, $e = { class: "right-item" }, et = { key: 2 }, tt = { class: "code-preview" };
|
|
338
338
|
function nt(n, t, u, e, i, g) {
|
|
339
|
-
const
|
|
340
|
-
return e.isOpen ? (h(), C(
|
|
339
|
+
const _ = p("tiny-button"), o = p("svg-button"), R = p("button-group"), v = p("tiny-radio"), r = p("tiny-radio-group"), s = p("tiny-form-item"), y = p("tiny-input"), k = p("tiny-checkbox"), K = p("monaco-editor"), d = p("tiny-form"), f = p("plugin-setting");
|
|
340
|
+
return e.isOpen ? (h(), C(f, {
|
|
341
341
|
key: 0,
|
|
342
342
|
align: e.align,
|
|
343
343
|
"fixed-name": e.PLUGIN_NAME.Bridge
|
|
@@ -350,7 +350,7 @@ function nt(n, t, u, e, i, g) {
|
|
|
350
350
|
header: l(() => [
|
|
351
351
|
a(R, null, {
|
|
352
352
|
default: l(() => [
|
|
353
|
-
a(
|
|
353
|
+
a(_, {
|
|
354
354
|
class: "save-btn",
|
|
355
355
|
type: "primary",
|
|
356
356
|
onClick: e.save
|
|
@@ -358,7 +358,8 @@ function nt(n, t, u, e, i, g) {
|
|
|
358
358
|
default: l(() => t[10] || (t[10] = [
|
|
359
359
|
L("保存")
|
|
360
360
|
])),
|
|
361
|
-
_: 1
|
|
361
|
+
_: 1,
|
|
362
|
+
__: [10]
|
|
362
363
|
}, 8, ["onClick"]),
|
|
363
364
|
e.state.status ? (h(), C(o, {
|
|
364
365
|
key: 0,
|
|
@@ -429,7 +430,7 @@ function nt(n, t, u, e, i, g) {
|
|
|
429
430
|
prop: "name"
|
|
430
431
|
}, {
|
|
431
432
|
default: l(() => [
|
|
432
|
-
a(
|
|
433
|
+
a(y, {
|
|
433
434
|
modelValue: e.state.name,
|
|
434
435
|
"onUpdate:modelValue": t[1] || (t[1] = (c) => e.state.name = c),
|
|
435
436
|
placeholder: "请输入工具类名称"
|
|
@@ -443,7 +444,7 @@ function nt(n, t, u, e, i, g) {
|
|
|
443
444
|
prop: "content.package"
|
|
444
445
|
}, {
|
|
445
446
|
default: l(() => [
|
|
446
|
-
a(
|
|
447
|
+
a(y, {
|
|
447
448
|
modelValue: e.state.content.package,
|
|
448
449
|
"onUpdate:modelValue": t[2] || (t[2] = (c) => e.state.content.package = c),
|
|
449
450
|
placeholder: "请输入npm包名称"
|
|
@@ -456,7 +457,7 @@ function nt(n, t, u, e, i, g) {
|
|
|
456
457
|
prop: "content.exportName"
|
|
457
458
|
}, {
|
|
458
459
|
default: l(() => [
|
|
459
|
-
a(
|
|
460
|
+
a(y, {
|
|
460
461
|
modelValue: e.state.content.exportName,
|
|
461
462
|
"onUpdate:modelValue": t[3] || (t[3] = (c) => e.state.content.exportName = c),
|
|
462
463
|
placeholder: "请输入npm包的导出名称"
|
|
@@ -473,7 +474,8 @@ function nt(n, t, u, e, i, g) {
|
|
|
473
474
|
default: l(() => t[11] || (t[11] = [
|
|
474
475
|
L("解构npm包")
|
|
475
476
|
])),
|
|
476
|
-
_: 1
|
|
477
|
+
_: 1,
|
|
478
|
+
__: [11]
|
|
477
479
|
}, 8, ["modelValue"])
|
|
478
480
|
]),
|
|
479
481
|
_: 1
|
|
@@ -496,7 +498,7 @@ function nt(n, t, u, e, i, g) {
|
|
|
496
498
|
prop: "content.instanceName"
|
|
497
499
|
}, {
|
|
498
500
|
default: l(() => [
|
|
499
|
-
a(
|
|
501
|
+
a(y, {
|
|
500
502
|
modelValue: e.state.content.instance,
|
|
501
503
|
"onUpdate:modelValue": t[6] || (t[6] = (c) => e.state.content.instance = c)
|
|
502
504
|
}, null, 8, ["modelValue"])
|
|
@@ -505,7 +507,7 @@ function nt(n, t, u, e, i, g) {
|
|
|
505
507
|
})) : N("", !0),
|
|
506
508
|
a(s, { label: "入口路径" }, {
|
|
507
509
|
default: l(() => [
|
|
508
|
-
a(
|
|
510
|
+
a(y, {
|
|
509
511
|
modelValue: e.state.content.main,
|
|
510
512
|
"onUpdate:modelValue": t[7] || (t[7] = (c) => e.state.content.main = c),
|
|
511
513
|
placeholder: "main"
|
|
@@ -515,7 +517,7 @@ function nt(n, t, u, e, i, g) {
|
|
|
515
517
|
}),
|
|
516
518
|
a(s, { label: "版本号" }, {
|
|
517
519
|
default: l(() => [
|
|
518
|
-
a(
|
|
520
|
+
a(y, {
|
|
519
521
|
modelValue: e.state.content.version,
|
|
520
522
|
"onUpdate:modelValue": t[8] || (t[8] = (c) => e.state.content.version = c),
|
|
521
523
|
placeholder: "latest"
|
|
@@ -530,14 +532,15 @@ function nt(n, t, u, e, i, g) {
|
|
|
530
532
|
], -1)
|
|
531
533
|
])),
|
|
532
534
|
default: l(() => [
|
|
533
|
-
a(
|
|
535
|
+
a(y, {
|
|
534
536
|
modelValue: e.state.content.cdnLink,
|
|
535
537
|
"onUpdate:modelValue": t[9] || (t[9] = (c) => e.state.content.cdnLink = c),
|
|
536
538
|
placeholder: "CDN"
|
|
537
539
|
}, null, 8, ["modelValue"]),
|
|
538
540
|
t[13] || (t[13] = E("div", { class: "tip" }, "浏览器直接可用的生产包链接,请确保可用,否则可能会造成页面预览失败", -1))
|
|
539
541
|
]),
|
|
540
|
-
_: 1
|
|
542
|
+
_: 1,
|
|
543
|
+
__: [13]
|
|
541
544
|
}),
|
|
542
545
|
a(s, { label: "生成utils.js代码预览" }, {
|
|
543
546
|
default: l(() => [
|
|
@@ -575,10 +578,10 @@ const ot = /* @__PURE__ */ J(Xe, [["render", nt], ["__scopeId", "data-v-a30fa265
|
|
|
575
578
|
}
|
|
576
579
|
},
|
|
577
580
|
setup(n, { emit: t }) {
|
|
578
|
-
const u = U(V.Util), e = U(null), i = b(() => Oe[u.value]), { PLUGIN_NAME: g } = te(),
|
|
581
|
+
const u = U(V.Util), e = U(null), i = b(() => Oe[u.value]), { PLUGIN_NAME: g } = te(), _ = M({
|
|
579
582
|
emitEvent: t
|
|
580
583
|
});
|
|
581
|
-
return ce("panelState",
|
|
584
|
+
return ce("panelState", _), {
|
|
582
585
|
PLUGIN_NAME: g,
|
|
583
586
|
addResource: (r) => {
|
|
584
587
|
e.value.add(r);
|
|
@@ -598,7 +601,7 @@ const ot = /* @__PURE__ */ J(Xe, [["render", nt], ["__scopeId", "data-v-a30fa265
|
|
|
598
601
|
}
|
|
599
602
|
};
|
|
600
603
|
function st(n, t, u, e, i, g) {
|
|
601
|
-
const
|
|
604
|
+
const _ = p("svg-button"), o = p("bridge-manage"), R = p("bridge-setting"), v = p("plugin-panel");
|
|
602
605
|
return h(), C(v, {
|
|
603
606
|
title: "资源管理",
|
|
604
607
|
class: "plugin-bridge",
|
|
@@ -607,7 +610,7 @@ function st(n, t, u, e, i, g) {
|
|
|
607
610
|
onClose: e.closePanel
|
|
608
611
|
}, {
|
|
609
612
|
header: l(() => [
|
|
610
|
-
a(
|
|
613
|
+
a(_, {
|
|
611
614
|
name: "add-utils",
|
|
612
615
|
placement: "left",
|
|
613
616
|
tips: e.tips,
|
|
@@ -631,10 +634,10 @@ const rt = /* @__PURE__ */ J(at, [["render", st], ["__scopeId", "data-v-1a60fd05
|
|
|
631
634
|
type: "plugins",
|
|
632
635
|
align: "leftTop",
|
|
633
636
|
icon: "plugin-icon-sresources"
|
|
634
|
-
},
|
|
637
|
+
}, yt = {
|
|
635
638
|
...lt,
|
|
636
639
|
entry: rt
|
|
637
640
|
};
|
|
638
641
|
export {
|
|
639
|
-
|
|
642
|
+
yt as default
|
|
640
643
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/tiny-engine-plugin-bridge",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0-alpha.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"homepage": "https://opentiny.design/tiny-engine",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@opentiny/tiny-engine-common": "2.
|
|
29
|
-
"@opentiny/tiny-engine-meta-register": "2.
|
|
28
|
+
"@opentiny/tiny-engine-common": "2.6.0-alpha.0",
|
|
29
|
+
"@opentiny/tiny-engine-meta-register": "2.6.0-alpha.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.
|
|
32
|
+
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.6.0-alpha.0",
|
|
33
33
|
"@vitejs/plugin-vue": "^5.1.2",
|
|
34
34
|
"@vitejs/plugin-vue-jsx": "^4.0.1",
|
|
35
35
|
"vite": "^5.4.2"
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"@opentiny/vue-icon": "^3.20.0",
|
|
40
40
|
"vue": "^3.4.15"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "91ddb45772ee61d827b3ae02a97d3dc9cd599029"
|
|
43
43
|
}
|