@vtj/renderer 0.13.36 → 0.13.38
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 +327 -312
- package/package.json +6 -6
- package/types/plugins/access.d.ts +1 -0
- package/types/provider/provider.d.ts +3 -1
- package/types/render/context.d.ts +2 -0
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Base as ze, BUILT_IN_COMPONENTS as Ge, ProjectModel as U, HistoryModel as je } from "@vtj/core";
|
|
2
|
-
import { isUrl as se, url as F, dedupArray as Ve, isString as I, isFunction as q, logger as M, storage as X, cookie as Y, toArray as
|
|
2
|
+
import { isUrl as se, url as F, dedupArray as Ve, isString as I, isFunction as q, logger as M, storage as X, cookie as Y, toArray as ye, unRSA as _e, delay as J, createRequest as Ee, jsonp as Re, merge as Qe, pathToRegexp as We, pathToRegexpMatch as Xe, formDataToJson as Ye, Queue as Ze, cloneDeep as we, camelCase as A, isObject as et, upperFirst as tt, pick as st, request as ne, loadScript as Se, Storage as nt, mapToObject as ue } from "@vtj/utils";
|
|
3
3
|
import * as z from "vue";
|
|
4
|
-
import { inject as Pe, defineComponent as Ce, h as re, ref as
|
|
4
|
+
import { inject as Pe, defineComponent as Ce, h as re, ref as ie, watchEffect as rt, defineAsyncComponent as $e } from "vue";
|
|
5
5
|
import { useRoute as Ae } 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.13.
|
|
10
|
+
* @version 0.13.38
|
|
11
11
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
12
12
|
*/
|
|
13
|
-
const
|
|
13
|
+
const T = "0.13.38";
|
|
14
14
|
var w = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(w || {});
|
|
15
15
|
const be = [
|
|
16
16
|
"$el",
|
|
@@ -24,7 +24,7 @@ const be = [
|
|
|
24
24
|
"$props",
|
|
25
25
|
"$options",
|
|
26
26
|
"$forceUpdate"
|
|
27
|
-
],
|
|
27
|
+
], vs = [
|
|
28
28
|
"beforeCreate",
|
|
29
29
|
"created",
|
|
30
30
|
"beforeMount",
|
|
@@ -38,7 +38,7 @@ const be = [
|
|
|
38
38
|
"renderTriggered",
|
|
39
39
|
"activated",
|
|
40
40
|
"deactivated"
|
|
41
|
-
],
|
|
41
|
+
], it = [
|
|
42
42
|
"vIf",
|
|
43
43
|
"vElseIf",
|
|
44
44
|
"vElse",
|
|
@@ -47,7 +47,7 @@ const be = [
|
|
|
47
47
|
"vFor",
|
|
48
48
|
"vBind",
|
|
49
49
|
"vHtml"
|
|
50
|
-
],
|
|
50
|
+
], ot = {
|
|
51
51
|
String,
|
|
52
52
|
Number,
|
|
53
53
|
Boolean,
|
|
@@ -55,9 +55,9 @@ const be = [
|
|
|
55
55
|
Object,
|
|
56
56
|
Function,
|
|
57
57
|
Date
|
|
58
|
-
},
|
|
58
|
+
}, D = "VtjPage", N = "VtjHomepage", at = "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
|
-
), ct = "component,slot".split(","),
|
|
60
|
+
), ct = "component,slot".split(","), ys = [
|
|
61
61
|
"h",
|
|
62
62
|
"t",
|
|
63
63
|
"t",
|
|
@@ -153,30 +153,30 @@ function lt(n) {
|
|
|
153
153
|
}
|
|
154
154
|
function ws(n) {
|
|
155
155
|
return n.map(
|
|
156
|
-
(e) => `<script src="${F.append(e, { v:
|
|
156
|
+
(e) => `<script src="${F.append(e, { v: T })}"><\/script>`
|
|
157
157
|
).join("");
|
|
158
158
|
}
|
|
159
159
|
function Ss(n = []) {
|
|
160
160
|
return n.map(
|
|
161
|
-
(e) => `<link rel="stylesheet" href="${F.append(e, { v:
|
|
161
|
+
(e) => `<link rel="stylesheet" href="${F.append(e, { v: T })}" />`
|
|
162
162
|
).join("");
|
|
163
163
|
}
|
|
164
164
|
function ut(n, e = !1) {
|
|
165
165
|
return e && n.endsWith(".prod.js") ? n.replace(".prod.js", ".js") : n;
|
|
166
166
|
}
|
|
167
167
|
function ft(n, e, t = !1) {
|
|
168
|
-
const s = n.filter((p) => !!p.enabled), r = [],
|
|
168
|
+
const s = n.filter((p) => !!p.enabled), r = [], i = [], a = [], o = [], l = {}, c = {}, u = [], f = {};
|
|
169
169
|
return s.forEach(
|
|
170
170
|
({ urls: p, assetsUrl: h, library: d, assetsLibrary: m, localeLibrary: g }) => {
|
|
171
|
-
p?.forEach((
|
|
172
|
-
V(
|
|
173
|
-
}), d && (
|
|
171
|
+
p?.forEach((v) => {
|
|
172
|
+
V(v) && r.push(ut(v, t)), G(v) && i.push(v);
|
|
173
|
+
}), d && (o.push(d), l[d] = B(p || [], e), g && (c[d] = g)), h && a.push(h), m && u.push(m), d && m && (f[m] = d);
|
|
174
174
|
}
|
|
175
175
|
), {
|
|
176
176
|
scripts: B(r, e),
|
|
177
|
-
css: B(
|
|
177
|
+
css: B(i, e),
|
|
178
178
|
materials: B(a, e),
|
|
179
|
-
libraryExports:
|
|
179
|
+
libraryExports: o,
|
|
180
180
|
materialExports: Ve(u),
|
|
181
181
|
materialMapLibrary: f,
|
|
182
182
|
libraryMap: l,
|
|
@@ -204,30 +204,30 @@ function ht(n, e) {
|
|
|
204
204
|
continue;
|
|
205
205
|
}
|
|
206
206
|
if (c.substring(f, f + 2) === "/*") {
|
|
207
|
-
const
|
|
208
|
-
if (
|
|
209
|
-
f =
|
|
207
|
+
const v = c.indexOf("*/", f + 2);
|
|
208
|
+
if (v !== -1) {
|
|
209
|
+
f = v + 2;
|
|
210
210
|
continue;
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
if (c[f] === "@") {
|
|
214
|
-
const
|
|
214
|
+
const v = f;
|
|
215
215
|
for (; f < c.length && c[f] !== "{" && c[f] !== ";"; )
|
|
216
216
|
f++;
|
|
217
|
-
const _ = c.substring(
|
|
217
|
+
const _ = c.substring(v, f).trim(), y = _.includes("@keyframes");
|
|
218
218
|
if (c[f] === ";")
|
|
219
219
|
u.push({
|
|
220
220
|
type: "simple-at-rule",
|
|
221
|
-
content: c.substring(
|
|
221
|
+
content: c.substring(v, f + 1)
|
|
222
222
|
}), f++;
|
|
223
223
|
else if (c[f] === "{") {
|
|
224
224
|
const S = f + 1;
|
|
225
225
|
let P = 1;
|
|
226
226
|
for (f++; f < c.length && P > 0; )
|
|
227
227
|
c[f] === "{" ? P++ : c[f] === "}" && P--, f++;
|
|
228
|
-
const Q = c.substring(
|
|
228
|
+
const Q = c.substring(v, f), C = c.substring(S, f - 1);
|
|
229
229
|
u.push({
|
|
230
|
-
type:
|
|
230
|
+
type: y ? "keyframes" : "at-rule",
|
|
231
231
|
rule: _,
|
|
232
232
|
content: Q,
|
|
233
233
|
inner: C
|
|
@@ -262,7 +262,7 @@ function ht(n, e) {
|
|
|
262
262
|
}, r = (c) => c.replace(/::v-deep\(/g, ":deep(").replace(/::v-deep\s+/g, ":deep(").replace(/\/deep\//g, " ").replace(/>>>/g, " ").replace(/(.*?):deep\(([^)]+)\)/g, (u, f, p) => {
|
|
263
263
|
const h = f.trim(), d = p.trim();
|
|
264
264
|
return h ? `${h}[${e}] ${d}` : d;
|
|
265
|
-
}),
|
|
265
|
+
}), i = (c) => {
|
|
266
266
|
const u = c.trim();
|
|
267
267
|
if (!u || u.includes(`[${e}]`) || /^(:root|:host|html|body)(\s|$|:|\.|\#|\[)/.test(u) || s(u))
|
|
268
268
|
return u;
|
|
@@ -272,7 +272,7 @@ function ht(n, e) {
|
|
|
272
272
|
return d ? `${d}[${e}]${h}` : u;
|
|
273
273
|
}
|
|
274
274
|
return `${u}[${e}]`;
|
|
275
|
-
}, a = (c) => r(c).split(",").map((f) =>
|
|
275
|
+
}, a = (c) => r(c).split(",").map((f) => i(f)).filter((f) => f.trim()).join(", "), o = (c) => c.map((u) => {
|
|
276
276
|
switch (u.type) {
|
|
277
277
|
case "simple-at-rule":
|
|
278
278
|
return u.content;
|
|
@@ -280,7 +280,7 @@ function ht(n, e) {
|
|
|
280
280
|
return u.content;
|
|
281
281
|
case "at-rule":
|
|
282
282
|
try {
|
|
283
|
-
const p = t(u.inner), h =
|
|
283
|
+
const p = t(u.inner), h = o(p);
|
|
284
284
|
return `${u.rule} { ${h} }`;
|
|
285
285
|
} catch {
|
|
286
286
|
return u.content;
|
|
@@ -296,7 +296,7 @@ function ht(n, e) {
|
|
|
296
296
|
}).filter((u) => u.trim()).join(" "), l = (c) => c.replace(/\s*{\s*/g, " { ").replace(/\s*}\s*/g, " } ").replace(/\s*;\s*/g, "; ").replace(/\s*,\s*/g, ", ").replace(/\s+/g, " ").replace(/^\s+|\s+$/g, "").replace(/\s*}\s*}/g, " } }").trim();
|
|
297
297
|
try {
|
|
298
298
|
const c = n.replace(/\/\*(?!\s*!)[\s\S]*?\*\//g, "").replace(/^\s+|\s+$/gm, "").replace(/\n\s*\n/g, `
|
|
299
|
-
`), u = t(c), f =
|
|
299
|
+
`), u = t(c), f = o(u);
|
|
300
300
|
return l(f);
|
|
301
301
|
} catch (c) {
|
|
302
302
|
return console.error("CSS scoping failed:", c), console.error("Input CSS:", n), n.replace(/\/\*[\s\S]*?\*\//g, "").replace(
|
|
@@ -312,18 +312,18 @@ function Ie(n) {
|
|
|
312
312
|
return I(n) ? n : JSON.stringify(n);
|
|
313
313
|
}
|
|
314
314
|
function fe(n, e, t, s = !1) {
|
|
315
|
-
const r = n.CSSStyleSheet,
|
|
315
|
+
const r = n.CSSStyleSheet, i = s ? `data-v-${e}` : e, a = s ? ht(t, i) : t;
|
|
316
316
|
if (r.prototype.replaceSync) {
|
|
317
|
-
const
|
|
318
|
-
|
|
317
|
+
const o = new r();
|
|
318
|
+
o.id = e, o.replaceSync(a);
|
|
319
319
|
const l = n.document, c = l.adoptedStyleSheets, u = Array.from(c).filter(
|
|
320
320
|
(f) => f.id !== e
|
|
321
321
|
);
|
|
322
|
-
l.adoptedStyleSheets = [...u,
|
|
322
|
+
l.adoptedStyleSheets = [...u, o];
|
|
323
323
|
} else {
|
|
324
|
-
const
|
|
325
|
-
let l =
|
|
326
|
-
l ? l.innerHTML = a : (l =
|
|
324
|
+
const o = n.document;
|
|
325
|
+
let l = o.getElementById(e);
|
|
326
|
+
l ? l.innerHTML = a : (l = o.createElement("style"), l.id = e, l.innerHTML = a, o.head.appendChild(l));
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
function $s(n) {
|
|
@@ -356,14 +356,14 @@ function ke(n, e = window) {
|
|
|
356
356
|
}
|
|
357
357
|
async function Fe(n, e, t = window) {
|
|
358
358
|
const s = t.document, r = t.document.head;
|
|
359
|
-
let
|
|
360
|
-
return
|
|
359
|
+
let i = t[e];
|
|
360
|
+
return i ? i.default || i : new Promise((a, o) => {
|
|
361
361
|
for (const l of n) {
|
|
362
362
|
const c = s.createElement("script");
|
|
363
363
|
c.src = l, c.onload = () => {
|
|
364
|
-
|
|
364
|
+
i = t[e], i ? a(i.default || i) : o(null);
|
|
365
365
|
}, c.onerror = (u) => {
|
|
366
|
-
|
|
366
|
+
o(u);
|
|
367
367
|
}, r.appendChild(c);
|
|
368
368
|
}
|
|
369
369
|
});
|
|
@@ -371,10 +371,10 @@ async function Fe(n, e, t = window) {
|
|
|
371
371
|
function gt(n) {
|
|
372
372
|
return q(n) && Object.getOwnPropertyNames(n.prototype || {}).length === 0 || q(n?.install);
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function vt(n) {
|
|
375
375
|
return ct.includes(n);
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function yt(n) {
|
|
378
378
|
return at.includes(n);
|
|
379
379
|
}
|
|
380
380
|
function H(n = window) {
|
|
@@ -391,30 +391,30 @@ function bs(n, e, t) {
|
|
|
391
391
|
}
|
|
392
392
|
function x(n, e, t = !1, s = !1, r = !1) {
|
|
393
393
|
try {
|
|
394
|
-
const
|
|
395
|
-
|
|
394
|
+
const i = ['"use strict";', "var __self = arguments[0];"];
|
|
395
|
+
i.push("return ");
|
|
396
396
|
let a = (n.value || "").trim();
|
|
397
|
-
r || (a = a.replace(/this(\W|$)/g, (l, c) => `__self${c}`)), a =
|
|
397
|
+
r || (a = a.replace(/this(\W|$)/g, (l, c) => `__self${c}`)), a = i.join(`
|
|
398
398
|
`) + a;
|
|
399
|
-
const
|
|
399
|
+
const o = r ? `
|
|
400
400
|
${a}
|
|
401
401
|
` : `with(${t ? "{}" : "$scope || {}"}) { ${a} }`;
|
|
402
|
-
return new Function("$scope",
|
|
403
|
-
} catch (
|
|
404
|
-
if (M.error("parseExpression.error",
|
|
405
|
-
throw
|
|
402
|
+
return new Function("$scope", o)(e);
|
|
403
|
+
} catch (i) {
|
|
404
|
+
if (M.error("parseExpression.error", i, n, e?.__self ?? e), s)
|
|
405
|
+
throw i;
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
408
|
function R(n, e, t = !1, s = !1, r = !1) {
|
|
409
|
-
const
|
|
410
|
-
if (typeof
|
|
409
|
+
const i = x(n, e, t, s, r);
|
|
410
|
+
if (typeof i != "function" && (M.error(
|
|
411
411
|
"parseFunction.error",
|
|
412
412
|
"not a function",
|
|
413
413
|
n,
|
|
414
414
|
e?.__self ?? e
|
|
415
415
|
), s))
|
|
416
416
|
throw new Error(`"${n.value}" not a function`);
|
|
417
|
-
return
|
|
417
|
+
return i;
|
|
418
418
|
}
|
|
419
419
|
function E(n) {
|
|
420
420
|
return n && n.type === "JSExpression";
|
|
@@ -447,6 +447,7 @@ class pe {
|
|
|
447
447
|
data = null;
|
|
448
448
|
mode = w.Raw;
|
|
449
449
|
interceptResponse = !0;
|
|
450
|
+
isTipShowing = !1;
|
|
450
451
|
constructor(e) {
|
|
451
452
|
this.options = Object.assign({}, wt, e), this.loadData();
|
|
452
453
|
}
|
|
@@ -461,11 +462,11 @@ class pe {
|
|
|
461
462
|
this.mode = t, s && this.mode !== w.Design && this.setGuard(s), r && this.setRequest(r);
|
|
462
463
|
}
|
|
463
464
|
login(e) {
|
|
464
|
-
const { storageKey: t, storagePrefix: s, session: r, authKey:
|
|
465
|
+
const { storageKey: t, storagePrefix: s, session: r, authKey: i } = this.options;
|
|
465
466
|
this.setData(e), this.data && (X.save(t, e, {
|
|
466
467
|
type: "local",
|
|
467
468
|
prefix: s
|
|
468
|
-
}), r && Y.set(
|
|
469
|
+
}), r && Y.set(i, this.data.token));
|
|
469
470
|
}
|
|
470
471
|
clear() {
|
|
471
472
|
const { storageKey: e, storagePrefix: t, session: s, authKey: r } = this.options;
|
|
@@ -485,11 +486,11 @@ class pe {
|
|
|
485
486
|
}
|
|
486
487
|
can(e) {
|
|
487
488
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
|
488
|
-
return typeof e == "function" ? e(s) :
|
|
489
|
+
return typeof e == "function" ? e(s) : ye(e).every((i) => s[i] || s[t + "." + i]);
|
|
489
490
|
}
|
|
490
491
|
some(e) {
|
|
491
492
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
|
492
|
-
return
|
|
493
|
+
return ye(e).some((i) => s[i] || s[t + "." + i]);
|
|
493
494
|
}
|
|
494
495
|
install(e) {
|
|
495
496
|
e.config.globalProperties.$access = this, e.provide(Me, this);
|
|
@@ -543,11 +544,11 @@ class pe {
|
|
|
543
544
|
return e && t ? !!Y.get(t) : !!this.getToken();
|
|
544
545
|
}
|
|
545
546
|
hasRoutePermission(e) {
|
|
546
|
-
if (e.name ===
|
|
547
|
+
if (e.name === D) {
|
|
547
548
|
const t = e.params.id;
|
|
548
549
|
return t && this.can(t);
|
|
549
550
|
}
|
|
550
|
-
return e.meta.__vtj__ ? this.can(e.meta.__vtj__) : !0;
|
|
551
|
+
return e.meta.__vtj__ ? this.can(e.meta.__vtj__) : e.meta.permission ? this.can(e.meta.permission) : !0;
|
|
551
552
|
}
|
|
552
553
|
setGuard(e) {
|
|
553
554
|
e.beforeEach((t, s, r) => this.guard(t, r));
|
|
@@ -575,14 +576,16 @@ class pe {
|
|
|
575
576
|
}
|
|
576
577
|
async showUnauthorizedAlert(e) {
|
|
577
578
|
const { unauthorizedMessage: t = "登录已失效" } = this.options;
|
|
578
|
-
this.isUnauthorized(e) &&
|
|
579
|
+
this.isUnauthorized(e) && await this.showTip(t) && this.toLogin();
|
|
579
580
|
}
|
|
580
581
|
async showTip(e) {
|
|
581
582
|
const { alert: t } = this.options;
|
|
582
|
-
return t ? (await J(150), await t(e, {
|
|
583
|
+
return this.isTipShowing ? !1 : t ? (this.isTipShowing = !0, await J(150), await t(e, {
|
|
583
584
|
title: "提示",
|
|
584
585
|
type: "warning"
|
|
585
|
-
})?.catch(() => !
|
|
586
|
+
})?.catch(() => !0)?.finally(() => {
|
|
587
|
+
this.isTipShowing = !1;
|
|
588
|
+
})) : (window.alert(e), !0);
|
|
586
589
|
}
|
|
587
590
|
setRequest(e) {
|
|
588
591
|
e.useRequest((t) => (this.data?.token && (t.headers[this.options.authKey] = this.data?.token), t)), e.useResponse(
|
|
@@ -604,9 +607,9 @@ function Es(n = {}) {
|
|
|
604
607
|
loading: t,
|
|
605
608
|
settings: s = {},
|
|
606
609
|
Startup: r,
|
|
607
|
-
access:
|
|
610
|
+
access: i,
|
|
608
611
|
useTitle: a,
|
|
609
|
-
alert:
|
|
612
|
+
alert: o
|
|
610
613
|
} = n;
|
|
611
614
|
let l = null;
|
|
612
615
|
return {
|
|
@@ -634,9 +637,9 @@ function Es(n = {}) {
|
|
|
634
637
|
notify: e,
|
|
635
638
|
loading: t,
|
|
636
639
|
useTitle: a,
|
|
637
|
-
alert:
|
|
640
|
+
alert: o,
|
|
638
641
|
startupComponent: r,
|
|
639
|
-
access:
|
|
642
|
+
access: i ? new pe({ alert: o, ...i }) : void 0
|
|
640
643
|
};
|
|
641
644
|
}
|
|
642
645
|
function Rs(n = {}) {
|
|
@@ -650,7 +653,7 @@ function $t(n, e) {
|
|
|
650
653
|
query: r
|
|
651
654
|
});
|
|
652
655
|
{
|
|
653
|
-
const r = n.headers ? x(n.headers, {}, !0) : void 0,
|
|
656
|
+
const r = n.headers ? x(n.headers, {}, !0) : void 0, i = {
|
|
654
657
|
url: n.url,
|
|
655
658
|
method: n.method,
|
|
656
659
|
settings: {
|
|
@@ -658,26 +661,26 @@ function $t(n, e) {
|
|
|
658
661
|
headers: r
|
|
659
662
|
}
|
|
660
663
|
};
|
|
661
|
-
return (a,
|
|
664
|
+
return (a, o) => (delete i.data, s.send(Qe(i, o || {}, { data: a })));
|
|
662
665
|
}
|
|
663
666
|
}
|
|
664
667
|
function bt(n, e) {
|
|
665
668
|
const { metaQuery: t } = e;
|
|
666
669
|
if (!t) return;
|
|
667
670
|
const { code: s, queryCode: r } = n;
|
|
668
|
-
return (
|
|
671
|
+
return (i, a) => {
|
|
669
672
|
if (!t) {
|
|
670
673
|
console.warn("adapter.metaQuery is not defined!");
|
|
671
674
|
return;
|
|
672
675
|
}
|
|
673
|
-
return t(s, r,
|
|
676
|
+
return t(s, r, i, a);
|
|
674
677
|
};
|
|
675
678
|
}
|
|
676
679
|
function jt(n = [], e = [], t) {
|
|
677
680
|
const s = {};
|
|
678
681
|
for (const r of n) {
|
|
679
|
-
const
|
|
680
|
-
s[r.id] =
|
|
682
|
+
const i = $t(r, t);
|
|
683
|
+
s[r.id] = i, s[r.name] = i;
|
|
681
684
|
}
|
|
682
685
|
for (const r of e)
|
|
683
686
|
s[r.id] = bt(r, t);
|
|
@@ -690,14 +693,14 @@ async function Et(n = [], e = window) {
|
|
|
690
693
|
function Rt(n, e = window) {
|
|
691
694
|
const t = b(n.mockTemplate) && n.mockTemplate.value ? R(n.mockTemplate, {}, !0) : void 0, s = H(e);
|
|
692
695
|
return async (...r) => {
|
|
693
|
-
let
|
|
696
|
+
let i = {};
|
|
694
697
|
if (t)
|
|
695
698
|
try {
|
|
696
|
-
|
|
699
|
+
i = await t.apply(t, r);
|
|
697
700
|
} catch (a) {
|
|
698
701
|
M.warn("模拟数据模版异常", a);
|
|
699
702
|
}
|
|
700
|
-
return s?.mock(
|
|
703
|
+
return s?.mock(i);
|
|
701
704
|
};
|
|
702
705
|
}
|
|
703
706
|
function Pt(n, e) {
|
|
@@ -705,14 +708,14 @@ function Pt(n, e) {
|
|
|
705
708
|
const { url: t, mockTemplate: s } = e;
|
|
706
709
|
if (t && s)
|
|
707
710
|
try {
|
|
708
|
-
const r = se(t) ? new URL(t).pathname : t,
|
|
709
|
-
n.mock(
|
|
711
|
+
const r = se(t) ? new URL(t).pathname : t, i = We(`(.*)${r}(.*)`), a = Xe(r, { decode: decodeURIComponent }), o = x(s, {}, !0);
|
|
712
|
+
n.mock(i, (l) => {
|
|
710
713
|
const c = F.parse(l.url) || {}, u = l.body instanceof FormData ? Ye(l.body) : l.body, f = se(l.url) ? new URL(l.url).pathname : l.url.split("?")[0], p = a(f)?.params;
|
|
711
714
|
Object.assign(l, { data: u, params: p, query: c });
|
|
712
715
|
try {
|
|
713
|
-
return n.mock(
|
|
716
|
+
return n.mock(o(l));
|
|
714
717
|
} catch (h) {
|
|
715
|
-
return console.warn("[mockApi]",
|
|
718
|
+
return console.warn("[mockApi]", i, l, h), null;
|
|
716
719
|
}
|
|
717
720
|
});
|
|
718
721
|
} catch (r) {
|
|
@@ -747,6 +750,7 @@ class Ct {
|
|
|
747
750
|
$components = {};
|
|
748
751
|
$libs = {};
|
|
749
752
|
$apis = {};
|
|
753
|
+
$provider = null;
|
|
750
754
|
__transform = {};
|
|
751
755
|
constructor(e) {
|
|
752
756
|
const { mode: t, dsl: s, attrs: r } = e;
|
|
@@ -809,8 +813,8 @@ class Ct {
|
|
|
809
813
|
__getRefEl(e, t, s) {
|
|
810
814
|
const r = e[t];
|
|
811
815
|
if (r && s !== r) {
|
|
812
|
-
const
|
|
813
|
-
return Array.from(
|
|
816
|
+
const i = new Set([].concat(r, s));
|
|
817
|
+
return Array.from(i);
|
|
814
818
|
} else
|
|
815
819
|
return s;
|
|
816
820
|
}
|
|
@@ -822,40 +826,40 @@ class Ct {
|
|
|
822
826
|
return s.context.__proto__ = this.context, s.__proto__ = this, s;
|
|
823
827
|
}
|
|
824
828
|
}
|
|
825
|
-
function
|
|
829
|
+
function oe(n) {
|
|
826
830
|
const {
|
|
827
831
|
Vue: e = z,
|
|
828
832
|
mode: t = w.Runtime,
|
|
829
833
|
components: s = {},
|
|
830
834
|
libs: r = {},
|
|
831
|
-
apis:
|
|
835
|
+
apis: i = {},
|
|
832
836
|
loader: a
|
|
833
|
-
} = n,
|
|
837
|
+
} = n, o = e.computed(() => n.dsl), l = {
|
|
834
838
|
$components: s,
|
|
835
839
|
$libs: r,
|
|
836
|
-
$apis:
|
|
840
|
+
$apis: i
|
|
837
841
|
}, c = new Ct({
|
|
838
842
|
mode: t,
|
|
839
|
-
dsl:
|
|
843
|
+
dsl: o.value,
|
|
840
844
|
attrs: l
|
|
841
845
|
}), u = e.defineComponent({
|
|
842
|
-
name:
|
|
843
|
-
__scopeId:
|
|
846
|
+
name: o.value.name,
|
|
847
|
+
__scopeId: o.value.id ? `data-v-${o.value.id}` : void 0,
|
|
844
848
|
props: {
|
|
845
|
-
...It(
|
|
849
|
+
...It(o.value.props ?? [], c)
|
|
846
850
|
},
|
|
847
851
|
setup(f) {
|
|
848
|
-
c.$props = f, c.props = f,
|
|
852
|
+
c.$props = f, c.props = f, o.value.id && fe(
|
|
849
853
|
n.window || window,
|
|
850
|
-
|
|
851
|
-
|
|
854
|
+
o.value.id,
|
|
855
|
+
o.value.css || "",
|
|
852
856
|
!0
|
|
853
|
-
), c.state = kt(e,
|
|
854
|
-
const p = Ft(e,
|
|
855
|
-
for (const [
|
|
856
|
-
d[
|
|
857
|
-
const m =
|
|
858
|
-
|
|
857
|
+
), c.state = kt(e, o.value.state ?? {}, c);
|
|
858
|
+
const p = Ft(e, o.value.computed ?? {}, c), h = Mt(o.value.methods ?? {}, c), d = Ot(e, o.value.inject, c);
|
|
859
|
+
for (const [v, _] of Object.entries(d || {}))
|
|
860
|
+
d[v] = e.inject(v, _);
|
|
861
|
+
const m = Tt(
|
|
862
|
+
o.value.dataSources || {},
|
|
859
863
|
c
|
|
860
864
|
), g = {
|
|
861
865
|
...d,
|
|
@@ -863,23 +867,23 @@ function ie(n) {
|
|
|
863
867
|
...h,
|
|
864
868
|
...m
|
|
865
869
|
};
|
|
866
|
-
return c.setup(g, e),
|
|
870
|
+
return c.setup(g, e), Dt(e, o.value.watch ?? [], c), {
|
|
867
871
|
vtj: c,
|
|
868
872
|
state: c.state,
|
|
869
873
|
...p,
|
|
870
874
|
...h
|
|
871
875
|
};
|
|
872
876
|
},
|
|
873
|
-
emits: At(
|
|
874
|
-
expose: ["vtj", ...
|
|
877
|
+
emits: At(o.value.emits),
|
|
878
|
+
expose: ["vtj", ...o.value.expose || []],
|
|
875
879
|
render() {
|
|
876
|
-
if (!
|
|
877
|
-
const f =
|
|
880
|
+
if (!o.value.nodes) return null;
|
|
881
|
+
const f = o.value.nodes || [];
|
|
878
882
|
return f.length === 1 ? O(f[0], c, e, a, f) : f.map(
|
|
879
883
|
(p) => O(p, c, e, a, f)
|
|
880
884
|
);
|
|
881
885
|
},
|
|
882
|
-
...Ht(
|
|
886
|
+
...Ht(o.value.lifeCycles ?? {}, c)
|
|
883
887
|
});
|
|
884
888
|
return {
|
|
885
889
|
renderer: e.markRaw(u),
|
|
@@ -890,7 +894,7 @@ function At(n = []) {
|
|
|
890
894
|
return n.map((e) => I(e) ? e : e.name);
|
|
891
895
|
}
|
|
892
896
|
function It(n = [], e) {
|
|
893
|
-
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((
|
|
897
|
+
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((i) => ot[i]) : void 0;
|
|
894
898
|
return n.map((s) => I(s) ? {
|
|
895
899
|
name: s
|
|
896
900
|
} : {
|
|
@@ -911,8 +915,8 @@ function kt(n, e, t) {
|
|
|
911
915
|
return n.reactive(
|
|
912
916
|
Object.keys(e || {}).reduce(
|
|
913
917
|
(s, r) => {
|
|
914
|
-
let
|
|
915
|
-
return E(
|
|
918
|
+
let i = e[r];
|
|
919
|
+
return E(i) ? i = t.__parseExpression(i) : b(i) && (i = t.__parseFunction(i)), s[r] = i, s;
|
|
916
920
|
},
|
|
917
921
|
{}
|
|
918
922
|
)
|
|
@@ -920,7 +924,7 @@ function kt(n, e, t) {
|
|
|
920
924
|
}
|
|
921
925
|
function Ft(n, e, t) {
|
|
922
926
|
return Object.entries(e ?? {}).reduce(
|
|
923
|
-
(s, [r,
|
|
927
|
+
(s, [r, i]) => (s[r] = n.computed(t.__parseFunction(i)), s),
|
|
924
928
|
{}
|
|
925
929
|
);
|
|
926
930
|
}
|
|
@@ -933,24 +937,24 @@ function Mt(n, e) {
|
|
|
933
937
|
function Ot(n, e = [], t) {
|
|
934
938
|
return e.reduce(
|
|
935
939
|
(s, r) => {
|
|
936
|
-
const { name:
|
|
940
|
+
const { name: i, from: a } = r || {};
|
|
937
941
|
r.default;
|
|
938
|
-
const
|
|
939
|
-
return s[
|
|
942
|
+
const o = E(a) ? t.__parseExpression(a) || i : a ?? i, l = E(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
|
|
943
|
+
return s[i] = n.inject(o, l), s;
|
|
940
944
|
},
|
|
941
945
|
{}
|
|
942
946
|
);
|
|
943
947
|
}
|
|
944
|
-
function
|
|
948
|
+
function Tt(n, e) {
|
|
945
949
|
return Object.keys(n).reduce(
|
|
946
950
|
(t, s) => {
|
|
947
951
|
const r = n[s];
|
|
948
952
|
if (r.type === "mock")
|
|
949
953
|
t[s] = Rt(r);
|
|
950
954
|
else if (r.ref) {
|
|
951
|
-
const
|
|
952
|
-
t[s] = async (...
|
|
953
|
-
const l = await
|
|
955
|
+
const i = e.$apis[r.ref], a = b(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
|
956
|
+
t[s] = async (...o) => {
|
|
957
|
+
const l = await i.apply(e, o);
|
|
954
958
|
return a ? a(l) : l;
|
|
955
959
|
};
|
|
956
960
|
}
|
|
@@ -959,7 +963,7 @@ function Dt(n, e) {
|
|
|
959
963
|
{}
|
|
960
964
|
);
|
|
961
965
|
}
|
|
962
|
-
function
|
|
966
|
+
function Dt(n, e = [], t) {
|
|
963
967
|
e.forEach((s) => {
|
|
964
968
|
n.watch(
|
|
965
969
|
t.__parseExpression(s.source),
|
|
@@ -974,113 +978,113 @@ function Tt(n, e = [], t) {
|
|
|
974
978
|
function Ht(n, e) {
|
|
975
979
|
return Object.entries(n ?? {}).reduce(
|
|
976
980
|
(t, [s, r]) => {
|
|
977
|
-
const
|
|
981
|
+
const i = e.__parseFunction(r);
|
|
978
982
|
return t[s] = async () => {
|
|
979
|
-
await J(0), q(
|
|
983
|
+
await J(0), q(i) && i();
|
|
980
984
|
}, t;
|
|
981
985
|
},
|
|
982
986
|
{}
|
|
983
987
|
);
|
|
984
988
|
}
|
|
985
|
-
const
|
|
989
|
+
const Te = new Ze();
|
|
986
990
|
let Z = [], k = {};
|
|
987
991
|
const xt = (n) => n;
|
|
988
|
-
async function
|
|
989
|
-
const { urls: t = [], library: s } = n, r = t.filter((
|
|
992
|
+
async function De(n, e = window) {
|
|
993
|
+
const { urls: t = [], library: s } = n, r = t.filter((o) => V(o));
|
|
990
994
|
if (r.length === 0 || !s) return null;
|
|
991
|
-
const
|
|
992
|
-
return
|
|
993
|
-
(
|
|
995
|
+
const i = t.filter((o) => G(o));
|
|
996
|
+
return i.length && ke(i, e), await Fe(r, s, e).catch(
|
|
997
|
+
(o) => (console.warn("loadScriptUrl error", r, s, o), null)
|
|
994
998
|
);
|
|
995
999
|
}
|
|
996
1000
|
function ae(n) {
|
|
997
1001
|
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
|
998
1002
|
return s.window && (Z.forEach((r) => {
|
|
999
1003
|
delete s.window[r];
|
|
1000
|
-
}), Z = []), (r,
|
|
1001
|
-
if (!
|
|
1002
|
-
if (
|
|
1004
|
+
}), Z = []), (r, i, a = z) => {
|
|
1005
|
+
if (!i || typeof i == "string") return r;
|
|
1006
|
+
if (i.type === "Schema" && i.id)
|
|
1003
1007
|
return a.defineAsyncComponent(async () => {
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1006
|
-
() => e(
|
|
1008
|
+
const o = k[i.id] || await Te.add(
|
|
1009
|
+
i.id,
|
|
1010
|
+
() => e(i.id)
|
|
1007
1011
|
);
|
|
1008
|
-
return
|
|
1012
|
+
return o && (o.name = r, k[i.id] = o), o ? oe({
|
|
1009
1013
|
...s,
|
|
1010
1014
|
Vue: a,
|
|
1011
|
-
dsl: we(
|
|
1015
|
+
dsl: we(o),
|
|
1012
1016
|
mode: w.Runtime,
|
|
1013
1017
|
loader: ae(n)
|
|
1014
1018
|
}).renderer : null;
|
|
1015
1019
|
});
|
|
1016
|
-
if (
|
|
1020
|
+
if (i.type === "UrlSchema" && i.url)
|
|
1017
1021
|
return a.defineAsyncComponent(async () => {
|
|
1018
|
-
const
|
|
1019
|
-
return
|
|
1022
|
+
const o = k[i.url] || await t(i.url);
|
|
1023
|
+
return o && (o.name = r, k[i.url] = o), o ? oe({
|
|
1020
1024
|
...s,
|
|
1021
1025
|
Vue: a,
|
|
1022
|
-
dsl: we(
|
|
1026
|
+
dsl: we(o),
|
|
1023
1027
|
mode: w.Runtime,
|
|
1024
1028
|
loader: ae(n)
|
|
1025
1029
|
}).renderer : null;
|
|
1026
1030
|
});
|
|
1027
|
-
if (
|
|
1028
|
-
let
|
|
1029
|
-
return
|
|
1031
|
+
if (i.type === "Plugin") {
|
|
1032
|
+
let o = i.library ? k[i.library] : null;
|
|
1033
|
+
return o || (i.library && Z.push(i.library), o = k[i.library || Symbol()] = a.defineAsyncComponent(
|
|
1030
1034
|
async () => {
|
|
1031
|
-
const l = await
|
|
1032
|
-
return l || (console.warn("getPlugin result is null",
|
|
1035
|
+
const l = await De(i, s.window);
|
|
1036
|
+
return l || (console.warn("getPlugin result is null", i), null);
|
|
1033
1037
|
}
|
|
1034
|
-
),
|
|
1038
|
+
), o);
|
|
1035
1039
|
}
|
|
1036
1040
|
return r;
|
|
1037
1041
|
};
|
|
1038
1042
|
}
|
|
1039
1043
|
function Ps() {
|
|
1040
|
-
k = {},
|
|
1044
|
+
k = {}, Te.clearAllCache();
|
|
1041
1045
|
}
|
|
1042
|
-
function O(n, e, t = z, s = xt, r = [],
|
|
1046
|
+
function O(n, e, t = z, s = xt, r = [], i = !1) {
|
|
1043
1047
|
if (!n || !n.name || n.invisible) return null;
|
|
1044
|
-
const a = t.getCurrentInstance()?.appContext, { id:
|
|
1045
|
-
if (!
|
|
1048
|
+
const a = t.getCurrentInstance()?.appContext, { id: o = null, directives: l = [] } = n, { vIf: c, vElseIf: u, vElse: f, vFor: p, vShow: h, vModels: d, vBind: m, vHtml: g, others: v } = He(l);
|
|
1049
|
+
if (!i && (u || f))
|
|
1046
1050
|
return null;
|
|
1047
1051
|
if (c && !Lt(c, e))
|
|
1048
1052
|
return Jt(n, e, t, s, r);
|
|
1049
|
-
const _ = (
|
|
1050
|
-
const P =
|
|
1053
|
+
const _ = (y, S = 0) => {
|
|
1054
|
+
const P = y.$components, Q = (() => {
|
|
1051
1055
|
if (n.name === "component")
|
|
1052
|
-
return Nt(
|
|
1056
|
+
return Nt(y, n.props?.is);
|
|
1053
1057
|
if (n.name === "slot") return n.name;
|
|
1054
1058
|
const j = s(n.name, n.from, t);
|
|
1055
1059
|
if (I(j))
|
|
1056
|
-
return
|
|
1060
|
+
return vt(j) || yt(j) ? j : P[j] ?? a?.app?.component(j) ?? j;
|
|
1057
1061
|
if (et(j) && n.id) {
|
|
1058
|
-
const ge = `Loader${n.id}_${S}`,
|
|
1059
|
-
return
|
|
1062
|
+
const ge = `Loader${n.id}_${S}`, ve = P[ge];
|
|
1063
|
+
return ve || (P[ge] = j);
|
|
1060
1064
|
}
|
|
1061
1065
|
return j;
|
|
1062
|
-
})(), C = Ut(
|
|
1066
|
+
})(), C = Ut(o, n.props ?? {}, y), qe = qt(t, n.events ?? {}, y);
|
|
1063
1067
|
if (n.name === "slot")
|
|
1064
|
-
return Kt(t, n, C,
|
|
1065
|
-
m && Object.assign(C,
|
|
1068
|
+
return Kt(t, n, C, y, s);
|
|
1069
|
+
m && Object.assign(C, y.__parseExpression(m.value)), h && (C.style = Object.assign(
|
|
1066
1070
|
C.style ?? {},
|
|
1067
|
-
Gt(h,
|
|
1068
|
-
)), g && Object.assign(C, Vt(g,
|
|
1069
|
-
Object.assign(C, Qt(t, j,
|
|
1071
|
+
Gt(h, y)
|
|
1072
|
+
)), g && Object.assign(C, Vt(g, y)), d.forEach((j) => {
|
|
1073
|
+
Object.assign(C, Qt(t, j, y));
|
|
1070
1074
|
});
|
|
1071
1075
|
const Je = Wt(
|
|
1072
1076
|
t,
|
|
1073
1077
|
n.children ?? [],
|
|
1074
|
-
|
|
1078
|
+
y,
|
|
1075
1079
|
s,
|
|
1076
1080
|
n
|
|
1077
|
-
), he =
|
|
1081
|
+
), he = y?.__id ? `data-v-${y.__id}` : void 0, Ke = he ? { [he]: "" } : {};
|
|
1078
1082
|
let W = t.createVNode(
|
|
1079
1083
|
Q,
|
|
1080
|
-
{ key: `${
|
|
1084
|
+
{ key: `${o}_${S}`, ...Ke, ...C, ...qe },
|
|
1081
1085
|
Je
|
|
1082
1086
|
);
|
|
1083
|
-
const me = a ? Bt(a,
|
|
1087
|
+
const me = a ? Bt(a, v, y) : [];
|
|
1084
1088
|
return me.length && (W = t.withDirectives(W, me)), W;
|
|
1085
1089
|
};
|
|
1086
1090
|
return p ? Zt(p, _, e) : _(e);
|
|
@@ -1088,30 +1092,30 @@ function O(n, e, t = z, s = xt, r = [], o = !1) {
|
|
|
1088
1092
|
function Bt(n, e, t) {
|
|
1089
1093
|
const s = n.app;
|
|
1090
1094
|
return e.map((r) => {
|
|
1091
|
-
const
|
|
1092
|
-
if (!
|
|
1093
|
-
const a = [
|
|
1095
|
+
const i = typeof r.name == "string" ? s.directive(r.name) : t.__parseExpression(r.name);
|
|
1096
|
+
if (!i) return null;
|
|
1097
|
+
const a = [i];
|
|
1094
1098
|
return r.value && a.push(t.__parseExpression(r.value)), r.arg && a.push(r.arg), r.modifiers && a.push(r.modifiers), a;
|
|
1095
1099
|
}).filter((r) => !!r);
|
|
1096
1100
|
}
|
|
1097
1101
|
function He(n = []) {
|
|
1098
1102
|
const e = n.find((u) => A(u.name) === "vIf"), t = n.find(
|
|
1099
1103
|
(u) => A(u.name) === "vElseIf"
|
|
1100
|
-
), s = n.find((u) => A(u.name) === "vElse"), r = n.find((u) => A(u.name) === "vFor"),
|
|
1104
|
+
), s = n.find((u) => A(u.name) === "vElse"), r = n.find((u) => A(u.name) === "vFor"), i = n.find((u) => A(u.name) === "vShow"), a = n.find((u) => A(u.name) === "vBind"), o = n.find((u) => A(u.name) === "vHtml"), l = n.filter(
|
|
1101
1105
|
(u) => A(u.name) === "vModel"
|
|
1102
1106
|
), c = n.filter(
|
|
1103
|
-
(u) => !
|
|
1107
|
+
(u) => !it.includes(A(u.name))
|
|
1104
1108
|
);
|
|
1105
1109
|
return {
|
|
1106
1110
|
vIf: e,
|
|
1107
1111
|
vElseIf: t,
|
|
1108
1112
|
vElse: s,
|
|
1109
1113
|
vFor: r,
|
|
1110
|
-
vShow:
|
|
1114
|
+
vShow: i,
|
|
1111
1115
|
vModels: l,
|
|
1112
1116
|
vBind: a,
|
|
1113
1117
|
others: c,
|
|
1114
|
-
vHtml:
|
|
1118
|
+
vHtml: o
|
|
1115
1119
|
};
|
|
1116
1120
|
}
|
|
1117
1121
|
function Lt(n, e) {
|
|
@@ -1140,17 +1144,17 @@ function qt(n, e, t) {
|
|
|
1140
1144
|
passive: "OnceCapture"
|
|
1141
1145
|
};
|
|
1142
1146
|
return Object.keys(e || {}).reduce(
|
|
1143
|
-
(
|
|
1144
|
-
const
|
|
1145
|
-
return f && (
|
|
1147
|
+
(i, a) => {
|
|
1148
|
+
const o = e[a], l = xe(o.modifiers), c = l.find((p) => s.includes(p)), u = "on" + tt(a) + (c && r[c] || ""), f = t.__parseFunction(o.handler);
|
|
1149
|
+
return f && (i[u] = n.withModifiers(f, l)), i;
|
|
1146
1150
|
},
|
|
1147
1151
|
{}
|
|
1148
1152
|
);
|
|
1149
1153
|
}
|
|
1150
1154
|
function Jt(n, e, t, s, r = []) {
|
|
1151
|
-
let
|
|
1152
|
-
for (let a = ++
|
|
1153
|
-
const { directives:
|
|
1155
|
+
let i = r.findIndex((a) => a.id === n.id);
|
|
1156
|
+
for (let a = ++i; a < r.length; a++) {
|
|
1157
|
+
const { directives: o = [] } = r[a], { vElseIf: l, vElse: c } = He(o);
|
|
1154
1158
|
if (l) {
|
|
1155
1159
|
if (e.__parseExpression(l.value))
|
|
1156
1160
|
return O(r[a], e, t, s, r, !0);
|
|
@@ -1166,11 +1170,11 @@ function xe(n = {}, e = !1) {
|
|
|
1166
1170
|
return e ? t.map((s) => "." + s) : t;
|
|
1167
1171
|
}
|
|
1168
1172
|
function Kt(n, e, t, s, r) {
|
|
1169
|
-
const { children:
|
|
1170
|
-
return
|
|
1171
|
-
Ie(s.__parseExpression(
|
|
1172
|
-
) : Array.isArray(
|
|
1173
|
-
(l) => O(l, s, n, r,
|
|
1173
|
+
const { children: i } = e, a = zt(e, s), o = s.$slots?.[a.name];
|
|
1174
|
+
return o ? o(t) : i ? I(i) ? n.createTextVNode(i) : E(i) ? n.createTextVNode(
|
|
1175
|
+
Ie(s.__parseExpression(i))
|
|
1176
|
+
) : Array.isArray(i) ? i.map(
|
|
1177
|
+
(l) => O(l, s, n, r, i)
|
|
1174
1178
|
) : null : null;
|
|
1175
1179
|
}
|
|
1176
1180
|
function zt(n, e) {
|
|
@@ -1196,12 +1200,12 @@ function Qt(n, e, t) {
|
|
|
1196
1200
|
value: e.value?.value ? `(v) => {
|
|
1197
1201
|
${e.value.value} = v;
|
|
1198
1202
|
}` : "(v) => {}"
|
|
1199
|
-
}, r = t.__parseFunction(s),
|
|
1203
|
+
}, r = t.__parseFunction(s), i = xe(
|
|
1200
1204
|
E(e.modifiers) ? t.__parseExpression(e.modifiers) : e.modifiers
|
|
1201
1205
|
), a = E(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
|
1202
1206
|
return {
|
|
1203
1207
|
[a]: t.__parseExpression(e.value),
|
|
1204
|
-
[`onUpdate:${a}`]:
|
|
1208
|
+
[`onUpdate:${a}`]: i.length && r ? n.withModifiers(r, i) : r
|
|
1205
1209
|
};
|
|
1206
1210
|
}
|
|
1207
1211
|
function Wt(n, e, t, s, r) {
|
|
@@ -1213,18 +1217,18 @@ function Wt(n, e, t, s, r) {
|
|
|
1213
1217
|
default: () => Ie(t.__parseExpression(e))
|
|
1214
1218
|
};
|
|
1215
1219
|
if (Array.isArray(e) && e.length > 0) {
|
|
1216
|
-
const
|
|
1217
|
-
[l]:
|
|
1220
|
+
const i = Xt(e), a = (o, l) => !o || !r ? {} : r?.id && Object.keys(o).length ? l ? {
|
|
1221
|
+
[l]: o
|
|
1218
1222
|
} : {
|
|
1219
|
-
[`scope_${r.id}`]:
|
|
1223
|
+
[`scope_${r.id}`]: o
|
|
1220
1224
|
} : l ? { [l]: /* @__PURE__ */ Object.create(null) } : {};
|
|
1221
|
-
return Object.entries(
|
|
1222
|
-
(
|
|
1225
|
+
return Object.entries(i).reduce(
|
|
1226
|
+
(o, [l, { nodes: c, params: u, scope: f }]) => (o[l] = (p) => {
|
|
1223
1227
|
const h = u.length ? st(p ?? {}, u) : a(p, f);
|
|
1224
1228
|
return c.map(
|
|
1225
1229
|
(d) => O(d, t.__clone(h), n, s, c)
|
|
1226
1230
|
);
|
|
1227
|
-
},
|
|
1231
|
+
}, o),
|
|
1228
1232
|
{}
|
|
1229
1233
|
);
|
|
1230
1234
|
}
|
|
@@ -1246,18 +1250,21 @@ function Yt(n = "default") {
|
|
|
1246
1250
|
return I(n) ? { name: n, params: [], scope: "" } : { params: [], scope: "", ...n };
|
|
1247
1251
|
}
|
|
1248
1252
|
function Zt(n, e, t) {
|
|
1249
|
-
const { value: s, iterator: r } = n, { item:
|
|
1250
|
-
let
|
|
1251
|
-
return Number.isInteger(
|
|
1253
|
+
const { value: s, iterator: r } = n, { item: i = "item", index: a = "index" } = r || {};
|
|
1254
|
+
let o = t.__parseExpression(s) || [];
|
|
1255
|
+
return Number.isInteger(o) && (o = new Array(o).fill(!0).map((l, c) => c + 1)), Array.isArray(o) ? o.map((l, c) => e(t.__clone({ [i]: l, [a]: c }), c)) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
|
1252
1256
|
}
|
|
1253
1257
|
const ee = Ce({
|
|
1254
1258
|
name: "VtjPageContainer",
|
|
1255
1259
|
async setup() {
|
|
1256
|
-
const n = Ne(), e = Ae(), t = e.meta.__vtj__ || e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null,
|
|
1260
|
+
const n = Ne(), e = Ae(), t = e.meta.__vtj__ || e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null, i = ie(Symbol());
|
|
1257
1261
|
if (s) {
|
|
1258
1262
|
Object.assign(e.meta, s.meta || {}, { cache: s.cache });
|
|
1259
1263
|
const { useTitle: a } = n?.adapter;
|
|
1260
|
-
|
|
1264
|
+
if (a) {
|
|
1265
|
+
const o = e.meta.title || s.title || "VTJ.PRO";
|
|
1266
|
+
a(o);
|
|
1267
|
+
}
|
|
1261
1268
|
}
|
|
1262
1269
|
return {
|
|
1263
1270
|
provider: n,
|
|
@@ -1265,7 +1272,7 @@ const ee = Ce({
|
|
|
1265
1272
|
file: s,
|
|
1266
1273
|
query: e.query,
|
|
1267
1274
|
meta: e.meta,
|
|
1268
|
-
sid:
|
|
1275
|
+
sid: i,
|
|
1269
1276
|
route: e
|
|
1270
1277
|
};
|
|
1271
1278
|
},
|
|
@@ -1285,17 +1292,17 @@ const ee = Ce({
|
|
|
1285
1292
|
function K(n, e, t = []) {
|
|
1286
1293
|
const s = [];
|
|
1287
1294
|
for (const r of t) {
|
|
1288
|
-
const { id:
|
|
1295
|
+
const { id: i, title: a, icon: o, children: l, hidden: c, layout: u } = r;
|
|
1289
1296
|
if (u) {
|
|
1290
1297
|
const f = K(n, e, l || []);
|
|
1291
1298
|
s.push(...f);
|
|
1292
1299
|
} else {
|
|
1293
1300
|
const f = {
|
|
1294
|
-
id:
|
|
1301
|
+
id: i,
|
|
1295
1302
|
title: a,
|
|
1296
|
-
icon:
|
|
1303
|
+
icon: o,
|
|
1297
1304
|
hidden: c,
|
|
1298
|
-
url: `${n}/${e}/${
|
|
1305
|
+
url: `${n}/${e}/${i}`,
|
|
1299
1306
|
children: l && l.length ? K(n, e, l) : void 0
|
|
1300
1307
|
};
|
|
1301
1308
|
s.push(f);
|
|
@@ -1319,12 +1326,12 @@ function Cs(n) {
|
|
|
1319
1326
|
menuPathPrefix: e = "",
|
|
1320
1327
|
pageRouteName: t = "page",
|
|
1321
1328
|
disableMenusFilter: s = !1
|
|
1322
|
-
} = n || {}, r = Ne(),
|
|
1323
|
-
|
|
1329
|
+
} = n || {}, r = Ne(), i = Ae(), a = St(), o = ie(!1), l = ie(!1), c = r.project, u = (h, d) => {
|
|
1330
|
+
o.value = !h?.mask, l.value = d?.pure ?? !!h?.pure;
|
|
1324
1331
|
};
|
|
1325
1332
|
rt(() => {
|
|
1326
|
-
const { name: h, params: d, meta: m } =
|
|
1327
|
-
if (h ===
|
|
1333
|
+
const { name: h, params: d, meta: m } = i;
|
|
1334
|
+
if (h === D) {
|
|
1328
1335
|
const g = r.getPage(d.id);
|
|
1329
1336
|
u(g, m);
|
|
1330
1337
|
} else if (h === N) {
|
|
@@ -1333,10 +1340,10 @@ function Cs(n) {
|
|
|
1333
1340
|
} else {
|
|
1334
1341
|
const g = m.__vtj__;
|
|
1335
1342
|
if (g) {
|
|
1336
|
-
const
|
|
1337
|
-
u(
|
|
1343
|
+
const v = r.getPage(g);
|
|
1344
|
+
u(v, m);
|
|
1338
1345
|
} else
|
|
1339
|
-
|
|
1346
|
+
o.value = !m.mask, l.value = !!m.pure;
|
|
1340
1347
|
}
|
|
1341
1348
|
});
|
|
1342
1349
|
const f = K(
|
|
@@ -1345,7 +1352,7 @@ function Cs(n) {
|
|
|
1345
1352
|
c?.pages
|
|
1346
1353
|
), p = c?.config;
|
|
1347
1354
|
return {
|
|
1348
|
-
disabled:
|
|
1355
|
+
disabled: o,
|
|
1349
1356
|
logo: p?.logo,
|
|
1350
1357
|
themeSwitchable: p?.themeSwitchable,
|
|
1351
1358
|
title: p?.title || c?.description || c?.name || "VTJ App",
|
|
@@ -1354,11 +1361,11 @@ function Cs(n) {
|
|
|
1354
1361
|
};
|
|
1355
1362
|
}
|
|
1356
1363
|
function te(n, e) {
|
|
1357
|
-
const { id: t, title: s, meta: r } = n, { name:
|
|
1364
|
+
const { id: t, title: s, meta: r } = n, { name: i = "page", prefix: a = "", component: o, routeMeta: l } = e;
|
|
1358
1365
|
return {
|
|
1359
1366
|
name: t,
|
|
1360
|
-
path: `${a}${
|
|
1361
|
-
component:
|
|
1367
|
+
path: `${a}${i}/${t}`,
|
|
1368
|
+
component: o,
|
|
1362
1369
|
meta: {
|
|
1363
1370
|
title: s,
|
|
1364
1371
|
...l,
|
|
@@ -1373,9 +1380,9 @@ function le(n) {
|
|
|
1373
1380
|
prefix: t = "",
|
|
1374
1381
|
pages: s = [],
|
|
1375
1382
|
component: r,
|
|
1376
|
-
loader:
|
|
1383
|
+
loader: i,
|
|
1377
1384
|
routeMeta: a,
|
|
1378
|
-
homepage:
|
|
1385
|
+
homepage: o
|
|
1379
1386
|
} = n, l = [];
|
|
1380
1387
|
for (const c of s) {
|
|
1381
1388
|
const { id: u, title: f, dir: p, layout: h, children: d, meta: m } = c;
|
|
@@ -1385,8 +1392,8 @@ function le(n) {
|
|
|
1385
1392
|
prefix: t,
|
|
1386
1393
|
component: r,
|
|
1387
1394
|
routeMeta: a,
|
|
1388
|
-
homepage:
|
|
1389
|
-
loader:
|
|
1395
|
+
homepage: o,
|
|
1396
|
+
loader: i,
|
|
1390
1397
|
pages: d || []
|
|
1391
1398
|
});
|
|
1392
1399
|
l.push(...g);
|
|
@@ -1396,13 +1403,13 @@ function le(n) {
|
|
|
1396
1403
|
prefix: t,
|
|
1397
1404
|
component: r,
|
|
1398
1405
|
routeMeta: a,
|
|
1399
|
-
homepage:
|
|
1400
|
-
loader:
|
|
1406
|
+
homepage: o,
|
|
1407
|
+
loader: i,
|
|
1401
1408
|
pages: d || []
|
|
1402
|
-
}),
|
|
1409
|
+
}), v = {
|
|
1403
1410
|
name: `layout_${u}`,
|
|
1404
1411
|
path: t,
|
|
1405
|
-
component: () =>
|
|
1412
|
+
component: () => i(u),
|
|
1406
1413
|
meta: {
|
|
1407
1414
|
title: f,
|
|
1408
1415
|
...a,
|
|
@@ -1411,8 +1418,8 @@ function le(n) {
|
|
|
1411
1418
|
},
|
|
1412
1419
|
children: g
|
|
1413
1420
|
};
|
|
1414
|
-
l.push(
|
|
1415
|
-
} else if (l.push(te(c, n)),
|
|
1421
|
+
l.push(v), l.push(te(c, n));
|
|
1422
|
+
} else if (l.push(te(c, n)), o === u) {
|
|
1416
1423
|
const g = te(c, n);
|
|
1417
1424
|
g.path = "", g.name = `home_${u}`, l.push(g);
|
|
1418
1425
|
}
|
|
@@ -1420,71 +1427,71 @@ function le(n) {
|
|
|
1420
1427
|
return l;
|
|
1421
1428
|
}
|
|
1422
1429
|
function ts(n = {}, e) {
|
|
1423
|
-
const { css: t, store: s, enhance: r } = n, { window:
|
|
1424
|
-
a.config.globalProperties.$libs =
|
|
1430
|
+
const { css: t, store: s, enhance: r } = n, { window: i, app: a, library: o = {}, adapter: l, mode: c } = e, { Pinia: u } = o;
|
|
1431
|
+
a.config.globalProperties.$libs = o, fe(i, "global-css", t || ""), u && s && ss(s, a, u), rs(a, l, n), !l.access && n.access && ns(n.access, a, c, l), is(a, n), r && os(r, a, o);
|
|
1425
1432
|
}
|
|
1426
1433
|
function ss(n, e, t) {
|
|
1427
1434
|
const s = t.createPinia();
|
|
1428
1435
|
if (e.use(s), b(n) && n.value) {
|
|
1429
|
-
const r = R(n, {}, !1, !1, !0),
|
|
1430
|
-
e.config.globalProperties.$store =
|
|
1436
|
+
const r = R(n, {}, !1, !1, !0), i = t.defineStore("$store", r(e) || {});
|
|
1437
|
+
e.config.globalProperties.$store = i();
|
|
1431
1438
|
}
|
|
1432
1439
|
}
|
|
1433
1440
|
function ns(n, e, t, s) {
|
|
1434
1441
|
if (b(n) && n.value) {
|
|
1435
|
-
const r = R(n, {}, !1, !1, !0), { alert:
|
|
1436
|
-
alert:
|
|
1442
|
+
const r = R(n, {}, !1, !1, !0), { alert: i, request: a } = s, o = new pe({
|
|
1443
|
+
alert: i,
|
|
1437
1444
|
storagePrefix: "__VTJ_APP_",
|
|
1438
1445
|
...r(e)
|
|
1439
1446
|
}), l = e.config.globalProperties.$router;
|
|
1440
|
-
|
|
1447
|
+
o.connect({ mode: t, router: l, request: a }), e.use(o);
|
|
1441
1448
|
}
|
|
1442
1449
|
}
|
|
1443
1450
|
function rs(n, e, t) {
|
|
1444
1451
|
if (!e.request) return;
|
|
1445
|
-
const { axios: s, request: r, response:
|
|
1452
|
+
const { axios: s, request: r, response: i } = t;
|
|
1446
1453
|
if (s && b(s) && s.value) {
|
|
1447
1454
|
const a = R(s, {}, !1, !1, !0);
|
|
1448
1455
|
e.request.setConfig(a(n));
|
|
1449
1456
|
}
|
|
1450
1457
|
if (r && b(r) && r.value) {
|
|
1451
|
-
const a = R(r, {}, !1, !1, !0),
|
|
1452
|
-
|
|
1458
|
+
const a = R(r, {}, !1, !1, !0), o = e.request;
|
|
1459
|
+
o.__unReq && o.__unReq(), o.__unReq = e.request.useRequest((l) => a(l, n));
|
|
1453
1460
|
}
|
|
1454
|
-
if (
|
|
1455
|
-
const a = R(
|
|
1456
|
-
|
|
1461
|
+
if (i && b(i) && i.value) {
|
|
1462
|
+
const a = R(i, {}, !1, !1, !0), o = e.request;
|
|
1463
|
+
o.__unRes && o.__unRes(), o.__unRes = e.request.useResponse((l) => a(l, n));
|
|
1457
1464
|
}
|
|
1458
1465
|
}
|
|
1459
|
-
function
|
|
1466
|
+
function is(n, e) {
|
|
1460
1467
|
const { beforeEach: t, afterEach: s } = e, r = n.config.globalProperties.$router;
|
|
1461
1468
|
if (t && b(t) && t.value) {
|
|
1462
|
-
const
|
|
1463
|
-
r && r.beforeEach((a,
|
|
1469
|
+
const i = R(t, {}, !1, !1, !0);
|
|
1470
|
+
r && r.beforeEach((a, o, l) => i(a, o, l, n));
|
|
1464
1471
|
}
|
|
1465
1472
|
if (s && b(s) && s.value) {
|
|
1466
|
-
const
|
|
1467
|
-
r && r.afterEach((a,
|
|
1473
|
+
const i = R(s, {}, !1, !1, !0);
|
|
1474
|
+
r && r.afterEach((a, o, l) => i(a, o, l, n));
|
|
1468
1475
|
}
|
|
1469
1476
|
}
|
|
1470
|
-
function
|
|
1477
|
+
function os(n, e, t = {}) {
|
|
1471
1478
|
b(n) && n.value && R(n, {}, !1, !1, !0)(e, t);
|
|
1472
1479
|
}
|
|
1473
1480
|
function as(n, e, t) {
|
|
1474
1481
|
if (!n || !e || !t) return;
|
|
1475
1482
|
const { VueI18n: s } = e;
|
|
1476
1483
|
if (s) {
|
|
1477
|
-
const { locale: r, fallbackLocale:
|
|
1484
|
+
const { locale: r, fallbackLocale: i, messages: a = [] } = t, o = {};
|
|
1478
1485
|
for (let c of a) {
|
|
1479
1486
|
const u = Object.keys(c).filter((f) => f !== "key");
|
|
1480
1487
|
for (const f of u)
|
|
1481
|
-
|
|
1488
|
+
o[f] || (o[f] = {}), o[f][c.key] = c[f];
|
|
1482
1489
|
}
|
|
1483
1490
|
const l = s.createI18n({
|
|
1484
1491
|
legacy: !1,
|
|
1485
1492
|
locale: r,
|
|
1486
|
-
fallbackLocale:
|
|
1487
|
-
messages:
|
|
1493
|
+
fallbackLocale: i,
|
|
1494
|
+
messages: o
|
|
1488
1495
|
});
|
|
1489
1496
|
n.use(l);
|
|
1490
1497
|
}
|
|
@@ -1503,9 +1510,9 @@ class ls extends ze {
|
|
|
1503
1510
|
service: t,
|
|
1504
1511
|
mode: s = w.Raw,
|
|
1505
1512
|
dependencies: r,
|
|
1506
|
-
materials:
|
|
1513
|
+
materials: i,
|
|
1507
1514
|
project: a = {},
|
|
1508
|
-
adapter:
|
|
1515
|
+
adapter: o = {},
|
|
1509
1516
|
globals: l = {},
|
|
1510
1517
|
modules: c = {},
|
|
1511
1518
|
router: u = null,
|
|
@@ -1513,7 +1520,7 @@ class ls extends ze {
|
|
|
1513
1520
|
nodeEnv: p = "development"
|
|
1514
1521
|
/* Development */
|
|
1515
1522
|
} = e;
|
|
1516
|
-
this.mode = s, this.modules = c, this.service = t, this.router = u, this.materialPath = f, this.nodeEnv = p, r && (this.dependencies = r),
|
|
1523
|
+
this.mode = s, this.modules = c, this.service = t, this.router = u, this.materialPath = f, this.nodeEnv = p, r && (this.dependencies = r), i && (this.materials = i), Object.assign(this.globals, l), Object.assign(this.adapter, o);
|
|
1517
1524
|
const { access: h, request: d } = this.adapter;
|
|
1518
1525
|
h && h.connect({ mode: s, router: u, request: d }), a && s !== w.Design ? this.load(a) : this.project = a;
|
|
1519
1526
|
}
|
|
@@ -1545,6 +1552,8 @@ class ls extends ze {
|
|
|
1545
1552
|
// 组件集合
|
|
1546
1553
|
nodeEnv = "development";
|
|
1547
1554
|
// 运行环境
|
|
1555
|
+
env = {};
|
|
1556
|
+
// 环境变量
|
|
1548
1557
|
router = null;
|
|
1549
1558
|
// 路由实例
|
|
1550
1559
|
materialPath = "./";
|
|
@@ -1556,8 +1565,8 @@ class ls extends ze {
|
|
|
1556
1565
|
if (e)
|
|
1557
1566
|
try {
|
|
1558
1567
|
s = await e.apply(e, t);
|
|
1559
|
-
} catch (
|
|
1560
|
-
M.warn("模拟数据模版异常",
|
|
1568
|
+
} catch (i) {
|
|
1569
|
+
M.warn("模拟数据模版异常", i);
|
|
1561
1570
|
}
|
|
1562
1571
|
return H()?.mock(s);
|
|
1563
1572
|
};
|
|
@@ -1575,8 +1584,8 @@ class ls extends ze {
|
|
|
1575
1584
|
const { vtjDir: t = ".vtj" } = this.options, s = this.modules[`${t}/projects/${e.id}.json`] || this.modules[`/src/${t}/projects/${e.id}.json`];
|
|
1576
1585
|
if (this.project = s ? await s() : await this.service.init(e), !this.project)
|
|
1577
1586
|
throw new Error("project is null");
|
|
1578
|
-
const { apis: r = [], meta:
|
|
1579
|
-
|
|
1587
|
+
const { apis: r = [], meta: i = [], env: a = [] } = this.project, o = window;
|
|
1588
|
+
o && (o.CKEDITOR_VERSION = void 0), this.initEnv(a), this.mode === w.Raw ? await this.loadDependencies(o) : await this.loadAssets(o), this.initMock(o), this.apis = jt(r, i, this.adapter), Oe(o), Et(r, o), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
|
|
1580
1589
|
}
|
|
1581
1590
|
initMock(e) {
|
|
1582
1591
|
const t = H(e);
|
|
@@ -1593,9 +1602,9 @@ class ls extends ze {
|
|
|
1593
1602
|
const { dependencies: t = [] } = this.project, {
|
|
1594
1603
|
dependencies: s,
|
|
1595
1604
|
library: r,
|
|
1596
|
-
components:
|
|
1605
|
+
components: i,
|
|
1597
1606
|
materialPath: a,
|
|
1598
|
-
nodeEnv:
|
|
1607
|
+
nodeEnv: o,
|
|
1599
1608
|
libraryLocales: l
|
|
1600
1609
|
} = this, {
|
|
1601
1610
|
libraryExports: c,
|
|
@@ -1607,42 +1616,42 @@ class ls extends ze {
|
|
|
1607
1616
|
} = ft(
|
|
1608
1617
|
t,
|
|
1609
1618
|
a,
|
|
1610
|
-
|
|
1619
|
+
o === "development"
|
|
1611
1620
|
/* Development */
|
|
1612
1621
|
);
|
|
1613
1622
|
Object.assign(this.libraryLocaleMap, d);
|
|
1614
1623
|
for (const m of c) {
|
|
1615
|
-
const g = s[m],
|
|
1616
|
-
if (
|
|
1617
|
-
r[m] =
|
|
1624
|
+
const g = s[m], v = e[m];
|
|
1625
|
+
if (v)
|
|
1626
|
+
r[m] = v;
|
|
1618
1627
|
else if (g)
|
|
1619
1628
|
e[m] = r[m] = await g();
|
|
1620
1629
|
else {
|
|
1621
|
-
const
|
|
1622
|
-
for (const S of
|
|
1623
|
-
G(S) && await mt(S, F.append(S, { v:
|
|
1630
|
+
const y = u[m] || [];
|
|
1631
|
+
for (const S of y)
|
|
1632
|
+
G(S) && await mt(S, F.append(S, { v: T })), V(S) && await Se(F.append(S, { v: T }));
|
|
1624
1633
|
r[m] = e[m];
|
|
1625
1634
|
}
|
|
1626
1635
|
const _ = d[m];
|
|
1627
1636
|
if (_) {
|
|
1628
|
-
const
|
|
1629
|
-
l[_] =
|
|
1637
|
+
const y = s[_];
|
|
1638
|
+
l[_] = y ? await y() : e[_];
|
|
1630
1639
|
}
|
|
1631
1640
|
}
|
|
1632
|
-
if (
|
|
1641
|
+
if (o === "development") {
|
|
1633
1642
|
for (const g of f)
|
|
1634
|
-
await Se(F.append(g, { v:
|
|
1643
|
+
await Se(F.append(g, { v: T }));
|
|
1635
1644
|
const m = this.materials || {};
|
|
1636
1645
|
for (const g of p) {
|
|
1637
|
-
const
|
|
1638
|
-
if (
|
|
1639
|
-
_ &&
|
|
1640
|
-
|
|
1646
|
+
const v = e[h[g]], _ = v?.default || v, y = Ge[g];
|
|
1647
|
+
if (y)
|
|
1648
|
+
_ && y.forEach((S) => {
|
|
1649
|
+
i[S] = _[S];
|
|
1641
1650
|
});
|
|
1642
1651
|
else {
|
|
1643
1652
|
const S = m[g] ? (await m[g]()).default : e[g];
|
|
1644
1653
|
S && _ && (S.components || []).forEach((P) => {
|
|
1645
|
-
|
|
1654
|
+
i[P.name] = pt(P, _);
|
|
1646
1655
|
});
|
|
1647
1656
|
}
|
|
1648
1657
|
}
|
|
@@ -1651,13 +1660,13 @@ class ls extends ze {
|
|
|
1651
1660
|
initRouter() {
|
|
1652
1661
|
const { router: e, project: t, options: s, adapter: r } = this;
|
|
1653
1662
|
if (!e) return;
|
|
1654
|
-
const
|
|
1663
|
+
const i = t?.platform === "uniapp" ? "pages" : "page", {
|
|
1655
1664
|
routeAppendTo: a,
|
|
1656
|
-
pageRouteName:
|
|
1665
|
+
pageRouteName: o = i,
|
|
1657
1666
|
routeMeta: l
|
|
1658
1667
|
} = s, c = a ? "" : "/", u = {
|
|
1659
|
-
path: `${c}${
|
|
1660
|
-
name:
|
|
1668
|
+
path: `${c}${o}/:id`,
|
|
1669
|
+
name: D,
|
|
1661
1670
|
component: ee
|
|
1662
1671
|
}, f = {
|
|
1663
1672
|
path: c,
|
|
@@ -1665,10 +1674,10 @@ class ls extends ze {
|
|
|
1665
1674
|
component: t?.homepage ? ee : r.startupComponent || es,
|
|
1666
1675
|
meta: l
|
|
1667
1676
|
};
|
|
1668
|
-
if (e.hasRoute(
|
|
1677
|
+
if (e.hasRoute(D) && e.removeRoute(D), e.hasRoute(N) && e.removeRoute(N), s.enableStaticRoute) {
|
|
1669
1678
|
const p = t?.pages || [];
|
|
1670
1679
|
le({
|
|
1671
|
-
name:
|
|
1680
|
+
name: o,
|
|
1672
1681
|
prefix: c,
|
|
1673
1682
|
pages: p,
|
|
1674
1683
|
component: ee,
|
|
@@ -1692,10 +1701,10 @@ class ls extends ze {
|
|
|
1692
1701
|
*/
|
|
1693
1702
|
install(e) {
|
|
1694
1703
|
const { libraryLocaleMap: t, libraryLocales: s } = this, r = e.config.globalProperties.installed || {};
|
|
1695
|
-
for (const [
|
|
1696
|
-
if (!r[
|
|
1697
|
-
const
|
|
1698
|
-
e.use(a, { locale:
|
|
1704
|
+
for (const [i, a] of Object.entries(this.library))
|
|
1705
|
+
if (!r[i] && gt(a)) {
|
|
1706
|
+
const o = s[t[i]];
|
|
1707
|
+
e.use(a, { locale: o }), r[i] = !0;
|
|
1699
1708
|
}
|
|
1700
1709
|
e.provide(Le, this), e.config.globalProperties.$provider = this, e.config.globalProperties.$request = this.adapter?.request, this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), this.project?.platform !== "uniapp" && this.mode !== w.Design && this.initGlobals(this.project?.globals || {}, {
|
|
1701
1710
|
app: e,
|
|
@@ -1703,16 +1712,16 @@ class ls extends ze {
|
|
|
1703
1712
|
adapter: this.adapter,
|
|
1704
1713
|
library: this.library,
|
|
1705
1714
|
mode: this.mode
|
|
1706
|
-
}), this.mode !== w.Design && this.project?.i18n && this.initI18n(e, this.library, this.project.i18n), this.options.enhance && e.use(this.options.enhance, this), this.mode === w.Design && (e.config.errorHandler = (
|
|
1707
|
-
const l = a?.$options.name, c = typeof
|
|
1715
|
+
}), this.mode !== w.Design && this.project?.i18n && this.initI18n(e, this.library, this.project.i18n), this.options.enhance && e.use(this.options.enhance, this), this.mode === w.Design && (e.config.errorHandler = (i, a, o) => {
|
|
1716
|
+
const l = a?.$options.name, c = typeof i == "string" ? i : i?.message || i?.msg || "未知错误", u = `[ ${l} ] ${c} ${o}`;
|
|
1708
1717
|
console.error(
|
|
1709
1718
|
"[VTJ Error]:",
|
|
1710
1719
|
{
|
|
1711
|
-
err:
|
|
1720
|
+
err: i,
|
|
1712
1721
|
instance: a,
|
|
1713
|
-
info:
|
|
1722
|
+
info: o
|
|
1714
1723
|
},
|
|
1715
|
-
|
|
1724
|
+
i?.stack
|
|
1716
1725
|
), this.adapter.notify && this.adapter.notify(u, "组件渲染错误", "error");
|
|
1717
1726
|
}), e.config.globalProperties.installed = r;
|
|
1718
1727
|
}
|
|
@@ -1721,14 +1730,14 @@ class ls extends ze {
|
|
|
1721
1730
|
return this.getPage(e) || t.find((s) => s.id === e) || null;
|
|
1722
1731
|
}
|
|
1723
1732
|
getPage(e) {
|
|
1724
|
-
const { pages: t = [] } = this.project || {}, s = (r,
|
|
1725
|
-
for (const a of
|
|
1733
|
+
const { pages: t = [] } = this.project || {}, s = (r, i = []) => {
|
|
1734
|
+
for (const a of i) {
|
|
1726
1735
|
if (a.id === r)
|
|
1727
1736
|
return a;
|
|
1728
1737
|
if (a.children && a.children.length) {
|
|
1729
|
-
const
|
|
1730
|
-
if (
|
|
1731
|
-
return
|
|
1738
|
+
const o = s(r, a.children);
|
|
1739
|
+
if (o)
|
|
1740
|
+
return o;
|
|
1732
1741
|
}
|
|
1733
1742
|
}
|
|
1734
1743
|
};
|
|
@@ -1766,8 +1775,8 @@ class ls extends ze {
|
|
|
1766
1775
|
* @returns 渲染器实例
|
|
1767
1776
|
*/
|
|
1768
1777
|
createDslRenderer(e, t = {}) {
|
|
1769
|
-
const { library: s, components: r, mode:
|
|
1770
|
-
mode:
|
|
1778
|
+
const { library: s, components: r, mode: i, apis: a } = this, o = {
|
|
1779
|
+
mode: i,
|
|
1771
1780
|
Vue: s.Vue,
|
|
1772
1781
|
components: r,
|
|
1773
1782
|
libs: s,
|
|
@@ -1777,10 +1786,10 @@ class ls extends ze {
|
|
|
1777
1786
|
}, l = ae({
|
|
1778
1787
|
getDsl: async (c) => await this.getDsl(c) || null,
|
|
1779
1788
|
getDslByUrl: async (c) => await this.getDslByUrl(c) || null,
|
|
1780
|
-
options:
|
|
1789
|
+
options: o
|
|
1781
1790
|
});
|
|
1782
|
-
return
|
|
1783
|
-
...
|
|
1791
|
+
return oe({
|
|
1792
|
+
...o,
|
|
1784
1793
|
dsl: e,
|
|
1785
1794
|
loader: l
|
|
1786
1795
|
});
|
|
@@ -1800,8 +1809,8 @@ class ls extends ze {
|
|
|
1800
1809
|
if (!s)
|
|
1801
1810
|
return M.warn(`Can not find file: ${e}`), null;
|
|
1802
1811
|
if (t && t(s), this.mode === w.Raw) {
|
|
1803
|
-
const { vtjRawDir:
|
|
1804
|
-
return
|
|
1812
|
+
const { vtjRawDir: i = ".vtj/vue" } = this.options, a = `${i}/${e}.vue`, o = this.modules[a] || this.modules[`/src/pages/${e}.vue`];
|
|
1813
|
+
return o ? (await o())?.default : this.nodeEnv === "development" && this.adapter.startupComponent || null;
|
|
1805
1814
|
}
|
|
1806
1815
|
const r = await this.getDsl(s.id);
|
|
1807
1816
|
return r ? this.createDslRenderer(r).renderer : (M.warn(`Can not find dsl: ${e}`), null);
|
|
@@ -1829,7 +1838,7 @@ class ls extends ze {
|
|
|
1829
1838
|
* @returns Vue异步组件
|
|
1830
1839
|
*/
|
|
1831
1840
|
definePluginComponent(e) {
|
|
1832
|
-
return $e(async () => await
|
|
1841
|
+
return $e(async () => await De(e, window));
|
|
1833
1842
|
}
|
|
1834
1843
|
/**
|
|
1835
1844
|
* 设置应用全局
|
|
@@ -1849,6 +1858,12 @@ class ls extends ze {
|
|
|
1849
1858
|
initI18n(e, t, s) {
|
|
1850
1859
|
as(e, t, s);
|
|
1851
1860
|
}
|
|
1861
|
+
initEnv(e = []) {
|
|
1862
|
+
this.env = e.reduce(
|
|
1863
|
+
(t, s) => (t[s.name] = s[this.nodeEnv], t),
|
|
1864
|
+
{}
|
|
1865
|
+
);
|
|
1866
|
+
}
|
|
1852
1867
|
}
|
|
1853
1868
|
function As(n) {
|
|
1854
1869
|
const e = new ls(n);
|
|
@@ -1875,8 +1890,8 @@ function Ne(n = {}) {
|
|
|
1875
1890
|
return e;
|
|
1876
1891
|
}
|
|
1877
1892
|
async function Is(n, e = "") {
|
|
1878
|
-
const { name: t, urls: s = [] } = n || {}, r = s.map((
|
|
1879
|
-
if (
|
|
1893
|
+
const { name: t, urls: s = [] } = n || {}, r = s.map((o) => e + o), { css: i, js: a } = dt(r);
|
|
1894
|
+
if (i.length && ke(i), a.length)
|
|
1880
1895
|
return await Fe(a, t).catch(
|
|
1881
1896
|
() => {
|
|
1882
1897
|
}
|
|
@@ -2010,7 +2025,7 @@ class de {
|
|
|
2010
2025
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
|
2011
2026
|
}
|
|
2012
2027
|
async getPluginMaterial(e) {
|
|
2013
|
-
const { urls: t = [] } = e, s = t.filter((
|
|
2028
|
+
const { urls: t = [] } = e, s = t.filter((i) => lt(i))[0];
|
|
2014
2029
|
if (!s) return null;
|
|
2015
2030
|
const r = this.pluginCaches[s];
|
|
2016
2031
|
return r || (this.pluginCaches[s] = ne.send({
|
|
@@ -2020,7 +2035,7 @@ class de {
|
|
|
2020
2035
|
validSuccess: !1,
|
|
2021
2036
|
originResponse: !0
|
|
2022
2037
|
}
|
|
2023
|
-
}).then((
|
|
2038
|
+
}).then((i) => i.data).catch(() => null));
|
|
2024
2039
|
}
|
|
2025
2040
|
async genSource(e) {
|
|
2026
2041
|
return console.log("BaseService.genSource", e), "";
|
|
@@ -2059,7 +2074,7 @@ class Fs extends de {
|
|
|
2059
2074
|
removeHistory(e) {
|
|
2060
2075
|
const t = $.get(`history_${e}`);
|
|
2061
2076
|
if (t) {
|
|
2062
|
-
const r = (t.items || []).map((
|
|
2077
|
+
const r = (t.items || []).map((i) => i.id);
|
|
2063
2078
|
this.removeHistoryItem(e, r), $.remove(`history_${e}`);
|
|
2064
2079
|
}
|
|
2065
2080
|
return Promise.resolve(!0);
|
|
@@ -2114,7 +2129,7 @@ class ps extends de {
|
|
|
2114
2129
|
removeHistory(e) {
|
|
2115
2130
|
const t = this.histories[e];
|
|
2116
2131
|
if (t) {
|
|
2117
|
-
const r = (t.items || []).map((
|
|
2132
|
+
const r = (t.items || []).map((i) => i.id);
|
|
2118
2133
|
this.removeHistoryItem(e, r), delete this.historyItems[e];
|
|
2119
2134
|
}
|
|
2120
2135
|
return Promise.resolve(!0);
|
|
@@ -2204,24 +2219,24 @@ export {
|
|
|
2204
2219
|
Me as ACCESS_KEY,
|
|
2205
2220
|
pe as Access,
|
|
2206
2221
|
ct as BUILD_IN_TAGS,
|
|
2207
|
-
|
|
2222
|
+
it as BUILT_IN_DIRECTIVES,
|
|
2208
2223
|
de as BaseService,
|
|
2209
2224
|
be as CONTEXT_HOST,
|
|
2210
2225
|
Ct as Context,
|
|
2211
2226
|
w as ContextMode,
|
|
2212
|
-
|
|
2227
|
+
ot as DATA_TYPES,
|
|
2213
2228
|
N as HOMEPAGE_ROUTE_NAME,
|
|
2214
2229
|
at as HTML_TAGS,
|
|
2215
2230
|
js as JSCodeToString,
|
|
2216
|
-
|
|
2231
|
+
vs as LIFE_CYCLES_LIST,
|
|
2217
2232
|
Os as LocalService,
|
|
2218
2233
|
ps as MemoryService,
|
|
2219
2234
|
cs as NodeEnv,
|
|
2220
|
-
|
|
2235
|
+
D as PAGE_ROUTE_NAME,
|
|
2221
2236
|
ls as Provider,
|
|
2222
|
-
|
|
2237
|
+
ys as REMOTE,
|
|
2223
2238
|
Fs as StorageService,
|
|
2224
|
-
|
|
2239
|
+
T as VTJ_RENDERER_VERSION,
|
|
2225
2240
|
$s as adoptStylesToInline,
|
|
2226
2241
|
fe as adoptedStyleSheets,
|
|
2227
2242
|
Ps as clearLoaderCache,
|
|
@@ -2230,14 +2245,14 @@ export {
|
|
|
2230
2245
|
Es as createAdapter,
|
|
2231
2246
|
ws as createAssetScripts,
|
|
2232
2247
|
Ss as createAssetsCss,
|
|
2233
|
-
|
|
2248
|
+
Tt as createDataSources,
|
|
2234
2249
|
ae as createLoader,
|
|
2235
2250
|
Ms as createMemoryService,
|
|
2236
2251
|
K as createMenus,
|
|
2237
2252
|
bt as createMetaApi,
|
|
2238
2253
|
Rt as createMock,
|
|
2239
2254
|
As as createProvider,
|
|
2240
|
-
|
|
2255
|
+
oe as createRenderer,
|
|
2241
2256
|
$t as createSchemaApi,
|
|
2242
2257
|
jt as createSchemaApis,
|
|
2243
2258
|
ks as createServiceRequest,
|
|
@@ -2245,16 +2260,16 @@ export {
|
|
|
2245
2260
|
B as fillBasePath,
|
|
2246
2261
|
H as getMock,
|
|
2247
2262
|
xe as getModifiers,
|
|
2248
|
-
|
|
2263
|
+
De as getPlugin,
|
|
2249
2264
|
pt as getRawComponent,
|
|
2250
|
-
|
|
2265
|
+
vt as isBuiltInTag,
|
|
2251
2266
|
G as isCSSUrl,
|
|
2252
2267
|
_t as isJSCode,
|
|
2253
2268
|
E as isJSExpression,
|
|
2254
2269
|
b as isJSFunction,
|
|
2255
2270
|
lt as isJSON,
|
|
2256
2271
|
V as isJSUrl,
|
|
2257
|
-
|
|
2272
|
+
yt as isNativeTag,
|
|
2258
2273
|
gt as isVuePlugin,
|
|
2259
2274
|
mt as loadCss,
|
|
2260
2275
|
ke as loadCssUrl,
|