@vtj/renderer 0.9.2 → 0.9.4
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.cjs +7 -7
- package/dist/index.mjs +306 -273
- package/package.json +6 -6
- package/types/components/Startup.d.ts +1 -1
- package/types/provider/apis.d.ts +2 -1
- package/types/provider/provider.d.ts +1 -0
- package/types/version.d.ts +3 -3
package/dist/index.mjs
CHANGED
@@ -1,19 +1,20 @@
|
|
1
|
-
import { Base as Ae, BUILT_IN_COMPONENTS as Te, ProjectModel as
|
2
|
-
import { isUrl as Ie, url as
|
3
|
-
import * as
|
4
|
-
import { inject as he, toRef as ze, readonly as Ke, customRef as We, ref as
|
5
|
-
import { ElNotification as
|
1
|
+
import { Base as Ae, BUILT_IN_COMPONENTS as Te, ProjectModel as O, HistoryModel as de } from "@vtj/core";
|
2
|
+
import { isUrl as Ie, url as P, dedupArray as Me, isString as j, isFunction as K, logger as x, createRequest as De, merge as He, pathToRegexp as Oe, pathToRegexpMatch as Be, formDataToJson as Ne, storage as q, cookie as J, toArray as ie, unRSA as ae, delay as fe, camelCase as $, upperFirst as Ue, pick as Le, jsonp as qe, loadScript as ce, Request as Je, Storage as Ve, mapToObject as X } from "@vtj/utils";
|
3
|
+
import * as N from "vue";
|
4
|
+
import { inject as he, toRef as ze, readonly as Ke, customRef as We, ref as A, onBeforeUnmount as Ge, getCurrentScope as Ye, onScopeDispose as Qe, getCurrentInstance as me, watch as ge, computed as ve, toValue as Z, onMounted as Xe, defineComponent as ee, h as W, openBlock as Ze, createElementBlock as et, createElementVNode as k, toDisplayString as V, defineAsyncComponent as le, watchEffect as tt } from "vue";
|
5
|
+
import { ElNotification as U, ElLoading as st } from "element-plus";
|
6
|
+
import E from "mockjs";
|
6
7
|
import { useRoute as ye } from "vue-router";
|
7
8
|
/**!
|
8
|
-
* Copyright (c)
|
9
|
+
* Copyright (c) 2025, VTJ.PRO All rights reserved.
|
9
10
|
* @name @vtj/renderer
|
10
11
|
* @author CHC chenhuachun1549@dingtalk.com
|
11
|
-
* @version 0.9.
|
12
|
+
* @version 0.9.4
|
12
13
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
13
14
|
*/
|
14
|
-
const
|
15
|
+
const C = "0.9.4";
|
15
16
|
var y = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(y || {});
|
16
|
-
const
|
17
|
+
const ue = [
|
17
18
|
"$el",
|
18
19
|
"$emit",
|
19
20
|
"$nextTick",
|
@@ -25,7 +26,7 @@ const le = [
|
|
25
26
|
"$props",
|
26
27
|
"$options",
|
27
28
|
"$forceUpdate"
|
28
|
-
],
|
29
|
+
], As = [
|
29
30
|
"beforeCreate",
|
30
31
|
"created",
|
31
32
|
"beforeMount",
|
@@ -39,14 +40,14 @@ const le = [
|
|
39
40
|
"renderTriggered",
|
40
41
|
"activated",
|
41
42
|
"deactivated"
|
42
|
-
],
|
43
|
+
], nt = [
|
43
44
|
"vIf",
|
44
45
|
"vShow",
|
45
46
|
"vModel",
|
46
47
|
"vFor",
|
47
48
|
"vBind",
|
48
49
|
"vHtml"
|
49
|
-
],
|
50
|
+
], rt = {
|
50
51
|
String,
|
51
52
|
Number,
|
52
53
|
Boolean,
|
@@ -54,54 +55,54 @@ const le = [
|
|
54
55
|
Object,
|
55
56
|
Function,
|
56
57
|
Date
|
57
|
-
},
|
58
|
+
}, F = "VtjPage", H = "VtjHomepage", ot = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot".split(
|
58
59
|
","
|
59
|
-
),
|
60
|
-
function
|
60
|
+
), it = "component,slot".split(",");
|
61
|
+
function M(n, e) {
|
61
62
|
return n.map((t) => Ie(t) || t.startsWith("/") ? t : `${e}${t}`);
|
62
63
|
}
|
63
|
-
function
|
64
|
+
function te(n) {
|
64
65
|
return /\.css$/.test(n);
|
65
66
|
}
|
66
|
-
function
|
67
|
+
function se(n) {
|
67
68
|
return /\.js$/.test(n);
|
68
69
|
}
|
69
|
-
function
|
70
|
+
function at(n) {
|
70
71
|
return /\.json$/.test(n);
|
71
72
|
}
|
72
|
-
function
|
73
|
+
function Ts(n) {
|
73
74
|
return n.map(
|
74
|
-
(e) => `<script src="${
|
75
|
+
(e) => `<script src="${P.append(e, { v: C })}"><\/script>`
|
75
76
|
).join("");
|
76
77
|
}
|
77
|
-
function
|
78
|
+
function Is(n = []) {
|
78
79
|
return n.map(
|
79
|
-
(e) => `<link rel="stylesheet" href="${
|
80
|
+
(e) => `<link rel="stylesheet" href="${P.append(e, { v: C })}" />`
|
80
81
|
).join("");
|
81
82
|
}
|
82
|
-
function
|
83
|
+
function ct(n, e = !1) {
|
83
84
|
return e && n.endsWith(".prod.js") ? n.replace(".prod.js", ".js") : n;
|
84
85
|
}
|
85
|
-
function
|
86
|
+
function lt(n, e, t = !1) {
|
86
87
|
const s = n.filter((p) => !!p.enabled), r = [], o = [], a = [], i = [], c = {}, l = {}, f = [], u = {};
|
87
88
|
return s.forEach(
|
88
89
|
({ urls: p, assetsUrl: h, library: m, assetsLibrary: d, localeLibrary: w }) => {
|
89
90
|
p?.forEach((g) => {
|
90
|
-
|
91
|
-
}), m && (i.push(m), c[m] =
|
91
|
+
se(g) && r.push(ct(g, t)), te(g) && o.push(g);
|
92
|
+
}), m && (i.push(m), c[m] = M(p || [], e), w && (l[m] = w)), h && a.push(h), d && f.push(d), m && d && (u[d] = m);
|
92
93
|
}
|
93
94
|
), {
|
94
|
-
scripts:
|
95
|
-
css:
|
96
|
-
materials:
|
95
|
+
scripts: M(r, e),
|
96
|
+
css: M(o, e),
|
97
|
+
materials: M(a, e),
|
97
98
|
libraryExports: i,
|
98
|
-
materialExports:
|
99
|
+
materialExports: Me(f),
|
99
100
|
materialMapLibrary: u,
|
100
101
|
libraryMap: c,
|
101
102
|
libraryLocaleMap: l
|
102
103
|
};
|
103
104
|
}
|
104
|
-
function
|
105
|
+
function ut(n, e) {
|
105
106
|
const { name: t, parent: s, alias: r } = n;
|
106
107
|
return s ? e[s]?.[r || t] : e[r || t];
|
107
108
|
}
|
@@ -123,11 +124,11 @@ function we(n, e, t) {
|
|
123
124
|
o ? o.innerHTML = t : (o = r.createElement("style"), o.id = e, o.innerHTML = t, r.head.appendChild(o));
|
124
125
|
}
|
125
126
|
}
|
126
|
-
async function
|
127
|
+
async function pt(n, e) {
|
127
128
|
const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
|
128
129
|
t && we(window, n, t);
|
129
130
|
}
|
130
|
-
function
|
131
|
+
function dt(n, e = window) {
|
131
132
|
const t = e.document, s = e.document.head;
|
132
133
|
for (const r of n)
|
133
134
|
if (!t.getElementById(r)) {
|
@@ -135,7 +136,7 @@ function ft(n, e = window) {
|
|
135
136
|
a.rel = "stylesheet", a.id = r, a.href = r, s.appendChild(a);
|
136
137
|
}
|
137
138
|
}
|
138
|
-
async function
|
139
|
+
async function ft(n, e, t = window) {
|
139
140
|
const s = t.document, r = t.document.head;
|
140
141
|
let o = t[e];
|
141
142
|
return o ? o.default || o : new Promise((a, i) => {
|
@@ -149,16 +150,16 @@ async function ht(n, e, t = window) {
|
|
149
150
|
}
|
150
151
|
});
|
151
152
|
}
|
152
|
-
function
|
153
|
+
function ht(n) {
|
153
154
|
return K(n) || K(n?.install);
|
154
155
|
}
|
155
|
-
function
|
156
|
-
return at.includes(n);
|
157
|
-
}
|
158
|
-
function vt(n) {
|
156
|
+
function mt(n) {
|
159
157
|
return it.includes(n);
|
160
158
|
}
|
161
|
-
function
|
159
|
+
function gt(n) {
|
160
|
+
return ot.includes(n);
|
161
|
+
}
|
162
|
+
function T(n, e, t = !1, s = !1) {
|
162
163
|
try {
|
163
164
|
const r = ['"use strict";', "var __self = arguments[0];"];
|
164
165
|
r.push("return ");
|
@@ -168,13 +169,13 @@ function A(n, e, t = !1, s = !1) {
|
|
168
169
|
const a = `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
|
169
170
|
return new Function("$scope", a)(e);
|
170
171
|
} catch (r) {
|
171
|
-
if (
|
172
|
+
if (x.error("parseExpression.error", r, n, e?.__self ?? e), s)
|
172
173
|
throw r;
|
173
174
|
}
|
174
175
|
}
|
175
|
-
function
|
176
|
-
const r =
|
177
|
-
if (typeof r != "function" && (
|
176
|
+
function G(n, e, t = !1, s = !1) {
|
177
|
+
const r = T(n, e, t, s);
|
178
|
+
if (typeof r != "function" && (x.error(
|
178
179
|
"parseFunction.error",
|
179
180
|
"not a function",
|
180
181
|
n,
|
@@ -186,17 +187,17 @@ function ue(n, e, t = !1, s = !1) {
|
|
186
187
|
function _(n) {
|
187
188
|
return n && n.type === "JSExpression";
|
188
189
|
}
|
189
|
-
function
|
190
|
+
function I(n) {
|
190
191
|
return typeof n == "object" && n && n.type === "JSFunction";
|
191
192
|
}
|
192
|
-
function
|
193
|
-
return _(n) ||
|
193
|
+
function vt(n) {
|
194
|
+
return _(n) || I(n);
|
194
195
|
}
|
195
|
-
function
|
196
|
-
return
|
196
|
+
function Ms(n) {
|
197
|
+
return vt(n) ? n.value : JSON.stringify(n);
|
197
198
|
}
|
198
199
|
let R = null;
|
199
|
-
const
|
200
|
+
const yt = De({
|
200
201
|
settings: {
|
201
202
|
type: "form",
|
202
203
|
validSuccess: !0,
|
@@ -205,12 +206,12 @@ const _t = He({
|
|
205
206
|
validate: (n) => n.data?.code === 0 || !!n.data?.success,
|
206
207
|
failMessage: !0,
|
207
208
|
showError: (n) => {
|
208
|
-
|
209
|
+
U.error({
|
209
210
|
message: n || "未知错误"
|
210
211
|
});
|
211
212
|
},
|
212
213
|
showLoading: () => {
|
213
|
-
R && R.close(), R =
|
214
|
+
R && R.close(), R = st.service({
|
214
215
|
lock: !0,
|
215
216
|
text: "Loading",
|
216
217
|
background: "rgba(0, 0, 0, 0.05)"
|
@@ -221,8 +222,7 @@ const _t = He({
|
|
221
222
|
}
|
222
223
|
}
|
223
224
|
});
|
224
|
-
|
225
|
-
function wt(n, e) {
|
225
|
+
function _t(n, e) {
|
226
226
|
const { jsonp: t, request: s } = e;
|
227
227
|
if (n.method === "jsonp")
|
228
228
|
return (r = {}) => t(n.url, {
|
@@ -230,7 +230,7 @@ function wt(n, e) {
|
|
230
230
|
query: r
|
231
231
|
});
|
232
232
|
{
|
233
|
-
const r = n.headers ?
|
233
|
+
const r = n.headers ? T(n.headers, {}, !0) : void 0, o = {
|
234
234
|
url: n.url,
|
235
235
|
method: n.method,
|
236
236
|
settings: {
|
@@ -238,10 +238,10 @@ function wt(n, e) {
|
|
238
238
|
headers: r
|
239
239
|
}
|
240
240
|
};
|
241
|
-
return (a, i) => (delete o.data, s.send(
|
241
|
+
return (a, i) => (delete o.data, s.send(He(o, i || {}, { data: a })));
|
242
242
|
}
|
243
243
|
}
|
244
|
-
function
|
244
|
+
function wt(n, e) {
|
245
245
|
const { metaQuery: t } = e;
|
246
246
|
if (!t) return;
|
247
247
|
const { code: s, queryCode: r } = n;
|
@@ -253,32 +253,43 @@ function St(n, e) {
|
|
253
253
|
return t(s, r, o, a);
|
254
254
|
};
|
255
255
|
}
|
256
|
-
function
|
256
|
+
function St(n = [], e = [], t) {
|
257
257
|
const s = {};
|
258
258
|
for (const r of n)
|
259
|
-
s[r.id] =
|
259
|
+
s[r.id] = _t(r, t);
|
260
260
|
for (const r of e)
|
261
|
-
s[r.id] =
|
261
|
+
s[r.id] = wt(r, t);
|
262
262
|
return s;
|
263
263
|
}
|
264
|
-
async function
|
265
|
-
|
266
|
-
|
267
|
-
|
264
|
+
async function bt(n = []) {
|
265
|
+
E && (Se(), n.forEach((e) => $t(E, e)));
|
266
|
+
}
|
267
|
+
function jt(n) {
|
268
|
+
const e = I(n.mockTemplate) && n.mockTemplate.value ? G(n.mockTemplate, {}, !0) : void 0;
|
269
|
+
return async (...t) => {
|
270
|
+
let s = {};
|
271
|
+
if (e)
|
272
|
+
try {
|
273
|
+
s = await e.apply(e, t);
|
274
|
+
} catch (r) {
|
275
|
+
x.warn("模拟数据模版异常", r);
|
276
|
+
}
|
277
|
+
return E.mock(s);
|
278
|
+
};
|
268
279
|
}
|
269
280
|
function $t(n, e) {
|
270
281
|
if (!e.mock) return;
|
271
282
|
const { url: t, mockTemplate: s } = e;
|
272
283
|
if (t && s) {
|
273
|
-
const r = Oe(`${t}(.*)`), o = Be(t, { decode: decodeURIComponent }), a =
|
284
|
+
const r = Oe(`${t}(.*)`), o = Be(t, { decode: decodeURIComponent }), a = T(s, {}, !0);
|
274
285
|
n.mock(r, (i) => {
|
275
|
-
const c =
|
286
|
+
const c = P.parse(i.url) || {}, l = i.body instanceof FormData ? Ne(i.body) : i.body, f = o(i.url)?.params;
|
276
287
|
return Object.assign(i, { data: l, params: c, query: f }), n.mock(a(i));
|
277
288
|
});
|
278
289
|
}
|
279
290
|
}
|
280
291
|
function Se() {
|
281
|
-
|
292
|
+
E && (E._mocked = {});
|
282
293
|
}
|
283
294
|
const Et = {
|
284
295
|
session: !1,
|
@@ -293,7 +304,7 @@ const Et = {
|
|
293
304
|
noPermissionMessage: "无权限访问该页面",
|
294
305
|
appName: ""
|
295
306
|
}, be = Symbol("access");
|
296
|
-
class
|
307
|
+
class Ds {
|
297
308
|
options;
|
298
309
|
data = null;
|
299
310
|
mode = y.Raw;
|
@@ -329,11 +340,11 @@ class Is {
|
|
329
340
|
}
|
330
341
|
can(e) {
|
331
342
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
332
|
-
return typeof e == "function" ? e(s) :
|
343
|
+
return typeof e == "function" ? e(s) : ie(e).every((o) => s[o] || s[t + "." + o]);
|
333
344
|
}
|
334
345
|
some(e) {
|
335
346
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
336
|
-
return
|
347
|
+
return ie(e).some((o) => s[o] || s[t + "." + o]);
|
337
348
|
}
|
338
349
|
install(e) {
|
339
350
|
e.config.globalProperties.$access || (e.config.globalProperties.$access = this), e.provide(be, this);
|
@@ -357,13 +368,13 @@ class Is {
|
|
357
368
|
setData(e) {
|
358
369
|
const { privateKey: t } = this.options;
|
359
370
|
if (Array.isArray(e) && t) {
|
360
|
-
const s = e.map((r) =>
|
371
|
+
const s = e.map((r) => ae(r, t));
|
361
372
|
this.data = JSON.parse(s.join(""));
|
362
373
|
return;
|
363
374
|
}
|
364
375
|
if (typeof e == "string")
|
365
376
|
try {
|
366
|
-
const s = t ?
|
377
|
+
const s = t ? ae(e, t) : e;
|
367
378
|
s ? this.data = JSON.parse(s) : console.warn("RSA解密失败或登录信息缺失");
|
368
379
|
} catch (s) {
|
369
380
|
console.warn(s);
|
@@ -383,7 +394,7 @@ class Is {
|
|
383
394
|
return e && t ? !!J.get(t) : !!this.getToken();
|
384
395
|
}
|
385
396
|
hasRoutePermission(e) {
|
386
|
-
if (e.name ===
|
397
|
+
if (e.name === F) {
|
387
398
|
const t = e.params.id;
|
388
399
|
return t && this.can(t);
|
389
400
|
}
|
@@ -434,10 +445,10 @@ class Is {
|
|
434
445
|
);
|
435
446
|
}
|
436
447
|
}
|
437
|
-
function
|
448
|
+
function kt() {
|
438
449
|
return he(be, null);
|
439
450
|
}
|
440
|
-
class
|
451
|
+
class Rt {
|
441
452
|
__id = null;
|
442
453
|
__mode;
|
443
454
|
__instance = null;
|
@@ -466,7 +477,7 @@ class Pt {
|
|
466
477
|
const { mode: t, dsl: s, attrs: r } = e;
|
467
478
|
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), r && Object.assign(this, r);
|
468
479
|
}
|
469
|
-
setup(e, t =
|
480
|
+
setup(e, t = N) {
|
470
481
|
const s = t.getCurrentInstance();
|
471
482
|
if (!s) return;
|
472
483
|
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = s.proxy;
|
@@ -480,12 +491,12 @@ class Pt {
|
|
480
491
|
});
|
481
492
|
}
|
482
493
|
__proxy() {
|
483
|
-
this.__instance &&
|
494
|
+
this.__instance && ue.forEach((e) => {
|
484
495
|
this[e] = this.__instance?.[e];
|
485
496
|
});
|
486
497
|
}
|
487
498
|
__cleanup() {
|
488
|
-
|
499
|
+
ue.forEach((e) => {
|
489
500
|
this[e] = null;
|
490
501
|
});
|
491
502
|
}
|
@@ -493,17 +504,17 @@ class Pt {
|
|
493
504
|
if (e)
|
494
505
|
if (this.__mode === y.Runtime) {
|
495
506
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
496
|
-
return
|
507
|
+
return G({ type: s, value: r }, this);
|
497
508
|
} else
|
498
|
-
return
|
509
|
+
return G(e, this);
|
499
510
|
}
|
500
511
|
__parseExpression(e) {
|
501
512
|
if (e)
|
502
513
|
if (this.__mode === y.Runtime) {
|
503
514
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
504
|
-
return
|
515
|
+
return T({ type: s, value: r }, this);
|
505
516
|
} else
|
506
|
-
return
|
517
|
+
return T(e, this);
|
507
518
|
}
|
508
519
|
__ref(e = null, t) {
|
509
520
|
if (this.__mode !== y.VNode)
|
@@ -535,9 +546,9 @@ class Pt {
|
|
535
546
|
return s.context.__proto__ = this.context, s.__proto__ = this, s;
|
536
547
|
}
|
537
548
|
}
|
538
|
-
function
|
549
|
+
function Y(n) {
|
539
550
|
const {
|
540
|
-
Vue: e =
|
551
|
+
Vue: e = N,
|
541
552
|
mode: t = y.Runtime,
|
542
553
|
components: s = {},
|
543
554
|
libs: r = {},
|
@@ -547,14 +558,14 @@ function G(n) {
|
|
547
558
|
$components: s,
|
548
559
|
$libs: r,
|
549
560
|
$apis: o
|
550
|
-
}, l = new
|
561
|
+
}, l = new Rt({
|
551
562
|
mode: t,
|
552
563
|
dsl: i.value,
|
553
564
|
attrs: c
|
554
565
|
}), f = e.defineComponent({
|
555
566
|
name: i.value.name,
|
556
567
|
props: {
|
557
|
-
...
|
568
|
+
...xt(i.value.props ?? [], l)
|
558
569
|
},
|
559
570
|
setup(u) {
|
560
571
|
l.$props = u, l.props = u, i.value.id && we(
|
@@ -571,29 +582,29 @@ function G(n) {
|
|
571
582
|
...h,
|
572
583
|
...d
|
573
584
|
};
|
574
|
-
return l.setup(w, e),
|
585
|
+
return l.setup(w, e), Mt(e, i.value.watch ?? [], l), {
|
575
586
|
vtj: l
|
576
587
|
};
|
577
588
|
},
|
578
|
-
emits:
|
589
|
+
emits: Pt(i.value.emits),
|
579
590
|
expose: ["vtj"],
|
580
591
|
render() {
|
581
592
|
if (!i.value.nodes) return null;
|
582
593
|
const u = i.value.nodes || [];
|
583
|
-
return u.length === 1 ?
|
594
|
+
return u.length === 1 ? B(u[0], l, e, a) : u.map((p) => B(p, l, e, a));
|
584
595
|
},
|
585
|
-
...
|
596
|
+
...Dt(i.value.lifeCycles ?? {}, l)
|
586
597
|
});
|
587
598
|
return {
|
588
599
|
renderer: e.markRaw(f),
|
589
600
|
context: l
|
590
601
|
};
|
591
602
|
}
|
592
|
-
function
|
603
|
+
function Pt(n = []) {
|
593
604
|
return n.map((e) => j(e) ? e : e.name);
|
594
605
|
}
|
595
|
-
function
|
596
|
-
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) =>
|
606
|
+
function xt(n = [], e) {
|
607
|
+
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => rt[o]) : void 0;
|
597
608
|
return n.map((s) => j(s) ? {
|
598
609
|
name: s
|
599
610
|
} : {
|
@@ -615,7 +626,7 @@ function Ct(n, e, t) {
|
|
615
626
|
Object.keys(e || {}).reduce(
|
616
627
|
(s, r) => {
|
617
628
|
let o = e[r];
|
618
|
-
return _(o) ? o = t.__parseExpression(o) :
|
629
|
+
return _(o) ? o = t.__parseExpression(o) : I(o) && (o = t.__parseFunction(o)), s[r] = o, s;
|
619
630
|
},
|
620
631
|
{}
|
621
632
|
)
|
@@ -647,16 +658,22 @@ function Tt(n, e = [], t) {
|
|
647
658
|
function It(n, e) {
|
648
659
|
return Object.keys(n).reduce(
|
649
660
|
(t, s) => {
|
650
|
-
const r = n[s]
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
661
|
+
const r = n[s];
|
662
|
+
if (r.type === "mock")
|
663
|
+
t[s] = jt(r);
|
664
|
+
else if (r.ref) {
|
665
|
+
const o = e.$apis[r.ref], a = I(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
666
|
+
t[s] = async (...i) => {
|
667
|
+
const c = await o.apply(e, i);
|
668
|
+
return a ? a(c) : c;
|
669
|
+
};
|
670
|
+
}
|
671
|
+
return t;
|
655
672
|
},
|
656
673
|
{}
|
657
674
|
);
|
658
675
|
}
|
659
|
-
function
|
676
|
+
function Mt(n, e = [], t) {
|
660
677
|
e.forEach((s) => {
|
661
678
|
n.watch(
|
662
679
|
t.__parseExpression(s.source),
|
@@ -668,50 +685,50 @@ function Dt(n, e = [], t) {
|
|
668
685
|
);
|
669
686
|
});
|
670
687
|
}
|
671
|
-
function
|
688
|
+
function Dt(n, e) {
|
672
689
|
return Object.entries(n ?? {}).reduce(
|
673
690
|
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
674
691
|
{}
|
675
692
|
);
|
676
693
|
}
|
677
694
|
let z = [];
|
678
|
-
const
|
695
|
+
const Ht = (n) => n;
|
679
696
|
async function je(n, e = window) {
|
680
|
-
const { urls: t = [], library: s } = n, r = t.filter((i) =>
|
697
|
+
const { urls: t = [], library: s } = n, r = t.filter((i) => se(i));
|
681
698
|
if (r.length === 0 || !s) return null;
|
682
|
-
const o = t.filter((i) =>
|
683
|
-
return o.length &&
|
699
|
+
const o = t.filter((i) => te(i));
|
700
|
+
return o.length && dt(o, e), await ft(r, s, e).catch(
|
684
701
|
(i) => (console.warn("loadScriptUrl error", r, s, i), null)
|
685
702
|
);
|
686
703
|
}
|
687
|
-
function
|
704
|
+
function Q(n) {
|
688
705
|
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
689
706
|
return s.window && (z.forEach((r) => {
|
690
707
|
delete s.window[r];
|
691
|
-
}), z = []), (r, o, a =
|
708
|
+
}), z = []), (r, o, a = N) => !o || typeof o == "string" ? r : o.type === "Schema" && o.id ? a.defineAsyncComponent(async () => {
|
692
709
|
const i = await e(o.id);
|
693
|
-
return i && (i.name = r), i ?
|
710
|
+
return i && (i.name = r), i ? Y({
|
694
711
|
...s,
|
695
712
|
Vue: a,
|
696
713
|
dsl: i,
|
697
714
|
mode: y.Runtime,
|
698
|
-
loader:
|
715
|
+
loader: Q(n)
|
699
716
|
}).renderer : null;
|
700
717
|
}) : o.type === "UrlSchema" && o.url ? a.defineAsyncComponent(async () => {
|
701
718
|
const i = await t(o.url);
|
702
|
-
return i && (i.name = r), i ?
|
719
|
+
return i && (i.name = r), i ? Y({
|
703
720
|
...s,
|
704
721
|
Vue: a,
|
705
722
|
dsl: i,
|
706
723
|
mode: y.Runtime,
|
707
|
-
loader:
|
724
|
+
loader: Q(n)
|
708
725
|
}).renderer : null;
|
709
726
|
}) : o.type === "Plugin" ? (o.library && z.push(o.library), a.defineAsyncComponent(async () => {
|
710
727
|
const i = await je(o, s.window);
|
711
728
|
return i || (console.warn("getPlugin result is null", o), null);
|
712
729
|
})) : r;
|
713
730
|
}
|
714
|
-
function
|
731
|
+
function B(n, e, t = N, s = Ht) {
|
715
732
|
if (!n || !n.name || n.invisible) return null;
|
716
733
|
const r = t.getCurrentInstance()?.appContext, { id: o = null, directives: a = [] } = n, { vIf: i, vFor: c, vShow: l, vModels: f, vBind: u, vHtml: p, others: h } = Bt(a);
|
717
734
|
if (i && !Nt(i, e))
|
@@ -722,7 +739,7 @@ function O(n, e, t = B, s = Mt) {
|
|
722
739
|
return Ut(d, n.props?.is);
|
723
740
|
if (n.name === "slot") return n.name;
|
724
741
|
const b = s(n.name, n.from, t);
|
725
|
-
return j(b) ?
|
742
|
+
return j(b) ? mt(b) || gt(b) ? b : w[b] ?? r?.app?.component(b) ?? b : b;
|
726
743
|
})(), S = Lt(o, n.props ?? {}, d), Ce = qt(t, n.events ?? {}, d);
|
727
744
|
if (n.name === "slot")
|
728
745
|
return Jt(t, n, S, d, s);
|
@@ -740,8 +757,8 @@ function O(n, e, t = B, s = Mt) {
|
|
740
757
|
n
|
741
758
|
);
|
742
759
|
let L = t.createVNode(g, { ...S, ...Ce }, Fe);
|
743
|
-
const
|
744
|
-
return
|
760
|
+
const oe = r ? Ot(r, h, d) : [];
|
761
|
+
return oe.length && (L = t.withDirectives(L, oe)), L;
|
745
762
|
};
|
746
763
|
return c ? Xt(c, m, e) : m(e);
|
747
764
|
}
|
@@ -758,7 +775,7 @@ function Bt(n = []) {
|
|
758
775
|
const e = n.find((c) => $(c.name) === "vIf"), t = n.find((c) => $(c.name) === "vFor"), s = n.find((c) => $(c.name) === "vShow"), r = n.find((c) => $(c.name) === "vBind"), o = n.find((c) => $(c.name) === "vHtml"), a = n.filter(
|
759
776
|
(c) => $(c.name) === "vModel"
|
760
777
|
), i = n.filter(
|
761
|
-
(c) => !
|
778
|
+
(c) => !nt.includes($(c.name))
|
762
779
|
);
|
763
780
|
return {
|
764
781
|
vIf: e,
|
@@ -780,7 +797,7 @@ function Lt(n, e, t) {
|
|
780
797
|
const s = Object.keys(e || {}).reduce(
|
781
798
|
(r, o) => {
|
782
799
|
let a = e[o];
|
783
|
-
return _(a) ? a = t.__parseExpression(a) :
|
800
|
+
return _(a) ? a = t.__parseExpression(a) : I(a) && (a = t.__parseFunction(a)), r[o] = a, r;
|
784
801
|
},
|
785
802
|
{}
|
786
803
|
);
|
@@ -809,7 +826,7 @@ function Jt(n, e, t, s, r) {
|
|
809
826
|
return i ? i(t) : o ? j(o) ? n.createTextVNode(o) : _(o) ? n.createTextVNode(
|
810
827
|
_e(s.__parseExpression(o))
|
811
828
|
) : Array.isArray(o) ? o.map(
|
812
|
-
(c) =>
|
829
|
+
(c) => B(c, s, n, r)
|
813
830
|
) : null : null;
|
814
831
|
}
|
815
832
|
function Vt(n, e) {
|
@@ -858,7 +875,7 @@ function Gt(n, e, t, s, r) {
|
|
858
875
|
return Object.entries(o).reduce((i, [c, { nodes: l, params: f }]) => (i[c] = (u) => {
|
859
876
|
const p = f.length ? Le(u ?? {}, f) : a(u);
|
860
877
|
return l.map(
|
861
|
-
(h) =>
|
878
|
+
(h) => B(h, t.__clone(p), n, s)
|
862
879
|
);
|
863
880
|
}, i), {});
|
864
881
|
}
|
@@ -891,9 +908,6 @@ function Xt(n, e, t) {
|
|
891
908
|
function Zt(n) {
|
892
909
|
return Ye() ? (Qe(n), !0) : !1;
|
893
910
|
}
|
894
|
-
function te(n) {
|
895
|
-
return typeof n == "function" ? n() : Xe(n);
|
896
|
-
}
|
897
911
|
const Ee = typeof window < "u" && typeof document < "u";
|
898
912
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
899
913
|
const es = (n) => n != null, ts = () => {
|
@@ -901,38 +915,41 @@ const es = (n) => n != null, ts = () => {
|
|
901
915
|
function ss(n) {
|
902
916
|
return me();
|
903
917
|
}
|
904
|
-
function ns(
|
918
|
+
function ns(n) {
|
919
|
+
return Array.isArray(n) ? n : [n];
|
920
|
+
}
|
921
|
+
function rs(...n) {
|
905
922
|
if (n.length !== 1)
|
906
923
|
return ze(...n);
|
907
924
|
const e = n[0];
|
908
|
-
return typeof e == "function" ? Ke(We(() => ({ get: e, set: ts }))) :
|
925
|
+
return typeof e == "function" ? Ke(We(() => ({ get: e, set: ts }))) : A(e);
|
909
926
|
}
|
910
|
-
function
|
927
|
+
function os(n, e) {
|
911
928
|
ss() && Ge(n, e);
|
912
929
|
}
|
913
|
-
const
|
914
|
-
function
|
930
|
+
const is = Ee ? window : void 0, as = Ee ? window.document : void 0;
|
931
|
+
function cs(n) {
|
915
932
|
var e;
|
916
|
-
const t =
|
933
|
+
const t = Z(n);
|
917
934
|
return (e = t?.$el) != null ? e : t;
|
918
935
|
}
|
919
|
-
function
|
920
|
-
const n =
|
921
|
-
return e &&
|
936
|
+
function ls() {
|
937
|
+
const n = A(!1), e = me();
|
938
|
+
return e && Xe(() => {
|
922
939
|
n.value = !0;
|
923
940
|
}, e), n;
|
924
941
|
}
|
925
|
-
function
|
926
|
-
const e =
|
942
|
+
function us(n) {
|
943
|
+
const e = ls();
|
927
944
|
return ve(() => (e.value, !!n()));
|
928
945
|
}
|
929
|
-
function
|
930
|
-
const { window: s =
|
946
|
+
function ps(n, e, t = {}) {
|
947
|
+
const { window: s = is, ...r } = t;
|
931
948
|
let o;
|
932
|
-
const a =
|
949
|
+
const a = us(() => s && "MutationObserver" in s), i = () => {
|
933
950
|
o && (o.disconnect(), o = void 0);
|
934
951
|
}, c = ve(() => {
|
935
|
-
const p =
|
952
|
+
const p = Z(n), h = ns(p).map(cs).filter(es);
|
936
953
|
return new Set(h);
|
937
954
|
}), l = ge(
|
938
955
|
() => c.value,
|
@@ -949,17 +966,17 @@ function us(n, e, t = {}) {
|
|
949
966
|
takeRecords: f
|
950
967
|
};
|
951
968
|
}
|
952
|
-
function
|
969
|
+
function ds(n = null, e = {}) {
|
953
970
|
var t, s, r;
|
954
971
|
const {
|
955
|
-
document: o =
|
972
|
+
document: o = as,
|
956
973
|
restoreOnUnmount: a = (u) => u
|
957
|
-
} = e, i = (t = o?.title) != null ? t : "", c =
|
974
|
+
} = e, i = (t = o?.title) != null ? t : "", c = rs((s = n ?? o?.title) != null ? s : null), l = n && typeof n == "function";
|
958
975
|
function f(u) {
|
959
976
|
if (!("titleTemplate" in e))
|
960
977
|
return u;
|
961
978
|
const p = e.titleTemplate || "%s";
|
962
|
-
return typeof p == "function" ? p(u) :
|
979
|
+
return typeof p == "function" ? p(u) : Z(p).replace(/%s/g, u);
|
963
980
|
}
|
964
981
|
return ge(
|
965
982
|
c,
|
@@ -967,24 +984,24 @@ function ps(n = null, e = {}) {
|
|
967
984
|
u !== p && o && (o.title = f(typeof u == "string" ? u : ""));
|
968
985
|
},
|
969
986
|
{ immediate: !0 }
|
970
|
-
), e.observe && !e.titleTemplate && o && !l &&
|
987
|
+
), e.observe && !e.titleTemplate && o && !l && ps(
|
971
988
|
(r = o.head) == null ? void 0 : r.querySelector("title"),
|
972
989
|
() => {
|
973
990
|
o && o.title !== c.value && (c.value = f(o.title));
|
974
991
|
},
|
975
992
|
{ childList: !0 }
|
976
|
-
),
|
993
|
+
), os(() => {
|
977
994
|
if (a) {
|
978
995
|
const u = a(i, c.value || "");
|
979
996
|
u != null && o && (o.title = u);
|
980
997
|
}
|
981
998
|
}), c;
|
982
999
|
}
|
983
|
-
const pe =
|
1000
|
+
const pe = ee({
|
984
1001
|
name: "VtjPageContainer",
|
985
1002
|
async setup() {
|
986
|
-
const n =
|
987
|
-
return s && (Object.assign(e.meta, s.meta || {}, { cache: s.cache }),
|
1003
|
+
const n = Re(), e = ye(), t = e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null, o = A(Symbol());
|
1004
|
+
return s && (Object.assign(e.meta, s.meta || {}, { cache: s.cache }), ds(s.title || "VTJ")), {
|
988
1005
|
provider: n,
|
989
1006
|
component: r,
|
990
1007
|
file: s,
|
@@ -1001,22 +1018,22 @@ const pe = X({
|
|
1001
1018
|
activated() {
|
1002
1019
|
this.meta.cache === !1 && (this.sid = Symbol());
|
1003
1020
|
}
|
1004
|
-
}),
|
1021
|
+
}), fs = {
|
1005
1022
|
"data-l-h6o7ki7": "",
|
1006
1023
|
class: "vtj-startup__wrapper"
|
1007
|
-
},
|
1024
|
+
}, hs = {
|
1008
1025
|
"data-l-h6o7ki7": "",
|
1009
1026
|
class: "vtj-startup"
|
1010
|
-
},
|
1027
|
+
}, ms = {
|
1011
1028
|
"data-l-h6o7ki7": "",
|
1012
1029
|
class: "vtj-startup__name"
|
1013
|
-
},
|
1030
|
+
}, gs = { "data-l-h6o7ki7": "" }, vs = {
|
1014
1031
|
"data-l-h6o7ki7": "",
|
1015
1032
|
class: "vtj-startup__tagline"
|
1016
|
-
},
|
1033
|
+
}, ys = {
|
1017
1034
|
"data-l-h6o7ki7": "",
|
1018
1035
|
class: "vtj-startup__actions"
|
1019
|
-
},
|
1036
|
+
}, _s = /* @__PURE__ */ ee({
|
1020
1037
|
__name: "Startup",
|
1021
1038
|
props: {
|
1022
1039
|
name: { default: "VTJ.PRO" },
|
@@ -1104,14 +1121,14 @@ const pe = X({
|
|
1104
1121
|
window.location.href = o;
|
1105
1122
|
}
|
1106
1123
|
};
|
1107
|
-
return (r, o) => (
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1124
|
+
return (r, o) => (Ze(), et("div", fs, [
|
1125
|
+
k("div", hs, [
|
1126
|
+
k("h1", ms, [
|
1127
|
+
k("span", gs, V(t.name), 1)
|
1111
1128
|
]),
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1129
|
+
k("div", vs, V(t.tagline), 1),
|
1130
|
+
k("div", ys, [
|
1131
|
+
k("button", {
|
1115
1132
|
"data-l-h6o7ki7": "",
|
1116
1133
|
onClick: s
|
1117
1134
|
}, V(t.actionText), 1)
|
@@ -1119,14 +1136,14 @@ const pe = X({
|
|
1119
1136
|
])
|
1120
1137
|
]));
|
1121
1138
|
}
|
1122
|
-
}),
|
1139
|
+
}), ws = ee({
|
1123
1140
|
name: "VtjStartupContainer",
|
1124
1141
|
render() {
|
1125
|
-
return W(
|
1142
|
+
return W(_s);
|
1126
1143
|
}
|
1127
|
-
}),
|
1128
|
-
var
|
1129
|
-
class
|
1144
|
+
}), ke = Symbol("Provider");
|
1145
|
+
var Ss = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(Ss || {});
|
1146
|
+
class bs extends Ae {
|
1130
1147
|
constructor(e) {
|
1131
1148
|
super(), this.options = e;
|
1132
1149
|
const {
|
@@ -1145,13 +1162,16 @@ class Ss extends Ae {
|
|
1145
1162
|
} = e;
|
1146
1163
|
this.mode = s, this.modules = l, this.service = t, this.router = f, this.materialPath = u, this.nodeEnv = p, r && (this.dependencies = r), o && (this.materials = o), Object.assign(this.globals, c), Object.assign(this.adapter, i);
|
1147
1164
|
const { access: h, request: m } = this.adapter;
|
1148
|
-
h && h.connect({ mode: s, router: f, request: m }), a && s !== y.Design ? this.load(a) : this.project = a
|
1165
|
+
h && h.connect({ mode: s, router: f, request: m }), a && s !== y.Design ? this.load(a) : this.project = a, E.setup({
|
1166
|
+
timeout: "50-500"
|
1167
|
+
});
|
1149
1168
|
}
|
1150
1169
|
mode;
|
1151
1170
|
globals = {};
|
1152
1171
|
modules = {};
|
1153
|
-
adapter = { request:
|
1172
|
+
adapter = { request: yt, jsonp: qe };
|
1154
1173
|
apis = {};
|
1174
|
+
// public createMock: typeof createMock = createMock;
|
1155
1175
|
dependencies = {};
|
1156
1176
|
materials = {};
|
1157
1177
|
library = {};
|
@@ -1162,12 +1182,24 @@ class Ss extends Ae {
|
|
1162
1182
|
router = null;
|
1163
1183
|
materialPath = "./";
|
1164
1184
|
urlDslCaches = {};
|
1185
|
+
createMock(e) {
|
1186
|
+
return async (...t) => {
|
1187
|
+
let s = {};
|
1188
|
+
if (e)
|
1189
|
+
try {
|
1190
|
+
s = await e.apply(e, t);
|
1191
|
+
} catch (r) {
|
1192
|
+
x.warn("模拟数据模版异常", r);
|
1193
|
+
}
|
1194
|
+
return E.mock(s);
|
1195
|
+
};
|
1196
|
+
}
|
1165
1197
|
async load(e) {
|
1166
1198
|
const t = this.modules[`.vtj/projects/${e.id}.json`];
|
1167
1199
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
1168
1200
|
throw new Error("project is null");
|
1169
1201
|
const { apis: s = [], meta: r = [] } = this.project, o = window;
|
1170
|
-
o.CKEDITOR_VERSION = void 0, this.mode === y.Raw ? await this.loadDependencies(o) : await this.loadAssets(o), this.apis =
|
1202
|
+
o.CKEDITOR_VERSION = void 0, this.mode === y.Raw ? await this.loadDependencies(o) : await this.loadAssets(o), this.apis = St(s, r, this.adapter), Se(), bt(s), this.initRouter(), this.triggerReady();
|
1171
1203
|
}
|
1172
1204
|
async loadDependencies(e) {
|
1173
1205
|
const t = Object.entries(this.dependencies);
|
@@ -1181,7 +1213,7 @@ class Ss extends Ae {
|
|
1181
1213
|
materials: f,
|
1182
1214
|
materialExports: u,
|
1183
1215
|
materialMapLibrary: p
|
1184
|
-
} =
|
1216
|
+
} = lt(
|
1185
1217
|
t,
|
1186
1218
|
a,
|
1187
1219
|
i === "development"
|
@@ -1196,13 +1228,13 @@ class Ss extends Ae {
|
|
1196
1228
|
else {
|
1197
1229
|
const w = l[h] || [];
|
1198
1230
|
for (const g of w)
|
1199
|
-
|
1231
|
+
te(g) && await pt(h, P.append(g, { v: C })), se(g) && await ce(P.append(g, { v: C }));
|
1200
1232
|
r[h] = e[h];
|
1201
1233
|
}
|
1202
1234
|
}
|
1203
1235
|
if (i === "development") {
|
1204
1236
|
for (const m of f)
|
1205
|
-
await
|
1237
|
+
await ce(P.append(m, { v: C }));
|
1206
1238
|
const h = this.materials || {};
|
1207
1239
|
for (const m of u) {
|
1208
1240
|
const d = e[p[m]], w = Te[m];
|
@@ -1213,7 +1245,7 @@ class Ss extends Ae {
|
|
1213
1245
|
else {
|
1214
1246
|
const g = h[m] ? (await h[m]()).default : e[m];
|
1215
1247
|
g && d && (g.components || []).forEach((S) => {
|
1216
|
-
o[S.name] =
|
1248
|
+
o[S.name] = ut(S, d);
|
1217
1249
|
});
|
1218
1250
|
}
|
1219
1251
|
}
|
@@ -1224,21 +1256,21 @@ class Ss extends Ae {
|
|
1224
1256
|
if (!e) return;
|
1225
1257
|
const { routeAppendTo: o, pageRouteName: a = "page", routeMeta: i } = s, c = o ? "" : "/", l = {
|
1226
1258
|
path: `${c}${a}/:id`,
|
1227
|
-
name:
|
1259
|
+
name: F,
|
1228
1260
|
component: pe
|
1229
1261
|
}, f = {
|
1230
1262
|
path: c,
|
1231
|
-
name:
|
1232
|
-
component: t?.homepage ? pe : r.startupComponent ||
|
1263
|
+
name: H,
|
1264
|
+
component: t?.homepage ? pe : r.startupComponent || ws,
|
1233
1265
|
meta: i
|
1234
1266
|
};
|
1235
|
-
e.hasRoute(
|
1267
|
+
e.hasRoute(F) && e.removeRoute(F), e.hasRoute(H) && e.removeRoute(H), o ? (e.addRoute(o, l), e.addRoute(o, f)) : (e.addRoute(l), e.addRoute(f));
|
1236
1268
|
}
|
1237
1269
|
install(e) {
|
1238
1270
|
const t = e.config.globalProperties.installed || {};
|
1239
1271
|
for (const [s, r] of Object.entries(this.library))
|
1240
|
-
!t[s] &&
|
1241
|
-
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(
|
1272
|
+
!t[s] && ht(r) && (e.use(r), t[s] = !0);
|
1273
|
+
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(ke, this), e.config.globalProperties.installed = t, this.mode === y.Design && (e.config.errorHandler = (s, r, o) => {
|
1242
1274
|
const a = r?.$options.name, i = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", c = `[ ${a} ] ${i} ${o}`;
|
1243
1275
|
console.error(
|
1244
1276
|
"[VTJ Error]:",
|
@@ -1248,7 +1280,7 @@ class Ss extends Ae {
|
|
1248
1280
|
info: o
|
1249
1281
|
},
|
1250
1282
|
s?.stack
|
1251
|
-
),
|
1283
|
+
), U.error({
|
1252
1284
|
title: "未处理的异常:请在控制台查看详情",
|
1253
1285
|
message: c
|
1254
1286
|
});
|
@@ -1300,12 +1332,12 @@ class Ss extends Ae {
|
|
1300
1332
|
apis: a,
|
1301
1333
|
window,
|
1302
1334
|
...t
|
1303
|
-
}, c =
|
1335
|
+
}, c = Q({
|
1304
1336
|
getDsl: async (l) => await this.getDsl(l) || null,
|
1305
1337
|
getDslByUrl: async (l) => await this.getDslByUrl(l) || null,
|
1306
1338
|
options: i
|
1307
1339
|
});
|
1308
|
-
return
|
1340
|
+
return Y({
|
1309
1341
|
...i,
|
1310
1342
|
dsl: e,
|
1311
1343
|
loader: c
|
@@ -1314,40 +1346,40 @@ class Ss extends Ae {
|
|
1314
1346
|
async getRenderComponent(e, t) {
|
1315
1347
|
const s = this.getFile(e);
|
1316
1348
|
if (!s)
|
1317
|
-
return
|
1349
|
+
return x.warn(`Can not find file: ${e}`), null;
|
1318
1350
|
t && t(s);
|
1319
1351
|
const r = `.vtj/vue/${e}.vue`, o = this.modules[r];
|
1320
1352
|
if (o)
|
1321
1353
|
return (await o())?.default;
|
1322
1354
|
const a = await this.getDsl(s.id);
|
1323
|
-
return a ? this.createDslRenderer(a).renderer : (
|
1355
|
+
return a ? this.createDslRenderer(a).renderer : (x.warn(`Can not find dsl: ${e}`), null);
|
1324
1356
|
}
|
1325
1357
|
defineUrlSchemaComponent(e, t) {
|
1326
|
-
return
|
1358
|
+
return le(async () => {
|
1327
1359
|
const s = await this.getDslByUrl(e);
|
1328
1360
|
return s ? (s.name = t || s.name, this.createDslRenderer(s).renderer) : null;
|
1329
1361
|
});
|
1330
1362
|
}
|
1331
1363
|
definePluginComponent(e) {
|
1332
|
-
return
|
1364
|
+
return le(async () => await je(e, window));
|
1333
1365
|
}
|
1334
1366
|
}
|
1335
|
-
function
|
1336
|
-
const e = new
|
1367
|
+
function Hs(n) {
|
1368
|
+
const e = new bs(n);
|
1337
1369
|
return {
|
1338
1370
|
provider: e,
|
1339
1371
|
onReady: (s) => e.ready(s)
|
1340
1372
|
};
|
1341
1373
|
}
|
1342
|
-
function
|
1343
|
-
const e = he(
|
1374
|
+
function Re(n = {}) {
|
1375
|
+
const e = he(ke);
|
1344
1376
|
if (!e)
|
1345
1377
|
throw new Error("Can not find provider");
|
1346
1378
|
if (e.nodeEnv === "development") {
|
1347
1379
|
const { id: t, version: s } = n;
|
1348
1380
|
t && s && (async () => {
|
1349
1381
|
const r = await e.getDsl(t);
|
1350
|
-
r?.__VERSION__ !== s &&
|
1382
|
+
r?.__VERSION__ !== s && U.warning({
|
1351
1383
|
title: r?.name,
|
1352
1384
|
message: "当前组件源码版本与运行时版本不一致,请重新发布组件"
|
1353
1385
|
});
|
@@ -1355,7 +1387,7 @@ function Pe(n = {}) {
|
|
1355
1387
|
}
|
1356
1388
|
return e;
|
1357
1389
|
}
|
1358
|
-
const
|
1390
|
+
const ne = new Je({
|
1359
1391
|
settings: {
|
1360
1392
|
type: "json",
|
1361
1393
|
validSuccess: !0,
|
@@ -1363,12 +1395,12 @@ const se = new Je({
|
|
1363
1395
|
failMessage: !0,
|
1364
1396
|
validate: (n) => n.data?.code === 0,
|
1365
1397
|
showError: (n) => {
|
1366
|
-
|
1398
|
+
U.error({
|
1367
1399
|
message: n || "未知错误"
|
1368
1400
|
});
|
1369
1401
|
}
|
1370
1402
|
}
|
1371
|
-
}),
|
1403
|
+
}), js = (n = "/__vtj__/api/:type.json") => (e, t) => ne.send({
|
1372
1404
|
url: n,
|
1373
1405
|
method: "post",
|
1374
1406
|
params: { type: e },
|
@@ -1376,7 +1408,7 @@ const se = new Je({
|
|
1376
1408
|
type: e,
|
1377
1409
|
data: t
|
1378
1410
|
}
|
1379
|
-
}),
|
1411
|
+
}), $s = (n = "/__vtj__/api/uploader.json") => async (e, t) => await ne.send({
|
1380
1412
|
url: n,
|
1381
1413
|
method: "post",
|
1382
1414
|
data: {
|
@@ -1387,12 +1419,12 @@ const se = new Je({
|
|
1387
1419
|
type: "data"
|
1388
1420
|
}
|
1389
1421
|
}).then((s) => s && s[0] ? s[0] : null).catch(() => null);
|
1390
|
-
class
|
1422
|
+
class re {
|
1391
1423
|
api;
|
1392
1424
|
pluginCaches = {};
|
1393
1425
|
uploader;
|
1394
1426
|
constructor() {
|
1395
|
-
this.api =
|
1427
|
+
this.api = js(), this.uploader = $s();
|
1396
1428
|
}
|
1397
1429
|
async getExtension() {
|
1398
1430
|
console.log("BaseService.getExtension");
|
@@ -1465,10 +1497,10 @@ class ne {
|
|
1465
1497
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
1466
1498
|
}
|
1467
1499
|
async getPluginMaterial(e) {
|
1468
|
-
const { urls: t = [] } = e, s = t.filter((o) =>
|
1500
|
+
const { urls: t = [] } = e, s = t.filter((o) => at(o))[0];
|
1469
1501
|
if (!s) return null;
|
1470
1502
|
const r = this.pluginCaches[s];
|
1471
|
-
return r || (this.pluginCaches[s] =
|
1503
|
+
return r || (this.pluginCaches[s] = ne.send({
|
1472
1504
|
url: s,
|
1473
1505
|
method: "get",
|
1474
1506
|
settings: {
|
@@ -1486,17 +1518,17 @@ const v = new Ve({
|
|
1486
1518
|
expired: 0,
|
1487
1519
|
prefix: "__VTJ_"
|
1488
1520
|
});
|
1489
|
-
class
|
1521
|
+
class Os extends re {
|
1490
1522
|
init(e) {
|
1491
|
-
const t = new
|
1523
|
+
const t = new O(e), s = v.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
1492
1524
|
return v.save(`project_${t.id}`, r), Promise.resolve(r);
|
1493
1525
|
}
|
1494
1526
|
saveProject(e) {
|
1495
|
-
const t = new
|
1527
|
+
const t = new O(e);
|
1496
1528
|
return v.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
1497
1529
|
}
|
1498
1530
|
saveMaterials(e, t) {
|
1499
|
-
return v.save(`materials_${e.id}`,
|
1531
|
+
return v.save(`materials_${e.id}`, X(t)), Promise.resolve(!0);
|
1500
1532
|
}
|
1501
1533
|
saveFile(e) {
|
1502
1534
|
return v.save(`file_${e.id}`, e), Promise.resolve(!0);
|
@@ -1536,22 +1568,22 @@ class Hs extends ne {
|
|
1536
1568
|
}), Promise.resolve(!0);
|
1537
1569
|
}
|
1538
1570
|
}
|
1539
|
-
class
|
1571
|
+
class Es extends re {
|
1540
1572
|
projects = {};
|
1541
1573
|
materials = {};
|
1542
1574
|
files = {};
|
1543
1575
|
histories = {};
|
1544
1576
|
historyItems = {};
|
1545
1577
|
init(e) {
|
1546
|
-
const t = new
|
1578
|
+
const t = new O(e), s = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), s);
|
1547
1579
|
return this.projects[r.id] = r, Promise.resolve(r);
|
1548
1580
|
}
|
1549
1581
|
saveProject(e) {
|
1550
|
-
const t = new
|
1582
|
+
const t = new O(e);
|
1551
1583
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
1552
1584
|
}
|
1553
1585
|
saveMaterials(e, t) {
|
1554
|
-
return e.id && (this.materials[e.id] =
|
1586
|
+
return e.id && (this.materials[e.id] = X(t)), Promise.resolve(!0);
|
1555
1587
|
}
|
1556
1588
|
saveFile(e) {
|
1557
1589
|
return this.files[e.id] = e, Promise.resolve(!0);
|
@@ -1593,11 +1625,11 @@ class $s extends ne {
|
|
1593
1625
|
}), Promise.resolve(!0);
|
1594
1626
|
}
|
1595
1627
|
}
|
1596
|
-
let
|
1597
|
-
function
|
1598
|
-
return
|
1628
|
+
let D = null;
|
1629
|
+
function Bs() {
|
1630
|
+
return D || (D = new Es(), D);
|
1599
1631
|
}
|
1600
|
-
class
|
1632
|
+
class Ns extends re {
|
1601
1633
|
getFileCaches = {};
|
1602
1634
|
async getExtension() {
|
1603
1635
|
return await this.api("getExtension", {}).catch(() => {
|
@@ -1612,7 +1644,7 @@ class Os extends ne {
|
|
1612
1644
|
async saveMaterials(e, t) {
|
1613
1645
|
return !!await this.api("saveMaterials", {
|
1614
1646
|
project: e,
|
1615
|
-
materials:
|
1647
|
+
materials: X(t)
|
1616
1648
|
}).catch(() => !1);
|
1617
1649
|
}
|
1618
1650
|
async saveFile(e) {
|
@@ -1652,7 +1684,7 @@ class Os extends ne {
|
|
1652
1684
|
);
|
1653
1685
|
}
|
1654
1686
|
}
|
1655
|
-
function
|
1687
|
+
function Pe(n, e, t = []) {
|
1656
1688
|
return t.map((s) => {
|
1657
1689
|
const { id: r, title: o, icon: a, children: i, hidden: c } = s;
|
1658
1690
|
return {
|
@@ -1661,39 +1693,39 @@ function xe(n, e, t = []) {
|
|
1661
1693
|
icon: a,
|
1662
1694
|
hidden: c,
|
1663
1695
|
url: `${n}/${e}/${r}`,
|
1664
|
-
children: i && i.length ?
|
1696
|
+
children: i && i.length ? Pe(n, e, i) : void 0
|
1665
1697
|
};
|
1666
1698
|
});
|
1667
1699
|
}
|
1668
|
-
function
|
1700
|
+
function xe(n, e) {
|
1669
1701
|
if (!e) return n;
|
1670
1702
|
let t = [];
|
1671
1703
|
for (const s of n)
|
1672
1704
|
if (s.children && s.children.length) {
|
1673
|
-
const r =
|
1705
|
+
const r = xe(s.children, e);
|
1674
1706
|
r.length && (s.children = r, t.push(s));
|
1675
1707
|
} else
|
1676
1708
|
e.can(s.id.toString()) && t.push(s);
|
1677
1709
|
return t;
|
1678
1710
|
}
|
1679
|
-
function
|
1711
|
+
function Us(n) {
|
1680
1712
|
const {
|
1681
1713
|
menuPathPrefix: e = "",
|
1682
1714
|
pageRouteName: t = "page",
|
1683
1715
|
disableMenusFilter: s = !1
|
1684
|
-
} = n || {}, r =
|
1685
|
-
|
1716
|
+
} = n || {}, r = Re(), o = ye(), a = kt(), i = A(!1), c = A(!1), l = r.project;
|
1717
|
+
tt(() => {
|
1686
1718
|
const { name: p, params: h, meta: m } = o;
|
1687
|
-
if (p ===
|
1719
|
+
if (p === F) {
|
1688
1720
|
const d = r.getPage(h.id);
|
1689
1721
|
i.value = !d?.mask, c.value = !!d?.pure;
|
1690
|
-
} else if (p ===
|
1722
|
+
} else if (p === H) {
|
1691
1723
|
const d = r.getHomepage();
|
1692
1724
|
i.value = !d?.mask, c.value = !!d?.pure;
|
1693
1725
|
} else
|
1694
1726
|
i.value = !m.mask, c.value = !!m.pure;
|
1695
1727
|
});
|
1696
|
-
const f =
|
1728
|
+
const f = Pe(
|
1697
1729
|
e,
|
1698
1730
|
t,
|
1699
1731
|
l?.pages
|
@@ -1703,71 +1735,72 @@ function Bs(n) {
|
|
1703
1735
|
logo: u?.logo,
|
1704
1736
|
themeSwitchable: u?.themeSwitchable,
|
1705
1737
|
title: u?.title || l?.description || l?.name || "VTJ App",
|
1706
|
-
menus: s ? f :
|
1738
|
+
menus: s ? f : xe(f, a),
|
1707
1739
|
pure: c
|
1708
1740
|
};
|
1709
1741
|
}
|
1710
1742
|
export {
|
1711
1743
|
be as ACCESS_KEY,
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1744
|
+
Ds as Access,
|
1745
|
+
it as BUILD_IN_TAGS,
|
1746
|
+
nt as BUILT_IN_DIRECTIVES,
|
1747
|
+
re as BaseService,
|
1748
|
+
ue as CONTEXT_HOST,
|
1749
|
+
Rt as Context,
|
1718
1750
|
y as ContextMode,
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1751
|
+
rt as DATA_TYPES,
|
1752
|
+
H as HOMEPAGE_ROUTE_NAME,
|
1753
|
+
ot as HTML_TAGS,
|
1754
|
+
Ms as JSCodeToString,
|
1755
|
+
As as LIFE_CYCLES_LIST,
|
1756
|
+
Ns as LocalService,
|
1757
|
+
Es as MemoryService,
|
1758
|
+
Ss as NodeEnv,
|
1759
|
+
F as PAGE_ROUTE_NAME,
|
1760
|
+
bs as Provider,
|
1761
|
+
_s as Startup,
|
1762
|
+
Os as StorageService,
|
1763
|
+
C as VTJ_RENDERER_VERSION,
|
1732
1764
|
we as adoptedStyleSheets,
|
1733
|
-
|
1734
|
-
|
1765
|
+
Ts as createAssetScripts,
|
1766
|
+
Is as createAssetsCss,
|
1735
1767
|
It as createDataSources,
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1744
|
-
|
1768
|
+
Q as createLoader,
|
1769
|
+
Bs as createMemoryService,
|
1770
|
+
wt as createMetaApi,
|
1771
|
+
jt as createMock,
|
1772
|
+
Hs as createProvider,
|
1773
|
+
Y as createRenderer,
|
1774
|
+
_t as createSchemaApi,
|
1775
|
+
St as createSchemaApis,
|
1776
|
+
Ht as defaultLoader,
|
1777
|
+
M as fillBasePath,
|
1745
1778
|
$e as getModifiers,
|
1746
1779
|
je as getPlugin,
|
1747
|
-
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1780
|
+
ut as getRawComponent,
|
1781
|
+
mt as isBuiltInTag,
|
1782
|
+
te as isCSSUrl,
|
1783
|
+
vt as isJSCode,
|
1751
1784
|
_ as isJSExpression,
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1785
|
+
I as isJSFunction,
|
1786
|
+
at as isJSON,
|
1787
|
+
se as isJSUrl,
|
1788
|
+
gt as isNativeTag,
|
1789
|
+
ht as isVuePlugin,
|
1790
|
+
pt as loadCss,
|
1791
|
+
dt as loadCssUrl,
|
1792
|
+
ft as loadScriptUrl,
|
1760
1793
|
$t as mockApi,
|
1761
|
-
|
1794
|
+
bt as mockApis,
|
1762
1795
|
Se as mockCleanup,
|
1763
|
-
|
1764
|
-
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1796
|
+
B as nodeRender,
|
1797
|
+
lt as parseDeps,
|
1798
|
+
T as parseExpression,
|
1799
|
+
G as parseFunction,
|
1800
|
+
ke as providerKey,
|
1801
|
+
ct as removeProdFlag,
|
1769
1802
|
_e as toString,
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1803
|
+
kt as useAccess,
|
1804
|
+
Us as useMask,
|
1805
|
+
Re as useProvider
|
1773
1806
|
};
|