@vtj/renderer 0.12.43 → 0.12.45
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 +6 -6
- package/dist/index.mjs +377 -288
- package/package.json +6 -6
- package/types/constants.d.ts +6 -0
- package/types/hooks/mask.d.ts +4 -0
- package/types/plugins/access.d.ts +3 -3
- package/types/provider/provider.d.ts +2 -0
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
import { Base as
|
2
|
-
import { isUrl as Ke, url as
|
3
|
-
import * as
|
4
|
-
import { inject as
|
1
|
+
import { Base as Je, BUILT_IN_COMPONENTS as qe, ProjectModel as U, HistoryModel as _e } from "@vtj/core";
|
2
|
+
import { isUrl as Ke, url as A, dedupArray as ze, isString as R, isFunction as L, logger as I, storage as V, cookie as W, toArray as fe, unRSA as de, delay as ne, createRequest as we, jsonp as Se, merge as Ge, pathToRegexp as Ve, pathToRegexpMatch as We, formDataToJson as Qe, Queue as Xe, cloneDeep as he, camelCase as b, isObject as Ye, upperFirst as Ze, pick as et, request as X, loadScript as me, Storage as tt, mapToObject as ie } from "@vtj/utils";
|
3
|
+
import * as J from "vue";
|
4
|
+
import { inject as $e, defineComponent as Ee, h as Y, ref as Z, watchEffect as st, defineAsyncComponent as ge } from "vue";
|
5
5
|
import { useRoute as je } 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.12.
|
10
|
+
* @version 0.12.45
|
11
11
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
12
12
|
*/
|
13
|
-
const
|
13
|
+
const k = "0.12.45";
|
14
14
|
var w = /* @__PURE__ */ ((r) => (r.Runtime = "Runtime", r.Design = "Design", r.Raw = "Raw", r.VNode = "VNode", r))(w || {});
|
15
|
-
const
|
15
|
+
const ve = [
|
16
16
|
"$el",
|
17
17
|
"$emit",
|
18
18
|
"$nextTick",
|
@@ -55,13 +55,94 @@ const ge = [
|
|
55
55
|
Object,
|
56
56
|
Function,
|
57
57
|
Date
|
58
|
-
}, M = "VtjPage",
|
58
|
+
}, M = "VtjPage", N = "VtjHomepage", it = "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,svg".split(
|
59
59
|
","
|
60
|
-
), ot = "component,slot".split(",")
|
60
|
+
), ot = "component,slot".split(","), ls = [
|
61
|
+
"h",
|
62
|
+
"t",
|
63
|
+
"t",
|
64
|
+
"p",
|
65
|
+
"s",
|
66
|
+
":",
|
67
|
+
"/",
|
68
|
+
"/",
|
69
|
+
"l",
|
70
|
+
"c",
|
71
|
+
"d",
|
72
|
+
"p",
|
73
|
+
".",
|
74
|
+
"v",
|
75
|
+
"t",
|
76
|
+
"j",
|
77
|
+
".",
|
78
|
+
"p",
|
79
|
+
"r",
|
80
|
+
"o"
|
81
|
+
].join(""), us = {
|
82
|
+
auth: [
|
83
|
+
"h",
|
84
|
+
"t",
|
85
|
+
"t",
|
86
|
+
"p",
|
87
|
+
"s",
|
88
|
+
":",
|
89
|
+
"/",
|
90
|
+
"/",
|
91
|
+
"l",
|
92
|
+
"c",
|
93
|
+
"d",
|
94
|
+
"p",
|
95
|
+
".",
|
96
|
+
"v",
|
97
|
+
"t",
|
98
|
+
"j",
|
99
|
+
".",
|
100
|
+
"p",
|
101
|
+
"r",
|
102
|
+
"o",
|
103
|
+
"/",
|
104
|
+
"a",
|
105
|
+
"u",
|
106
|
+
"t",
|
107
|
+
"h",
|
108
|
+
".",
|
109
|
+
"h",
|
110
|
+
"t",
|
111
|
+
"m",
|
112
|
+
"l"
|
113
|
+
].join(""),
|
114
|
+
storageKey: [
|
115
|
+
"R",
|
116
|
+
"R",
|
117
|
+
"O",
|
118
|
+
"_",
|
119
|
+
"I",
|
120
|
+
"D",
|
121
|
+
"E",
|
122
|
+
"_",
|
123
|
+
"A",
|
124
|
+
"C",
|
125
|
+
"C",
|
126
|
+
"E",
|
127
|
+
"S",
|
128
|
+
"S",
|
129
|
+
"_",
|
130
|
+
"S",
|
131
|
+
"T",
|
132
|
+
"O",
|
133
|
+
"R",
|
134
|
+
"A",
|
135
|
+
"G",
|
136
|
+
"E",
|
137
|
+
"_",
|
138
|
+
"_"
|
139
|
+
].join(""),
|
140
|
+
privateKey: "MIIBOgIBAAJBAKoIzmn1FYQ1YOhOBw9EhABxZ+PySAIaydI+zdhoKflrdgJ4A5E4/5gbQmRpk09hPWG8nvX7h+l/QLU8kXxAIBECAwEAAQJAAlgpxQY6sByLsXqzJcthC8LSGsLf2JEJkHwlnpwFqlEV8UCkoINpuZ2Wzl+aftURu5rIfAzRCQBvHmeOTW9/zQIhAO5ufWDmnSLyfAAsNo5JRNpVuLFCFodR8Xm+ulDlosR/AiEAtpAltyP9wmCABKG/v/hrtTr3mcvFNGCjoGa9bUAok28CIHbrVs9w1ijrBlvTsXYwJw46uP539uKRRT4ymZzlm9QjAiB+1KH/G9f9pEEL9rtaSOG7JF5D0JcOjlze4MGVFs+ZrQIhALKOUFBNr2zEsyJIjw2PlvEucdlG77UniszjXTROHSPd"
|
141
|
+
};
|
61
142
|
function x(r, e) {
|
62
143
|
return r.map((t) => Ke(t) || t.startsWith("/") ? t : `${e}${t}`);
|
63
144
|
}
|
64
|
-
function
|
145
|
+
function q(r) {
|
65
146
|
return /\.css$/.test(r);
|
66
147
|
}
|
67
148
|
function K(r) {
|
@@ -70,14 +151,14 @@ function K(r) {
|
|
70
151
|
function at(r) {
|
71
152
|
return /\.json$/.test(r);
|
72
153
|
}
|
73
|
-
function
|
154
|
+
function ps(r) {
|
74
155
|
return r.map(
|
75
|
-
(e) => `<script src="${
|
156
|
+
(e) => `<script src="${A.append(e, { v: k })}"><\/script>`
|
76
157
|
).join("");
|
77
158
|
}
|
78
|
-
function
|
159
|
+
function fs(r = []) {
|
79
160
|
return r.map(
|
80
|
-
(e) => `<link rel="stylesheet" href="${
|
161
|
+
(e) => `<link rel="stylesheet" href="${A.append(e, { v: k })}" />`
|
81
162
|
).join("");
|
82
163
|
}
|
83
164
|
function ct(r, e = !1) {
|
@@ -88,7 +169,7 @@ function lt(r, e, t = !1) {
|
|
88
169
|
return s.forEach(
|
89
170
|
({ urls: h, assetsUrl: f, library: d, assetsLibrary: m, localeLibrary: y }) => {
|
90
171
|
h?.forEach((g) => {
|
91
|
-
K(g) && n.push(ct(g, t)),
|
172
|
+
K(g) && n.push(ct(g, t)), q(g) && i.push(g);
|
92
173
|
}), d && (o.push(d), p[d] = x(h || [], e), y && (c[d] = y)), f && a.push(f), m && u.push(m), d && m && (l[m] = d);
|
93
174
|
}
|
94
175
|
), {
|
@@ -107,7 +188,7 @@ function ut(r, e) {
|
|
107
188
|
return s ? e[s]?.[n || t] : e[n || t];
|
108
189
|
}
|
109
190
|
function pt(r = []) {
|
110
|
-
const e = r.filter((s) =>
|
191
|
+
const e = r.filter((s) => q(s)), t = r.filter((s) => K(s));
|
111
192
|
return {
|
112
193
|
css: e,
|
113
194
|
js: t
|
@@ -133,23 +214,23 @@ function ft(r, e) {
|
|
133
214
|
const g = l;
|
134
215
|
for (; l < c.length && c[l] !== "{" && c[l] !== ";"; )
|
135
216
|
l++;
|
136
|
-
const
|
217
|
+
const E = c.substring(g, l).trim(), v = E.includes("@keyframes");
|
137
218
|
if (c[l] === ";")
|
138
219
|
u.push({
|
139
220
|
type: "simple-at-rule",
|
140
221
|
content: c.substring(g, l + 1)
|
141
222
|
}), l++;
|
142
223
|
else if (c[l] === "{") {
|
143
|
-
const
|
144
|
-
let
|
145
|
-
for (l++; l < c.length &&
|
146
|
-
c[l] === "{" ?
|
147
|
-
const z = c.substring(g, l),
|
224
|
+
const H = l + 1;
|
225
|
+
let P = 1;
|
226
|
+
for (l++; l < c.length && P > 0; )
|
227
|
+
c[l] === "{" ? P++ : c[l] === "}" && P--, l++;
|
228
|
+
const z = c.substring(g, l), j = c.substring(H, l - 1);
|
148
229
|
u.push({
|
149
230
|
type: v ? "keyframes" : "at-rule",
|
150
|
-
rule:
|
231
|
+
rule: E,
|
151
232
|
content: z,
|
152
|
-
inner:
|
233
|
+
inner: j
|
153
234
|
});
|
154
235
|
}
|
155
236
|
continue;
|
@@ -228,9 +309,9 @@ function ft(r, e) {
|
|
228
309
|
}
|
229
310
|
}
|
230
311
|
function be(r) {
|
231
|
-
return
|
312
|
+
return R(r) ? r : JSON.stringify(r);
|
232
313
|
}
|
233
|
-
function
|
314
|
+
function Re(r, e, t, s = !1) {
|
234
315
|
const n = r.CSSStyleSheet, i = s ? `data-v-${e}` : e, a = s ? ft(t, i) : t;
|
235
316
|
if (n.prototype.replaceSync) {
|
236
317
|
const o = new n();
|
@@ -247,7 +328,7 @@ function Ee(r, e, t, s = !1) {
|
|
247
328
|
}
|
248
329
|
async function dt(r, e) {
|
249
330
|
const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
|
250
|
-
t &&
|
331
|
+
t && Re(window, r, t);
|
251
332
|
}
|
252
333
|
function Pe(r, e = window) {
|
253
334
|
const t = e.document, s = e.document.head;
|
@@ -257,7 +338,7 @@ function Pe(r, e = window) {
|
|
257
338
|
a.rel = "stylesheet", a.id = n, a.href = n, s.appendChild(a);
|
258
339
|
}
|
259
340
|
}
|
260
|
-
async function
|
341
|
+
async function Ce(r, e, t = window) {
|
261
342
|
const s = t.document, n = t.document.head;
|
262
343
|
let i = t[e];
|
263
344
|
return i ? i.default || i : new Promise((a, o) => {
|
@@ -280,14 +361,14 @@ function mt(r) {
|
|
280
361
|
function gt(r) {
|
281
362
|
return it.includes(r);
|
282
363
|
}
|
283
|
-
function
|
364
|
+
function O(r = window) {
|
284
365
|
const e = window?.Mock;
|
285
366
|
if (e) return e;
|
286
367
|
const t = r?.Mock;
|
287
368
|
if (t && window)
|
288
369
|
return window.Mock = t, t;
|
289
370
|
}
|
290
|
-
function
|
371
|
+
function ds(r, e, t) {
|
291
372
|
Object.assign(e.meta, t.meta);
|
292
373
|
const s = r?._container;
|
293
374
|
t?.type === "page" && s.classList.add("is-page"), t?.pure && s.classList.add("is-pure");
|
@@ -302,13 +383,13 @@ function T(r, e, t = !1, s = !1) {
|
|
302
383
|
const a = `with(${t ? "{}" : "$scope || {}"}) { ${i} }`;
|
303
384
|
return new Function("$scope", a)(e);
|
304
385
|
} catch (n) {
|
305
|
-
if (
|
386
|
+
if (I.error("parseExpression.error", n, r, e?.__self ?? e), s)
|
306
387
|
throw n;
|
307
388
|
}
|
308
389
|
}
|
309
390
|
function ee(r, e, t = !1, s = !1) {
|
310
391
|
const n = T(r, e, t, s);
|
311
|
-
if (typeof n != "function" && (
|
392
|
+
if (typeof n != "function" && (I.error(
|
312
393
|
"parseFunction.error",
|
313
394
|
"not a function",
|
314
395
|
r,
|
@@ -320,13 +401,13 @@ function ee(r, e, t = !1, s = !1) {
|
|
320
401
|
function $(r) {
|
321
402
|
return r && r.type === "JSExpression";
|
322
403
|
}
|
323
|
-
function
|
404
|
+
function D(r) {
|
324
405
|
return typeof r == "object" && r && r.type === "JSFunction";
|
325
406
|
}
|
326
407
|
function vt(r) {
|
327
|
-
return $(r) ||
|
408
|
+
return $(r) || D(r);
|
328
409
|
}
|
329
|
-
function
|
410
|
+
function hs(r) {
|
330
411
|
return vt(r) ? r.value : JSON.stringify(r);
|
331
412
|
}
|
332
413
|
const yt = {
|
@@ -342,8 +423,8 @@ const yt = {
|
|
342
423
|
noPermissionMessage: "无权限访问该页面",
|
343
424
|
appName: "",
|
344
425
|
statusKey: "code"
|
345
|
-
},
|
346
|
-
class
|
426
|
+
}, Ae = Symbol("access");
|
427
|
+
class Ie {
|
347
428
|
options;
|
348
429
|
data = null;
|
349
430
|
mode = w.Raw;
|
@@ -363,17 +444,17 @@ class ke {
|
|
363
444
|
}
|
364
445
|
login(e) {
|
365
446
|
const { storageKey: t, storagePrefix: s, session: n, authKey: i } = this.options;
|
366
|
-
this.setData(e), this.data && (
|
447
|
+
this.setData(e), this.data && (V.save(t, e, {
|
367
448
|
type: "local",
|
368
449
|
prefix: s
|
369
|
-
}), n &&
|
450
|
+
}), n && W.set(i, this.data.token));
|
370
451
|
}
|
371
452
|
clear() {
|
372
453
|
const { storageKey: e, storagePrefix: t, session: s, authKey: n } = this.options;
|
373
|
-
this.data = null,
|
454
|
+
this.data = null, V.remove(e, {
|
374
455
|
type: "local",
|
375
456
|
prefix: t
|
376
|
-
}), s &&
|
457
|
+
}), s && W.remove(n);
|
377
458
|
}
|
378
459
|
logout() {
|
379
460
|
this.clear(), this.toLogin();
|
@@ -386,14 +467,14 @@ class ke {
|
|
386
467
|
}
|
387
468
|
can(e) {
|
388
469
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
389
|
-
return typeof e == "function" ? e(s) :
|
470
|
+
return typeof e == "function" ? e(s) : fe(e).every((i) => s[i] || s[t + "." + i]);
|
390
471
|
}
|
391
472
|
some(e) {
|
392
473
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
393
|
-
return
|
474
|
+
return fe(e).some((i) => s[i] || s[t + "." + i]);
|
394
475
|
}
|
395
476
|
install(e) {
|
396
|
-
e.config.globalProperties.$access = this, e.provide(
|
477
|
+
e.config.globalProperties.$access = this, e.provide(Ae, this);
|
397
478
|
}
|
398
479
|
isAuthPath(e) {
|
399
480
|
const { auth: t, isAuth: s } = this.options;
|
@@ -414,7 +495,7 @@ class ke {
|
|
414
495
|
setData(e) {
|
415
496
|
const { privateKey: t } = this.options;
|
416
497
|
if (Array.isArray(e) && t) {
|
417
|
-
const s = e.map((n) =>
|
498
|
+
const s = e.map((n) => de(n, t));
|
418
499
|
try {
|
419
500
|
this.data = JSON.parse(s.join(""));
|
420
501
|
} catch (n) {
|
@@ -424,7 +505,7 @@ class ke {
|
|
424
505
|
}
|
425
506
|
if (typeof e == "string")
|
426
507
|
try {
|
427
|
-
const s = t ?
|
508
|
+
const s = t ? de(e, t) : e;
|
428
509
|
s ? this.data = JSON.parse(s) : console.warn("RSA解密失败或登录信息缺失");
|
429
510
|
} catch (s) {
|
430
511
|
console.warn(s);
|
@@ -433,7 +514,7 @@ class ke {
|
|
433
514
|
this.data = e;
|
434
515
|
}
|
435
516
|
loadData() {
|
436
|
-
const { storageKey: e, storagePrefix: t } = this.options, s =
|
517
|
+
const { storageKey: e, storagePrefix: t } = this.options, s = V.get(e, {
|
437
518
|
type: "local",
|
438
519
|
prefix: t
|
439
520
|
});
|
@@ -441,7 +522,7 @@ class ke {
|
|
441
522
|
}
|
442
523
|
isLogined() {
|
443
524
|
const { session: e, authKey: t } = this.options;
|
444
|
-
return e && t ? !!
|
525
|
+
return e && t ? !!W.get(t) : !!this.getToken();
|
445
526
|
}
|
446
527
|
hasRoutePermission(e) {
|
447
528
|
if (e.name === M) {
|
@@ -461,7 +542,7 @@ class ke {
|
|
461
542
|
return t();
|
462
543
|
{
|
463
544
|
const { noPermissionMessage: s = "无权限访问", unauthorized: n = !1 } = this.options;
|
464
|
-
return await this.showTip(s), L(n) ? (n(), t(!1)) :
|
545
|
+
return await this.showTip(s), L(n) ? (n(), t(!1)) : R(n) ? t(n) : t(!1);
|
465
546
|
}
|
466
547
|
}
|
467
548
|
t(!1), this.toLogin();
|
@@ -497,9 +578,9 @@ class ke {
|
|
497
578
|
}
|
498
579
|
}
|
499
580
|
function _t() {
|
500
|
-
return
|
581
|
+
return $e(Ae, null);
|
501
582
|
}
|
502
|
-
function
|
583
|
+
function ms(r = {}) {
|
503
584
|
const {
|
504
585
|
notify: e,
|
505
586
|
loading: t,
|
@@ -511,7 +592,7 @@ function ds(r = {}) {
|
|
511
592
|
} = r;
|
512
593
|
let p = null;
|
513
594
|
return {
|
514
|
-
request:
|
595
|
+
request: we({
|
515
596
|
settings: {
|
516
597
|
type: "form",
|
517
598
|
validSuccess: !0,
|
@@ -531,16 +612,16 @@ function ds(r = {}) {
|
|
531
612
|
...s
|
532
613
|
}
|
533
614
|
}),
|
534
|
-
jsonp:
|
615
|
+
jsonp: Se,
|
535
616
|
notify: e,
|
536
617
|
loading: t,
|
537
618
|
useTitle: a,
|
538
619
|
startupComponent: n,
|
539
|
-
access: i ? new
|
620
|
+
access: i ? new Ie({ alert: o, ...i }) : void 0
|
540
621
|
};
|
541
622
|
}
|
542
|
-
function
|
543
|
-
return new
|
623
|
+
function gs(r = {}) {
|
624
|
+
return new Ie(r);
|
544
625
|
}
|
545
626
|
function wt(r, e) {
|
546
627
|
const { jsonp: t, request: s } = e;
|
@@ -558,7 +639,7 @@ function wt(r, e) {
|
|
558
639
|
headers: n
|
559
640
|
}
|
560
641
|
};
|
561
|
-
return (a, o) => (delete i.data, s.send(
|
642
|
+
return (a, o) => (delete i.data, s.send(Ge(i, o || {}, { data: a })));
|
562
643
|
}
|
563
644
|
}
|
564
645
|
function St(r, e) {
|
@@ -581,39 +662,39 @@ function $t(r = [], e = [], t) {
|
|
581
662
|
s[n.id] = St(n, t);
|
582
663
|
return s;
|
583
664
|
}
|
584
|
-
async function
|
585
|
-
const t =
|
586
|
-
t && (
|
665
|
+
async function Et(r = [], e = window) {
|
666
|
+
const t = O(e);
|
667
|
+
t && (Fe(e), r.forEach((s) => bt(t, s)));
|
587
668
|
}
|
588
|
-
function
|
589
|
-
const t =
|
669
|
+
function jt(r, e = window) {
|
670
|
+
const t = D(r.mockTemplate) && r.mockTemplate.value ? ee(r.mockTemplate, {}, !0) : void 0, s = O(e);
|
590
671
|
return async (...n) => {
|
591
672
|
let i = {};
|
592
673
|
if (t)
|
593
674
|
try {
|
594
675
|
i = await t.apply(t, n);
|
595
676
|
} catch (a) {
|
596
|
-
|
677
|
+
I.warn("模拟数据模版异常", a);
|
597
678
|
}
|
598
679
|
return s?.mock(i);
|
599
680
|
};
|
600
681
|
}
|
601
|
-
function
|
682
|
+
function bt(r, e) {
|
602
683
|
if (!e.mock) return;
|
603
684
|
const { url: t, mockTemplate: s } = e;
|
604
685
|
if (t && s) {
|
605
|
-
const n =
|
686
|
+
const n = Ve(`${t}(.*)`), i = We(t, { decode: decodeURIComponent }), a = T(s, {}, !0);
|
606
687
|
r.mock(n, (o) => {
|
607
|
-
const p =
|
688
|
+
const p = A.parse(o.url) || {}, c = o.body instanceof FormData ? Qe(o.body) : o.body, u = i(o.url)?.params;
|
608
689
|
return Object.assign(o, { data: c, params: p, query: u }), r.mock(a(o));
|
609
690
|
});
|
610
691
|
}
|
611
692
|
}
|
612
|
-
function
|
613
|
-
const e =
|
693
|
+
function Fe(r = window) {
|
694
|
+
const e = O(r);
|
614
695
|
e && (e._mocked = {});
|
615
696
|
}
|
616
|
-
class
|
697
|
+
class Rt {
|
617
698
|
__id = null;
|
618
699
|
__mode;
|
619
700
|
__instance = null;
|
@@ -642,7 +723,7 @@ class Pt {
|
|
642
723
|
const { mode: t, dsl: s, attrs: n } = e;
|
643
724
|
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), n && Object.assign(this, n);
|
644
725
|
}
|
645
|
-
setup(e, t =
|
726
|
+
setup(e, t = J) {
|
646
727
|
const s = t.getCurrentInstance();
|
647
728
|
if (!s) return;
|
648
729
|
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = s.proxy;
|
@@ -656,12 +737,12 @@ class Pt {
|
|
656
737
|
});
|
657
738
|
}
|
658
739
|
__proxy() {
|
659
|
-
this.__instance &&
|
740
|
+
this.__instance && ve.forEach((e) => {
|
660
741
|
this[e] = this.__instance?.[e];
|
661
742
|
});
|
662
743
|
}
|
663
744
|
__cleanup() {
|
664
|
-
|
745
|
+
ve.forEach((e) => {
|
665
746
|
this[e] = null;
|
666
747
|
}), this.__reset();
|
667
748
|
}
|
@@ -714,7 +795,7 @@ class Pt {
|
|
714
795
|
}
|
715
796
|
function te(r) {
|
716
797
|
const {
|
717
|
-
Vue: e =
|
798
|
+
Vue: e = J,
|
718
799
|
mode: t = w.Runtime,
|
719
800
|
components: s = {},
|
720
801
|
libs: n = {},
|
@@ -724,7 +805,7 @@ function te(r) {
|
|
724
805
|
$components: s,
|
725
806
|
$libs: n,
|
726
807
|
$apis: i
|
727
|
-
}, c = new
|
808
|
+
}, c = new Rt({
|
728
809
|
mode: t,
|
729
810
|
dsl: o.value,
|
730
811
|
attrs: p
|
@@ -735,15 +816,15 @@ function te(r) {
|
|
735
816
|
...Ct(o.value.props ?? [], c)
|
736
817
|
},
|
737
818
|
setup(l) {
|
738
|
-
c.$props = l, c.props = l, o.value.id &&
|
819
|
+
c.$props = l, c.props = l, o.value.id && Re(
|
739
820
|
r.window || window,
|
740
821
|
o.value.id,
|
741
822
|
o.value.css || "",
|
742
823
|
!0
|
743
|
-
), c.state =
|
744
|
-
const h =
|
745
|
-
for (const [g,
|
746
|
-
d[g] = e.inject(g,
|
824
|
+
), c.state = At(e, o.value.state ?? {}, c);
|
825
|
+
const h = It(e, o.value.computed ?? {}, c), f = Ft(o.value.methods ?? {}, c), d = kt(e, o.value.inject, c);
|
826
|
+
for (const [g, E] of Object.entries(d || {}))
|
827
|
+
d[g] = e.inject(g, E);
|
747
828
|
const m = Mt(
|
748
829
|
o.value.dataSources || {},
|
749
830
|
c
|
@@ -753,11 +834,11 @@ function te(r) {
|
|
753
834
|
...f,
|
754
835
|
...m
|
755
836
|
};
|
756
|
-
return c.setup(y, e),
|
837
|
+
return c.setup(y, e), Ot(e, o.value.watch ?? [], c), {
|
757
838
|
vtj: c
|
758
839
|
};
|
759
840
|
},
|
760
|
-
emits:
|
841
|
+
emits: Pt(o.value.emits),
|
761
842
|
expose: ["vtj"],
|
762
843
|
render() {
|
763
844
|
if (!o.value.nodes) return null;
|
@@ -773,12 +854,12 @@ function te(r) {
|
|
773
854
|
context: c
|
774
855
|
};
|
775
856
|
}
|
776
|
-
function
|
777
|
-
return r.map((e) =>
|
857
|
+
function Pt(r = []) {
|
858
|
+
return r.map((e) => R(e) ? e : e.name);
|
778
859
|
}
|
779
860
|
function Ct(r = [], e) {
|
780
861
|
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((i) => nt[i]) : void 0;
|
781
|
-
return r.map((s) =>
|
862
|
+
return r.map((s) => R(s) ? {
|
782
863
|
name: s
|
783
864
|
} : {
|
784
865
|
name: s.name,
|
@@ -794,18 +875,18 @@ function Ct(r = [], e) {
|
|
794
875
|
{}
|
795
876
|
);
|
796
877
|
}
|
797
|
-
function
|
878
|
+
function At(r, e, t) {
|
798
879
|
return r.reactive(
|
799
880
|
Object.keys(e || {}).reduce(
|
800
881
|
(s, n) => {
|
801
882
|
let i = e[n];
|
802
|
-
return $(i) ? i = t.__parseExpression(i) :
|
883
|
+
return $(i) ? i = t.__parseExpression(i) : D(i) && (i = t.__parseFunction(i)), s[n] = i, s;
|
803
884
|
},
|
804
885
|
{}
|
805
886
|
)
|
806
887
|
);
|
807
888
|
}
|
808
|
-
function
|
889
|
+
function It(r, e, t) {
|
809
890
|
return Object.entries(e ?? {}).reduce(
|
810
891
|
(s, [n, i]) => (s[n] = r.computed(t.__parseFunction(i)), s),
|
811
892
|
{}
|
@@ -817,7 +898,7 @@ function Ft(r, e) {
|
|
817
898
|
{}
|
818
899
|
);
|
819
900
|
}
|
820
|
-
function
|
901
|
+
function kt(r, e = [], t) {
|
821
902
|
return e.reduce(
|
822
903
|
(s, n) => {
|
823
904
|
const { name: i, from: a } = n || {};
|
@@ -833,9 +914,9 @@ function Mt(r, e) {
|
|
833
914
|
(t, s) => {
|
834
915
|
const n = r[s];
|
835
916
|
if (n.type === "mock")
|
836
|
-
t[s] =
|
917
|
+
t[s] = jt(n);
|
837
918
|
else if (n.ref) {
|
838
|
-
const i = e.$apis[n.ref], a =
|
919
|
+
const i = e.$apis[n.ref], a = D(n.transform) ? n.transform.value ? e.__parseFunction(n.transform) : void 0 : n.transform;
|
839
920
|
t[s] = async (...o) => {
|
840
921
|
const p = await i.apply(e, o);
|
841
922
|
return a ? a(p) : p;
|
@@ -846,7 +927,7 @@ function Mt(r, e) {
|
|
846
927
|
{}
|
847
928
|
);
|
848
929
|
}
|
849
|
-
function
|
930
|
+
function Ot(r, e = [], t) {
|
850
931
|
e.forEach((s) => {
|
851
932
|
r.watch(
|
852
933
|
t.__parseExpression(s.source),
|
@@ -869,14 +950,14 @@ function Tt(r, e) {
|
|
869
950
|
{}
|
870
951
|
);
|
871
952
|
}
|
872
|
-
const
|
953
|
+
const ke = new Xe();
|
873
954
|
let Q = [], C = {};
|
874
|
-
const
|
875
|
-
async function
|
955
|
+
const Dt = (r) => r;
|
956
|
+
async function Me(r, e = window) {
|
876
957
|
const { urls: t = [], library: s } = r, n = t.filter((o) => K(o));
|
877
958
|
if (n.length === 0 || !s) return null;
|
878
|
-
const i = t.filter((o) =>
|
879
|
-
return i.length && Pe(i, e), await
|
959
|
+
const i = t.filter((o) => q(o));
|
960
|
+
return i.length && Pe(i, e), await Ce(n, s, e).catch(
|
880
961
|
(o) => (console.warn("loadScriptUrl error", n, s, o), null)
|
881
962
|
);
|
882
963
|
}
|
@@ -884,18 +965,18 @@ function se(r) {
|
|
884
965
|
const { getDsl: e, getDslByUrl: t, options: s } = r;
|
885
966
|
return s.window && (Q.forEach((n) => {
|
886
967
|
delete s.window[n];
|
887
|
-
}), Q = []), (n, i, a =
|
968
|
+
}), Q = []), (n, i, a = J) => {
|
888
969
|
if (!i || typeof i == "string") return n;
|
889
970
|
if (i.type === "Schema" && i.id)
|
890
971
|
return a.defineAsyncComponent(async () => {
|
891
|
-
const o = C[i.id] || await
|
972
|
+
const o = C[i.id] || await ke.add(
|
892
973
|
i.id,
|
893
974
|
() => e(i.id)
|
894
975
|
);
|
895
976
|
return o && (o.name = n, C[i.id] = o), o ? te({
|
896
977
|
...s,
|
897
978
|
Vue: a,
|
898
|
-
dsl:
|
979
|
+
dsl: he(o),
|
899
980
|
mode: w.Runtime,
|
900
981
|
loader: se(r)
|
901
982
|
}).renderer : null;
|
@@ -906,7 +987,7 @@ function se(r) {
|
|
906
987
|
return o && (o.name = n, C[i.url] = o), o ? te({
|
907
988
|
...s,
|
908
989
|
Vue: a,
|
909
|
-
dsl:
|
990
|
+
dsl: he(o),
|
910
991
|
mode: w.Runtime,
|
911
992
|
loader: se(r)
|
912
993
|
}).renderer : null;
|
@@ -915,7 +996,7 @@ function se(r) {
|
|
915
996
|
let o = i.library ? C[i.library] : null;
|
916
997
|
return o || (i.library && Q.push(i.library), o = C[i.library || Symbol()] = a.defineAsyncComponent(
|
917
998
|
async () => {
|
918
|
-
const p = await
|
999
|
+
const p = await Me(i, s.window);
|
919
1000
|
return p || (console.warn("getPlugin result is null", i), null);
|
920
1001
|
}
|
921
1002
|
), o);
|
@@ -923,56 +1004,56 @@ function se(r) {
|
|
923
1004
|
return n;
|
924
1005
|
};
|
925
1006
|
}
|
926
|
-
function
|
927
|
-
C = {},
|
1007
|
+
function vs() {
|
1008
|
+
C = {}, ke.clearAllCache();
|
928
1009
|
}
|
929
|
-
function F(r, e, t =
|
1010
|
+
function F(r, e, t = J, s = Dt, n = [], i = !1) {
|
930
1011
|
if (!r || !r.name || r.invisible) return null;
|
931
|
-
const a = t.getCurrentInstance()?.appContext, { id: o = null, directives: p = [] } = r, { vIf: c, vElseIf: u, vElse: l, vFor: h, vShow: f, vModels: d, vBind: m, vHtml: y, others: g } =
|
1012
|
+
const a = t.getCurrentInstance()?.appContext, { id: o = null, directives: p = [] } = r, { vIf: c, vElseIf: u, vElse: l, vFor: h, vShow: f, vModels: d, vBind: m, vHtml: y, others: g } = Oe(p);
|
932
1013
|
if (!i && (u || l))
|
933
1014
|
return null;
|
934
1015
|
if (c && !xt(c, e))
|
935
1016
|
return Lt(r, e, t, s, n);
|
936
|
-
const
|
937
|
-
const
|
1017
|
+
const E = (v, H = 0) => {
|
1018
|
+
const P = v.$components, z = (() => {
|
938
1019
|
if (r.name === "component")
|
939
|
-
return
|
1020
|
+
return Bt(v, r.props?.is);
|
940
1021
|
if (r.name === "slot") return r.name;
|
941
1022
|
const S = s(r.name, r.from, t);
|
942
|
-
if (
|
943
|
-
return mt(S) || gt(S) ? S :
|
944
|
-
if (
|
945
|
-
const
|
946
|
-
return
|
1023
|
+
if (R(S))
|
1024
|
+
return mt(S) || gt(S) ? S : P[S] ?? a?.app?.component(S) ?? S;
|
1025
|
+
if (Ye(S) && r.id) {
|
1026
|
+
const ue = `Loader${r.id}_${H}`, pe = P[ue];
|
1027
|
+
return pe || (P[ue] = S);
|
947
1028
|
}
|
948
1029
|
return S;
|
949
|
-
})(),
|
1030
|
+
})(), j = Nt(o, r.props ?? {}, v), Ne = Ut(t, r.events ?? {}, v);
|
950
1031
|
if (r.name === "slot")
|
951
|
-
return
|
952
|
-
m && Object.assign(
|
953
|
-
|
1032
|
+
return Jt(t, r, j, v, s);
|
1033
|
+
m && Object.assign(j, v.__parseExpression(m.value)), f && (j.style = Object.assign(
|
1034
|
+
j.style ?? {},
|
954
1035
|
Kt(f, v)
|
955
|
-
)), y && Object.assign(
|
956
|
-
Object.assign(
|
1036
|
+
)), y && Object.assign(j, zt(y, v)), d.forEach((S) => {
|
1037
|
+
Object.assign(j, Gt(t, S, v));
|
957
1038
|
});
|
958
|
-
const Ue =
|
1039
|
+
const Ue = Vt(
|
959
1040
|
t,
|
960
1041
|
r.children ?? [],
|
961
1042
|
v,
|
962
1043
|
s,
|
963
1044
|
r
|
964
|
-
),
|
965
|
-
let
|
1045
|
+
), ce = v?.__id ? `data-v-${v.__id}` : void 0, Le = ce ? { [ce]: "" } : {};
|
1046
|
+
let G = t.createVNode(
|
966
1047
|
z,
|
967
|
-
{ key: `${o}_${
|
1048
|
+
{ key: `${o}_${H}`, ...Le, ...j, ...Ne },
|
968
1049
|
Ue
|
969
1050
|
);
|
970
|
-
const
|
971
|
-
return
|
1051
|
+
const le = a ? Ht(a, g, v) : [];
|
1052
|
+
return le.length && (G = t.withDirectives(G, le)), G;
|
972
1053
|
};
|
973
|
-
return h ?
|
1054
|
+
return h ? Xt(h, E, e) : E(e);
|
974
1055
|
}
|
975
|
-
function
|
1056
|
+
function Ht(r, e, t) {
|
976
1057
|
const s = r.app;
|
977
1058
|
return e.map((n) => {
|
978
1059
|
const i = typeof n.name == "string" ? s.directive(n.name) : t.__parseExpression(n.name);
|
@@ -981,13 +1062,13 @@ function Ot(r, e, t) {
|
|
981
1062
|
return n.value && a.push(t.__parseExpression(n.value)), n.arg && a.push(n.arg), n.modifiers && a.push(n.modifiers), a;
|
982
1063
|
}).filter((n) => !!n);
|
983
1064
|
}
|
984
|
-
function
|
985
|
-
const e = r.find((u) =>
|
986
|
-
(u) =>
|
987
|
-
), s = r.find((u) =>
|
988
|
-
(u) =>
|
1065
|
+
function Oe(r = []) {
|
1066
|
+
const e = r.find((u) => b(u.name) === "vIf"), t = r.find(
|
1067
|
+
(u) => b(u.name) === "vElseIf"
|
1068
|
+
), s = r.find((u) => b(u.name) === "vElse"), n = r.find((u) => b(u.name) === "vFor"), i = r.find((u) => b(u.name) === "vShow"), a = r.find((u) => b(u.name) === "vBind"), o = r.find((u) => b(u.name) === "vHtml"), p = r.filter(
|
1069
|
+
(u) => b(u.name) === "vModel"
|
989
1070
|
), c = r.filter(
|
990
|
-
(u) => !rt.includes(
|
1071
|
+
(u) => !rt.includes(b(u.name))
|
991
1072
|
);
|
992
1073
|
return {
|
993
1074
|
vIf: e,
|
@@ -1004,15 +1085,15 @@ function Me(r = []) {
|
|
1004
1085
|
function xt(r, e) {
|
1005
1086
|
return !!e.__parseExpression(r.value);
|
1006
1087
|
}
|
1007
|
-
function
|
1088
|
+
function Bt(r, e) {
|
1008
1089
|
return e ? $(e) ? r.__parseExpression(e) : e : "div";
|
1009
1090
|
}
|
1010
|
-
function
|
1091
|
+
function Nt(r, e, t) {
|
1011
1092
|
const s = re(e, t);
|
1012
1093
|
return s.ref = t.__ref(r, s.ref), s;
|
1013
1094
|
}
|
1014
1095
|
function re(r, e) {
|
1015
|
-
return $(r) ? e.__parseExpression(r) :
|
1096
|
+
return $(r) ? e.__parseExpression(r) : D(r) ? e.__parseFunction(r) : Array.isArray(r) ? r.map((t) => re(t, e)) : typeof r == "object" ? Object.keys(r || {}).reduce(
|
1016
1097
|
(t, s) => {
|
1017
1098
|
let n = r[s];
|
1018
1099
|
return t[s] = re(n, e), t;
|
@@ -1028,7 +1109,7 @@ function Ut(r, e, t) {
|
|
1028
1109
|
};
|
1029
1110
|
return Object.keys(e || {}).reduce(
|
1030
1111
|
(i, a) => {
|
1031
|
-
const o = e[a], p =
|
1112
|
+
const o = e[a], p = Te(o.modifiers), c = p.find((h) => s.includes(h)), u = "on" + Ze(a) + (c && n[c] || ""), l = t.__parseFunction(o.handler);
|
1032
1113
|
return l && (i[u] = r.withModifiers(l, p)), i;
|
1033
1114
|
},
|
1034
1115
|
{}
|
@@ -1037,7 +1118,7 @@ function Ut(r, e, t) {
|
|
1037
1118
|
function Lt(r, e, t, s, n = []) {
|
1038
1119
|
let i = n.findIndex((a) => a.id === r.id);
|
1039
1120
|
for (let a = ++i; a < n.length; a++) {
|
1040
|
-
const { directives: o = [] } = n[a], { vElseIf: p, vElse: c } =
|
1121
|
+
const { directives: o = [] } = n[a], { vElseIf: p, vElse: c } = Oe(o);
|
1041
1122
|
if (p) {
|
1042
1123
|
if (e.__parseExpression(p.value))
|
1043
1124
|
return F(n[a], e, t, s, n, !0);
|
@@ -1048,19 +1129,19 @@ function Lt(r, e, t, s, n = []) {
|
|
1048
1129
|
}
|
1049
1130
|
return null;
|
1050
1131
|
}
|
1051
|
-
function
|
1132
|
+
function Te(r = {}, e = !1) {
|
1052
1133
|
const t = Object.keys(r);
|
1053
1134
|
return e ? t.map((s) => "." + s) : t;
|
1054
1135
|
}
|
1055
|
-
function
|
1056
|
-
const { children: i } = e, a =
|
1057
|
-
return o ? o(t) : i ?
|
1136
|
+
function Jt(r, e, t, s, n) {
|
1137
|
+
const { children: i } = e, a = qt(e, s), o = s.$slots?.[a.name];
|
1138
|
+
return o ? o(t) : i ? R(i) ? r.createTextVNode(i) : $(i) ? r.createTextVNode(
|
1058
1139
|
be(s.__parseExpression(i))
|
1059
1140
|
) : Array.isArray(i) ? i.map(
|
1060
1141
|
(p) => F(p, s, r, n, i)
|
1061
1142
|
) : null : null;
|
1062
1143
|
}
|
1063
|
-
function
|
1144
|
+
function qt(r, e) {
|
1064
1145
|
const { props: t } = r, s = t?.name || "default";
|
1065
1146
|
return {
|
1066
1147
|
name: $(s) ? e.__parseExpression(s) : s,
|
@@ -1077,13 +1158,13 @@ function zt(r, e) {
|
|
1077
1158
|
innerHTML: e.__parseExpression(r.value) || ""
|
1078
1159
|
};
|
1079
1160
|
}
|
1080
|
-
function
|
1161
|
+
function Gt(r, e, t) {
|
1081
1162
|
const s = {
|
1082
1163
|
type: "JSFunction",
|
1083
1164
|
value: e.value?.value ? `(v) => {
|
1084
1165
|
${e.value.value} = v;
|
1085
1166
|
}` : "(v) => {}"
|
1086
|
-
}, n = t.__parseFunction(s), i =
|
1167
|
+
}, n = t.__parseFunction(s), i = Te(
|
1087
1168
|
$(e.modifiers) ? t.__parseExpression(e.modifiers) : e.modifiers
|
1088
1169
|
), a = $(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
1089
1170
|
return {
|
@@ -1091,16 +1172,16 @@ function Vt(r, e, t) {
|
|
1091
1172
|
[`onUpdate:${a}`]: i.length && n ? r.withModifiers(n, i) : n
|
1092
1173
|
};
|
1093
1174
|
}
|
1094
|
-
function
|
1175
|
+
function Vt(r, e, t, s, n) {
|
1095
1176
|
if (!e) return null;
|
1096
|
-
if (
|
1177
|
+
if (R(e))
|
1097
1178
|
return { default: () => e };
|
1098
1179
|
if ($(e))
|
1099
1180
|
return {
|
1100
1181
|
default: () => be(t.__parseExpression(e))
|
1101
1182
|
};
|
1102
1183
|
if (Array.isArray(e) && e.length > 0) {
|
1103
|
-
const i =
|
1184
|
+
const i = Wt(e), a = (o) => !o || !n ? {} : n?.id && Object.keys(o).length ? {
|
1104
1185
|
[`scope_${n.id}`]: o
|
1105
1186
|
} : {};
|
1106
1187
|
return Object.entries(i).reduce((o, [p, { nodes: c, params: u }]) => (o[p] = (l) => {
|
@@ -1112,7 +1193,7 @@ function Wt(r, e, t, s, n) {
|
|
1112
1193
|
}
|
1113
1194
|
return null;
|
1114
1195
|
}
|
1115
|
-
function
|
1196
|
+
function Wt(r) {
|
1116
1197
|
const e = {};
|
1117
1198
|
for (const t of r) {
|
1118
1199
|
const s = Qt(t.slot), n = s.name;
|
@@ -1124,17 +1205,17 @@ function Gt(r) {
|
|
1124
1205
|
return e;
|
1125
1206
|
}
|
1126
1207
|
function Qt(r = "default") {
|
1127
|
-
return
|
1208
|
+
return R(r) ? { name: r, params: [] } : { params: [], ...r };
|
1128
1209
|
}
|
1129
|
-
function
|
1210
|
+
function Xt(r, e, t) {
|
1130
1211
|
const { value: s, iterator: n } = r, { item: i = "item", index: a = "index" } = n || {};
|
1131
1212
|
let o = t.__parseExpression(s) || [];
|
1132
1213
|
return Number.isInteger(o) && (o = new Array(o).fill(!0).map((p, c) => c + 1)), Array.isArray(o) ? o.map((p, c) => e(t.__clone({ [i]: p, [a]: c }), c)) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
1133
1214
|
}
|
1134
|
-
const
|
1215
|
+
const ye = Ee({
|
1135
1216
|
name: "VtjPageContainer",
|
1136
1217
|
async setup() {
|
1137
|
-
const r =
|
1218
|
+
const r = xe(), e = je(), t = e.params.id, s = t ? r.getPage(t) : r.getHomepage(), n = s ? await r.getRenderComponent(s.id) : null, i = Z(Symbol());
|
1138
1219
|
if (s) {
|
1139
1220
|
Object.assign(e.meta, s.meta || {}, { cache: s.cache });
|
1140
1221
|
const { useTitle: a } = r?.adapter;
|
@@ -1152,19 +1233,75 @@ const ve = $e({
|
|
1152
1233
|
},
|
1153
1234
|
render() {
|
1154
1235
|
const { component: r, query: e, sid: t } = this;
|
1155
|
-
return r ?
|
1236
|
+
return r ? Y(r, { ...e, key: t }) : Y("div", "页面不存在");
|
1156
1237
|
},
|
1157
1238
|
activated() {
|
1158
1239
|
this.meta.cache === !1 && (this.sid = Symbol());
|
1159
1240
|
}
|
1160
|
-
}),
|
1241
|
+
}), Yt = Ee({
|
1161
1242
|
name: "VtjStartupContainer",
|
1162
1243
|
render() {
|
1163
|
-
return
|
1244
|
+
return Y("div", "page not found!");
|
1164
1245
|
}
|
1165
|
-
})
|
1246
|
+
});
|
1247
|
+
function oe(r, e, t = []) {
|
1248
|
+
return t.map((s) => {
|
1249
|
+
const { id: n, title: i, icon: a, children: o, hidden: p } = s;
|
1250
|
+
return {
|
1251
|
+
id: n,
|
1252
|
+
title: i,
|
1253
|
+
icon: a,
|
1254
|
+
hidden: p,
|
1255
|
+
url: `${r}/${e}/${n}`,
|
1256
|
+
children: o && o.length ? oe(r, e, o) : void 0
|
1257
|
+
};
|
1258
|
+
});
|
1259
|
+
}
|
1260
|
+
function De(r, e) {
|
1261
|
+
if (!e) return r;
|
1262
|
+
let t = [];
|
1263
|
+
for (const s of r)
|
1264
|
+
if (s.children && s.children.length) {
|
1265
|
+
const n = De(s.children, e);
|
1266
|
+
n.length && (s.children = n, t.push(s));
|
1267
|
+
} else
|
1268
|
+
e.can(s.id.toString()) && t.push(s);
|
1269
|
+
return t;
|
1270
|
+
}
|
1271
|
+
function ys(r) {
|
1272
|
+
const {
|
1273
|
+
menuPathPrefix: e = "",
|
1274
|
+
pageRouteName: t = "page",
|
1275
|
+
disableMenusFilter: s = !1
|
1276
|
+
} = r || {}, n = xe(), i = je(), a = _t(), o = Z(!1), p = Z(!1), c = n.project;
|
1277
|
+
st(() => {
|
1278
|
+
const { name: h, params: f, meta: d } = i;
|
1279
|
+
if (h === M) {
|
1280
|
+
const m = n.getPage(f.id);
|
1281
|
+
o.value = !m?.mask, p.value = !!m?.pure;
|
1282
|
+
} else if (h === N) {
|
1283
|
+
const m = n.getHomepage();
|
1284
|
+
o.value = !m?.mask, p.value = !!m?.pure;
|
1285
|
+
} else
|
1286
|
+
o.value = !d.mask, p.value = !!d.pure;
|
1287
|
+
});
|
1288
|
+
const u = oe(
|
1289
|
+
e,
|
1290
|
+
t,
|
1291
|
+
c?.pages
|
1292
|
+
), l = c?.config;
|
1293
|
+
return {
|
1294
|
+
disabled: o,
|
1295
|
+
logo: l?.logo,
|
1296
|
+
themeSwitchable: l?.themeSwitchable,
|
1297
|
+
title: l?.title || c?.description || c?.name || "VTJ App",
|
1298
|
+
menus: s ? u : De(u, a),
|
1299
|
+
pure: p
|
1300
|
+
};
|
1301
|
+
}
|
1302
|
+
const He = Symbol("Provider");
|
1166
1303
|
var Zt = /* @__PURE__ */ ((r) => (r.Production = "production", r.Development = "development", r))(Zt || {});
|
1167
|
-
class es extends
|
1304
|
+
class es extends Je {
|
1168
1305
|
// DSL缓存
|
1169
1306
|
/**
|
1170
1307
|
* 创建Provider实例
|
@@ -1196,7 +1333,7 @@ class es extends qe {
|
|
1196
1333
|
// 全局变量
|
1197
1334
|
modules = {};
|
1198
1335
|
// 异步模块加载器
|
1199
|
-
adapter = { request:
|
1336
|
+
adapter = { request: X, jsonp: Se };
|
1200
1337
|
// 适配器接口
|
1201
1338
|
apis = {};
|
1202
1339
|
// API集合
|
@@ -1226,9 +1363,9 @@ class es extends qe {
|
|
1226
1363
|
try {
|
1227
1364
|
s = await e.apply(e, t);
|
1228
1365
|
} catch (i) {
|
1229
|
-
|
1366
|
+
I.warn("模拟数据模版异常", i);
|
1230
1367
|
}
|
1231
|
-
return
|
1368
|
+
return O()?.mock(s);
|
1232
1369
|
};
|
1233
1370
|
}
|
1234
1371
|
/**
|
@@ -1245,10 +1382,10 @@ class es extends qe {
|
|
1245
1382
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
1246
1383
|
throw new Error("project is null");
|
1247
1384
|
const { apis: s = [], meta: n = [] } = this.project, i = window;
|
1248
|
-
i && (i.CKEDITOR_VERSION = void 0), this.mode === w.Raw ? await this.loadDependencies(i) : await this.loadAssets(i), this.initMock(i), this.apis = $t(s, n, this.adapter),
|
1385
|
+
i && (i.CKEDITOR_VERSION = void 0), this.mode === w.Raw ? await this.loadDependencies(i) : await this.loadAssets(i), this.initMock(i), this.apis = $t(s, n, this.adapter), Fe(i), Et(s, i), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
|
1249
1386
|
}
|
1250
1387
|
initMock(e) {
|
1251
|
-
const t =
|
1388
|
+
const t = O(e);
|
1252
1389
|
t && t.setup({
|
1253
1390
|
timeout: "50-500"
|
1254
1391
|
});
|
@@ -1280,24 +1417,24 @@ class es extends qe {
|
|
1280
1417
|
else {
|
1281
1418
|
const y = c[f] || [];
|
1282
1419
|
for (const g of y)
|
1283
|
-
|
1420
|
+
q(g) && await dt(f, A.append(g, { v: k })), K(g) && await me(A.append(g, { v: k }));
|
1284
1421
|
n[f] = e[f];
|
1285
1422
|
}
|
1286
1423
|
}
|
1287
1424
|
if (o === "development") {
|
1288
1425
|
for (const d of u)
|
1289
|
-
await
|
1426
|
+
await me(A.append(d, { v: k }));
|
1290
1427
|
const f = this.materials || {};
|
1291
1428
|
for (const d of l) {
|
1292
|
-
const m = e[h[d]], y =
|
1429
|
+
const m = e[h[d]], y = qe[d];
|
1293
1430
|
if (y)
|
1294
1431
|
m && y.forEach((g) => {
|
1295
1432
|
i[g] = m[g];
|
1296
1433
|
});
|
1297
1434
|
else {
|
1298
1435
|
const g = f[d] ? (await f[d]()).default : e[d];
|
1299
|
-
g && m && (g.components || []).forEach((
|
1300
|
-
i[
|
1436
|
+
g && m && (g.components || []).forEach((E) => {
|
1437
|
+
i[E.name] = ut(E, m);
|
1301
1438
|
});
|
1302
1439
|
}
|
1303
1440
|
}
|
@@ -1313,14 +1450,14 @@ class es extends qe {
|
|
1313
1450
|
} = s, c = a ? "" : "/", u = {
|
1314
1451
|
path: `${c}${o}/:id`,
|
1315
1452
|
name: M,
|
1316
|
-
component:
|
1453
|
+
component: ye
|
1317
1454
|
}, l = {
|
1318
1455
|
path: c,
|
1319
|
-
name:
|
1320
|
-
component: t?.homepage ?
|
1456
|
+
name: N,
|
1457
|
+
component: t?.homepage ? ye : n.startupComponent || Yt,
|
1321
1458
|
meta: p
|
1322
1459
|
};
|
1323
|
-
e.hasRoute(M) && e.removeRoute(M), e.hasRoute(
|
1460
|
+
e.hasRoute(M) && e.removeRoute(M), e.hasRoute(N) && e.removeRoute(N), a ? (e.addRoute(a, u), e.addRoute(a, l)) : (e.addRoute(u), e.addRoute(l));
|
1324
1461
|
}
|
1325
1462
|
/**
|
1326
1463
|
* Vue 插件安装方法
|
@@ -1336,7 +1473,7 @@ class es extends qe {
|
|
1336
1473
|
const t = e.config.globalProperties.installed || {};
|
1337
1474
|
for (const [s, n] of Object.entries(this.library))
|
1338
1475
|
!t[s] && ht(n) && (e.use(n), t[s] = !0);
|
1339
|
-
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(
|
1476
|
+
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(He, this), e.config.globalProperties.$provider = this, e.config.globalProperties.installed = t, this.mode === w.Design && (e.config.errorHandler = (s, n, i) => {
|
1340
1477
|
const a = n?.$options.name, o = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", p = `[ ${a} ] ${o} ${i}`;
|
1341
1478
|
console.error(
|
1342
1479
|
"[VTJ Error]:",
|
@@ -1367,6 +1504,9 @@ class es extends qe {
|
|
1367
1504
|
};
|
1368
1505
|
return s(e, t) || null;
|
1369
1506
|
}
|
1507
|
+
getMenus(e = "page", t = "") {
|
1508
|
+
return oe(t, e, this.project?.pages || []);
|
1509
|
+
}
|
1370
1510
|
getHomepage() {
|
1371
1511
|
const { homepage: e } = this.project || {};
|
1372
1512
|
return e ? this.getPage(e) : null;
|
@@ -1428,13 +1568,13 @@ class es extends qe {
|
|
1428
1568
|
async getRenderComponent(e, t) {
|
1429
1569
|
const s = this.getFile(e);
|
1430
1570
|
if (!s)
|
1431
|
-
return
|
1571
|
+
return I.warn(`Can not find file: ${e}`), null;
|
1432
1572
|
t && t(s);
|
1433
1573
|
const n = `.vtj/vue/${e}.vue`, i = this.modules[n] || this.modules[`/src/pages/${e}.vue`];
|
1434
1574
|
if (i)
|
1435
1575
|
return (await i())?.default;
|
1436
1576
|
const a = await this.getDsl(s.id);
|
1437
|
-
return a ? this.createDslRenderer(a).renderer : (
|
1577
|
+
return a ? this.createDslRenderer(a).renderer : (I.warn(`Can not find dsl: ${e}`), null);
|
1438
1578
|
}
|
1439
1579
|
/**
|
1440
1580
|
* 定义基于URL的异步组件
|
@@ -1446,7 +1586,7 @@ class es extends qe {
|
|
1446
1586
|
* @returns Vue异步组件
|
1447
1587
|
*/
|
1448
1588
|
defineUrlSchemaComponent(e, t) {
|
1449
|
-
return
|
1589
|
+
return ge(async () => {
|
1450
1590
|
const s = await this.getDslByUrl(e);
|
1451
1591
|
return s ? (s.name = t || s.name, this.createDslRenderer(s).renderer) : null;
|
1452
1592
|
});
|
@@ -1459,18 +1599,18 @@ class es extends qe {
|
|
1459
1599
|
* @returns Vue异步组件
|
1460
1600
|
*/
|
1461
1601
|
definePluginComponent(e) {
|
1462
|
-
return
|
1602
|
+
return ge(async () => await Me(e, window));
|
1463
1603
|
}
|
1464
1604
|
}
|
1465
|
-
function
|
1605
|
+
function _s(r) {
|
1466
1606
|
const e = new es(r);
|
1467
1607
|
return {
|
1468
1608
|
provider: e,
|
1469
1609
|
onReady: (s) => e.ready(s)
|
1470
1610
|
};
|
1471
1611
|
}
|
1472
|
-
function
|
1473
|
-
const e =
|
1612
|
+
function xe(r = {}) {
|
1613
|
+
const e = $e(He, null);
|
1474
1614
|
if (!e)
|
1475
1615
|
throw new Error("Can not find provider");
|
1476
1616
|
if (e.nodeEnv === "development") {
|
@@ -1486,15 +1626,15 @@ function He(r = {}) {
|
|
1486
1626
|
}
|
1487
1627
|
return e;
|
1488
1628
|
}
|
1489
|
-
async function
|
1629
|
+
async function ws(r, e = "") {
|
1490
1630
|
const { name: t, urls: s = [] } = r || {}, n = s.map((o) => e + o), { css: i, js: a } = pt(n);
|
1491
1631
|
if (i.length && Pe(i), a.length)
|
1492
|
-
return await
|
1632
|
+
return await Ce(a, t).catch(
|
1493
1633
|
() => {
|
1494
1634
|
}
|
1495
1635
|
);
|
1496
1636
|
}
|
1497
|
-
const
|
1637
|
+
const Be = {
|
1498
1638
|
type: "json",
|
1499
1639
|
validSuccess: !0,
|
1500
1640
|
originResponse: !1,
|
@@ -1509,7 +1649,7 @@ const Oe = {
|
|
1509
1649
|
type: t,
|
1510
1650
|
data: s
|
1511
1651
|
},
|
1512
|
-
settings:
|
1652
|
+
settings: Be
|
1513
1653
|
}), ss = (r, e = "/__vtj__/api/uploader.json") => async (t, s) => await r.send({
|
1514
1654
|
url: e,
|
1515
1655
|
method: "post",
|
@@ -1518,12 +1658,12 @@ const Oe = {
|
|
1518
1658
|
projectId: s
|
1519
1659
|
},
|
1520
1660
|
settings: {
|
1521
|
-
...
|
1661
|
+
...Be,
|
1522
1662
|
type: "data"
|
1523
1663
|
}
|
1524
1664
|
}).then((n) => n && n[0] ? n[0] : null).catch(() => null);
|
1525
|
-
function
|
1526
|
-
return
|
1665
|
+
function Ss(r) {
|
1666
|
+
return we({
|
1527
1667
|
settings: {
|
1528
1668
|
type: "json",
|
1529
1669
|
validSuccess: !0,
|
@@ -1536,8 +1676,8 @@ function ys(r) {
|
|
1536
1676
|
}
|
1537
1677
|
});
|
1538
1678
|
}
|
1539
|
-
class
|
1540
|
-
constructor(e =
|
1679
|
+
class ae {
|
1680
|
+
constructor(e = X) {
|
1541
1681
|
this.req = e, this.api = ts(e), this.uploader = ss(e);
|
1542
1682
|
}
|
1543
1683
|
api;
|
@@ -1625,7 +1765,7 @@ class oe {
|
|
1625
1765
|
const { urls: t = [] } = e, s = t.filter((i) => at(i))[0];
|
1626
1766
|
if (!s) return null;
|
1627
1767
|
const n = this.pluginCaches[s];
|
1628
|
-
return n || (this.pluginCaches[s] =
|
1768
|
+
return n || (this.pluginCaches[s] = X.send({
|
1629
1769
|
url: s,
|
1630
1770
|
method: "get",
|
1631
1771
|
settings: {
|
@@ -1643,7 +1783,7 @@ const _ = new tt({
|
|
1643
1783
|
expired: 0,
|
1644
1784
|
prefix: "__VTJ_"
|
1645
1785
|
});
|
1646
|
-
class
|
1786
|
+
class $s extends ae {
|
1647
1787
|
init(e) {
|
1648
1788
|
const t = new U(e), s = _.get(`project_${t.id}`), n = Object.assign(t.toDsl(), s || {});
|
1649
1789
|
return _.save(`project_${t.id}`, n), Promise.resolve(n);
|
@@ -1677,7 +1817,7 @@ class _s extends oe {
|
|
1677
1817
|
return Promise.resolve(!0);
|
1678
1818
|
}
|
1679
1819
|
getHistory(e) {
|
1680
|
-
const t = _.get(`history_${e}`), s = new
|
1820
|
+
const t = _.get(`history_${e}`), s = new _e(t || { id: e });
|
1681
1821
|
return Promise.resolve(s.toDsl());
|
1682
1822
|
}
|
1683
1823
|
getHistoryItem(e, t) {
|
@@ -1693,7 +1833,7 @@ class _s extends oe {
|
|
1693
1833
|
}), Promise.resolve(!0);
|
1694
1834
|
}
|
1695
1835
|
}
|
1696
|
-
class rs extends
|
1836
|
+
class rs extends ae {
|
1697
1837
|
projects = {};
|
1698
1838
|
materials = {};
|
1699
1839
|
files = {};
|
@@ -1732,7 +1872,7 @@ class rs extends oe {
|
|
1732
1872
|
return Promise.resolve(!0);
|
1733
1873
|
}
|
1734
1874
|
getHistory(e) {
|
1735
|
-
const t = this.histories[e], s = new
|
1875
|
+
const t = this.histories[e], s = new _e(t || { id: e });
|
1736
1876
|
return Promise.resolve(s);
|
1737
1877
|
}
|
1738
1878
|
getHistoryItem(e, t) {
|
@@ -1750,11 +1890,11 @@ class rs extends oe {
|
|
1750
1890
|
}), Promise.resolve(!0);
|
1751
1891
|
}
|
1752
1892
|
}
|
1753
|
-
let
|
1754
|
-
function
|
1755
|
-
return
|
1893
|
+
let B = null;
|
1894
|
+
function Es() {
|
1895
|
+
return B || (B = new rs(), B);
|
1756
1896
|
}
|
1757
|
-
class
|
1897
|
+
class js extends ae {
|
1758
1898
|
getFileCaches = {};
|
1759
1899
|
async getExtension() {
|
1760
1900
|
return await this.api("getExtension", {}).catch(() => {
|
@@ -1811,131 +1951,80 @@ class Ss extends oe {
|
|
1811
1951
|
);
|
1812
1952
|
}
|
1813
1953
|
}
|
1814
|
-
function xe(r, e, t = []) {
|
1815
|
-
return t.map((s) => {
|
1816
|
-
const { id: n, title: i, icon: a, children: o, hidden: p } = s;
|
1817
|
-
return {
|
1818
|
-
id: n,
|
1819
|
-
title: i,
|
1820
|
-
icon: a,
|
1821
|
-
hidden: p,
|
1822
|
-
url: `${r}/${e}/${n}`,
|
1823
|
-
children: o && o.length ? xe(r, e, o) : void 0
|
1824
|
-
};
|
1825
|
-
});
|
1826
|
-
}
|
1827
|
-
function Ne(r, e) {
|
1828
|
-
if (!e) return r;
|
1829
|
-
let t = [];
|
1830
|
-
for (const s of r)
|
1831
|
-
if (s.children && s.children.length) {
|
1832
|
-
const n = Ne(s.children, e);
|
1833
|
-
n.length && (s.children = n, t.push(s));
|
1834
|
-
} else
|
1835
|
-
e.can(s.id.toString()) && t.push(s);
|
1836
|
-
return t;
|
1837
|
-
}
|
1838
|
-
function $s(r) {
|
1839
|
-
const {
|
1840
|
-
menuPathPrefix: e = "",
|
1841
|
-
pageRouteName: t = "page",
|
1842
|
-
disableMenusFilter: s = !1
|
1843
|
-
} = r || {}, n = He(), i = je(), a = _t(), o = Z(!1), p = Z(!1), c = n.project;
|
1844
|
-
st(() => {
|
1845
|
-
const { name: h, params: f, meta: d } = i;
|
1846
|
-
if (h === M) {
|
1847
|
-
const m = n.getPage(f.id);
|
1848
|
-
o.value = !m?.mask, p.value = !!m?.pure;
|
1849
|
-
} else if (h === B) {
|
1850
|
-
const m = n.getHomepage();
|
1851
|
-
o.value = !m?.mask, p.value = !!m?.pure;
|
1852
|
-
} else
|
1853
|
-
o.value = !d.mask, p.value = !!d.pure;
|
1854
|
-
});
|
1855
|
-
const u = xe(
|
1856
|
-
e,
|
1857
|
-
t,
|
1858
|
-
c?.pages
|
1859
|
-
), l = c?.config;
|
1860
|
-
return {
|
1861
|
-
disabled: o,
|
1862
|
-
logo: l?.logo,
|
1863
|
-
themeSwitchable: l?.themeSwitchable,
|
1864
|
-
title: l?.title || c?.description || c?.name || "VTJ App",
|
1865
|
-
menus: s ? u : Ne(u, a),
|
1866
|
-
pure: p
|
1867
|
-
};
|
1868
|
-
}
|
1869
1954
|
export {
|
1870
|
-
|
1871
|
-
|
1955
|
+
us as ACCESS,
|
1956
|
+
Ae as ACCESS_KEY,
|
1957
|
+
Ie as Access,
|
1872
1958
|
ot as BUILD_IN_TAGS,
|
1873
1959
|
rt as BUILT_IN_DIRECTIVES,
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1960
|
+
ae as BaseService,
|
1961
|
+
ve as CONTEXT_HOST,
|
1962
|
+
Rt as Context,
|
1877
1963
|
w as ContextMode,
|
1878
1964
|
nt as DATA_TYPES,
|
1879
|
-
|
1965
|
+
N as HOMEPAGE_ROUTE_NAME,
|
1880
1966
|
it as HTML_TAGS,
|
1881
|
-
|
1967
|
+
hs as JSCodeToString,
|
1882
1968
|
cs as LIFE_CYCLES_LIST,
|
1883
|
-
|
1969
|
+
js as LocalService,
|
1884
1970
|
rs as MemoryService,
|
1885
1971
|
Zt as NodeEnv,
|
1886
1972
|
M as PAGE_ROUTE_NAME,
|
1887
1973
|
es as Provider,
|
1888
|
-
|
1889
|
-
|
1890
|
-
|
1891
|
-
|
1974
|
+
ls as REMOTE,
|
1975
|
+
$s as StorageService,
|
1976
|
+
k as VTJ_RENDERER_VERSION,
|
1977
|
+
Re as adoptedStyleSheets,
|
1978
|
+
vs as clearLoaderCache,
|
1892
1979
|
ft as compileScopedCSS,
|
1893
|
-
|
1894
|
-
|
1895
|
-
|
1896
|
-
|
1980
|
+
gs as createAccess,
|
1981
|
+
ms as createAdapter,
|
1982
|
+
ps as createAssetScripts,
|
1983
|
+
fs as createAssetsCss,
|
1897
1984
|
Mt as createDataSources,
|
1898
1985
|
se as createLoader,
|
1899
|
-
|
1986
|
+
Es as createMemoryService,
|
1987
|
+
oe as createMenus,
|
1900
1988
|
St as createMetaApi,
|
1901
|
-
|
1902
|
-
|
1989
|
+
jt as createMock,
|
1990
|
+
_s as createProvider,
|
1903
1991
|
te as createRenderer,
|
1904
1992
|
wt as createSchemaApi,
|
1905
1993
|
$t as createSchemaApis,
|
1906
|
-
|
1907
|
-
|
1994
|
+
Ss as createServiceRequest,
|
1995
|
+
Dt as defaultLoader,
|
1908
1996
|
x as fillBasePath,
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1997
|
+
O as getMock,
|
1998
|
+
Te as getModifiers,
|
1999
|
+
Me as getPlugin,
|
1912
2000
|
ut as getRawComponent,
|
1913
2001
|
mt as isBuiltInTag,
|
1914
|
-
|
2002
|
+
q as isCSSUrl,
|
1915
2003
|
vt as isJSCode,
|
1916
2004
|
$ as isJSExpression,
|
1917
|
-
|
2005
|
+
D as isJSFunction,
|
1918
2006
|
at as isJSON,
|
1919
2007
|
K as isJSUrl,
|
1920
2008
|
gt as isNativeTag,
|
1921
2009
|
ht as isVuePlugin,
|
1922
2010
|
dt as loadCss,
|
1923
2011
|
Pe as loadCssUrl,
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
2012
|
+
ws as loadEnhance,
|
2013
|
+
Ce as loadScriptUrl,
|
2014
|
+
De as menusFilter,
|
2015
|
+
bt as mockApi,
|
2016
|
+
Et as mockApis,
|
2017
|
+
Fe as mockCleanup,
|
1929
2018
|
F as nodeRender,
|
1930
2019
|
lt as parseDeps,
|
1931
2020
|
T as parseExpression,
|
1932
2021
|
ee as parseFunction,
|
1933
2022
|
pt as parseUrls,
|
1934
|
-
|
2023
|
+
He as providerKey,
|
1935
2024
|
ct as removeProdFlag,
|
1936
|
-
|
2025
|
+
ds as setupPageSetting,
|
1937
2026
|
be as toString,
|
1938
2027
|
_t as useAccess,
|
1939
|
-
|
1940
|
-
|
2028
|
+
ys as useMask,
|
2029
|
+
xe as useProvider
|
1941
2030
|
};
|