@vtj/renderer 0.11.0 → 0.11.1-alpha.1
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 +268 -265
- package/package.json +6 -6
- package/types/provider/defaults.d.ts +1 -0
- 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.11.
|
10
|
+
* @version 0.11.1-alpha.1
|
11
11
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
12
12
|
*/
|
13
|
-
const
|
13
|
+
const C = "0.11.1-alpha.1";
|
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",
|
@@ -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
|
-
),
|
59
|
-
function
|
60
|
-
return r.map((t) =>
|
58
|
+
), Je = "component,slot".split(",");
|
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
|
-
function
|
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
|
-
function
|
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
|
-
function
|
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(
|
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)) {
|
@@ -134,7 +134,7 @@ function Qe(r, e = window) {
|
|
134
134
|
a.rel = "stylesheet", a.id = n, a.href = n, s.appendChild(a);
|
135
135
|
}
|
136
136
|
}
|
137
|
-
async function
|
137
|
+
async function Qe(r, e, t = window) {
|
138
138
|
const s = t.document, n = t.document.head;
|
139
139
|
let i = t[e];
|
140
140
|
return i ? i.default || i : new Promise((a, o) => {
|
@@ -142,20 +142,20 @@ async function Xe(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
|
-
function
|
152
|
-
return
|
151
|
+
function Xe(r) {
|
152
|
+
return q(r) || q(r?.install);
|
153
153
|
}
|
154
154
|
function Ze(r) {
|
155
|
-
return
|
155
|
+
return Je.includes(r);
|
156
156
|
}
|
157
157
|
function et(r) {
|
158
|
-
return
|
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,13 +197,13 @@ 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
203
|
function tt(r) {
|
204
|
-
return _(r) ||
|
204
|
+
return _(r) || M(r);
|
205
205
|
}
|
206
|
-
function
|
206
|
+
function Yt(r) {
|
207
207
|
return tt(r) ? r.value : JSON.stringify(r);
|
208
208
|
}
|
209
209
|
const st = {
|
@@ -239,14 +239,14 @@ class ye {
|
|
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);
|
@@ -309,7 +309,7 @@ class ye {
|
|
309
309
|
this.data = e;
|
310
310
|
}
|
311
311
|
loadData() {
|
312
|
-
const { storageKey: e, storagePrefix: t } = this.options, s =
|
312
|
+
const { storageKey: e, storagePrefix: t } = this.options, s = B.get(e, {
|
313
313
|
type: "local",
|
314
314
|
prefix: t
|
315
315
|
});
|
@@ -320,7 +320,7 @@ class ye {
|
|
320
320
|
return e && t ? !!U.get(t) : !!this.getToken();
|
321
321
|
}
|
322
322
|
hasRoutePermission(e) {
|
323
|
-
if (e.name ===
|
323
|
+
if (e.name === k) {
|
324
324
|
const t = e.params.id;
|
325
325
|
return t && this.can(t);
|
326
326
|
}
|
@@ -337,7 +337,7 @@ class ye {
|
|
337
337
|
return t();
|
338
338
|
{
|
339
339
|
const { noPermissionMessage: s = "无权限访问", unauthorized: n = !1 } = this.options;
|
340
|
-
return await this.showTip(s),
|
340
|
+
return await this.showTip(s), q(n) ? (n(), t(!1)) : j(n) ? t(n) : t(!1);
|
341
341
|
}
|
342
342
|
}
|
343
343
|
t(!1), this.toLogin();
|
@@ -375,9 +375,17 @@ class ye {
|
|
375
375
|
function rt() {
|
376
376
|
return de(ve, null);
|
377
377
|
}
|
378
|
-
function
|
379
|
-
const {
|
380
|
-
|
378
|
+
function Qt(r = {}) {
|
379
|
+
const {
|
380
|
+
notify: e,
|
381
|
+
loading: t,
|
382
|
+
settings: s = {},
|
383
|
+
Startup: n,
|
384
|
+
access: i,
|
385
|
+
useTitle: a,
|
386
|
+
alert: o
|
387
|
+
} = r;
|
388
|
+
let c = null;
|
381
389
|
return {
|
382
390
|
request: ue({
|
383
391
|
settings: {
|
@@ -385,16 +393,16 @@ function Xt(r = {}) {
|
|
385
393
|
validSuccess: !0,
|
386
394
|
originResponse: !1,
|
387
395
|
loading: !0,
|
388
|
-
validate: (
|
396
|
+
validate: (p) => p.data?.code === 0 || !!p.data?.success,
|
389
397
|
failMessage: !0,
|
390
|
-
showError: (
|
391
|
-
e && e(
|
398
|
+
showError: (p) => {
|
399
|
+
e && e(p || "未知错误");
|
392
400
|
},
|
393
401
|
showLoading: () => {
|
394
|
-
|
402
|
+
c && c.close(), t && (c = t());
|
395
403
|
},
|
396
404
|
hideLoading: () => {
|
397
|
-
|
405
|
+
c && (c.close(), c = null);
|
398
406
|
},
|
399
407
|
...s
|
400
408
|
}
|
@@ -404,16 +412,11 @@ function Xt(r = {}) {
|
|
404
412
|
loading: t,
|
405
413
|
useTitle: a,
|
406
414
|
startupComponent: n,
|
407
|
-
access: i ? new ye(i) : void 0
|
415
|
+
access: i ? new ye({ alert: o, ...i }) : void 0
|
408
416
|
};
|
409
417
|
}
|
410
|
-
function
|
411
|
-
|
412
|
-
storageKey: "RRO_IDE_ACCESS_STORAGE__",
|
413
|
-
auth: "https://lcdp.vtj.pro/auth.html",
|
414
|
-
privateKey: "MIIBOgIBAAJBAKoIzmn1FYQ1YOhOBw9EhABxZ+PySAIaydI+zdhoKflrdgJ4A5E4/5gbQmRpk09hPWG8nvX7h+l/QLU8kXxAIBECAwEAAQJAAlgpxQY6sByLsXqzJcthC8LSGsLf2JEJkHwlnpwFqlEV8UCkoINpuZ2Wzl+aftURu5rIfAzRCQBvHmeOTW9/zQIhAO5ufWDmnSLyfAAsNo5JRNpVuLFCFodR8Xm+ulDlosR/AiEAtpAltyP9wmCABKG/v/hrtTr3mcvFNGCjoGa9bUAok28CIHbrVs9w1ijrBlvTsXYwJw46uP539uKRRT4ymZzlm9QjAiB+1KH/G9f9pEEL9rtaSOG7JF5D0JcOjlze4MGVFs+ZrQIhALKOUFBNr2zEsyJIjw2PlvEucdlG77UniszjXTROHSPd"
|
415
|
-
};
|
416
|
-
return new ye(Object.assign(e, r));
|
418
|
+
function Xt(r = {}) {
|
419
|
+
return new ye(r);
|
417
420
|
}
|
418
421
|
function nt(r, e) {
|
419
422
|
const { jsonp: t, request: s } = e;
|
@@ -423,7 +426,7 @@ function nt(r, e) {
|
|
423
426
|
query: n
|
424
427
|
});
|
425
428
|
{
|
426
|
-
const n = r.headers ?
|
429
|
+
const n = r.headers ? A(r.headers, {}, !0) : void 0, i = {
|
427
430
|
url: r.url,
|
428
431
|
method: r.method,
|
429
432
|
settings: {
|
@@ -431,7 +434,7 @@ function nt(r, e) {
|
|
431
434
|
headers: n
|
432
435
|
}
|
433
436
|
};
|
434
|
-
return (a, o) => (delete i.data, s.send(
|
437
|
+
return (a, o) => (delete i.data, s.send(Ie(i, o || {}, { data: a })));
|
435
438
|
}
|
436
439
|
}
|
437
440
|
function it(r, e) {
|
@@ -459,14 +462,14 @@ async function at(r = [], e = window) {
|
|
459
462
|
t && (_e(e), r.forEach((s) => lt(t, s)));
|
460
463
|
}
|
461
464
|
function ct(r, e = window) {
|
462
|
-
const t =
|
465
|
+
const t = M(r.mockTemplate) && r.mockTemplate.value ? V(r.mockTemplate, {}, !0) : void 0, s = F(e);
|
463
466
|
return async (...n) => {
|
464
467
|
let i = {};
|
465
468
|
if (t)
|
466
469
|
try {
|
467
470
|
i = await t.apply(t, n);
|
468
471
|
} catch (a) {
|
469
|
-
|
472
|
+
R.warn("模拟数据模版异常", a);
|
470
473
|
}
|
471
474
|
return s?.mock(i);
|
472
475
|
};
|
@@ -475,10 +478,10 @@ function lt(r, e) {
|
|
475
478
|
if (!e.mock) return;
|
476
479
|
const { url: t, mockTemplate: s } = e;
|
477
480
|
if (t && s) {
|
478
|
-
const n =
|
481
|
+
const n = He(`${t}(.*)`), i = Te(t, { decode: decodeURIComponent }), a = A(s, {}, !0);
|
479
482
|
r.mock(n, (o) => {
|
480
|
-
const c =
|
481
|
-
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));
|
482
485
|
});
|
483
486
|
}
|
484
487
|
}
|
@@ -515,7 +518,7 @@ class ut {
|
|
515
518
|
const { mode: t, dsl: s, attrs: n } = e;
|
516
519
|
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), n && Object.assign(this, n);
|
517
520
|
}
|
518
|
-
setup(e, t =
|
521
|
+
setup(e, t = O) {
|
519
522
|
const s = t.getCurrentInstance();
|
520
523
|
if (!s) return;
|
521
524
|
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = s.proxy;
|
@@ -545,17 +548,17 @@ class ut {
|
|
545
548
|
if (e)
|
546
549
|
if (this.__mode === y.Runtime) {
|
547
550
|
const { id: t, type: s } = e, n = t ? this.__transform[t] ?? e.value : e.value;
|
548
|
-
return
|
551
|
+
return V({ type: s, value: n }, this);
|
549
552
|
} else
|
550
|
-
return
|
553
|
+
return V(e, this);
|
551
554
|
}
|
552
555
|
__parseExpression(e) {
|
553
556
|
if (e)
|
554
557
|
if (this.__mode === y.Runtime) {
|
555
558
|
const { id: t, type: s } = e, n = t ? this.__transform[t] ?? e.value : e.value;
|
556
|
-
return
|
559
|
+
return A({ type: s, value: n }, this);
|
557
560
|
} else
|
558
|
-
return
|
561
|
+
return A(e, this);
|
559
562
|
}
|
560
563
|
__ref(e = null, t) {
|
561
564
|
if (this.__mode !== y.VNode)
|
@@ -585,9 +588,9 @@ class ut {
|
|
585
588
|
return s.context.__proto__ = this.context, s.__proto__ = this, s;
|
586
589
|
}
|
587
590
|
}
|
588
|
-
function
|
591
|
+
function W(r) {
|
589
592
|
const {
|
590
|
-
Vue: e =
|
593
|
+
Vue: e = O,
|
591
594
|
mode: t = y.Runtime,
|
592
595
|
components: s = {},
|
593
596
|
libs: n = {},
|
@@ -601,22 +604,22 @@ function V(r) {
|
|
601
604
|
mode: t,
|
602
605
|
dsl: o.value,
|
603
606
|
attrs: c
|
604
|
-
}),
|
607
|
+
}), p = e.defineComponent({
|
605
608
|
name: o.value.name,
|
606
609
|
props: {
|
607
610
|
...dt(o.value.props ?? [], l)
|
608
611
|
},
|
609
|
-
setup(
|
610
|
-
l.$props =
|
612
|
+
setup(d) {
|
613
|
+
l.$props = d, l.props = d, o.value.id && ge(
|
611
614
|
r.window || window,
|
612
615
|
o.value.id,
|
613
616
|
o.value.css || ""
|
614
617
|
), l.state = ft(e, o.value.state ?? {}, l);
|
615
|
-
const m = ht(e, o.value.computed ?? {}, l), h = mt(o.value.methods ?? {}, 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(
|
616
619
|
o.value.dataSources || {},
|
617
620
|
l
|
618
621
|
), w = {
|
619
|
-
...
|
622
|
+
...f,
|
620
623
|
...m,
|
621
624
|
...h,
|
622
625
|
...u
|
@@ -629,22 +632,22 @@ function V(r) {
|
|
629
632
|
expose: ["vtj"],
|
630
633
|
render() {
|
631
634
|
if (!o.value.nodes) return null;
|
632
|
-
const
|
633
|
-
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));
|
634
637
|
},
|
635
638
|
..._t(o.value.lifeCycles ?? {}, l)
|
636
639
|
});
|
637
640
|
return {
|
638
|
-
renderer: e.markRaw(
|
641
|
+
renderer: e.markRaw(p),
|
639
642
|
context: l
|
640
643
|
};
|
641
644
|
}
|
642
645
|
function pt(r = []) {
|
643
|
-
return r.map((e) =>
|
646
|
+
return r.map((e) => j(e) ? e : e.name);
|
644
647
|
}
|
645
648
|
function dt(r = [], e) {
|
646
649
|
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((i) => Le[i]) : void 0;
|
647
|
-
return r.map((s) =>
|
650
|
+
return r.map((s) => j(s) ? {
|
648
651
|
name: s
|
649
652
|
} : {
|
650
653
|
name: s.name,
|
@@ -665,7 +668,7 @@ function ft(r, e, t) {
|
|
665
668
|
Object.keys(e || {}).reduce(
|
666
669
|
(s, n) => {
|
667
670
|
let i = e[n];
|
668
|
-
return _(i) ? i = t.__parseExpression(i) :
|
671
|
+
return _(i) ? i = t.__parseExpression(i) : M(i) && (i = t.__parseFunction(i)), s[n] = i, s;
|
669
672
|
},
|
670
673
|
{}
|
671
674
|
)
|
@@ -701,7 +704,7 @@ function vt(r, e) {
|
|
701
704
|
if (n.type === "mock")
|
702
705
|
t[s] = ct(n);
|
703
706
|
else if (n.ref) {
|
704
|
-
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;
|
705
708
|
t[s] = async (...o) => {
|
706
709
|
const c = await i.apply(e, o);
|
707
710
|
return a ? a(c) : c;
|
@@ -730,51 +733,51 @@ function _t(r, e) {
|
|
730
733
|
{}
|
731
734
|
);
|
732
735
|
}
|
733
|
-
let L = [],
|
736
|
+
let L = [], P = {};
|
734
737
|
const wt = (r) => r;
|
735
738
|
async function we(r, e = window) {
|
736
739
|
const { urls: t = [], library: s } = r, n = t.filter((o) => Z(o));
|
737
740
|
if (n.length === 0 || !s) return null;
|
738
|
-
const i = t.filter((o) =>
|
739
|
-
return i.length &&
|
741
|
+
const i = t.filter((o) => X(o));
|
742
|
+
return i.length && Ye(i, e), await Qe(n, s, e).catch(
|
740
743
|
(o) => (console.warn("loadScriptUrl error", n, s, o), null)
|
741
744
|
);
|
742
745
|
}
|
743
|
-
function
|
746
|
+
function G(r) {
|
744
747
|
const { getDsl: e, getDslByUrl: t, options: s } = r;
|
745
748
|
return s.window && (L.forEach((n) => {
|
746
749
|
delete s.window[n];
|
747
|
-
}), L = []), (n, i, a =
|
750
|
+
}), L = []), (n, i, a = O) => {
|
748
751
|
if (!i || typeof i == "string") return n;
|
749
752
|
if (i.type === "Schema" && i.id) {
|
750
|
-
let o =
|
751
|
-
return o || (o =
|
753
|
+
let o = P[i.id];
|
754
|
+
return o || (o = P[i.id] = a.defineAsyncComponent(async () => {
|
752
755
|
const c = await e(i.id);
|
753
|
-
return c && (c.name = n), c ?
|
756
|
+
return c && (c.name = n), c ? W({
|
754
757
|
...s,
|
755
758
|
Vue: a,
|
756
759
|
dsl: c,
|
757
760
|
mode: y.Runtime,
|
758
|
-
loader:
|
761
|
+
loader: G(r)
|
759
762
|
}).renderer : null;
|
760
763
|
}), o);
|
761
764
|
}
|
762
765
|
if (i.type === "UrlSchema" && i.url) {
|
763
|
-
let o =
|
764
|
-
return o || (o =
|
766
|
+
let o = P[i.url];
|
767
|
+
return o || (o = P[i.url] = a.defineAsyncComponent(async () => {
|
765
768
|
const c = await t(i.url);
|
766
|
-
return c && (c.name = n), c ?
|
769
|
+
return c && (c.name = n), c ? W({
|
767
770
|
...s,
|
768
771
|
Vue: a,
|
769
772
|
dsl: c,
|
770
773
|
mode: y.Runtime,
|
771
|
-
loader:
|
774
|
+
loader: G(r)
|
772
775
|
}).renderer : null;
|
773
776
|
}), o);
|
774
777
|
}
|
775
778
|
if (i.type === "Plugin") {
|
776
|
-
let o = i.library ?
|
777
|
-
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(
|
778
781
|
async () => {
|
779
782
|
const c = await we(i, s.window);
|
780
783
|
return c || (console.warn("getPlugin result is null", i), null);
|
@@ -785,41 +788,41 @@ function W(r) {
|
|
785
788
|
};
|
786
789
|
}
|
787
790
|
function Zt() {
|
788
|
-
|
791
|
+
P = {};
|
789
792
|
}
|
790
|
-
function
|
793
|
+
function x(r, e, t = O, s = wt) {
|
791
794
|
if (!r || !r.name || r.invisible) return null;
|
792
|
-
const n = t.getCurrentInstance()?.appContext, { id: i = null, directives: a = [] } = r, { vIf: o, vFor: c, vShow: l, vModels:
|
793
|
-
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))
|
794
797
|
return null;
|
795
|
-
const
|
798
|
+
const f = (u) => {
|
796
799
|
const w = u.$components, g = (() => {
|
797
800
|
if (r.name === "component")
|
798
|
-
return
|
801
|
+
return bt(u, r.props?.is);
|
799
802
|
if (r.name === "slot") return r.name;
|
800
|
-
const
|
801
|
-
return $
|
802
|
-
})(), 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);
|
803
806
|
if (r.name === "slot")
|
804
|
-
return
|
805
|
-
|
807
|
+
return Rt(t, r, S, u, s);
|
808
|
+
d && Object.assign(S, u.__parseExpression(d.value)), l && (S.style = Object.assign(
|
806
809
|
S.style ?? {},
|
807
|
-
|
808
|
-
)), m && Object.assign(S, Ft(m, u)),
|
809
|
-
Object.assign(S,
|
810
|
+
kt(l, u)
|
811
|
+
)), m && Object.assign(S, Ft(m, u)), p.forEach(($) => {
|
812
|
+
Object.assign(S, At(t, $, u));
|
810
813
|
});
|
811
|
-
const
|
814
|
+
const Ce = Mt(
|
812
815
|
t,
|
813
816
|
r.children ?? [],
|
814
817
|
u,
|
815
818
|
s,
|
816
819
|
r
|
817
820
|
);
|
818
|
-
let
|
821
|
+
let N = t.createVNode(g, { ...S, ...Re }, Ce);
|
819
822
|
const te = n ? St(n, h, u) : [];
|
820
|
-
return te.length && (
|
823
|
+
return te.length && (N = t.withDirectives(N, te)), N;
|
821
824
|
};
|
822
|
-
return c ? Tt(c,
|
825
|
+
return c ? Tt(c, f, e) : f(e);
|
823
826
|
}
|
824
827
|
function St(r, e, t) {
|
825
828
|
const s = r.app;
|
@@ -830,11 +833,11 @@ function St(r, e, t) {
|
|
830
833
|
return n.value && a.push(t.__parseExpression(n.value)), n.arg && a.push(n.arg), n.modifiers && a.push(n.modifiers), a;
|
831
834
|
}).filter((n) => !!n);
|
832
835
|
}
|
833
|
-
function
|
834
|
-
const e = r.find((c) =>
|
835
|
-
(c) =>
|
836
|
+
function $t(r = []) {
|
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"
|
836
839
|
), o = r.filter(
|
837
|
-
(c) => !Ue.includes(
|
840
|
+
(c) => !Ue.includes(b(c.name))
|
838
841
|
);
|
839
842
|
return {
|
840
843
|
vIf: e,
|
@@ -846,26 +849,26 @@ function jt(r = []) {
|
|
846
849
|
vHtml: i
|
847
850
|
};
|
848
851
|
}
|
849
|
-
function
|
852
|
+
function jt(r, e) {
|
850
853
|
return !!e.__parseExpression(r.value);
|
851
854
|
}
|
852
|
-
function
|
855
|
+
function bt(r, e) {
|
853
856
|
return e ? _(e) ? r.__parseExpression(e) : e : "div";
|
854
857
|
}
|
855
|
-
function
|
856
|
-
const s =
|
858
|
+
function Pt(r, e, t) {
|
859
|
+
const s = Y(e, t);
|
857
860
|
return s.ref = t.__ref(r, s.ref), s;
|
858
861
|
}
|
859
|
-
function
|
860
|
-
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(
|
861
864
|
(t, s) => {
|
862
865
|
let n = r[s];
|
863
|
-
return t[s] =
|
866
|
+
return t[s] = Y(n, e), t;
|
864
867
|
},
|
865
868
|
{}
|
866
869
|
) : r;
|
867
870
|
}
|
868
|
-
function
|
871
|
+
function Et(r, e, t) {
|
869
872
|
const s = ["passive", "capture", "once"], n = {
|
870
873
|
capture: "Capture",
|
871
874
|
once: "Once",
|
@@ -873,8 +876,8 @@ function bt(r, e, t) {
|
|
873
876
|
};
|
874
877
|
return Object.keys(e || {}).reduce(
|
875
878
|
(i, a) => {
|
876
|
-
const o = e[a], c = Se(o.modifiers), l = c.find((m) => s.includes(m)),
|
877
|
-
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;
|
878
881
|
},
|
879
882
|
{}
|
880
883
|
);
|
@@ -883,22 +886,22 @@ function Se(r = {}, e = !1) {
|
|
883
886
|
const t = Object.keys(r);
|
884
887
|
return e ? t.map((s) => "." + s) : t;
|
885
888
|
}
|
886
|
-
function
|
887
|
-
const { children: i } = e, a =
|
888
|
-
return o ? o(t) : i ?
|
889
|
+
function Rt(r, e, t, s, n) {
|
890
|
+
const { children: i } = e, a = Ct(e, s), o = s.$slots?.[a.name];
|
891
|
+
return o ? o(t) : i ? j(i) ? r.createTextVNode(i) : _(i) ? r.createTextVNode(
|
889
892
|
me(s.__parseExpression(i))
|
890
893
|
) : Array.isArray(i) ? i.map(
|
891
|
-
(c) =>
|
894
|
+
(c) => x(c, s, r, n)
|
892
895
|
) : null : null;
|
893
896
|
}
|
894
|
-
function
|
897
|
+
function Ct(r, e) {
|
895
898
|
const { props: t } = r, s = t?.name || "default";
|
896
899
|
return {
|
897
900
|
name: _(s) ? e.__parseExpression(s) : s,
|
898
901
|
params: []
|
899
902
|
};
|
900
903
|
}
|
901
|
-
function
|
904
|
+
function kt(r, e) {
|
902
905
|
return e.__parseExpression(r.value) ? {} : {
|
903
906
|
display: "none"
|
904
907
|
};
|
@@ -908,7 +911,7 @@ function Ft(r, e) {
|
|
908
911
|
innerHTML: e.__parseExpression(r.value) || ""
|
909
912
|
};
|
910
913
|
}
|
911
|
-
function
|
914
|
+
function At(r, e, t) {
|
912
915
|
const s = {
|
913
916
|
type: "JSFunction",
|
914
917
|
value: e.value?.value ? `(v) => {
|
@@ -922,28 +925,28 @@ function It(r, e, t) {
|
|
922
925
|
[`onUpdate:${a}`]: i.length && n ? r.withModifiers(n, i) : n
|
923
926
|
};
|
924
927
|
}
|
925
|
-
function
|
928
|
+
function Mt(r, e, t, s, n) {
|
926
929
|
if (!e) return null;
|
927
|
-
if (
|
930
|
+
if (j(e))
|
928
931
|
return { default: () => e };
|
929
932
|
if (_(e))
|
930
933
|
return {
|
931
934
|
default: () => me(t.__parseExpression(e))
|
932
935
|
};
|
933
936
|
if (Array.isArray(e) && e.length > 0) {
|
934
|
-
const i =
|
937
|
+
const i = It(e), a = (o) => !o || !n ? {} : n?.id && Object.keys(o).length ? {
|
935
938
|
[`scope_${n.id}`]: o
|
936
939
|
} : {};
|
937
|
-
return Object.entries(i).reduce((o, [c, { nodes: l, params:
|
938
|
-
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);
|
939
942
|
return l.map(
|
940
|
-
(h) =>
|
943
|
+
(h) => x(h, t.__clone(m), r, s)
|
941
944
|
);
|
942
945
|
}, o), {});
|
943
946
|
}
|
944
947
|
return null;
|
945
948
|
}
|
946
|
-
function
|
949
|
+
function It(r) {
|
947
950
|
const e = {
|
948
951
|
default: {
|
949
952
|
params: [],
|
@@ -951,7 +954,7 @@ function Mt(r) {
|
|
951
954
|
}
|
952
955
|
};
|
953
956
|
for (const t of r) {
|
954
|
-
const s =
|
957
|
+
const s = Ht(t.slot), n = s.name;
|
955
958
|
e[n] ? (e[n].nodes.push(t), e[n].params = e[n].params.concat(s.params)) : e[n] = {
|
956
959
|
nodes: [t],
|
957
960
|
params: s.params
|
@@ -959,8 +962,8 @@ function Mt(r) {
|
|
959
962
|
}
|
960
963
|
return e;
|
961
964
|
}
|
962
|
-
function
|
963
|
-
return
|
965
|
+
function Ht(r = "default") {
|
966
|
+
return j(r) ? { name: r, params: [] } : { params: [], ...r };
|
964
967
|
}
|
965
968
|
function Tt(r, e, t) {
|
966
969
|
const { value: s, iterator: n } = r, { item: i = "item", index: a = "index" } = n || {};
|
@@ -970,7 +973,7 @@ function Tt(r, e, t) {
|
|
970
973
|
const ae = fe({
|
971
974
|
name: "VtjPageContainer",
|
972
975
|
async setup() {
|
973
|
-
const r =
|
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());
|
974
977
|
if (s) {
|
975
978
|
Object.assign(e.meta, s.meta || {}, { cache: s.cache });
|
976
979
|
const { useTitle: a } = r?.adapter;
|
@@ -988,19 +991,19 @@ const ae = fe({
|
|
988
991
|
},
|
989
992
|
render() {
|
990
993
|
const { component: r, query: e, sid: t } = this;
|
991
|
-
return r ?
|
994
|
+
return r ? K(r, { ...e, key: t }) : K("div", "页面不存在");
|
992
995
|
},
|
993
996
|
activated() {
|
994
997
|
this.meta.cache === !1 && (this.sid = Symbol());
|
995
998
|
}
|
996
|
-
}),
|
999
|
+
}), Dt = fe({
|
997
1000
|
name: "VtjStartupContainer",
|
998
1001
|
render() {
|
999
|
-
return
|
1002
|
+
return K("div", "page not found!");
|
1000
1003
|
}
|
1001
|
-
}),
|
1002
|
-
var
|
1003
|
-
class
|
1004
|
+
}), $e = Symbol("Provider");
|
1005
|
+
var xt = /* @__PURE__ */ ((r) => (r.Production = "production", r.Development = "development", r))(xt || {});
|
1006
|
+
class Ot extends ke {
|
1004
1007
|
constructor(e) {
|
1005
1008
|
super(), this.options = e;
|
1006
1009
|
const {
|
@@ -1012,19 +1015,19 @@ class xt extends Ce {
|
|
1012
1015
|
adapter: o = {},
|
1013
1016
|
globals: c = {},
|
1014
1017
|
modules: l = {},
|
1015
|
-
router:
|
1016
|
-
materialPath:
|
1018
|
+
router: p = null,
|
1019
|
+
materialPath: d = "./",
|
1017
1020
|
nodeEnv: m = "development"
|
1018
1021
|
/* Development */
|
1019
1022
|
} = e;
|
1020
|
-
this.mode = s, this.modules = l, this.service = t, this.router =
|
1021
|
-
const { access: h, request:
|
1022
|
-
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;
|
1023
1026
|
}
|
1024
1027
|
mode;
|
1025
1028
|
globals = {};
|
1026
1029
|
modules = {};
|
1027
|
-
adapter = { request:
|
1030
|
+
adapter = { request: J, jsonp: pe };
|
1028
1031
|
apis = {};
|
1029
1032
|
dependencies = {};
|
1030
1033
|
materials = {};
|
@@ -1043,7 +1046,7 @@ class xt extends Ce {
|
|
1043
1046
|
try {
|
1044
1047
|
s = await e.apply(e, t);
|
1045
1048
|
} catch (i) {
|
1046
|
-
|
1049
|
+
R.warn("模拟数据模版异常", i);
|
1047
1050
|
}
|
1048
1051
|
return F()?.mock(s);
|
1049
1052
|
};
|
@@ -1070,42 +1073,42 @@ class xt extends Ce {
|
|
1070
1073
|
const { dependencies: t = [] } = this.project, { dependencies: s, library: n, components: i, materialPath: a, nodeEnv: o } = this, {
|
1071
1074
|
libraryExports: c,
|
1072
1075
|
libraryMap: l,
|
1073
|
-
materials:
|
1074
|
-
materialExports:
|
1076
|
+
materials: p,
|
1077
|
+
materialExports: d,
|
1075
1078
|
materialMapLibrary: m
|
1076
|
-
} =
|
1079
|
+
} = Ve(
|
1077
1080
|
t,
|
1078
1081
|
a,
|
1079
1082
|
o === "development"
|
1080
1083
|
/* Development */
|
1081
1084
|
);
|
1082
1085
|
for (const h of c) {
|
1083
|
-
const
|
1086
|
+
const f = s[h], u = e[h];
|
1084
1087
|
if (u)
|
1085
1088
|
n[h] = u;
|
1086
|
-
else if (
|
1087
|
-
e[h] = n[h] = await
|
1089
|
+
else if (f)
|
1090
|
+
e[h] = n[h] = await f();
|
1088
1091
|
else {
|
1089
1092
|
const w = l[h] || [];
|
1090
1093
|
for (const g of w)
|
1091
|
-
|
1094
|
+
X(g) && await Ge(h, E.append(g, { v: C })), Z(g) && await ne(E.append(g, { v: C }));
|
1092
1095
|
n[h] = e[h];
|
1093
1096
|
}
|
1094
1097
|
}
|
1095
1098
|
if (o === "development") {
|
1096
|
-
for (const
|
1097
|
-
await ne(
|
1099
|
+
for (const f of p)
|
1100
|
+
await ne(E.append(f, { v: C }));
|
1098
1101
|
const h = this.materials || {};
|
1099
|
-
for (const
|
1100
|
-
const u = e[m[
|
1102
|
+
for (const f of d) {
|
1103
|
+
const u = e[m[f]], w = Fe[f];
|
1101
1104
|
if (w)
|
1102
1105
|
u && w.forEach((g) => {
|
1103
1106
|
i[g] = u[g];
|
1104
1107
|
});
|
1105
1108
|
else {
|
1106
|
-
const g = h[
|
1109
|
+
const g = h[f] ? (await h[f]()).default : e[f];
|
1107
1110
|
g && u && (g.components || []).forEach((S) => {
|
1108
|
-
i[S.name] =
|
1111
|
+
i[S.name] = We(S, u);
|
1109
1112
|
});
|
1110
1113
|
}
|
1111
1114
|
}
|
@@ -1118,23 +1121,23 @@ class xt extends Ce {
|
|
1118
1121
|
routeAppendTo: a,
|
1119
1122
|
pageRouteName: o = i,
|
1120
1123
|
routeMeta: c
|
1121
|
-
} = s, l = a ? "" : "/",
|
1124
|
+
} = s, l = a ? "" : "/", p = {
|
1122
1125
|
path: `${l}${o}/:id`,
|
1123
|
-
name:
|
1126
|
+
name: k,
|
1124
1127
|
component: ae
|
1125
|
-
},
|
1128
|
+
}, d = {
|
1126
1129
|
path: l,
|
1127
1130
|
name: T,
|
1128
|
-
component: t?.homepage ? ae : n.startupComponent ||
|
1131
|
+
component: t?.homepage ? ae : n.startupComponent || Dt,
|
1129
1132
|
meta: c
|
1130
1133
|
};
|
1131
|
-
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));
|
1132
1135
|
}
|
1133
1136
|
install(e) {
|
1134
1137
|
const t = e.config.globalProperties.installed || {};
|
1135
1138
|
for (const [s, n] of Object.entries(this.library))
|
1136
|
-
!t[s] &&
|
1137
|
-
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(
|
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($e, this), e.config.globalProperties.$provider = this, e.config.globalProperties.installed = t, this.mode === y.Design && (e.config.errorHandler = (s, n, i) => {
|
1138
1141
|
const a = n?.$options.name, o = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", c = `[ ${a} ] ${o} ${i}`;
|
1139
1142
|
console.error(
|
1140
1143
|
"[VTJ Error]:",
|
@@ -1193,12 +1196,12 @@ class xt extends Ce {
|
|
1193
1196
|
apis: a,
|
1194
1197
|
window,
|
1195
1198
|
...t
|
1196
|
-
}, c =
|
1199
|
+
}, c = G({
|
1197
1200
|
getDsl: async (l) => await this.getDsl(l) || null,
|
1198
1201
|
getDslByUrl: async (l) => await this.getDslByUrl(l) || null,
|
1199
1202
|
options: o
|
1200
1203
|
});
|
1201
|
-
return
|
1204
|
+
return W({
|
1202
1205
|
...o,
|
1203
1206
|
dsl: e,
|
1204
1207
|
loader: c
|
@@ -1207,13 +1210,13 @@ class xt extends Ce {
|
|
1207
1210
|
async getRenderComponent(e, t) {
|
1208
1211
|
const s = this.getFile(e);
|
1209
1212
|
if (!s)
|
1210
|
-
return
|
1213
|
+
return R.warn(`Can not find file: ${e}`), null;
|
1211
1214
|
t && t(s);
|
1212
1215
|
const n = `.vtj/vue/${e}.vue`, i = this.modules[n] || this.modules[`/src/pages/${e}.vue`];
|
1213
1216
|
if (i)
|
1214
1217
|
return (await i())?.default;
|
1215
1218
|
const a = await this.getDsl(s.id);
|
1216
|
-
return a ? this.createDslRenderer(a).renderer : (
|
1219
|
+
return a ? this.createDslRenderer(a).renderer : (R.warn(`Can not find dsl: ${e}`), null);
|
1217
1220
|
}
|
1218
1221
|
defineUrlSchemaComponent(e, t) {
|
1219
1222
|
return ie(async () => {
|
@@ -1226,14 +1229,14 @@ class xt extends Ce {
|
|
1226
1229
|
}
|
1227
1230
|
}
|
1228
1231
|
function es(r) {
|
1229
|
-
const e = new
|
1232
|
+
const e = new Ot(r);
|
1230
1233
|
return {
|
1231
1234
|
provider: e,
|
1232
1235
|
onReady: (s) => e.ready(s)
|
1233
1236
|
};
|
1234
1237
|
}
|
1235
|
-
function
|
1236
|
-
const e = de(
|
1238
|
+
function je(r = {}) {
|
1239
|
+
const e = de($e, null);
|
1237
1240
|
if (!e)
|
1238
1241
|
throw new Error("Can not find provider");
|
1239
1242
|
if (e.nodeEnv === "development") {
|
@@ -1249,13 +1252,13 @@ function $e(r = {}) {
|
|
1249
1252
|
}
|
1250
1253
|
return e;
|
1251
1254
|
}
|
1252
|
-
const
|
1255
|
+
const be = {
|
1253
1256
|
type: "json",
|
1254
1257
|
validSuccess: !0,
|
1255
1258
|
originResponse: !1,
|
1256
1259
|
failMessage: !0,
|
1257
1260
|
validate: (r) => r.data?.code === 0
|
1258
|
-
},
|
1261
|
+
}, Nt = (r, e = "/__vtj__/api/:type.json") => (t, s, n) => r.send({
|
1259
1262
|
url: e,
|
1260
1263
|
method: "post",
|
1261
1264
|
params: { type: t },
|
@@ -1264,8 +1267,8 @@ const Ee = {
|
|
1264
1267
|
type: t,
|
1265
1268
|
data: s
|
1266
1269
|
},
|
1267
|
-
settings:
|
1268
|
-
}),
|
1270
|
+
settings: be
|
1271
|
+
}), Bt = (r, e = "/__vtj__/api/uploader.json") => async (t, s) => await r.send({
|
1269
1272
|
url: e,
|
1270
1273
|
method: "post",
|
1271
1274
|
data: {
|
@@ -1273,7 +1276,7 @@ const Ee = {
|
|
1273
1276
|
projectId: s
|
1274
1277
|
},
|
1275
1278
|
settings: {
|
1276
|
-
...
|
1279
|
+
...be,
|
1277
1280
|
type: "data"
|
1278
1281
|
}
|
1279
1282
|
}).then((n) => n && n[0] ? n[0] : null).catch(() => null);
|
@@ -1295,8 +1298,8 @@ class ee {
|
|
1295
1298
|
api;
|
1296
1299
|
pluginCaches = {};
|
1297
1300
|
uploader;
|
1298
|
-
constructor(e =
|
1299
|
-
this.api =
|
1301
|
+
constructor(e = J) {
|
1302
|
+
this.api = Nt(e), this.uploader = Bt(e);
|
1300
1303
|
}
|
1301
1304
|
async getExtension() {
|
1302
1305
|
console.log("BaseService.getExtension");
|
@@ -1371,10 +1374,10 @@ class ee {
|
|
1371
1374
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
1372
1375
|
}
|
1373
1376
|
async getPluginMaterial(e) {
|
1374
|
-
const { urls: t = [] } = e, s = t.filter((i) =>
|
1377
|
+
const { urls: t = [] } = e, s = t.filter((i) => Ke(i))[0];
|
1375
1378
|
if (!s) return null;
|
1376
1379
|
const n = this.pluginCaches[s];
|
1377
|
-
return n || (this.pluginCaches[s] =
|
1380
|
+
return n || (this.pluginCaches[s] = J.send({
|
1378
1381
|
url: s,
|
1379
1382
|
method: "get",
|
1380
1383
|
settings: {
|
@@ -1387,22 +1390,22 @@ class ee {
|
|
1387
1390
|
return console.log("BaseService.genSource", e), "";
|
1388
1391
|
}
|
1389
1392
|
}
|
1390
|
-
const v = new
|
1393
|
+
const v = new Ne({
|
1391
1394
|
type: "local",
|
1392
1395
|
expired: 0,
|
1393
1396
|
prefix: "__VTJ_"
|
1394
1397
|
});
|
1395
1398
|
class ss extends ee {
|
1396
1399
|
init(e) {
|
1397
|
-
const t = new
|
1400
|
+
const t = new D(e), s = v.get(`project_${t.id}`), n = Object.assign(t.toDsl(), s || {});
|
1398
1401
|
return v.save(`project_${t.id}`, n), Promise.resolve(n);
|
1399
1402
|
}
|
1400
1403
|
saveProject(e) {
|
1401
|
-
const t = new
|
1404
|
+
const t = new D(e);
|
1402
1405
|
return v.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
1403
1406
|
}
|
1404
1407
|
saveMaterials(e, t) {
|
1405
|
-
return v.save(`materials_${e.id}`,
|
1408
|
+
return v.save(`materials_${e.id}`, Q(t)), Promise.resolve(!0);
|
1406
1409
|
}
|
1407
1410
|
saveFile(e) {
|
1408
1411
|
return v.save(`file_${e.id}`, e), Promise.resolve(!0);
|
@@ -1449,15 +1452,15 @@ class Ut extends ee {
|
|
1449
1452
|
histories = {};
|
1450
1453
|
historyItems = {};
|
1451
1454
|
init(e) {
|
1452
|
-
const t = new
|
1455
|
+
const t = new D(e), s = this.projects[t.id] || {}, n = Object.assign(t.toDsl(), s);
|
1453
1456
|
return this.projects[n.id] = n, Promise.resolve(n);
|
1454
1457
|
}
|
1455
1458
|
saveProject(e) {
|
1456
|
-
const t = new
|
1459
|
+
const t = new D(e);
|
1457
1460
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
1458
1461
|
}
|
1459
1462
|
saveMaterials(e, t) {
|
1460
|
-
return e.id && (this.materials[e.id] =
|
1463
|
+
return e.id && (this.materials[e.id] = Q(t)), Promise.resolve(!0);
|
1461
1464
|
}
|
1462
1465
|
saveFile(e) {
|
1463
1466
|
return this.files[e.id] = e, Promise.resolve(!0);
|
@@ -1499,9 +1502,9 @@ class Ut extends ee {
|
|
1499
1502
|
}), Promise.resolve(!0);
|
1500
1503
|
}
|
1501
1504
|
}
|
1502
|
-
let
|
1505
|
+
let H = null;
|
1503
1506
|
function rs() {
|
1504
|
-
return
|
1507
|
+
return H || (H = new Ut(), H);
|
1505
1508
|
}
|
1506
1509
|
class ns extends ee {
|
1507
1510
|
getFileCaches = {};
|
@@ -1520,7 +1523,7 @@ class ns extends ee {
|
|
1520
1523
|
async saveMaterials(e, t) {
|
1521
1524
|
return !!await this.api("saveMaterials", {
|
1522
1525
|
project: e,
|
1523
|
-
materials:
|
1526
|
+
materials: Q(t)
|
1524
1527
|
}).catch(() => !1);
|
1525
1528
|
}
|
1526
1529
|
async saveFile(e) {
|
@@ -1560,7 +1563,7 @@ class ns extends ee {
|
|
1560
1563
|
);
|
1561
1564
|
}
|
1562
1565
|
}
|
1563
|
-
function
|
1566
|
+
function Pe(r, e, t = []) {
|
1564
1567
|
return t.map((s) => {
|
1565
1568
|
const { id: n, title: i, icon: a, children: o, hidden: c } = s;
|
1566
1569
|
return {
|
@@ -1569,16 +1572,16 @@ function Re(r, e, t = []) {
|
|
1569
1572
|
icon: a,
|
1570
1573
|
hidden: c,
|
1571
1574
|
url: `${r}/${e}/${n}`,
|
1572
|
-
children: o && o.length ?
|
1575
|
+
children: o && o.length ? Pe(r, e, o) : void 0
|
1573
1576
|
};
|
1574
1577
|
});
|
1575
1578
|
}
|
1576
|
-
function
|
1579
|
+
function Ee(r, e) {
|
1577
1580
|
if (!e) return r;
|
1578
1581
|
let t = [];
|
1579
1582
|
for (const s of r)
|
1580
1583
|
if (s.children && s.children.length) {
|
1581
|
-
const n =
|
1584
|
+
const n = Ee(s.children, e);
|
1582
1585
|
n.length && (s.children = n, t.push(s));
|
1583
1586
|
} else
|
1584
1587
|
e.can(s.id.toString()) && t.push(s);
|
@@ -1589,36 +1592,36 @@ function is(r) {
|
|
1589
1592
|
menuPathPrefix: e = "",
|
1590
1593
|
pageRouteName: t = "page",
|
1591
1594
|
disableMenusFilter: s = !1
|
1592
|
-
} = r || {}, n =
|
1593
|
-
|
1594
|
-
const { name: m, params: h, meta:
|
1595
|
-
if (m ===
|
1595
|
+
} = r || {}, n = je(), i = he(), a = rt(), o = z(!1), c = z(!1), l = n.project;
|
1596
|
+
Be(() => {
|
1597
|
+
const { name: m, params: h, meta: f } = i;
|
1598
|
+
if (m === k) {
|
1596
1599
|
const u = n.getPage(h.id);
|
1597
1600
|
o.value = !u?.mask, c.value = !!u?.pure;
|
1598
1601
|
} else if (m === T) {
|
1599
1602
|
const u = n.getHomepage();
|
1600
1603
|
o.value = !u?.mask, c.value = !!u?.pure;
|
1601
1604
|
} else
|
1602
|
-
o.value = !
|
1605
|
+
o.value = !f.mask, c.value = !!f.pure;
|
1603
1606
|
});
|
1604
|
-
const
|
1607
|
+
const p = Pe(
|
1605
1608
|
e,
|
1606
1609
|
t,
|
1607
1610
|
l?.pages
|
1608
|
-
),
|
1611
|
+
), d = l?.config;
|
1609
1612
|
return {
|
1610
1613
|
disabled: o,
|
1611
|
-
logo:
|
1612
|
-
themeSwitchable:
|
1613
|
-
title:
|
1614
|
-
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),
|
1615
1618
|
pure: c
|
1616
1619
|
};
|
1617
1620
|
}
|
1618
1621
|
export {
|
1619
1622
|
ve as ACCESS_KEY,
|
1620
1623
|
ye as Access,
|
1621
|
-
|
1624
|
+
Je as BUILD_IN_TAGS,
|
1622
1625
|
Ue as BUILT_IN_DIRECTIVES,
|
1623
1626
|
ee as BaseService,
|
1624
1627
|
oe as CONTEXT_HOST,
|
@@ -1626,62 +1629,62 @@ export {
|
|
1626
1629
|
y as ContextMode,
|
1627
1630
|
Le as DATA_TYPES,
|
1628
1631
|
T as HOMEPAGE_ROUTE_NAME,
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1632
|
+
qe as HTML_TAGS,
|
1633
|
+
Yt as JSCodeToString,
|
1634
|
+
zt as LIFE_CYCLES_LIST,
|
1632
1635
|
ns as LocalService,
|
1633
1636
|
Ut as MemoryService,
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
+
xt as NodeEnv,
|
1638
|
+
k as PAGE_ROUTE_NAME,
|
1639
|
+
Ot as Provider,
|
1637
1640
|
ss as StorageService,
|
1638
|
-
|
1641
|
+
C as VTJ_RENDERER_VERSION,
|
1639
1642
|
ge as adoptedStyleSheets,
|
1640
1643
|
Zt as clearLoaderCache,
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1644
|
+
Xt as createAccess,
|
1645
|
+
Qt as createAdapter,
|
1646
|
+
Vt as createAssetScripts,
|
1647
|
+
Wt as createAssetsCss,
|
1645
1648
|
vt as createDataSources,
|
1646
|
-
|
1649
|
+
G as createLoader,
|
1647
1650
|
rs as createMemoryService,
|
1648
1651
|
it as createMetaApi,
|
1649
1652
|
ct as createMock,
|
1650
1653
|
es as createProvider,
|
1651
|
-
|
1654
|
+
W as createRenderer,
|
1652
1655
|
nt as createSchemaApi,
|
1653
1656
|
ot as createSchemaApis,
|
1654
1657
|
ts as createServiceRequest,
|
1655
1658
|
wt as defaultLoader,
|
1656
|
-
|
1659
|
+
I as fillBasePath,
|
1657
1660
|
F as getMock,
|
1658
1661
|
Se as getModifiers,
|
1659
1662
|
we as getPlugin,
|
1660
|
-
|
1663
|
+
We as getRawComponent,
|
1661
1664
|
Ze as isBuiltInTag,
|
1662
|
-
|
1665
|
+
X as isCSSUrl,
|
1663
1666
|
tt as isJSCode,
|
1664
1667
|
_ as isJSExpression,
|
1665
|
-
|
1666
|
-
|
1668
|
+
M as isJSFunction,
|
1669
|
+
Ke as isJSON,
|
1667
1670
|
Z as isJSUrl,
|
1668
1671
|
et as isNativeTag,
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
1672
|
+
Xe as isVuePlugin,
|
1673
|
+
Ge as loadCss,
|
1674
|
+
Ye as loadCssUrl,
|
1675
|
+
Qe as loadScriptUrl,
|
1673
1676
|
lt as mockApi,
|
1674
1677
|
at as mockApis,
|
1675
1678
|
_e as mockCleanup,
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1679
|
+
x as nodeRender,
|
1680
|
+
Ve as parseDeps,
|
1681
|
+
A as parseExpression,
|
1682
|
+
V as parseFunction,
|
1683
|
+
$e as providerKey,
|
1684
|
+
ze as removeProdFlag,
|
1685
|
+
Gt as setupPageSetting,
|
1683
1686
|
me as toString,
|
1684
1687
|
rt as useAccess,
|
1685
1688
|
is as useMask,
|
1686
|
-
|
1689
|
+
je as useProvider
|
1687
1690
|
};
|