@vtj/renderer 0.10.15 → 0.11.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +309 -309
- package/package.json +6 -6
- package/types/plugins/access.d.ts +1 -1
- package/types/provider/defaults.d.ts +2 -5
- package/types/services/base.d.ts +2 -2
- package/types/services/local.d.ts +2 -2
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
import { Base as
|
2
|
-
import { isUrl as
|
3
|
-
import * as
|
4
|
-
import { inject as de, defineComponent as fe, h as
|
1
|
+
import { Base as ke, BUILT_IN_COMPONENTS as Fe, ProjectModel as D, HistoryModel as ce } from "@vtj/core";
|
2
|
+
import { isUrl as Ae, url as E, dedupArray as Me, isString as j, isFunction as q, logger as R, storage as B, cookie as U, toArray as se, unRSA as re, delay as le, createRequest as ue, jsonp as pe, merge as Ie, pathToRegexp as He, pathToRegexpMatch as Te, formDataToJson as De, camelCase as b, upperFirst as xe, pick as Oe, request as J, loadScript as ne, Storage as Ne, mapToObject as Q } from "@vtj/utils";
|
3
|
+
import * as O from "vue";
|
4
|
+
import { inject as de, defineComponent as fe, h as K, ref as z, defineAsyncComponent as ie, watchEffect as Be } from "vue";
|
5
5
|
import { useRoute as he } from "vue-router";
|
6
6
|
/**!
|
7
7
|
* Copyright (c) 2025, VTJ.PRO All rights reserved.
|
8
8
|
* @name @vtj/renderer
|
9
9
|
* @author CHC chenhuachun1549@dingtalk.com
|
10
|
-
* @version 0.
|
10
|
+
* @version 0.11.1-alpha.0
|
11
11
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
12
12
|
*/
|
13
|
-
const
|
13
|
+
const C = "0.11.1-alpha.0";
|
14
14
|
var y = /* @__PURE__ */ ((r) => (r.Runtime = "Runtime", r.Design = "Design", r.Raw = "Raw", r.VNode = "VNode", r))(y || {});
|
15
15
|
const oe = [
|
16
16
|
"$el",
|
@@ -24,7 +24,7 @@ const oe = [
|
|
24
24
|
"$props",
|
25
25
|
"$options",
|
26
26
|
"$forceUpdate"
|
27
|
-
],
|
27
|
+
], zt = [
|
28
28
|
"beforeCreate",
|
29
29
|
"created",
|
30
30
|
"beforeMount",
|
@@ -38,14 +38,14 @@ const oe = [
|
|
38
38
|
"renderTriggered",
|
39
39
|
"activated",
|
40
40
|
"deactivated"
|
41
|
-
],
|
41
|
+
], Ue = [
|
42
42
|
"vIf",
|
43
43
|
"vShow",
|
44
44
|
"vModel",
|
45
45
|
"vFor",
|
46
46
|
"vBind",
|
47
47
|
"vHtml"
|
48
|
-
],
|
48
|
+
], Le = {
|
49
49
|
String,
|
50
50
|
Number,
|
51
51
|
Boolean,
|
@@ -53,59 +53,59 @@ const oe = [
|
|
53
53
|
Object,
|
54
54
|
Function,
|
55
55
|
Date
|
56
|
-
},
|
56
|
+
}, k = "VtjPage", T = "VtjHomepage", qe = "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(
|
57
57
|
","
|
58
58
|
), Je = "component,slot".split(",");
|
59
|
-
function
|
60
|
-
return r.map((t) =>
|
59
|
+
function I(r, e) {
|
60
|
+
return r.map((t) => Ae(t) || t.startsWith("/") ? t : `${e}${t}`);
|
61
61
|
}
|
62
|
-
function
|
62
|
+
function X(r) {
|
63
63
|
return /\.css$/.test(r);
|
64
64
|
}
|
65
65
|
function Z(r) {
|
66
66
|
return /\.js$/.test(r);
|
67
67
|
}
|
68
|
-
function
|
68
|
+
function Ke(r) {
|
69
69
|
return /\.json$/.test(r);
|
70
70
|
}
|
71
71
|
function Vt(r) {
|
72
72
|
return r.map(
|
73
|
-
(e) => `<script src="${
|
73
|
+
(e) => `<script src="${E.append(e, { v: C })}"><\/script>`
|
74
74
|
).join("");
|
75
75
|
}
|
76
76
|
function Wt(r = []) {
|
77
77
|
return r.map(
|
78
|
-
(e) => `<link rel="stylesheet" href="${
|
78
|
+
(e) => `<link rel="stylesheet" href="${E.append(e, { v: C })}" />`
|
79
79
|
).join("");
|
80
80
|
}
|
81
81
|
function ze(r, e = !1) {
|
82
82
|
return e && r.endsWith(".prod.js") ? r.replace(".prod.js", ".js") : r;
|
83
83
|
}
|
84
|
-
function
|
85
|
-
const s = r.filter((m) => !!m.enabled), n = [], i = [], a = [], o = [], c = {}, l = {},
|
84
|
+
function Ve(r, e, t = !1) {
|
85
|
+
const s = r.filter((m) => !!m.enabled), n = [], i = [], a = [], o = [], c = {}, l = {}, p = [], d = {};
|
86
86
|
return s.forEach(
|
87
|
-
({ urls: m, assetsUrl: h, library:
|
87
|
+
({ urls: m, assetsUrl: h, library: f, assetsLibrary: u, localeLibrary: w }) => {
|
88
88
|
m?.forEach((g) => {
|
89
|
-
Z(g) && n.push(ze(g, t)),
|
90
|
-
}),
|
89
|
+
Z(g) && n.push(ze(g, t)), X(g) && i.push(g);
|
90
|
+
}), f && (o.push(f), c[f] = I(m || [], e), w && (l[f] = w)), h && a.push(h), u && p.push(u), f && u && (d[u] = f);
|
91
91
|
}
|
92
92
|
), {
|
93
|
-
scripts:
|
94
|
-
css:
|
95
|
-
materials:
|
93
|
+
scripts: I(n, e),
|
94
|
+
css: I(i, e),
|
95
|
+
materials: I(a, e),
|
96
96
|
libraryExports: o,
|
97
|
-
materialExports:
|
98
|
-
materialMapLibrary:
|
97
|
+
materialExports: Me(p),
|
98
|
+
materialMapLibrary: d,
|
99
99
|
libraryMap: c,
|
100
100
|
libraryLocaleMap: l
|
101
101
|
};
|
102
102
|
}
|
103
|
-
function
|
103
|
+
function We(r, e) {
|
104
104
|
const { name: t, parent: s, alias: n } = r;
|
105
105
|
return s ? e[s]?.[n || t] : e[n || t];
|
106
106
|
}
|
107
107
|
function me(r) {
|
108
|
-
return
|
108
|
+
return j(r) ? r : JSON.stringify(r);
|
109
109
|
}
|
110
110
|
function ge(r, e, t) {
|
111
111
|
const s = r.CSSStyleSheet;
|
@@ -122,11 +122,11 @@ function ge(r, e, t) {
|
|
122
122
|
i ? i.innerHTML = t : (i = n.createElement("style"), i.id = e, i.innerHTML = t, n.head.appendChild(i));
|
123
123
|
}
|
124
124
|
}
|
125
|
-
async function
|
125
|
+
async function Ge(r, e) {
|
126
126
|
const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
|
127
127
|
t && ge(window, r, t);
|
128
128
|
}
|
129
|
-
function
|
129
|
+
function Ye(r, e = window) {
|
130
130
|
const t = e.document, s = e.document.head;
|
131
131
|
for (const n of r)
|
132
132
|
if (!t.getElementById(n)) {
|
@@ -142,20 +142,20 @@ async function Qe(r, e, t = window) {
|
|
142
142
|
const l = s.createElement("script");
|
143
143
|
l.src = c, l.onload = () => {
|
144
144
|
i = t[e], i ? a(i.default || i) : o(null);
|
145
|
-
}, l.onerror = (
|
146
|
-
o(
|
145
|
+
}, l.onerror = (p) => {
|
146
|
+
o(p);
|
147
147
|
}, n.appendChild(l);
|
148
148
|
}
|
149
149
|
});
|
150
150
|
}
|
151
151
|
function Xe(r) {
|
152
|
-
return
|
152
|
+
return q(r) || q(r?.install);
|
153
153
|
}
|
154
|
-
function
|
154
|
+
function Ze(r) {
|
155
155
|
return Je.includes(r);
|
156
156
|
}
|
157
|
-
function
|
158
|
-
return
|
157
|
+
function et(r) {
|
158
|
+
return qe.includes(r);
|
159
159
|
}
|
160
160
|
function F(r = window) {
|
161
161
|
const e = window?.Mock;
|
@@ -164,12 +164,12 @@ function F(r = window) {
|
|
164
164
|
if (t && window)
|
165
165
|
return window.Mock = t, t;
|
166
166
|
}
|
167
|
-
function
|
167
|
+
function Gt(r, e, t) {
|
168
168
|
Object.assign(e.meta, t.meta);
|
169
169
|
const s = r?._container;
|
170
170
|
t?.type === "page" && s.classList.add("is-page"), t?.pure && s.classList.add("is-pure");
|
171
171
|
}
|
172
|
-
function
|
172
|
+
function A(r, e, t = !1, s = !1) {
|
173
173
|
try {
|
174
174
|
const n = ['"use strict";', "var __self = arguments[0];"];
|
175
175
|
n.push("return ");
|
@@ -179,13 +179,13 @@ function I(r, e, t = !1, s = !1) {
|
|
179
179
|
const a = `with(${t ? "{}" : "$scope || {}"}) { ${i} }`;
|
180
180
|
return new Function("$scope", a)(e);
|
181
181
|
} catch (n) {
|
182
|
-
if (
|
182
|
+
if (R.error("parseExpression.error", n, r, e?.__self ?? e), s)
|
183
183
|
throw n;
|
184
184
|
}
|
185
185
|
}
|
186
|
-
function
|
187
|
-
const n =
|
188
|
-
if (typeof n != "function" && (
|
186
|
+
function V(r, e, t = !1, s = !1) {
|
187
|
+
const n = A(r, e, t, s);
|
188
|
+
if (typeof n != "function" && (R.error(
|
189
189
|
"parseFunction.error",
|
190
190
|
"not a function",
|
191
191
|
r,
|
@@ -197,16 +197,16 @@ function G(r, e, t = !1, s = !1) {
|
|
197
197
|
function _(r) {
|
198
198
|
return r && r.type === "JSExpression";
|
199
199
|
}
|
200
|
-
function
|
200
|
+
function M(r) {
|
201
201
|
return typeof r == "object" && r && r.type === "JSFunction";
|
202
202
|
}
|
203
|
-
function
|
204
|
-
return _(r) ||
|
203
|
+
function tt(r) {
|
204
|
+
return _(r) || M(r);
|
205
205
|
}
|
206
|
-
function
|
207
|
-
return
|
206
|
+
function Yt(r) {
|
207
|
+
return tt(r) ? r.value : JSON.stringify(r);
|
208
208
|
}
|
209
|
-
const
|
209
|
+
const st = {
|
210
210
|
session: !1,
|
211
211
|
authKey: "Authorization",
|
212
212
|
storageKey: "ACCESS_STORAGE",
|
@@ -219,13 +219,13 @@ const tt = {
|
|
219
219
|
noPermissionMessage: "无权限访问该页面",
|
220
220
|
appName: ""
|
221
221
|
}, ve = Symbol("access");
|
222
|
-
class
|
222
|
+
class ye {
|
223
223
|
options;
|
224
224
|
data = null;
|
225
225
|
mode = y.Raw;
|
226
226
|
interceptResponse = !0;
|
227
227
|
constructor(e) {
|
228
|
-
this.options = Object.assign({},
|
228
|
+
this.options = Object.assign({}, st, e), this.loadData();
|
229
229
|
}
|
230
230
|
enableIntercept() {
|
231
231
|
this.interceptResponse = !0;
|
@@ -239,14 +239,14 @@ class st {
|
|
239
239
|
}
|
240
240
|
login(e) {
|
241
241
|
const { storageKey: t, storagePrefix: s, session: n, authKey: i } = this.options;
|
242
|
-
this.setData(e), this.data && (
|
242
|
+
this.setData(e), this.data && (B.save(t, e, {
|
243
243
|
type: "local",
|
244
244
|
prefix: s
|
245
245
|
}), n && U.set(i, this.data.token));
|
246
246
|
}
|
247
247
|
clear() {
|
248
248
|
const { storageKey: e, storagePrefix: t, session: s, authKey: n } = this.options;
|
249
|
-
this.data = null,
|
249
|
+
this.data = null, B.remove(e, {
|
250
250
|
type: "local",
|
251
251
|
prefix: t
|
252
252
|
}), s && U.remove(n);
|
@@ -291,7 +291,11 @@ class st {
|
|
291
291
|
const { privateKey: t } = this.options;
|
292
292
|
if (Array.isArray(e) && t) {
|
293
293
|
const s = e.map((n) => re(n, t));
|
294
|
-
|
294
|
+
try {
|
295
|
+
this.data = JSON.parse(s.join(""));
|
296
|
+
} catch (n) {
|
297
|
+
console.warn(n);
|
298
|
+
}
|
295
299
|
return;
|
296
300
|
}
|
297
301
|
if (typeof e == "string")
|
@@ -305,7 +309,7 @@ class st {
|
|
305
309
|
this.data = e;
|
306
310
|
}
|
307
311
|
loadData() {
|
308
|
-
const { storageKey: e, storagePrefix: t } = this.options, s =
|
312
|
+
const { storageKey: e, storagePrefix: t } = this.options, s = B.get(e, {
|
309
313
|
type: "local",
|
310
314
|
prefix: t
|
311
315
|
});
|
@@ -316,7 +320,7 @@ class st {
|
|
316
320
|
return e && t ? !!U.get(t) : !!this.getToken();
|
317
321
|
}
|
318
322
|
hasRoutePermission(e) {
|
319
|
-
if (e.name ===
|
323
|
+
if (e.name === k) {
|
320
324
|
const t = e.params.id;
|
321
325
|
return t && this.can(t);
|
322
326
|
}
|
@@ -333,7 +337,7 @@ class st {
|
|
333
337
|
return t();
|
334
338
|
{
|
335
339
|
const { noPermissionMessage: s = "无权限访问", unauthorized: n = !1 } = this.options;
|
336
|
-
return await this.showTip(s),
|
340
|
+
return await this.showTip(s), q(n) ? (n(), t(!1)) : j(n) ? t(n) : t(!1);
|
337
341
|
}
|
338
342
|
}
|
339
343
|
t(!1), this.toLogin();
|
@@ -371,16 +375,17 @@ class st {
|
|
371
375
|
function rt() {
|
372
376
|
return de(ve, null);
|
373
377
|
}
|
374
|
-
function
|
378
|
+
function Qt(r = {}) {
|
375
379
|
const {
|
376
380
|
notify: e,
|
377
381
|
loading: t,
|
378
382
|
settings: s = {},
|
379
383
|
Startup: n,
|
380
384
|
access: i,
|
381
|
-
|
385
|
+
useTitle: a,
|
386
|
+
alert: o
|
382
387
|
} = r;
|
383
|
-
let
|
388
|
+
let c = null;
|
384
389
|
return {
|
385
390
|
request: ue({
|
386
391
|
settings: {
|
@@ -388,16 +393,16 @@ function Yt(r = {}) {
|
|
388
393
|
validSuccess: !0,
|
389
394
|
originResponse: !1,
|
390
395
|
loading: !0,
|
391
|
-
validate: (
|
396
|
+
validate: (p) => p.data?.code === 0 || !!p.data?.success,
|
392
397
|
failMessage: !0,
|
393
|
-
showError: (
|
394
|
-
e && e(
|
398
|
+
showError: (p) => {
|
399
|
+
e && e(p || "未知错误");
|
395
400
|
},
|
396
401
|
showLoading: () => {
|
397
|
-
|
402
|
+
c && c.close(), t && (c = t());
|
398
403
|
},
|
399
404
|
hideLoading: () => {
|
400
|
-
|
405
|
+
c && (c.close(), c = null);
|
401
406
|
},
|
402
407
|
...s
|
403
408
|
}
|
@@ -405,20 +410,15 @@ function Yt(r = {}) {
|
|
405
410
|
jsonp: pe,
|
406
411
|
notify: e,
|
407
412
|
loading: t,
|
413
|
+
useTitle: a,
|
408
414
|
startupComponent: n,
|
409
|
-
|
410
|
-
access: i ? nt(i) : void 0
|
415
|
+
access: i ? new ye({ alert: o, ...i }) : void 0
|
411
416
|
};
|
412
417
|
}
|
413
|
-
function
|
414
|
-
|
415
|
-
storageKey: "RRO_IDE_ACCESS_STORAGE__",
|
416
|
-
auth: "https://lcdp.vtj.pro/auth.html",
|
417
|
-
privateKey: "MIIBOgIBAAJBAKoIzmn1FYQ1YOhOBw9EhABxZ+PySAIaydI+zdhoKflrdgJ4A5E4/5gbQmRpk09hPWG8nvX7h+l/QLU8kXxAIBECAwEAAQJAAlgpxQY6sByLsXqzJcthC8LSGsLf2JEJkHwlnpwFqlEV8UCkoINpuZ2Wzl+aftURu5rIfAzRCQBvHmeOTW9/zQIhAO5ufWDmnSLyfAAsNo5JRNpVuLFCFodR8Xm+ulDlosR/AiEAtpAltyP9wmCABKG/v/hrtTr3mcvFNGCjoGa9bUAok28CIHbrVs9w1ijrBlvTsXYwJw46uP539uKRRT4ymZzlm9QjAiB+1KH/G9f9pEEL9rtaSOG7JF5D0JcOjlze4MGVFs+ZrQIhALKOUFBNr2zEsyJIjw2PlvEucdlG77UniszjXTROHSPd"
|
418
|
-
};
|
419
|
-
return new st(Object.assign(e, r));
|
418
|
+
function Xt(r = {}) {
|
419
|
+
return new ye(r);
|
420
420
|
}
|
421
|
-
function
|
421
|
+
function nt(r, e) {
|
422
422
|
const { jsonp: t, request: s } = e;
|
423
423
|
if (r.method === "jsonp")
|
424
424
|
return (n = {}) => t(r.url, {
|
@@ -426,7 +426,7 @@ function it(r, e) {
|
|
426
426
|
query: n
|
427
427
|
});
|
428
428
|
{
|
429
|
-
const n = r.headers ?
|
429
|
+
const n = r.headers ? A(r.headers, {}, !0) : void 0, i = {
|
430
430
|
url: r.url,
|
431
431
|
method: r.method,
|
432
432
|
settings: {
|
@@ -434,10 +434,10 @@ function it(r, e) {
|
|
434
434
|
headers: n
|
435
435
|
}
|
436
436
|
};
|
437
|
-
return (a, o) => (delete i.data, s.send(
|
437
|
+
return (a, o) => (delete i.data, s.send(Ie(i, o || {}, { data: a })));
|
438
438
|
}
|
439
439
|
}
|
440
|
-
function
|
440
|
+
function it(r, e) {
|
441
441
|
const { metaQuery: t } = e;
|
442
442
|
if (!t) return;
|
443
443
|
const { code: s, queryCode: n } = r;
|
@@ -449,47 +449,47 @@ function ot(r, e) {
|
|
449
449
|
return t(s, n, i, a);
|
450
450
|
};
|
451
451
|
}
|
452
|
-
function
|
452
|
+
function ot(r = [], e = [], t) {
|
453
453
|
const s = {};
|
454
454
|
for (const n of r)
|
455
|
-
s[n.id] =
|
455
|
+
s[n.id] = nt(n, t);
|
456
456
|
for (const n of e)
|
457
|
-
s[n.id] =
|
457
|
+
s[n.id] = it(n, t);
|
458
458
|
return s;
|
459
459
|
}
|
460
|
-
async function
|
460
|
+
async function at(r = [], e = window) {
|
461
461
|
const t = F(e);
|
462
|
-
t && (
|
462
|
+
t && (_e(e), r.forEach((s) => lt(t, s)));
|
463
463
|
}
|
464
|
-
function
|
465
|
-
const t =
|
464
|
+
function ct(r, e = window) {
|
465
|
+
const t = M(r.mockTemplate) && r.mockTemplate.value ? V(r.mockTemplate, {}, !0) : void 0, s = F(e);
|
466
466
|
return async (...n) => {
|
467
467
|
let i = {};
|
468
468
|
if (t)
|
469
469
|
try {
|
470
470
|
i = await t.apply(t, n);
|
471
471
|
} catch (a) {
|
472
|
-
|
472
|
+
R.warn("模拟数据模版异常", a);
|
473
473
|
}
|
474
474
|
return s?.mock(i);
|
475
475
|
};
|
476
476
|
}
|
477
|
-
function
|
477
|
+
function lt(r, e) {
|
478
478
|
if (!e.mock) return;
|
479
479
|
const { url: t, mockTemplate: s } = e;
|
480
480
|
if (t && s) {
|
481
|
-
const n =
|
481
|
+
const n = He(`${t}(.*)`), i = Te(t, { decode: decodeURIComponent }), a = A(s, {}, !0);
|
482
482
|
r.mock(n, (o) => {
|
483
|
-
const c =
|
484
|
-
return Object.assign(o, { data: l, params: c, query:
|
483
|
+
const c = E.parse(o.url) || {}, l = o.body instanceof FormData ? De(o.body) : o.body, p = i(o.url)?.params;
|
484
|
+
return Object.assign(o, { data: l, params: c, query: p }), r.mock(a(o));
|
485
485
|
});
|
486
486
|
}
|
487
487
|
}
|
488
|
-
function
|
488
|
+
function _e(r = window) {
|
489
489
|
const e = F(r);
|
490
490
|
e && (e._mocked = {});
|
491
491
|
}
|
492
|
-
class
|
492
|
+
class ut {
|
493
493
|
__id = null;
|
494
494
|
__mode;
|
495
495
|
__instance = null;
|
@@ -518,7 +518,7 @@ class pt {
|
|
518
518
|
const { mode: t, dsl: s, attrs: n } = e;
|
519
519
|
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), n && Object.assign(this, n);
|
520
520
|
}
|
521
|
-
setup(e, t =
|
521
|
+
setup(e, t = O) {
|
522
522
|
const s = t.getCurrentInstance();
|
523
523
|
if (!s) return;
|
524
524
|
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = s.proxy;
|
@@ -548,17 +548,17 @@ class pt {
|
|
548
548
|
if (e)
|
549
549
|
if (this.__mode === y.Runtime) {
|
550
550
|
const { id: t, type: s } = e, n = t ? this.__transform[t] ?? e.value : e.value;
|
551
|
-
return
|
551
|
+
return V({ type: s, value: n }, this);
|
552
552
|
} else
|
553
|
-
return
|
553
|
+
return V(e, this);
|
554
554
|
}
|
555
555
|
__parseExpression(e) {
|
556
556
|
if (e)
|
557
557
|
if (this.__mode === y.Runtime) {
|
558
558
|
const { id: t, type: s } = e, n = t ? this.__transform[t] ?? e.value : e.value;
|
559
|
-
return
|
559
|
+
return A({ type: s, value: n }, this);
|
560
560
|
} else
|
561
|
-
return
|
561
|
+
return A(e, this);
|
562
562
|
}
|
563
563
|
__ref(e = null, t) {
|
564
564
|
if (this.__mode !== y.VNode)
|
@@ -588,9 +588,9 @@ class pt {
|
|
588
588
|
return s.context.__proto__ = this.context, s.__proto__ = this, s;
|
589
589
|
}
|
590
590
|
}
|
591
|
-
function
|
591
|
+
function W(r) {
|
592
592
|
const {
|
593
|
-
Vue: e =
|
593
|
+
Vue: e = O,
|
594
594
|
mode: t = y.Runtime,
|
595
595
|
components: s = {},
|
596
596
|
libs: n = {},
|
@@ -600,54 +600,54 @@ function V(r) {
|
|
600
600
|
$components: s,
|
601
601
|
$libs: n,
|
602
602
|
$apis: i
|
603
|
-
}, l = new
|
603
|
+
}, l = new ut({
|
604
604
|
mode: t,
|
605
605
|
dsl: o.value,
|
606
606
|
attrs: c
|
607
|
-
}),
|
607
|
+
}), p = e.defineComponent({
|
608
608
|
name: o.value.name,
|
609
609
|
props: {
|
610
|
-
...
|
610
|
+
...dt(o.value.props ?? [], l)
|
611
611
|
},
|
612
|
-
setup(
|
613
|
-
l.$props =
|
612
|
+
setup(d) {
|
613
|
+
l.$props = d, l.props = d, o.value.id && ge(
|
614
614
|
r.window || window,
|
615
615
|
o.value.id,
|
616
616
|
o.value.css || ""
|
617
|
-
), l.state =
|
618
|
-
const m =
|
617
|
+
), l.state = ft(e, o.value.state ?? {}, l);
|
618
|
+
const m = ht(e, o.value.computed ?? {}, l), h = mt(o.value.methods ?? {}, l), f = gt(e, o.value.inject, l), u = vt(
|
619
619
|
o.value.dataSources || {},
|
620
620
|
l
|
621
621
|
), w = {
|
622
|
-
...
|
622
|
+
...f,
|
623
623
|
...m,
|
624
624
|
...h,
|
625
625
|
...u
|
626
626
|
};
|
627
|
-
return l.setup(w, e),
|
627
|
+
return l.setup(w, e), yt(e, o.value.watch ?? [], l), {
|
628
628
|
vtj: l
|
629
629
|
};
|
630
630
|
},
|
631
|
-
emits:
|
631
|
+
emits: pt(o.value.emits),
|
632
632
|
expose: ["vtj"],
|
633
633
|
render() {
|
634
634
|
if (!o.value.nodes) return null;
|
635
|
-
const
|
636
|
-
return
|
635
|
+
const d = o.value.nodes || [];
|
636
|
+
return d.length === 1 ? x(d[0], l, e, a) : d.map((m) => x(m, l, e, a));
|
637
637
|
},
|
638
|
-
...
|
638
|
+
..._t(o.value.lifeCycles ?? {}, l)
|
639
639
|
});
|
640
640
|
return {
|
641
|
-
renderer: e.markRaw(
|
641
|
+
renderer: e.markRaw(p),
|
642
642
|
context: l
|
643
643
|
};
|
644
644
|
}
|
645
|
-
function
|
646
|
-
return r.map((e) =>
|
645
|
+
function pt(r = []) {
|
646
|
+
return r.map((e) => j(e) ? e : e.name);
|
647
647
|
}
|
648
|
-
function
|
649
|
-
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((i) =>
|
650
|
-
return r.map((s) =>
|
648
|
+
function dt(r = [], e) {
|
649
|
+
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((i) => Le[i]) : void 0;
|
650
|
+
return r.map((s) => j(s) ? {
|
651
651
|
name: s
|
652
652
|
} : {
|
653
653
|
name: s.name,
|
@@ -663,30 +663,30 @@ function ft(r = [], e) {
|
|
663
663
|
{}
|
664
664
|
);
|
665
665
|
}
|
666
|
-
function
|
666
|
+
function ft(r, e, t) {
|
667
667
|
return r.reactive(
|
668
668
|
Object.keys(e || {}).reduce(
|
669
669
|
(s, n) => {
|
670
670
|
let i = e[n];
|
671
|
-
return _(i) ? i = t.__parseExpression(i) :
|
671
|
+
return _(i) ? i = t.__parseExpression(i) : M(i) && (i = t.__parseFunction(i)), s[n] = i, s;
|
672
672
|
},
|
673
673
|
{}
|
674
674
|
)
|
675
675
|
);
|
676
676
|
}
|
677
|
-
function
|
677
|
+
function ht(r, e, t) {
|
678
678
|
return Object.entries(e ?? {}).reduce(
|
679
679
|
(s, [n, i]) => (s[n] = r.computed(t.__parseFunction(i)), s),
|
680
680
|
{}
|
681
681
|
);
|
682
682
|
}
|
683
|
-
function
|
683
|
+
function mt(r, e) {
|
684
684
|
return Object.entries(r ?? {}).reduce(
|
685
685
|
(t, [s, n]) => (t[s] = e.__parseFunction(n), t),
|
686
686
|
{}
|
687
687
|
);
|
688
688
|
}
|
689
|
-
function
|
689
|
+
function gt(r, e = [], t) {
|
690
690
|
return e.reduce(
|
691
691
|
(s, n) => {
|
692
692
|
const { name: i, from: a } = n || {};
|
@@ -697,14 +697,14 @@ function vt(r, e = [], t) {
|
|
697
697
|
{}
|
698
698
|
);
|
699
699
|
}
|
700
|
-
function
|
700
|
+
function vt(r, e) {
|
701
701
|
return Object.keys(r).reduce(
|
702
702
|
(t, s) => {
|
703
703
|
const n = r[s];
|
704
704
|
if (n.type === "mock")
|
705
|
-
t[s] =
|
705
|
+
t[s] = ct(n);
|
706
706
|
else if (n.ref) {
|
707
|
-
const i = e.$apis[n.ref], a =
|
707
|
+
const i = e.$apis[n.ref], a = M(n.transform) ? n.transform.value ? e.__parseFunction(n.transform) : void 0 : n.transform;
|
708
708
|
t[s] = async (...o) => {
|
709
709
|
const c = await i.apply(e, o);
|
710
710
|
return a ? a(c) : c;
|
@@ -715,7 +715,7 @@ function yt(r, e) {
|
|
715
715
|
{}
|
716
716
|
);
|
717
717
|
}
|
718
|
-
function
|
718
|
+
function yt(r, e = [], t) {
|
719
719
|
e.forEach((s) => {
|
720
720
|
r.watch(
|
721
721
|
t.__parseExpression(s.source),
|
@@ -727,59 +727,59 @@ function _t(r, e = [], t) {
|
|
727
727
|
);
|
728
728
|
});
|
729
729
|
}
|
730
|
-
function
|
730
|
+
function _t(r, e) {
|
731
731
|
return Object.entries(r ?? {}).reduce(
|
732
732
|
(t, [s, n]) => (t[s] = e.__parseFunction(n), t),
|
733
733
|
{}
|
734
734
|
);
|
735
735
|
}
|
736
|
-
let L = [],
|
737
|
-
const
|
738
|
-
async function
|
736
|
+
let L = [], P = {};
|
737
|
+
const wt = (r) => r;
|
738
|
+
async function we(r, e = window) {
|
739
739
|
const { urls: t = [], library: s } = r, n = t.filter((o) => Z(o));
|
740
740
|
if (n.length === 0 || !s) return null;
|
741
|
-
const i = t.filter((o) =>
|
742
|
-
return i.length &&
|
741
|
+
const i = t.filter((o) => X(o));
|
742
|
+
return i.length && Ye(i, e), await Qe(n, s, e).catch(
|
743
743
|
(o) => (console.warn("loadScriptUrl error", n, s, o), null)
|
744
744
|
);
|
745
745
|
}
|
746
|
-
function
|
746
|
+
function G(r) {
|
747
747
|
const { getDsl: e, getDslByUrl: t, options: s } = r;
|
748
748
|
return s.window && (L.forEach((n) => {
|
749
749
|
delete s.window[n];
|
750
|
-
}), L = []), (n, i, a =
|
750
|
+
}), L = []), (n, i, a = O) => {
|
751
751
|
if (!i || typeof i == "string") return n;
|
752
752
|
if (i.type === "Schema" && i.id) {
|
753
|
-
let o =
|
754
|
-
return o || (o =
|
753
|
+
let o = P[i.id];
|
754
|
+
return o || (o = P[i.id] = a.defineAsyncComponent(async () => {
|
755
755
|
const c = await e(i.id);
|
756
|
-
return c && (c.name = n), c ?
|
756
|
+
return c && (c.name = n), c ? W({
|
757
757
|
...s,
|
758
758
|
Vue: a,
|
759
759
|
dsl: c,
|
760
760
|
mode: y.Runtime,
|
761
|
-
loader:
|
761
|
+
loader: G(r)
|
762
762
|
}).renderer : null;
|
763
763
|
}), o);
|
764
764
|
}
|
765
765
|
if (i.type === "UrlSchema" && i.url) {
|
766
|
-
let o =
|
767
|
-
return o || (o =
|
766
|
+
let o = P[i.url];
|
767
|
+
return o || (o = P[i.url] = a.defineAsyncComponent(async () => {
|
768
768
|
const c = await t(i.url);
|
769
|
-
return c && (c.name = n), c ?
|
769
|
+
return c && (c.name = n), c ? W({
|
770
770
|
...s,
|
771
771
|
Vue: a,
|
772
772
|
dsl: c,
|
773
773
|
mode: y.Runtime,
|
774
|
-
loader:
|
774
|
+
loader: G(r)
|
775
775
|
}).renderer : null;
|
776
776
|
}), o);
|
777
777
|
}
|
778
778
|
if (i.type === "Plugin") {
|
779
|
-
let o = i.library ?
|
780
|
-
return o || (i.library && L.push(i.library), o =
|
779
|
+
let o = i.library ? P[i.library] : null;
|
780
|
+
return o || (i.library && L.push(i.library), o = P[i.library || Symbol()] = a.defineAsyncComponent(
|
781
781
|
async () => {
|
782
|
-
const c = await
|
782
|
+
const c = await we(i, s.window);
|
783
783
|
return c || (console.warn("getPlugin result is null", i), null);
|
784
784
|
}
|
785
785
|
), o);
|
@@ -788,43 +788,43 @@ function W(r) {
|
|
788
788
|
};
|
789
789
|
}
|
790
790
|
function Zt() {
|
791
|
-
|
791
|
+
P = {};
|
792
792
|
}
|
793
|
-
function
|
793
|
+
function x(r, e, t = O, s = wt) {
|
794
794
|
if (!r || !r.name || r.invisible) return null;
|
795
|
-
const n = t.getCurrentInstance()?.appContext, { id: i = null, directives: a = [] } = r, { vIf: o, vFor: c, vShow: l, vModels:
|
796
|
-
if (o && !
|
795
|
+
const n = t.getCurrentInstance()?.appContext, { id: i = null, directives: a = [] } = r, { vIf: o, vFor: c, vShow: l, vModels: p, vBind: d, vHtml: m, others: h } = $t(a);
|
796
|
+
if (o && !jt(o, e))
|
797
797
|
return null;
|
798
|
-
const
|
798
|
+
const f = (u) => {
|
799
799
|
const w = u.$components, g = (() => {
|
800
800
|
if (r.name === "component")
|
801
|
-
return
|
801
|
+
return bt(u, r.props?.is);
|
802
802
|
if (r.name === "slot") return r.name;
|
803
|
-
const
|
804
|
-
return $
|
805
|
-
})(), S =
|
803
|
+
const $ = s(r.name, r.from, t);
|
804
|
+
return j($) ? Ze($) || et($) ? $ : w[$] ?? n?.app?.component($) ?? $ : $;
|
805
|
+
})(), S = Pt(i, r.props ?? {}, u), Re = Et(t, r.events ?? {}, u);
|
806
806
|
if (r.name === "slot")
|
807
|
-
return
|
808
|
-
|
807
|
+
return Rt(t, r, S, u, s);
|
808
|
+
d && Object.assign(S, u.__parseExpression(d.value)), l && (S.style = Object.assign(
|
809
809
|
S.style ?? {},
|
810
|
-
|
811
|
-
)), m && Object.assign(S,
|
812
|
-
Object.assign(S,
|
810
|
+
kt(l, u)
|
811
|
+
)), m && Object.assign(S, Ft(m, u)), p.forEach(($) => {
|
812
|
+
Object.assign(S, At(t, $, u));
|
813
813
|
});
|
814
|
-
const
|
814
|
+
const Ce = Mt(
|
815
815
|
t,
|
816
816
|
r.children ?? [],
|
817
817
|
u,
|
818
818
|
s,
|
819
819
|
r
|
820
820
|
);
|
821
|
-
let
|
822
|
-
const te = n ?
|
823
|
-
return te.length && (
|
821
|
+
let N = t.createVNode(g, { ...S, ...Re }, Ce);
|
822
|
+
const te = n ? St(n, h, u) : [];
|
823
|
+
return te.length && (N = t.withDirectives(N, te)), N;
|
824
824
|
};
|
825
|
-
return c ? Tt(c,
|
825
|
+
return c ? Tt(c, f, e) : f(e);
|
826
826
|
}
|
827
|
-
function
|
827
|
+
function St(r, e, t) {
|
828
828
|
const s = r.app;
|
829
829
|
return e.map((n) => {
|
830
830
|
const i = typeof n.name == "string" ? s.directive(n.name) : t.__parseExpression(n.name);
|
@@ -834,10 +834,10 @@ function jt(r, e, t) {
|
|
834
834
|
}).filter((n) => !!n);
|
835
835
|
}
|
836
836
|
function $t(r = []) {
|
837
|
-
const e = r.find((c) =>
|
838
|
-
(c) =>
|
837
|
+
const e = r.find((c) => b(c.name) === "vIf"), t = r.find((c) => b(c.name) === "vFor"), s = r.find((c) => b(c.name) === "vShow"), n = r.find((c) => b(c.name) === "vBind"), i = r.find((c) => b(c.name) === "vHtml"), a = r.filter(
|
838
|
+
(c) => b(c.name) === "vModel"
|
839
839
|
), o = r.filter(
|
840
|
-
(c) => !
|
840
|
+
(c) => !Ue.includes(b(c.name))
|
841
841
|
);
|
842
842
|
return {
|
843
843
|
vIf: e,
|
@@ -849,26 +849,26 @@ function $t(r = []) {
|
|
849
849
|
vHtml: i
|
850
850
|
};
|
851
851
|
}
|
852
|
-
function
|
852
|
+
function jt(r, e) {
|
853
853
|
return !!e.__parseExpression(r.value);
|
854
854
|
}
|
855
|
-
function
|
855
|
+
function bt(r, e) {
|
856
856
|
return e ? _(e) ? r.__parseExpression(e) : e : "div";
|
857
857
|
}
|
858
|
-
function
|
859
|
-
const s =
|
858
|
+
function Pt(r, e, t) {
|
859
|
+
const s = Y(e, t);
|
860
860
|
return s.ref = t.__ref(r, s.ref), s;
|
861
861
|
}
|
862
|
-
function
|
863
|
-
return _(r) ? e.__parseExpression(r) :
|
862
|
+
function Y(r, e) {
|
863
|
+
return _(r) ? e.__parseExpression(r) : M(r) ? e.__parseFunction(r) : Array.isArray(r) ? r.map((t) => Y(t, e)) : typeof r == "object" ? Object.keys(r || {}).reduce(
|
864
864
|
(t, s) => {
|
865
865
|
let n = r[s];
|
866
|
-
return t[s] =
|
866
|
+
return t[s] = Y(n, e), t;
|
867
867
|
},
|
868
868
|
{}
|
869
869
|
) : r;
|
870
870
|
}
|
871
|
-
function
|
871
|
+
function Et(r, e, t) {
|
872
872
|
const s = ["passive", "capture", "once"], n = {
|
873
873
|
capture: "Capture",
|
874
874
|
once: "Once",
|
@@ -876,22 +876,22 @@ function Pt(r, e, t) {
|
|
876
876
|
};
|
877
877
|
return Object.keys(e || {}).reduce(
|
878
878
|
(i, a) => {
|
879
|
-
const o = e[a], c =
|
880
|
-
return
|
879
|
+
const o = e[a], c = Se(o.modifiers), l = c.find((m) => s.includes(m)), p = "on" + xe(a) + (l && n[l] || ""), d = t.__parseFunction(o.handler);
|
880
|
+
return d && (i[p] = r.withModifiers(d, c)), i;
|
881
881
|
},
|
882
882
|
{}
|
883
883
|
);
|
884
884
|
}
|
885
|
-
function
|
885
|
+
function Se(r = {}, e = !1) {
|
886
886
|
const t = Object.keys(r);
|
887
887
|
return e ? t.map((s) => "." + s) : t;
|
888
888
|
}
|
889
|
-
function
|
889
|
+
function Rt(r, e, t, s, n) {
|
890
890
|
const { children: i } = e, a = Ct(e, s), o = s.$slots?.[a.name];
|
891
|
-
return o ? o(t) : i ?
|
891
|
+
return o ? o(t) : i ? j(i) ? r.createTextVNode(i) : _(i) ? r.createTextVNode(
|
892
892
|
me(s.__parseExpression(i))
|
893
893
|
) : Array.isArray(i) ? i.map(
|
894
|
-
(c) =>
|
894
|
+
(c) => x(c, s, r, n)
|
895
895
|
) : null : null;
|
896
896
|
}
|
897
897
|
function Ct(r, e) {
|
@@ -901,23 +901,23 @@ function Ct(r, e) {
|
|
901
901
|
params: []
|
902
902
|
};
|
903
903
|
}
|
904
|
-
function
|
904
|
+
function kt(r, e) {
|
905
905
|
return e.__parseExpression(r.value) ? {} : {
|
906
906
|
display: "none"
|
907
907
|
};
|
908
908
|
}
|
909
|
-
function
|
909
|
+
function Ft(r, e) {
|
910
910
|
return {
|
911
911
|
innerHTML: e.__parseExpression(r.value) || ""
|
912
912
|
};
|
913
913
|
}
|
914
|
-
function
|
914
|
+
function At(r, e, t) {
|
915
915
|
const s = {
|
916
916
|
type: "JSFunction",
|
917
917
|
value: e.value?.value ? `(v) => {
|
918
918
|
${e.value.value} = v;
|
919
919
|
}` : "(v) => {}"
|
920
|
-
}, n = t.__parseFunction(s), i =
|
920
|
+
}, n = t.__parseFunction(s), i = Se(
|
921
921
|
_(e.modifiers) ? t.__parseExpression(e.modifiers) : e.modifiers
|
922
922
|
), a = _(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
923
923
|
return {
|
@@ -927,26 +927,26 @@ function kt(r, e, t) {
|
|
927
927
|
}
|
928
928
|
function Mt(r, e, t, s, n) {
|
929
929
|
if (!e) return null;
|
930
|
-
if (
|
930
|
+
if (j(e))
|
931
931
|
return { default: () => e };
|
932
932
|
if (_(e))
|
933
933
|
return {
|
934
934
|
default: () => me(t.__parseExpression(e))
|
935
935
|
};
|
936
936
|
if (Array.isArray(e) && e.length > 0) {
|
937
|
-
const i =
|
937
|
+
const i = It(e), a = (o) => !o || !n ? {} : n?.id && Object.keys(o).length ? {
|
938
938
|
[`scope_${n.id}`]: o
|
939
939
|
} : {};
|
940
|
-
return Object.entries(i).reduce((o, [c, { nodes: l, params:
|
941
|
-
const m =
|
940
|
+
return Object.entries(i).reduce((o, [c, { nodes: l, params: p }]) => (o[c] = (d) => {
|
941
|
+
const m = p.length ? Oe(d ?? {}, p) : a(d);
|
942
942
|
return l.map(
|
943
|
-
(h) =>
|
943
|
+
(h) => x(h, t.__clone(m), r, s)
|
944
944
|
);
|
945
945
|
}, o), {});
|
946
946
|
}
|
947
947
|
return null;
|
948
948
|
}
|
949
|
-
function
|
949
|
+
function It(r) {
|
950
950
|
const e = {
|
951
951
|
default: {
|
952
952
|
params: [],
|
@@ -963,7 +963,7 @@ function Ot(r) {
|
|
963
963
|
return e;
|
964
964
|
}
|
965
965
|
function Ht(r = "default") {
|
966
|
-
return
|
966
|
+
return j(r) ? { name: r, params: [] } : { params: [], ...r };
|
967
967
|
}
|
968
968
|
function Tt(r, e, t) {
|
969
969
|
const { value: s, iterator: n } = r, { item: i = "item", index: a = "index" } = n || {};
|
@@ -973,7 +973,7 @@ function Tt(r, e, t) {
|
|
973
973
|
const ae = fe({
|
974
974
|
name: "VtjPageContainer",
|
975
975
|
async setup() {
|
976
|
-
const r = je(), e = he(), t = e.params.id, s = t ? r.getPage(t) : r.getHomepage(), n = s ? await r.getRenderComponent(s.id) : null, i =
|
976
|
+
const r = je(), e = he(), t = e.params.id, s = t ? r.getPage(t) : r.getHomepage(), n = s ? await r.getRenderComponent(s.id) : null, i = z(Symbol());
|
977
977
|
if (s) {
|
978
978
|
Object.assign(e.meta, s.meta || {}, { cache: s.cache });
|
979
979
|
const { useTitle: a } = r?.adapter;
|
@@ -991,7 +991,7 @@ const ae = fe({
|
|
991
991
|
},
|
992
992
|
render() {
|
993
993
|
const { component: r, query: e, sid: t } = this;
|
994
|
-
return r ?
|
994
|
+
return r ? K(r, { ...e, key: t }) : K("div", "页面不存在");
|
995
995
|
},
|
996
996
|
activated() {
|
997
997
|
this.meta.cache === !1 && (this.sid = Symbol());
|
@@ -999,11 +999,11 @@ const ae = fe({
|
|
999
999
|
}), Dt = fe({
|
1000
1000
|
name: "VtjStartupContainer",
|
1001
1001
|
render() {
|
1002
|
-
return
|
1002
|
+
return K("div", "page not found!");
|
1003
1003
|
}
|
1004
|
-
}),
|
1004
|
+
}), $e = Symbol("Provider");
|
1005
1005
|
var xt = /* @__PURE__ */ ((r) => (r.Production = "production", r.Development = "development", r))(xt || {});
|
1006
|
-
class
|
1006
|
+
class Ot extends ke {
|
1007
1007
|
constructor(e) {
|
1008
1008
|
super(), this.options = e;
|
1009
1009
|
const {
|
@@ -1015,19 +1015,19 @@ class Bt extends Ae {
|
|
1015
1015
|
adapter: o = {},
|
1016
1016
|
globals: c = {},
|
1017
1017
|
modules: l = {},
|
1018
|
-
router:
|
1019
|
-
materialPath:
|
1018
|
+
router: p = null,
|
1019
|
+
materialPath: d = "./",
|
1020
1020
|
nodeEnv: m = "development"
|
1021
1021
|
/* Development */
|
1022
1022
|
} = e;
|
1023
|
-
this.mode = s, this.modules = l, this.service = t, this.router =
|
1024
|
-
const { access: h, request:
|
1025
|
-
h && h.connect({ mode: s, router:
|
1023
|
+
this.mode = s, this.modules = l, this.service = t, this.router = p, this.materialPath = d, this.nodeEnv = m, n && (this.dependencies = n), i && (this.materials = i), Object.assign(this.globals, c), Object.assign(this.adapter, o);
|
1024
|
+
const { access: h, request: f } = this.adapter;
|
1025
|
+
h && h.connect({ mode: s, router: p, request: f }), a && s !== y.Design ? this.load(a) : this.project = a;
|
1026
1026
|
}
|
1027
1027
|
mode;
|
1028
1028
|
globals = {};
|
1029
1029
|
modules = {};
|
1030
|
-
adapter = { request:
|
1030
|
+
adapter = { request: J, jsonp: pe };
|
1031
1031
|
apis = {};
|
1032
1032
|
dependencies = {};
|
1033
1033
|
materials = {};
|
@@ -1046,7 +1046,7 @@ class Bt extends Ae {
|
|
1046
1046
|
try {
|
1047
1047
|
s = await e.apply(e, t);
|
1048
1048
|
} catch (i) {
|
1049
|
-
|
1049
|
+
R.warn("模拟数据模版异常", i);
|
1050
1050
|
}
|
1051
1051
|
return F()?.mock(s);
|
1052
1052
|
};
|
@@ -1056,7 +1056,7 @@ class Bt extends Ae {
|
|
1056
1056
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
1057
1057
|
throw new Error("project is null");
|
1058
1058
|
const { apis: s = [], meta: n = [] } = this.project, i = window;
|
1059
|
-
i && (i.CKEDITOR_VERSION = void 0), this.mode === y.Raw ? await this.loadDependencies(i) : await this.loadAssets(i), this.initMock(i), this.apis =
|
1059
|
+
i && (i.CKEDITOR_VERSION = void 0), this.mode === y.Raw ? await this.loadDependencies(i) : await this.loadAssets(i), this.initMock(i), this.apis = ot(s, n, this.adapter), _e(i), at(s, i), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
|
1060
1060
|
}
|
1061
1061
|
initMock(e) {
|
1062
1062
|
const t = F(e);
|
@@ -1073,42 +1073,42 @@ class Bt extends Ae {
|
|
1073
1073
|
const { dependencies: t = [] } = this.project, { dependencies: s, library: n, components: i, materialPath: a, nodeEnv: o } = this, {
|
1074
1074
|
libraryExports: c,
|
1075
1075
|
libraryMap: l,
|
1076
|
-
materials:
|
1077
|
-
materialExports:
|
1076
|
+
materials: p,
|
1077
|
+
materialExports: d,
|
1078
1078
|
materialMapLibrary: m
|
1079
|
-
} =
|
1079
|
+
} = Ve(
|
1080
1080
|
t,
|
1081
1081
|
a,
|
1082
1082
|
o === "development"
|
1083
1083
|
/* Development */
|
1084
1084
|
);
|
1085
1085
|
for (const h of c) {
|
1086
|
-
const
|
1086
|
+
const f = s[h], u = e[h];
|
1087
1087
|
if (u)
|
1088
1088
|
n[h] = u;
|
1089
|
-
else if (
|
1090
|
-
e[h] = n[h] = await
|
1089
|
+
else if (f)
|
1090
|
+
e[h] = n[h] = await f();
|
1091
1091
|
else {
|
1092
1092
|
const w = l[h] || [];
|
1093
1093
|
for (const g of w)
|
1094
|
-
|
1094
|
+
X(g) && await Ge(h, E.append(g, { v: C })), Z(g) && await ne(E.append(g, { v: C }));
|
1095
1095
|
n[h] = e[h];
|
1096
1096
|
}
|
1097
1097
|
}
|
1098
1098
|
if (o === "development") {
|
1099
|
-
for (const
|
1100
|
-
await ne(
|
1099
|
+
for (const f of p)
|
1100
|
+
await ne(E.append(f, { v: C }));
|
1101
1101
|
const h = this.materials || {};
|
1102
|
-
for (const
|
1103
|
-
const u = e[m[
|
1102
|
+
for (const f of d) {
|
1103
|
+
const u = e[m[f]], w = Fe[f];
|
1104
1104
|
if (w)
|
1105
1105
|
u && w.forEach((g) => {
|
1106
1106
|
i[g] = u[g];
|
1107
1107
|
});
|
1108
1108
|
else {
|
1109
|
-
const g = h[
|
1109
|
+
const g = h[f] ? (await h[f]()).default : e[f];
|
1110
1110
|
g && u && (g.components || []).forEach((S) => {
|
1111
|
-
i[S.name] =
|
1111
|
+
i[S.name] = We(S, u);
|
1112
1112
|
});
|
1113
1113
|
}
|
1114
1114
|
}
|
@@ -1121,23 +1121,23 @@ class Bt extends Ae {
|
|
1121
1121
|
routeAppendTo: a,
|
1122
1122
|
pageRouteName: o = i,
|
1123
1123
|
routeMeta: c
|
1124
|
-
} = s, l = a ? "" : "/",
|
1124
|
+
} = s, l = a ? "" : "/", p = {
|
1125
1125
|
path: `${l}${o}/:id`,
|
1126
|
-
name:
|
1126
|
+
name: k,
|
1127
1127
|
component: ae
|
1128
|
-
},
|
1128
|
+
}, d = {
|
1129
1129
|
path: l,
|
1130
|
-
name:
|
1130
|
+
name: T,
|
1131
1131
|
component: t?.homepage ? ae : n.startupComponent || Dt,
|
1132
1132
|
meta: c
|
1133
1133
|
};
|
1134
|
-
e.hasRoute(
|
1134
|
+
e.hasRoute(k) && e.removeRoute(k), e.hasRoute(T) && e.removeRoute(T), a ? (e.addRoute(a, p), e.addRoute(a, d)) : (e.addRoute(p), e.addRoute(d));
|
1135
1135
|
}
|
1136
1136
|
install(e) {
|
1137
1137
|
const t = e.config.globalProperties.installed || {};
|
1138
1138
|
for (const [s, n] of Object.entries(this.library))
|
1139
1139
|
!t[s] && Xe(n) && (e.use(n), t[s] = !0);
|
1140
|
-
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(
|
1140
|
+
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide($e, this), e.config.globalProperties.$provider = this, e.config.globalProperties.installed = t, this.mode === y.Design && (e.config.errorHandler = (s, n, i) => {
|
1141
1141
|
const a = n?.$options.name, o = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", c = `[ ${a} ] ${o} ${i}`;
|
1142
1142
|
console.error(
|
1143
1143
|
"[VTJ Error]:",
|
@@ -1196,12 +1196,12 @@ class Bt extends Ae {
|
|
1196
1196
|
apis: a,
|
1197
1197
|
window,
|
1198
1198
|
...t
|
1199
|
-
}, c =
|
1199
|
+
}, c = G({
|
1200
1200
|
getDsl: async (l) => await this.getDsl(l) || null,
|
1201
1201
|
getDslByUrl: async (l) => await this.getDslByUrl(l) || null,
|
1202
1202
|
options: o
|
1203
1203
|
});
|
1204
|
-
return
|
1204
|
+
return W({
|
1205
1205
|
...o,
|
1206
1206
|
dsl: e,
|
1207
1207
|
loader: c
|
@@ -1210,13 +1210,13 @@ class Bt extends Ae {
|
|
1210
1210
|
async getRenderComponent(e, t) {
|
1211
1211
|
const s = this.getFile(e);
|
1212
1212
|
if (!s)
|
1213
|
-
return
|
1213
|
+
return R.warn(`Can not find file: ${e}`), null;
|
1214
1214
|
t && t(s);
|
1215
1215
|
const n = `.vtj/vue/${e}.vue`, i = this.modules[n] || this.modules[`/src/pages/${e}.vue`];
|
1216
1216
|
if (i)
|
1217
1217
|
return (await i())?.default;
|
1218
1218
|
const a = await this.getDsl(s.id);
|
1219
|
-
return a ? this.createDslRenderer(a).renderer : (
|
1219
|
+
return a ? this.createDslRenderer(a).renderer : (R.warn(`Can not find dsl: ${e}`), null);
|
1220
1220
|
}
|
1221
1221
|
defineUrlSchemaComponent(e, t) {
|
1222
1222
|
return ie(async () => {
|
@@ -1225,18 +1225,18 @@ class Bt extends Ae {
|
|
1225
1225
|
});
|
1226
1226
|
}
|
1227
1227
|
definePluginComponent(e) {
|
1228
|
-
return ie(async () => await
|
1228
|
+
return ie(async () => await we(e, window));
|
1229
1229
|
}
|
1230
1230
|
}
|
1231
1231
|
function es(r) {
|
1232
|
-
const e = new
|
1232
|
+
const e = new Ot(r);
|
1233
1233
|
return {
|
1234
1234
|
provider: e,
|
1235
1235
|
onReady: (s) => e.ready(s)
|
1236
1236
|
};
|
1237
1237
|
}
|
1238
1238
|
function je(r = {}) {
|
1239
|
-
const e = de(
|
1239
|
+
const e = de($e, null);
|
1240
1240
|
if (!e)
|
1241
1241
|
throw new Error("Can not find provider");
|
1242
1242
|
if (e.nodeEnv === "development") {
|
@@ -1252,7 +1252,7 @@ function je(r = {}) {
|
|
1252
1252
|
}
|
1253
1253
|
return e;
|
1254
1254
|
}
|
1255
|
-
const
|
1255
|
+
const be = {
|
1256
1256
|
type: "json",
|
1257
1257
|
validSuccess: !0,
|
1258
1258
|
originResponse: !1,
|
@@ -1267,8 +1267,8 @@ const $e = {
|
|
1267
1267
|
type: t,
|
1268
1268
|
data: s
|
1269
1269
|
},
|
1270
|
-
settings:
|
1271
|
-
}),
|
1270
|
+
settings: be
|
1271
|
+
}), Bt = (r, e = "/__vtj__/api/uploader.json") => async (t, s) => await r.send({
|
1272
1272
|
url: e,
|
1273
1273
|
method: "post",
|
1274
1274
|
data: {
|
@@ -1276,7 +1276,7 @@ const $e = {
|
|
1276
1276
|
projectId: s
|
1277
1277
|
},
|
1278
1278
|
settings: {
|
1279
|
-
|
1279
|
+
...be,
|
1280
1280
|
type: "data"
|
1281
1281
|
}
|
1282
1282
|
}).then((n) => n && n[0] ? n[0] : null).catch(() => null);
|
@@ -1298,8 +1298,8 @@ class ee {
|
|
1298
1298
|
api;
|
1299
1299
|
pluginCaches = {};
|
1300
1300
|
uploader;
|
1301
|
-
constructor(e =
|
1302
|
-
this.api = Nt(e), this.uploader =
|
1301
|
+
constructor(e = J) {
|
1302
|
+
this.api = Nt(e), this.uploader = Bt(e);
|
1303
1303
|
}
|
1304
1304
|
async getExtension() {
|
1305
1305
|
console.log("BaseService.getExtension");
|
@@ -1374,10 +1374,10 @@ class ee {
|
|
1374
1374
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
1375
1375
|
}
|
1376
1376
|
async getPluginMaterial(e) {
|
1377
|
-
const { urls: t = [] } = e, s = t.filter((i) =>
|
1377
|
+
const { urls: t = [] } = e, s = t.filter((i) => Ke(i))[0];
|
1378
1378
|
if (!s) return null;
|
1379
1379
|
const n = this.pluginCaches[s];
|
1380
|
-
return n || (this.pluginCaches[s] =
|
1380
|
+
return n || (this.pluginCaches[s] = J.send({
|
1381
1381
|
url: s,
|
1382
1382
|
method: "get",
|
1383
1383
|
settings: {
|
@@ -1390,22 +1390,22 @@ class ee {
|
|
1390
1390
|
return console.log("BaseService.genSource", e), "";
|
1391
1391
|
}
|
1392
1392
|
}
|
1393
|
-
const v = new
|
1393
|
+
const v = new Ne({
|
1394
1394
|
type: "local",
|
1395
1395
|
expired: 0,
|
1396
1396
|
prefix: "__VTJ_"
|
1397
1397
|
});
|
1398
1398
|
class ss extends ee {
|
1399
1399
|
init(e) {
|
1400
|
-
const t = new
|
1400
|
+
const t = new D(e), s = v.get(`project_${t.id}`), n = Object.assign(t.toDsl(), s || {});
|
1401
1401
|
return v.save(`project_${t.id}`, n), Promise.resolve(n);
|
1402
1402
|
}
|
1403
1403
|
saveProject(e) {
|
1404
|
-
const t = new
|
1404
|
+
const t = new D(e);
|
1405
1405
|
return v.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
1406
1406
|
}
|
1407
1407
|
saveMaterials(e, t) {
|
1408
|
-
return v.save(`materials_${e.id}`,
|
1408
|
+
return v.save(`materials_${e.id}`, Q(t)), Promise.resolve(!0);
|
1409
1409
|
}
|
1410
1410
|
saveFile(e) {
|
1411
1411
|
return v.save(`file_${e.id}`, e), Promise.resolve(!0);
|
@@ -1445,22 +1445,22 @@ class ss extends ee {
|
|
1445
1445
|
}), Promise.resolve(!0);
|
1446
1446
|
}
|
1447
1447
|
}
|
1448
|
-
class
|
1448
|
+
class Ut extends ee {
|
1449
1449
|
projects = {};
|
1450
1450
|
materials = {};
|
1451
1451
|
files = {};
|
1452
1452
|
histories = {};
|
1453
1453
|
historyItems = {};
|
1454
1454
|
init(e) {
|
1455
|
-
const t = new
|
1455
|
+
const t = new D(e), s = this.projects[t.id] || {}, n = Object.assign(t.toDsl(), s);
|
1456
1456
|
return this.projects[n.id] = n, Promise.resolve(n);
|
1457
1457
|
}
|
1458
1458
|
saveProject(e) {
|
1459
|
-
const t = new
|
1459
|
+
const t = new D(e);
|
1460
1460
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
1461
1461
|
}
|
1462
1462
|
saveMaterials(e, t) {
|
1463
|
-
return e.id && (this.materials[e.id] =
|
1463
|
+
return e.id && (this.materials[e.id] = Q(t)), Promise.resolve(!0);
|
1464
1464
|
}
|
1465
1465
|
saveFile(e) {
|
1466
1466
|
return this.files[e.id] = e, Promise.resolve(!0);
|
@@ -1502,9 +1502,9 @@ class Lt extends ee {
|
|
1502
1502
|
}), Promise.resolve(!0);
|
1503
1503
|
}
|
1504
1504
|
}
|
1505
|
-
let
|
1505
|
+
let H = null;
|
1506
1506
|
function rs() {
|
1507
|
-
return
|
1507
|
+
return H || (H = new Ut(), H);
|
1508
1508
|
}
|
1509
1509
|
class ns extends ee {
|
1510
1510
|
getFileCaches = {};
|
@@ -1523,7 +1523,7 @@ class ns extends ee {
|
|
1523
1523
|
async saveMaterials(e, t) {
|
1524
1524
|
return !!await this.api("saveMaterials", {
|
1525
1525
|
project: e,
|
1526
|
-
materials:
|
1526
|
+
materials: Q(t)
|
1527
1527
|
}).catch(() => !1);
|
1528
1528
|
}
|
1529
1529
|
async saveFile(e) {
|
@@ -1563,7 +1563,7 @@ class ns extends ee {
|
|
1563
1563
|
);
|
1564
1564
|
}
|
1565
1565
|
}
|
1566
|
-
function
|
1566
|
+
function Pe(r, e, t = []) {
|
1567
1567
|
return t.map((s) => {
|
1568
1568
|
const { id: n, title: i, icon: a, children: o, hidden: c } = s;
|
1569
1569
|
return {
|
@@ -1572,16 +1572,16 @@ function Ee(r, e, t = []) {
|
|
1572
1572
|
icon: a,
|
1573
1573
|
hidden: c,
|
1574
1574
|
url: `${r}/${e}/${n}`,
|
1575
|
-
children: o && o.length ?
|
1575
|
+
children: o && o.length ? Pe(r, e, o) : void 0
|
1576
1576
|
};
|
1577
1577
|
});
|
1578
1578
|
}
|
1579
|
-
function
|
1579
|
+
function Ee(r, e) {
|
1580
1580
|
if (!e) return r;
|
1581
1581
|
let t = [];
|
1582
1582
|
for (const s of r)
|
1583
1583
|
if (s.children && s.children.length) {
|
1584
|
-
const n =
|
1584
|
+
const n = Ee(s.children, e);
|
1585
1585
|
n.length && (s.children = n, t.push(s));
|
1586
1586
|
} else
|
1587
1587
|
e.can(s.id.toString()) && t.push(s);
|
@@ -1592,97 +1592,97 @@ function is(r) {
|
|
1592
1592
|
menuPathPrefix: e = "",
|
1593
1593
|
pageRouteName: t = "page",
|
1594
1594
|
disableMenusFilter: s = !1
|
1595
|
-
} = r || {}, n = je(), i = he(), a = rt(), o =
|
1595
|
+
} = r || {}, n = je(), i = he(), a = rt(), o = z(!1), c = z(!1), l = n.project;
|
1596
1596
|
Be(() => {
|
1597
|
-
const { name: m, params: h, meta:
|
1598
|
-
if (m ===
|
1597
|
+
const { name: m, params: h, meta: f } = i;
|
1598
|
+
if (m === k) {
|
1599
1599
|
const u = n.getPage(h.id);
|
1600
1600
|
o.value = !u?.mask, c.value = !!u?.pure;
|
1601
|
-
} else if (m ===
|
1601
|
+
} else if (m === T) {
|
1602
1602
|
const u = n.getHomepage();
|
1603
1603
|
o.value = !u?.mask, c.value = !!u?.pure;
|
1604
1604
|
} else
|
1605
|
-
o.value = !
|
1605
|
+
o.value = !f.mask, c.value = !!f.pure;
|
1606
1606
|
});
|
1607
|
-
const
|
1607
|
+
const p = Pe(
|
1608
1608
|
e,
|
1609
1609
|
t,
|
1610
1610
|
l?.pages
|
1611
|
-
),
|
1611
|
+
), d = l?.config;
|
1612
1612
|
return {
|
1613
1613
|
disabled: o,
|
1614
|
-
logo:
|
1615
|
-
themeSwitchable:
|
1616
|
-
title:
|
1617
|
-
menus: s ?
|
1614
|
+
logo: d?.logo,
|
1615
|
+
themeSwitchable: d?.themeSwitchable,
|
1616
|
+
title: d?.title || l?.description || l?.name || "VTJ App",
|
1617
|
+
menus: s ? p : Ee(p, a),
|
1618
1618
|
pure: c
|
1619
1619
|
};
|
1620
1620
|
}
|
1621
1621
|
export {
|
1622
1622
|
ve as ACCESS_KEY,
|
1623
|
-
|
1623
|
+
ye as Access,
|
1624
1624
|
Je as BUILD_IN_TAGS,
|
1625
|
-
|
1625
|
+
Ue as BUILT_IN_DIRECTIVES,
|
1626
1626
|
ee as BaseService,
|
1627
1627
|
oe as CONTEXT_HOST,
|
1628
|
-
|
1628
|
+
ut as Context,
|
1629
1629
|
y as ContextMode,
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
1633
|
-
|
1634
|
-
|
1630
|
+
Le as DATA_TYPES,
|
1631
|
+
T as HOMEPAGE_ROUTE_NAME,
|
1632
|
+
qe as HTML_TAGS,
|
1633
|
+
Yt as JSCodeToString,
|
1634
|
+
zt as LIFE_CYCLES_LIST,
|
1635
1635
|
ns as LocalService,
|
1636
|
-
|
1636
|
+
Ut as MemoryService,
|
1637
1637
|
xt as NodeEnv,
|
1638
|
-
|
1639
|
-
|
1638
|
+
k as PAGE_ROUTE_NAME,
|
1639
|
+
Ot as Provider,
|
1640
1640
|
ss as StorageService,
|
1641
|
-
|
1641
|
+
C as VTJ_RENDERER_VERSION,
|
1642
1642
|
ge as adoptedStyleSheets,
|
1643
1643
|
Zt as clearLoaderCache,
|
1644
|
-
|
1645
|
-
|
1644
|
+
Xt as createAccess,
|
1645
|
+
Qt as createAdapter,
|
1646
1646
|
Vt as createAssetScripts,
|
1647
1647
|
Wt as createAssetsCss,
|
1648
|
-
|
1649
|
-
|
1648
|
+
vt as createDataSources,
|
1649
|
+
G as createLoader,
|
1650
1650
|
rs as createMemoryService,
|
1651
|
-
|
1652
|
-
|
1651
|
+
it as createMetaApi,
|
1652
|
+
ct as createMock,
|
1653
1653
|
es as createProvider,
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1654
|
+
W as createRenderer,
|
1655
|
+
nt as createSchemaApi,
|
1656
|
+
ot as createSchemaApis,
|
1657
1657
|
ts as createServiceRequest,
|
1658
|
-
|
1659
|
-
|
1658
|
+
wt as defaultLoader,
|
1659
|
+
I as fillBasePath,
|
1660
1660
|
F as getMock,
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1661
|
+
Se as getModifiers,
|
1662
|
+
we as getPlugin,
|
1663
|
+
We as getRawComponent,
|
1664
|
+
Ze as isBuiltInTag,
|
1665
|
+
X as isCSSUrl,
|
1666
|
+
tt as isJSCode,
|
1667
1667
|
_ as isJSExpression,
|
1668
|
-
|
1669
|
-
|
1668
|
+
M as isJSFunction,
|
1669
|
+
Ke as isJSON,
|
1670
1670
|
Z as isJSUrl,
|
1671
|
-
|
1671
|
+
et as isNativeTag,
|
1672
1672
|
Xe as isVuePlugin,
|
1673
|
-
|
1674
|
-
|
1673
|
+
Ge as loadCss,
|
1674
|
+
Ye as loadCssUrl,
|
1675
1675
|
Qe as loadScriptUrl,
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1676
|
+
lt as mockApi,
|
1677
|
+
at as mockApis,
|
1678
|
+
_e as mockCleanup,
|
1679
|
+
x as nodeRender,
|
1680
|
+
Ve as parseDeps,
|
1681
|
+
A as parseExpression,
|
1682
|
+
V as parseFunction,
|
1683
|
+
$e as providerKey,
|
1684
1684
|
ze as removeProdFlag,
|
1685
|
-
|
1685
|
+
Gt as setupPageSetting,
|
1686
1686
|
me as toString,
|
1687
1687
|
rt as useAccess,
|
1688
1688
|
is as useMask,
|