@opentiny/tiny-engine-plugin-bridge 2.1.0-rc.0 → 2.1.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/LICENSE +22 -22
- package/dist/index.js +193 -193
- package/dist/style.css +1 -1
- package/package.json +5 -5
package/LICENSE
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 - present TinyEngine Authors.
|
|
4
|
-
Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd.
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
in the Software without restriction, including without limitation the rights
|
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
furnished to do so, subject to the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 - present TinyEngine Authors.
|
|
4
|
+
Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd.
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
|
-
import { reactive as j, ref as k, watchEffect as Z, resolveComponent as m, openBlock as
|
|
3
|
-
import { SearchEmpty as
|
|
4
|
-
import { getMetaApi as b, META_SERVICE as x, useResource as
|
|
5
|
-
import { isVsCodeEnv as
|
|
6
|
-
import { generateBridge as
|
|
7
|
-
import { Search as
|
|
8
|
-
import { iconSearch as
|
|
9
|
-
const
|
|
10
|
-
b(x.Http).get(`/app-center/api/apps/schema/${
|
|
11
|
-
|
|
2
|
+
import { reactive as j, ref as k, watchEffect as Z, resolveComponent as m, openBlock as v, createElementBlock as A, createElementVNode as _, createVNode as s, withCtx as l, Fragment as ee, renderList as te, normalizeClass as ne, withModifiers as K, toDisplayString as U, computed as R, watch as oe, onMounted as ae, createBlock as C, createTextVNode as L, withDirectives as se, vShow as re, createCommentVNode as N, nextTick as le } from "vue";
|
|
3
|
+
import { SearchEmpty as ce, PluginSetting as ie, VueMonaco as de, SvgButton as $, PluginPanel as pe } from "@opentiny/tiny-engine-common";
|
|
4
|
+
import { getMetaApi as b, META_SERVICE as x, useResource as B, useNotify as V, useModal as ue, getMergeMeta as me } from "@opentiny/tiny-engine-meta-register";
|
|
5
|
+
import { isVsCodeEnv as ge } from "@opentiny/tiny-engine-common/js/environments";
|
|
6
|
+
import { generateBridge as ye, generateUtil as fe } from "@opentiny/tiny-engine-common/js/vscodeGenerateFile";
|
|
7
|
+
import { Search as _e, Form as ve, Input as he, Button as Ee, FormItem as Re, Checkbox as Ce, RadioGroup as Ve, Radio as Se } from "@opentiny/vue";
|
|
8
|
+
import { iconSearch as be } from "@opentiny/vue-icon";
|
|
9
|
+
const xe = (n, t) => b(x.Http).get(`/app-center/api/apps/extension/list?app=${n}&category=${t}`), Te = (n) => b(x.Http).post("/app-center/api/apps/extension/create", n), ke = (n) => b(x.Http).post("/app-center/api/apps/extension/update", n), Ne = (n) => b(x.Http).get(`/app-center/api/apps/extension/delete?${n}`), Ue = (n) => {
|
|
10
|
+
b(x.Http).get(`/app-center/api/apps/schema/${n}`).then((t) => {
|
|
11
|
+
ye(t.bridge), fe(t.utils);
|
|
12
12
|
});
|
|
13
|
-
},
|
|
13
|
+
}, c = j({
|
|
14
14
|
actionType: "",
|
|
15
15
|
type: "",
|
|
16
16
|
category: "",
|
|
@@ -30,190 +30,190 @@ const Ne = (t, n) => b(x.Http).get(`/app-center/api/apps/extension/list?app=${t}
|
|
|
30
30
|
destructuring: !0,
|
|
31
31
|
main: ""
|
|
32
32
|
}
|
|
33
|
-
},
|
|
33
|
+
}, Be = {
|
|
34
34
|
name: "",
|
|
35
35
|
type: "function",
|
|
36
36
|
content: {
|
|
37
37
|
type: "JSFunction",
|
|
38
38
|
value: ""
|
|
39
39
|
}
|
|
40
|
-
},
|
|
40
|
+
}, S = {
|
|
41
41
|
Util: "utils",
|
|
42
42
|
Bridge: "bridge"
|
|
43
43
|
}, F = {
|
|
44
44
|
Npm: "npm",
|
|
45
45
|
Function: "function"
|
|
46
|
-
},
|
|
47
|
-
[
|
|
48
|
-
[
|
|
49
|
-
},
|
|
46
|
+
}, Ie = {
|
|
47
|
+
[S.Util]: "新建工具类",
|
|
48
|
+
[S.Bridge]: "新建桥接源"
|
|
49
|
+
}, I = {
|
|
50
50
|
Read: "read",
|
|
51
51
|
Edit: "edit"
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
const
|
|
56
|
-
return
|
|
57
|
-
}, Y = () =>
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
}, P = () =>
|
|
62
|
-
|
|
63
|
-
}, H = (
|
|
64
|
-
|
|
65
|
-
}, q = () =>
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
Y() ===
|
|
52
|
+
}, w = () => b(x.GlobalService).getBaseInfo().id, we = (n) => c.resourceNames[n], Oe = (n, t) => {
|
|
53
|
+
c.resourceNames[n] = t;
|
|
54
|
+
}, Le = (n) => {
|
|
55
|
+
const t = w();
|
|
56
|
+
return xe(t, n);
|
|
57
|
+
}, Y = () => c.actionType, M = (n) => {
|
|
58
|
+
c.actionType = n;
|
|
59
|
+
}, Ae = () => c.resource, G = (n = Q) => {
|
|
60
|
+
n || (n = c.category === F.Function ? Be : Q), c.resource = n;
|
|
61
|
+
}, P = () => c.type, X = (n) => {
|
|
62
|
+
c.type = n;
|
|
63
|
+
}, H = (n) => {
|
|
64
|
+
c.category = n;
|
|
65
|
+
}, q = () => c.category, z = (...n) => {
|
|
66
|
+
ge && Ue(...n);
|
|
67
|
+
}, Fe = (n, t, p) => {
|
|
68
|
+
Y() === I.Edit ? (n.id = c.resource.id, ke(n).then((e) => {
|
|
69
69
|
if (e) {
|
|
70
|
-
const o =
|
|
70
|
+
const o = B().appSchemaState[n.category].findIndex((y) => y.name === e.name);
|
|
71
71
|
if (o === -1) {
|
|
72
|
-
|
|
72
|
+
V({
|
|
73
73
|
type: "error",
|
|
74
74
|
message: "修改失败"
|
|
75
75
|
});
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
B().appSchemaState[n.category][o] = e, z(w()), V({
|
|
79
79
|
type: "success",
|
|
80
80
|
message: "修改成功"
|
|
81
|
-
}), p("refresh",
|
|
81
|
+
}), p("refresh", c.type), c.refresh = !0, t();
|
|
82
82
|
}
|
|
83
|
-
})) :
|
|
84
|
-
e && (
|
|
83
|
+
})) : Te(n).then((e) => {
|
|
84
|
+
e && (B().appSchemaState[n.category].push(e), z(w()), V({
|
|
85
85
|
type: "success",
|
|
86
86
|
message: "创建成功"
|
|
87
|
-
}), p("refresh",
|
|
87
|
+
}), p("refresh", c.type), c.refresh = !0, t());
|
|
88
88
|
});
|
|
89
|
-
},
|
|
89
|
+
}, Pe = (n, t, p) => {
|
|
90
90
|
var o;
|
|
91
|
-
const e = `app=${
|
|
92
|
-
|
|
93
|
-
if (
|
|
94
|
-
const u =
|
|
91
|
+
const e = `app=${w()}&id=${(o = c.resource) == null ? void 0 : o.id}`;
|
|
92
|
+
Ne(e).then((y) => {
|
|
93
|
+
if (y) {
|
|
94
|
+
const u = B().appSchemaState[c.type].findIndex((f) => f.name === y.name);
|
|
95
95
|
if (u === -1) {
|
|
96
|
-
|
|
96
|
+
V({
|
|
97
97
|
type: "error",
|
|
98
98
|
message: "删除失败"
|
|
99
99
|
});
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
|
-
|
|
102
|
+
B().appSchemaState[c.type].splice(u, 1), z(w()), V({
|
|
103
103
|
type: "success",
|
|
104
104
|
message: "删除成功"
|
|
105
|
-
}), p("refresh",
|
|
105
|
+
}), p("refresh", c.type), c.refresh = !0, t();
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
|
-
}, J = (
|
|
109
|
-
const p =
|
|
110
|
-
for (const [e, o] of
|
|
108
|
+
}, J = (n, t) => {
|
|
109
|
+
const p = n.__vccOpts || n;
|
|
110
|
+
for (const [e, o] of t)
|
|
111
111
|
p[e] = o;
|
|
112
112
|
return p;
|
|
113
|
-
},
|
|
113
|
+
}, De = {
|
|
114
114
|
components: {
|
|
115
|
-
TinySearch:
|
|
116
|
-
TinyIconSearch:
|
|
117
|
-
SearchEmpty:
|
|
115
|
+
TinySearch: _e,
|
|
116
|
+
TinyIconSearch: be(),
|
|
117
|
+
SearchEmpty: ce
|
|
118
118
|
},
|
|
119
119
|
props: {
|
|
120
120
|
name: {
|
|
121
121
|
type: String,
|
|
122
|
-
default:
|
|
122
|
+
default: S.Util
|
|
123
123
|
}
|
|
124
124
|
},
|
|
125
125
|
emits: ["open"],
|
|
126
|
-
setup(
|
|
126
|
+
setup(n, { emit: t }) {
|
|
127
127
|
const p = k([]), e = j({
|
|
128
128
|
resourceList: [],
|
|
129
129
|
activeIndex: -1,
|
|
130
130
|
searchValue: ""
|
|
131
|
-
}), o = (a = e.resourceList, i = e.searchValue) => a.filter((r) => r.name.toLowerCase().indexOf(i.toLowerCase()) > -1),
|
|
132
|
-
e.resourceList = await
|
|
131
|
+
}), o = (a = e.resourceList, i = e.searchValue) => a.filter((r) => r.name.toLowerCase().indexOf(i.toLowerCase()) > -1), y = async (a) => {
|
|
132
|
+
e.resourceList = await Le(a), Oe(
|
|
133
133
|
a,
|
|
134
134
|
Array.isArray(e.resourceList) ? e.resourceList.map((i) => i.name) : []
|
|
135
135
|
), p.value = o(e.resourceList);
|
|
136
136
|
};
|
|
137
137
|
return Z(async () => {
|
|
138
|
-
|
|
138
|
+
y(n.name);
|
|
139
139
|
}), {
|
|
140
140
|
state: e,
|
|
141
141
|
list: p,
|
|
142
142
|
add: (a) => {
|
|
143
|
-
M(""), X(
|
|
143
|
+
M(""), X(n.name), G(""), H(a), t("open");
|
|
144
144
|
},
|
|
145
145
|
openRead: (a, i) => {
|
|
146
|
-
e.activeIndex = i, G(a), M(
|
|
146
|
+
e.activeIndex = i, G(a), M(I.Edit), t("open");
|
|
147
147
|
},
|
|
148
148
|
openEdit: (a, i) => {
|
|
149
|
-
e.activeIndex = i, G(a), M(
|
|
149
|
+
e.activeIndex = i, G(a), M(I.Edit), X(n.name), H(a.type), t("open");
|
|
150
150
|
},
|
|
151
|
-
refresh:
|
|
151
|
+
refresh: y,
|
|
152
152
|
getType: P,
|
|
153
|
-
RESOURCE_TYPE:
|
|
153
|
+
RESOURCE_TYPE: S,
|
|
154
154
|
searchBridgeData: (a) => {
|
|
155
155
|
p.value = o(e.resourceList, a);
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
-
},
|
|
160
|
-
function
|
|
161
|
-
const u = m("tiny-icon-search"),
|
|
162
|
-
return
|
|
163
|
-
|
|
164
|
-
s(
|
|
159
|
+
}, Me = { class: "manage-panel" }, Ge = { class: "manage-panel-search" }, qe = { class: "list" }, Ye = ["onClick"], He = { class: "item-label" };
|
|
160
|
+
function ze(n, t, p, e, o, y) {
|
|
161
|
+
const u = m("tiny-icon-search"), f = m("tiny-search"), h = m("svg-icon"), E = m("search-empty");
|
|
162
|
+
return v(), A("div", Me, [
|
|
163
|
+
_("div", Ge, [
|
|
164
|
+
s(f, {
|
|
165
165
|
modelValue: e.state.searchValue,
|
|
166
166
|
"onUpdate:modelValue": [
|
|
167
|
-
|
|
167
|
+
t[0] || (t[0] = (a) => e.state.searchValue = a),
|
|
168
168
|
e.searchBridgeData
|
|
169
169
|
],
|
|
170
170
|
clearable: "",
|
|
171
171
|
placeholder: "搜索"
|
|
172
172
|
}, {
|
|
173
|
-
prefix:
|
|
173
|
+
prefix: l(() => [
|
|
174
174
|
s(u)
|
|
175
175
|
]),
|
|
176
176
|
_: 1
|
|
177
177
|
}, 8, ["modelValue", "onUpdate:modelValue"])
|
|
178
178
|
]),
|
|
179
|
-
|
|
180
|
-
(
|
|
179
|
+
_("div", qe, [
|
|
180
|
+
(v(!0), A(ee, null, te(e.list, (a, i) => (v(), A("div", {
|
|
181
181
|
key: a.name,
|
|
182
|
-
class:
|
|
182
|
+
class: ne(["list-item", i === e.state.activeIndex ? "active" : ""]),
|
|
183
183
|
onClick: K((r) => e.openEdit(a, i), ["stop"])
|
|
184
184
|
}, [
|
|
185
|
-
s(
|
|
186
|
-
|
|
187
|
-
s(
|
|
185
|
+
s(h, { name: "plugin-icon-sresources" }),
|
|
186
|
+
_("div", He, U(a.name), 1),
|
|
187
|
+
s(h, {
|
|
188
188
|
class: "setting-icon",
|
|
189
189
|
name: "setting",
|
|
190
190
|
onClick: K((r) => e.openEdit(a, i), ["stop"])
|
|
191
191
|
}, null, 8, ["onClick"])
|
|
192
|
-
], 10,
|
|
192
|
+
], 10, Ye))), 128)),
|
|
193
193
|
s(E, {
|
|
194
194
|
isShow: !e.list.length
|
|
195
195
|
}, null, 8, ["isShow"])
|
|
196
196
|
])
|
|
197
197
|
]);
|
|
198
198
|
}
|
|
199
|
-
const
|
|
199
|
+
const je = /* @__PURE__ */ J(De, [["render", ze], ["__scopeId", "data-v-f297beff"]]), W = k(!1), Je = () => {
|
|
200
200
|
W.value = !0, le(() => window.dispatchEvent(new Event("resize")));
|
|
201
201
|
}, D = () => {
|
|
202
202
|
W.value = !1;
|
|
203
|
-
},
|
|
203
|
+
}, We = {
|
|
204
204
|
components: {
|
|
205
|
-
TinyForm:
|
|
206
|
-
TinyInput:
|
|
207
|
-
TinyButton:
|
|
208
|
-
TinyFormItem:
|
|
209
|
-
TinyCheckbox:
|
|
210
|
-
PluginSetting:
|
|
211
|
-
MonacoEditor:
|
|
212
|
-
TinyRadioGroup:
|
|
213
|
-
TinyRadio:
|
|
205
|
+
TinyForm: ve,
|
|
206
|
+
TinyInput: he,
|
|
207
|
+
TinyButton: Ee,
|
|
208
|
+
TinyFormItem: Re,
|
|
209
|
+
TinyCheckbox: Ce,
|
|
210
|
+
PluginSetting: ie,
|
|
211
|
+
MonacoEditor: de,
|
|
212
|
+
TinyRadioGroup: Ve,
|
|
213
|
+
TinyRadio: Se,
|
|
214
214
|
SvgButton: $
|
|
215
215
|
},
|
|
216
|
-
setup(
|
|
216
|
+
setup(n, { emit: t }) {
|
|
217
217
|
const p = {
|
|
218
218
|
language: "javascript",
|
|
219
219
|
mouseStyle: "default",
|
|
@@ -221,24 +221,24 @@ const Ke = /* @__PURE__ */ J(qe, [["render", We], ["__scopeId", "data-v-6da3d7ff
|
|
|
221
221
|
// 禁用滚动条边边一直显示的边框
|
|
222
222
|
overviewRulerBorder: !1,
|
|
223
223
|
renderLineHighlightOnlyWhenFocus: !0
|
|
224
|
-
}, { confirm: e } =
|
|
225
|
-
resource: R(() =>
|
|
224
|
+
}, { confirm: e } = ue(), o = j({
|
|
225
|
+
resource: R(() => Ae()),
|
|
226
226
|
name: "",
|
|
227
227
|
value: "",
|
|
228
228
|
content: {},
|
|
229
|
-
status: R(() => Y() ===
|
|
229
|
+
status: R(() => Y() === I.Edit),
|
|
230
230
|
category: R(() => q() === F.Npm),
|
|
231
231
|
mode: R(() => {
|
|
232
232
|
var r;
|
|
233
|
-
return ((r =
|
|
233
|
+
return ((r = me("engine.config")) == null ? void 0 : r.dslMode) !== "Vue";
|
|
234
234
|
}),
|
|
235
235
|
isInstance: !1,
|
|
236
236
|
title: R(() => {
|
|
237
|
-
const r = Y() ===
|
|
237
|
+
const r = Y() === I.Edit ? "编辑" : "添加", g = P() === S.Bridge ? "桥接源" : "工具类";
|
|
238
238
|
return r + g;
|
|
239
239
|
}),
|
|
240
240
|
type: F.Npm
|
|
241
|
-
}),
|
|
241
|
+
}), y = R(() => {
|
|
242
242
|
const r = o.name || "name";
|
|
243
243
|
let g = r;
|
|
244
244
|
o.content.destructuring && (o.name && o.name === o.content.exportName ? g = `{ ${o.content.exportName || "exportName"} }` : g = `{ ${o.content.exportName || "exportName"} as ${r} }`);
|
|
@@ -249,20 +249,20 @@ export { ${r} }`;
|
|
|
249
249
|
Z(() => {
|
|
250
250
|
var r, g;
|
|
251
251
|
o.name = o.resource.name, o.content = o.resource.content || {}, o.value = ((g = (r = o.resource) == null ? void 0 : r.content) == null ? void 0 : g.value) || "", o.type = q();
|
|
252
|
-
}),
|
|
252
|
+
}), oe(
|
|
253
253
|
() => o.isInstance,
|
|
254
254
|
(r) => {
|
|
255
255
|
r || (o.content.instance = "");
|
|
256
256
|
}
|
|
257
257
|
);
|
|
258
|
-
const u = k(null),
|
|
259
|
-
return
|
|
258
|
+
const u = k(null), f = k(null);
|
|
259
|
+
return ae(() => window.dispatchEvent(new Event("resize"))), {
|
|
260
260
|
rules: {
|
|
261
261
|
name: [
|
|
262
262
|
{ required: !0, message: "必填", trigger: "change" },
|
|
263
263
|
{
|
|
264
264
|
validator: (r, g, T) => {
|
|
265
|
-
const O =
|
|
265
|
+
const O = we(P());
|
|
266
266
|
Array.isArray(O) && O.includes(g) ? T(new Error("资源名称已存在")) : T();
|
|
267
267
|
},
|
|
268
268
|
trigger: "change"
|
|
@@ -272,10 +272,10 @@ export { ${r} }`;
|
|
|
272
272
|
"content.exportName": [{ required: !0, message: "必填", trigger: "change" }],
|
|
273
273
|
"content.instanceName": { required: !0, message: "必填", trigger: "change" }
|
|
274
274
|
},
|
|
275
|
-
resourceForm:
|
|
275
|
+
resourceForm: f,
|
|
276
276
|
editor: u,
|
|
277
277
|
state: o,
|
|
278
|
-
codePreview:
|
|
278
|
+
codePreview: y,
|
|
279
279
|
isOpen: W,
|
|
280
280
|
closePanel: D,
|
|
281
281
|
save: () => {
|
|
@@ -289,22 +289,22 @@ export { ${r} }`;
|
|
|
289
289
|
value: u.value.getEditor().getValue()
|
|
290
290
|
}
|
|
291
291
|
};
|
|
292
|
-
|
|
292
|
+
f.value.validate((g) => {
|
|
293
293
|
if (!g) {
|
|
294
|
-
|
|
294
|
+
V({
|
|
295
295
|
type: "error",
|
|
296
296
|
message: "请检查必填项"
|
|
297
297
|
});
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
300
|
if (!o.category && !u.value.getEditor().getValue()) {
|
|
301
|
-
|
|
301
|
+
V({
|
|
302
302
|
type: "error",
|
|
303
303
|
message: "function 内容必填"
|
|
304
304
|
});
|
|
305
305
|
return;
|
|
306
306
|
}
|
|
307
|
-
|
|
307
|
+
Fe(r, D, t);
|
|
308
308
|
});
|
|
309
309
|
},
|
|
310
310
|
deleteReSource: () => {
|
|
@@ -312,7 +312,7 @@ export { ${r} }`;
|
|
|
312
312
|
title: "删除资源",
|
|
313
313
|
message: "如果删除正在使用的资源,将无法正常预览页面,确认要删除吗?",
|
|
314
314
|
exec: () => {
|
|
315
|
-
|
|
315
|
+
Pe(o.name, D, t);
|
|
316
316
|
}
|
|
317
317
|
});
|
|
318
318
|
},
|
|
@@ -323,44 +323,42 @@ export { ${r} }`;
|
|
|
323
323
|
RESOURCE_CATEGORY: F
|
|
324
324
|
};
|
|
325
325
|
}
|
|
326
|
-
},
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
f("div", Ze, [
|
|
334
|
-
f("span", null, U(e.state.title), 1)
|
|
326
|
+
}, Ke = { class: "title-wrap" }, Qe = { class: "header-wrap" }, Xe = { class: "right-item" }, Ze = { key: 2 }, $e = { class: "code-preview" };
|
|
327
|
+
function et(n, t, p, e, o, y) {
|
|
328
|
+
const u = m("tiny-button"), f = m("svg-button"), h = m("tiny-radio"), E = m("tiny-radio-group"), a = m("tiny-form-item"), i = m("tiny-input"), r = m("tiny-checkbox"), g = m("monaco-editor"), T = m("tiny-form"), O = m("plugin-setting");
|
|
329
|
+
return e.isOpen ? (v(), C(O, { key: 0 }, {
|
|
330
|
+
title: l(() => [
|
|
331
|
+
_("div", Ke, [
|
|
332
|
+
_("span", null, U(e.state.title), 1)
|
|
335
333
|
])
|
|
336
334
|
]),
|
|
337
|
-
header:
|
|
338
|
-
|
|
335
|
+
header: l(() => [
|
|
336
|
+
_("div", Qe, [
|
|
339
337
|
s(u, {
|
|
340
338
|
class: "save-btn",
|
|
341
339
|
type: "primary",
|
|
342
340
|
onClick: e.save
|
|
343
341
|
}, {
|
|
344
|
-
default:
|
|
342
|
+
default: l(() => t[10] || (t[10] = [
|
|
345
343
|
L("保存")
|
|
346
|
-
]),
|
|
344
|
+
])),
|
|
347
345
|
_: 1
|
|
348
346
|
}, 8, ["onClick"]),
|
|
349
|
-
|
|
347
|
+
se(s(f, {
|
|
350
348
|
class: "delete-btn",
|
|
351
349
|
name: "delete",
|
|
352
350
|
onClick: e.deleteReSource
|
|
353
351
|
}, null, 8, ["onClick"]), [
|
|
354
|
-
[
|
|
352
|
+
[re, e.state.status]
|
|
355
353
|
]),
|
|
356
|
-
s(
|
|
354
|
+
s(f, {
|
|
357
355
|
class: "close-btn",
|
|
358
356
|
name: "close",
|
|
359
357
|
onClick: e.closePanel
|
|
360
358
|
}, null, 8, ["onClick"])
|
|
361
359
|
])
|
|
362
360
|
]),
|
|
363
|
-
content:
|
|
361
|
+
content: l(() => [
|
|
364
362
|
s(T, {
|
|
365
363
|
ref: "resourceForm",
|
|
366
364
|
class: "resource-form",
|
|
@@ -371,33 +369,33 @@ function st(t, n, p, e, o, _) {
|
|
|
371
369
|
"label-position": "top",
|
|
372
370
|
"label-align": !0
|
|
373
371
|
}, {
|
|
374
|
-
default:
|
|
375
|
-
|
|
376
|
-
e.state.status ? N("", !0) : (
|
|
372
|
+
default: l(() => [
|
|
373
|
+
_("div", Xe, [
|
|
374
|
+
e.state.status ? N("", !0) : (v(), C(a, {
|
|
377
375
|
key: 0,
|
|
378
376
|
label: "工具类型",
|
|
379
377
|
prop: "type"
|
|
380
378
|
}, {
|
|
381
|
-
default:
|
|
379
|
+
default: l(() => [
|
|
382
380
|
s(E, {
|
|
383
381
|
modelValue: e.state.type,
|
|
384
|
-
"onUpdate:modelValue":
|
|
382
|
+
"onUpdate:modelValue": t[0] || (t[0] = (d) => e.state.type = d),
|
|
385
383
|
class: "resource-type-radio-group",
|
|
386
384
|
onChange: e.handleChangeType
|
|
387
385
|
}, {
|
|
388
|
-
default:
|
|
389
|
-
s(
|
|
386
|
+
default: l(() => [
|
|
387
|
+
s(h, {
|
|
390
388
|
label: e.RESOURCE_CATEGORY.Npm
|
|
391
389
|
}, {
|
|
392
|
-
default:
|
|
390
|
+
default: l(() => [
|
|
393
391
|
L(U(e.RESOURCE_CATEGORY.Npm), 1)
|
|
394
392
|
]),
|
|
395
393
|
_: 1
|
|
396
394
|
}, 8, ["label"]),
|
|
397
|
-
s(
|
|
395
|
+
s(h, {
|
|
398
396
|
label: e.RESOURCE_CATEGORY.Function
|
|
399
397
|
}, {
|
|
400
|
-
default:
|
|
398
|
+
default: l(() => [
|
|
401
399
|
L(U(e.RESOURCE_CATEGORY.Function), 1)
|
|
402
400
|
]),
|
|
403
401
|
_: 1
|
|
@@ -408,29 +406,29 @@ function st(t, n, p, e, o, _) {
|
|
|
408
406
|
]),
|
|
409
407
|
_: 1
|
|
410
408
|
})),
|
|
411
|
-
e.state.status ? N("", !0) : (
|
|
409
|
+
e.state.status ? N("", !0) : (v(), C(a, {
|
|
412
410
|
key: 1,
|
|
413
411
|
label: "工具名称",
|
|
414
412
|
prop: "name"
|
|
415
413
|
}, {
|
|
416
|
-
default:
|
|
414
|
+
default: l(() => [
|
|
417
415
|
s(i, {
|
|
418
416
|
modelValue: e.state.name,
|
|
419
|
-
"onUpdate:modelValue":
|
|
417
|
+
"onUpdate:modelValue": t[1] || (t[1] = (d) => e.state.name = d),
|
|
420
418
|
placeholder: "请输入工具类名称"
|
|
421
419
|
}, null, 8, ["modelValue"])
|
|
422
420
|
]),
|
|
423
421
|
_: 1
|
|
424
422
|
})),
|
|
425
|
-
e.state.category ? (
|
|
423
|
+
e.state.category ? (v(), A("div", Ze, [
|
|
426
424
|
s(a, {
|
|
427
425
|
label: "npm包名",
|
|
428
426
|
prop: "content.package"
|
|
429
427
|
}, {
|
|
430
|
-
default:
|
|
428
|
+
default: l(() => [
|
|
431
429
|
s(i, {
|
|
432
430
|
modelValue: e.state.content.package,
|
|
433
|
-
"onUpdate:modelValue":
|
|
431
|
+
"onUpdate:modelValue": t[2] || (t[2] = (d) => e.state.content.package = d),
|
|
434
432
|
placeholder: "请输入npm包名称"
|
|
435
433
|
}, null, 8, ["modelValue"])
|
|
436
434
|
]),
|
|
@@ -440,97 +438,99 @@ function st(t, n, p, e, o, _) {
|
|
|
440
438
|
label: "npm包导出名",
|
|
441
439
|
prop: "content.exportName"
|
|
442
440
|
}, {
|
|
443
|
-
default:
|
|
441
|
+
default: l(() => [
|
|
444
442
|
s(i, {
|
|
445
443
|
modelValue: e.state.content.exportName,
|
|
446
|
-
"onUpdate:modelValue":
|
|
444
|
+
"onUpdate:modelValue": t[3] || (t[3] = (d) => e.state.content.exportName = d),
|
|
447
445
|
placeholder: "请输入npm包的导出名称"
|
|
448
446
|
}, null, 8, ["modelValue"])
|
|
449
447
|
]),
|
|
450
448
|
_: 1
|
|
451
449
|
}),
|
|
452
450
|
s(a, { label: "" }, {
|
|
453
|
-
default:
|
|
451
|
+
default: l(() => [
|
|
454
452
|
s(r, {
|
|
455
453
|
modelValue: e.state.content.destructuring,
|
|
456
|
-
"onUpdate:modelValue":
|
|
454
|
+
"onUpdate:modelValue": t[4] || (t[4] = (d) => e.state.content.destructuring = d)
|
|
457
455
|
}, {
|
|
458
|
-
default:
|
|
456
|
+
default: l(() => t[11] || (t[11] = [
|
|
459
457
|
L("解构npm包")
|
|
460
|
-
]),
|
|
458
|
+
])),
|
|
461
459
|
_: 1
|
|
462
460
|
}, 8, ["modelValue"])
|
|
463
461
|
]),
|
|
464
462
|
_: 1
|
|
465
463
|
}),
|
|
466
|
-
e.state.mode ? (
|
|
464
|
+
e.state.mode ? (v(), C(a, {
|
|
467
465
|
key: 0,
|
|
468
466
|
label: "是否作为实例"
|
|
469
467
|
}, {
|
|
470
|
-
default:
|
|
468
|
+
default: l(() => [
|
|
471
469
|
s(r, {
|
|
472
470
|
modelValue: e.state.isInstance,
|
|
473
|
-
"onUpdate:modelValue":
|
|
471
|
+
"onUpdate:modelValue": t[5] || (t[5] = (d) => e.state.isInstance = d)
|
|
474
472
|
}, null, 8, ["modelValue"])
|
|
475
473
|
]),
|
|
476
474
|
_: 1
|
|
477
475
|
})) : N("", !0),
|
|
478
|
-
e.state.isInstance ? (
|
|
476
|
+
e.state.isInstance ? (v(), C(a, {
|
|
479
477
|
key: 1,
|
|
480
478
|
label: "实例名称",
|
|
481
479
|
prop: "content.instanceName"
|
|
482
480
|
}, {
|
|
483
|
-
default:
|
|
481
|
+
default: l(() => [
|
|
484
482
|
s(i, {
|
|
485
483
|
modelValue: e.state.content.instance,
|
|
486
|
-
"onUpdate:modelValue":
|
|
484
|
+
"onUpdate:modelValue": t[6] || (t[6] = (d) => e.state.content.instance = d)
|
|
487
485
|
}, null, 8, ["modelValue"])
|
|
488
486
|
]),
|
|
489
487
|
_: 1
|
|
490
488
|
})) : N("", !0),
|
|
491
489
|
s(a, { label: "入口路径" }, {
|
|
492
|
-
default:
|
|
490
|
+
default: l(() => [
|
|
493
491
|
s(i, {
|
|
494
492
|
modelValue: e.state.content.main,
|
|
495
|
-
"onUpdate:modelValue":
|
|
493
|
+
"onUpdate:modelValue": t[7] || (t[7] = (d) => e.state.content.main = d),
|
|
496
494
|
placeholder: "main"
|
|
497
495
|
}, null, 8, ["modelValue"])
|
|
498
496
|
]),
|
|
499
497
|
_: 1
|
|
500
498
|
}),
|
|
501
499
|
s(a, { label: "版本号" }, {
|
|
502
|
-
default:
|
|
500
|
+
default: l(() => [
|
|
503
501
|
s(i, {
|
|
504
502
|
modelValue: e.state.content.version,
|
|
505
|
-
"onUpdate:modelValue":
|
|
503
|
+
"onUpdate:modelValue": t[8] || (t[8] = (d) => e.state.content.version = d),
|
|
506
504
|
placeholder: "latest"
|
|
507
505
|
}, null, 8, ["modelValue"])
|
|
508
506
|
]),
|
|
509
507
|
_: 1
|
|
510
508
|
}),
|
|
511
509
|
s(a, null, {
|
|
512
|
-
label:
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
510
|
+
label: l(() => t[12] || (t[12] = [
|
|
511
|
+
_("div", { class: "cdn-label-wrap" }, [
|
|
512
|
+
_("span", null, "CDN")
|
|
513
|
+
], -1)
|
|
514
|
+
])),
|
|
515
|
+
default: l(() => [
|
|
516
516
|
s(i, {
|
|
517
517
|
modelValue: e.state.content.cdnLink,
|
|
518
|
-
"onUpdate:modelValue":
|
|
518
|
+
"onUpdate:modelValue": t[9] || (t[9] = (d) => e.state.content.cdnLink = d),
|
|
519
519
|
placeholder: "CDN"
|
|
520
520
|
}, null, 8, ["modelValue"]),
|
|
521
|
-
|
|
521
|
+
t[13] || (t[13] = _("div", { class: "tip" }, "浏览器直接可用的生产包链接,请确保可用,否则可能会造成页面预览失败", -1))
|
|
522
522
|
]),
|
|
523
523
|
_: 1
|
|
524
524
|
}),
|
|
525
525
|
s(a, { label: "生成utils.js代码预览" }, {
|
|
526
|
-
default:
|
|
527
|
-
|
|
528
|
-
|
|
526
|
+
default: l(() => [
|
|
527
|
+
_("div", $e, [
|
|
528
|
+
_("pre", null, U(e.codePreview), 1)
|
|
529
529
|
])
|
|
530
530
|
]),
|
|
531
531
|
_: 1
|
|
532
532
|
})
|
|
533
|
-
])) : (
|
|
533
|
+
])) : (v(), C(g, {
|
|
534
534
|
key: 3,
|
|
535
535
|
ref: "editor",
|
|
536
536
|
value: e.state.value,
|
|
@@ -545,69 +545,69 @@ function st(t, n, p, e, o, _) {
|
|
|
545
545
|
_: 1
|
|
546
546
|
})) : N("", !0);
|
|
547
547
|
}
|
|
548
|
-
const
|
|
548
|
+
const tt = /* @__PURE__ */ J(We, [["render", et], ["__scopeId", "data-v-0ab8a7ca"]]), nt = {
|
|
549
549
|
components: {
|
|
550
|
-
PluginPanel:
|
|
550
|
+
PluginPanel: pe,
|
|
551
551
|
SvgButton: $,
|
|
552
|
-
BridgeManage:
|
|
553
|
-
BridgeSetting:
|
|
552
|
+
BridgeManage: je,
|
|
553
|
+
BridgeSetting: tt
|
|
554
554
|
},
|
|
555
555
|
setup() {
|
|
556
|
-
const
|
|
556
|
+
const n = k(S.Util), t = k(null), p = R(() => Ie[n.value]);
|
|
557
557
|
return {
|
|
558
558
|
addResource: (u) => {
|
|
559
|
-
|
|
559
|
+
n.value == t.value.add(u);
|
|
560
560
|
},
|
|
561
|
-
RESOURCE_TYPE:
|
|
562
|
-
activedName:
|
|
561
|
+
RESOURCE_TYPE: S,
|
|
562
|
+
activedName: n,
|
|
563
563
|
openBridgePanel: () => {
|
|
564
|
-
|
|
564
|
+
Je();
|
|
565
565
|
},
|
|
566
566
|
closePanel: D,
|
|
567
567
|
refreshList: (u) => {
|
|
568
|
-
u ==
|
|
568
|
+
u == t.value.refresh(u);
|
|
569
569
|
},
|
|
570
|
-
utilsRef:
|
|
570
|
+
utilsRef: t,
|
|
571
571
|
tips: p
|
|
572
572
|
};
|
|
573
573
|
}
|
|
574
574
|
};
|
|
575
|
-
function
|
|
576
|
-
const u = m("svg-button"),
|
|
577
|
-
return
|
|
575
|
+
function ot(n, t, p, e, o, y) {
|
|
576
|
+
const u = m("svg-button"), f = m("bridge-manage"), h = m("bridge-setting"), E = m("plugin-panel");
|
|
577
|
+
return v(), C(E, {
|
|
578
578
|
title: "资源管理",
|
|
579
579
|
isCloseLeft: !1,
|
|
580
580
|
onClose: e.closePanel
|
|
581
581
|
}, {
|
|
582
|
-
header:
|
|
582
|
+
header: l(() => [
|
|
583
583
|
s(u, {
|
|
584
584
|
name: "add-utils",
|
|
585
585
|
placement: "left",
|
|
586
586
|
tips: e.tips,
|
|
587
|
-
onClick:
|
|
587
|
+
onClick: t[0] || (t[0] = (a) => e.addResource("npm"))
|
|
588
588
|
}, null, 8, ["tips"])
|
|
589
589
|
]),
|
|
590
|
-
content:
|
|
591
|
-
s(
|
|
590
|
+
content: l(() => [
|
|
591
|
+
s(f, {
|
|
592
592
|
ref: "utilsRef",
|
|
593
593
|
name: e.RESOURCE_TYPE.Util,
|
|
594
594
|
onOpen: e.openBridgePanel
|
|
595
595
|
}, null, 8, ["name", "onOpen"]),
|
|
596
|
-
s(
|
|
596
|
+
s(h, { onRefresh: e.refreshList }, null, 8, ["onRefresh"])
|
|
597
597
|
]),
|
|
598
598
|
_: 1
|
|
599
599
|
}, 8, ["onClose"]);
|
|
600
600
|
}
|
|
601
|
-
const
|
|
601
|
+
const at = /* @__PURE__ */ J(nt, [["render", ot], ["__scopeId", "data-v-c14cfd0a"]]), st = {
|
|
602
602
|
id: "engine.plugins.bridge",
|
|
603
603
|
title: "资源管理",
|
|
604
604
|
type: "plugins",
|
|
605
605
|
align: "top",
|
|
606
606
|
icon: "plugin-icon-sresources"
|
|
607
|
-
},
|
|
608
|
-
...
|
|
609
|
-
entry:
|
|
607
|
+
}, gt = {
|
|
608
|
+
...st,
|
|
609
|
+
entry: at
|
|
610
610
|
};
|
|
611
611
|
export {
|
|
612
|
-
|
|
612
|
+
gt as default
|
|
613
613
|
};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.manage-panel[data-v-
|
|
1
|
+
.manage-panel[data-v-f297beff]{height:100%;display:flex;flex-direction:column;position:relative}.manage-panel .manage-panel-search[data-v-f297beff]{padding:0 12px 12px}.manage-panel .add-button[data-v-f297beff]{align-self:flex-end;margin:6px}.manage-panel .list[data-v-f297beff]{flex:1;border-top:1px solid var(--ti-lowcode-tabs-border-color);overflow:auto;padding:12px 0}.manage-panel .list-item[data-v-f297beff]{height:24px;line-height:24px;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-f297beff]:hover,.manage-panel .list-item.active[data-v-f297beff]{background:var(--ti-lowcode-bridge-list-bg)}.manage-panel .list-item:hover .setting-icon[data-v-f297beff],.manage-panel .list-item.active .setting-icon[data-v-f297beff]{display:block}.manage-panel .list-item .setting-icon[data-v-f297beff]{display:none;color:var(--ti-lowcode-toolbar-more-hover-color)}.plugin-setting[data-v-0ab8a7ca] .icon-wrap{margin-right:8px}.plugin-setting .resource-form .tip[data-v-0ab8a7ca]{font-size:11px;line-height:18px;margin-top:8px;color:var(--ti-lowcode-datasource-tip-color)}.plugin-setting .resource-form[data-v-0ab8a7ca] .tiny-form-item__label .cdn-tips-icon{margin-left:4px}.plugin-setting .title-wrap[data-v-0ab8a7ca]{font-size:12px;font-weight:700;color:var(--te-common-text-primary)}.plugin-setting .title-wrap .help-link[data-v-0ab8a7ca]{display:inline-block;color:var(--ti-lowcode-common-primary-color);font-size:12px;margin-left:16px}.plugin-setting .title-wrap .help-link[data-v-0ab8a7ca]:hover{text-decoration:underline}.plugin-setting .header-wrap[data-v-0ab8a7ca]{display:flex;align-items:center;column-gap:6px}.plugin-setting .header-wrap .tiny-button[data-v-0ab8a7ca]{width:40px;padding:0;min-width:40px;margin-right:2px}.plugin-setting .monaco-editor[data-v-0ab8a7ca]{height:500px;margin-top:8px;border:1px solid var(--ti-lowcode-birdge-editor-border-color)}.plugin-setting .resource-form-footer[data-v-0ab8a7ca]{padding:12px 0 12px 80px}.plugin-setting .resource-form-footer .tiny-svg[data-v-0ab8a7ca]{margin-right:6px}.plugin-setting .resource-form-footer .del[data-v-0ab8a7ca]:hover{background-color:var(--ti-lowcode-delete-button-hover-bg)}.plugin-setting .cdn-label-wrap[data-v-0ab8a7ca]{display:flex;align-items:center}.code-preview[data-v-0ab8a7ca]{font-size:12px;line-height:20px;background:var(--te-common-bg-container);color:var(--te-common-text-weaken);border-radius:4px}.code-preview .pre-title[data-v-0ab8a7ca]{font-family:Microsoft YaHei}.code-preview>pre[data-v-0ab8a7ca]{margin:0;padding:8px 20px;font-family:Consolas,Courier New,monospace}[data-v-c14cfd0a] .tiny-button{border-radius:4px;height:24px;line-height:24px}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/tiny-engine-plugin-bridge",
|
|
3
|
-
"version": "2.1.0
|
|
3
|
+
"version": "2.1.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.1.0
|
|
29
|
-
"@opentiny/tiny-engine-meta-register": "2.1.0
|
|
28
|
+
"@opentiny/tiny-engine-common": "2.1.0",
|
|
29
|
+
"@opentiny/tiny-engine-meta-register": "2.1.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.1.0
|
|
32
|
+
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.1.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.14.0",
|
|
40
40
|
"vue": "^3.4.15"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "faf3072c75ea5024689972e2a687916e084c156f"
|
|
43
43
|
}
|