@opentiny/tiny-engine-plugin-bridge 2.1.0-rc.0 → 2.2.0-beta.3

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